chat_v1

package
v0.0.0-...-33e7104 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2024 License: MIT Imports: 32 Imported by: 0

Documentation

Overview

Package chat_v1 is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var ChatV1_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "chat_v1.ChatV1",
	HandlerType: (*ChatV1Server)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Create",
			Handler:    _ChatV1_Create_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _ChatV1_Delete_Handler,
		},
		{
			MethodName: "SendMessage",
			Handler:    _ChatV1_SendMessage_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "chat.proto",
}

ChatV1_ServiceDesc is the grpc.ServiceDesc for ChatV1 service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterChatV1Handler

func RegisterChatV1Handler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterChatV1Handler registers the http handlers for service ChatV1 to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterChatV1HandlerClient

func RegisterChatV1HandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChatV1Client) error

RegisterChatV1HandlerClient registers the http handlers for service ChatV1 to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ChatV1Client". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ChatV1Client" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ChatV1Client" to call the correct interceptors.

func RegisterChatV1HandlerFromEndpoint

func RegisterChatV1HandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterChatV1HandlerFromEndpoint is same as RegisterChatV1Handler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterChatV1HandlerServer

func RegisterChatV1HandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChatV1Server) error

RegisterChatV1HandlerServer registers the http handlers for service ChatV1 to "mux". UnaryRPC :call ChatV1Server directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterChatV1HandlerFromEndpoint instead.

func RegisterChatV1Server

func RegisterChatV1Server(s grpc.ServiceRegistrar, srv ChatV1Server)

Types

type ChatV1Client

type ChatV1Client interface {
	// Создает новый чат для указываемых собеседников
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
	// Удаляет чат по id
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*empty.Empty, error)
	// Отправляет в чат сообщение от указанного пользователя
	SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*empty.Empty, error)
}

ChatV1Client is the client API for ChatV1 service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewChatV1Client

func NewChatV1Client(cc grpc.ClientConnInterface) ChatV1Client

type ChatV1Server

type ChatV1Server interface {
	// Создает новый чат для указываемых собеседников
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	// Удаляет чат по id
	Delete(context.Context, *DeleteRequest) (*empty.Empty, error)
	// Отправляет в чат сообщение от указанного пользователя
	SendMessage(context.Context, *SendMessageRequest) (*empty.Empty, error)
	// contains filtered or unexported methods
}

ChatV1Server is the server API for ChatV1 service. All implementations must embed UnimplementedChatV1Server for forward compatibility

type CreateRequest

type CreateRequest struct {

	// Участники чата
	Usernames []string `protobuf:"bytes,1,rep,name=usernames,proto3" json:"usernames,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRequest) Descriptor deprecated

func (*CreateRequest) Descriptor() ([]byte, []int)

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetUsernames

func (x *CreateRequest) GetUsernames() []string

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

func (x *CreateRequest) ProtoReflect() protoreflect.Message

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

func (*CreateRequest) Validate

func (m *CreateRequest) Validate() error

Validate checks the field values on CreateRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*CreateRequest) ValidateAll

func (m *CreateRequest) ValidateAll() error

ValidateAll checks the field values on CreateRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in CreateRequestMultiError, or nil if none found.

type CreateRequestMultiError

type CreateRequestMultiError []error

CreateRequestMultiError is an error wrapping multiple validation errors returned by CreateRequest.ValidateAll() if the designated constraints aren't met.

func (CreateRequestMultiError) AllErrors

func (m CreateRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (CreateRequestMultiError) Error

func (m CreateRequestMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type CreateRequestValidationError

type CreateRequestValidationError struct {
	// contains filtered or unexported fields
}

CreateRequestValidationError is the validation error returned by CreateRequest.Validate if the designated constraints aren't met.

func (CreateRequestValidationError) Cause

Cause function returns cause value.

func (CreateRequestValidationError) Error

Error satisfies the builtin error interface

func (CreateRequestValidationError) ErrorName

func (e CreateRequestValidationError) ErrorName() string

ErrorName returns error name.

func (CreateRequestValidationError) Field

Field function returns field value.

func (CreateRequestValidationError) Key

Key function returns key value.

func (CreateRequestValidationError) Reason

Reason function returns reason value.

type CreateResponse

type CreateResponse struct {

	// Идентификатор созданного чата
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateResponse) Descriptor deprecated

func (*CreateResponse) Descriptor() ([]byte, []int)

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetId

func (x *CreateResponse) GetId() int64

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect

func (x *CreateResponse) ProtoReflect() protoreflect.Message

func (*CreateResponse) Reset

func (x *CreateResponse) Reset()

func (*CreateResponse) String

func (x *CreateResponse) String() string

func (*CreateResponse) Validate

func (m *CreateResponse) Validate() error

Validate checks the field values on CreateResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*CreateResponse) ValidateAll

func (m *CreateResponse) ValidateAll() error

ValidateAll checks the field values on CreateResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in CreateResponseMultiError, or nil if none found.

type CreateResponseMultiError

type CreateResponseMultiError []error

CreateResponseMultiError is an error wrapping multiple validation errors returned by CreateResponse.ValidateAll() if the designated constraints aren't met.

func (CreateResponseMultiError) AllErrors

func (m CreateResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (CreateResponseMultiError) Error

func (m CreateResponseMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type CreateResponseValidationError

type CreateResponseValidationError struct {
	// contains filtered or unexported fields
}

CreateResponseValidationError is the validation error returned by CreateResponse.Validate if the designated constraints aren't met.

func (CreateResponseValidationError) Cause

Cause function returns cause value.

func (CreateResponseValidationError) Error

Error satisfies the builtin error interface

func (CreateResponseValidationError) ErrorName

func (e CreateResponseValidationError) ErrorName() string

ErrorName returns error name.

func (CreateResponseValidationError) Field

Field function returns field value.

func (CreateResponseValidationError) Key

Key function returns key value.

func (CreateResponseValidationError) Reason

Reason function returns reason value.

type DeleteRequest

type DeleteRequest struct {

	// Идентификатор удаляемого чата
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteRequest) Descriptor deprecated

func (*DeleteRequest) Descriptor() ([]byte, []int)

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetId

func (x *DeleteRequest) GetId() int64

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

func (x *DeleteRequest) ProtoReflect() protoreflect.Message

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

func (*DeleteRequest) Validate

func (m *DeleteRequest) Validate() error

Validate checks the field values on DeleteRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*DeleteRequest) ValidateAll

func (m *DeleteRequest) ValidateAll() error

ValidateAll checks the field values on DeleteRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in DeleteRequestMultiError, or nil if none found.

type DeleteRequestMultiError

type DeleteRequestMultiError []error

DeleteRequestMultiError is an error wrapping multiple validation errors returned by DeleteRequest.ValidateAll() if the designated constraints aren't met.

func (DeleteRequestMultiError) AllErrors

func (m DeleteRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (DeleteRequestMultiError) Error

func (m DeleteRequestMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type DeleteRequestValidationError

type DeleteRequestValidationError struct {
	// contains filtered or unexported fields
}

DeleteRequestValidationError is the validation error returned by DeleteRequest.Validate if the designated constraints aren't met.

func (DeleteRequestValidationError) Cause

Cause function returns cause value.

func (DeleteRequestValidationError) Error

Error satisfies the builtin error interface

func (DeleteRequestValidationError) ErrorName

func (e DeleteRequestValidationError) ErrorName() string

ErrorName returns error name.

func (DeleteRequestValidationError) Field

Field function returns field value.

func (DeleteRequestValidationError) Key

Key function returns key value.

func (DeleteRequestValidationError) Reason

Reason function returns reason value.

type Message

type Message struct {

	// Отправитель
	From string `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
	// Текст сообщения
	Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
	// Время отправления сообщения
	Timestamp *timestamp.Timestamp `protobuf:"bytes,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

func (*Message) Descriptor deprecated

func (*Message) Descriptor() ([]byte, []int)

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetFrom

func (x *Message) GetFrom() string

func (*Message) GetText

func (x *Message) GetText() string

func (*Message) GetTimestamp

func (x *Message) GetTimestamp() *timestamp.Timestamp

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) ProtoReflect

func (x *Message) ProtoReflect() protoreflect.Message

func (*Message) Reset

func (x *Message) Reset()

func (*Message) String

func (x *Message) String() string

func (*Message) Validate

func (m *Message) Validate() error

Validate checks the field values on Message with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Message) ValidateAll

func (m *Message) ValidateAll() error

ValidateAll checks the field values on Message with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in MessageMultiError, or nil if none found.

type MessageMultiError

type MessageMultiError []error

MessageMultiError is an error wrapping multiple validation errors returned by Message.ValidateAll() if the designated constraints aren't met.

func (MessageMultiError) AllErrors

func (m MessageMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (MessageMultiError) Error

func (m MessageMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type MessageValidationError

type MessageValidationError struct {
	// contains filtered or unexported fields
}

MessageValidationError is the validation error returned by Message.Validate if the designated constraints aren't met.

func (MessageValidationError) Cause

func (e MessageValidationError) Cause() error

Cause function returns cause value.

func (MessageValidationError) Error

func (e MessageValidationError) Error() string

Error satisfies the builtin error interface

func (MessageValidationError) ErrorName

func (e MessageValidationError) ErrorName() string

ErrorName returns error name.

func (MessageValidationError) Field

func (e MessageValidationError) Field() string

Field function returns field value.

func (MessageValidationError) Key

func (e MessageValidationError) Key() bool

Key function returns key value.

func (MessageValidationError) Reason

func (e MessageValidationError) Reason() string

Reason function returns reason value.

type SendMessageRequest

type SendMessageRequest struct {
	Message *Message `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*SendMessageRequest) Descriptor deprecated

func (*SendMessageRequest) Descriptor() ([]byte, []int)

Deprecated: Use SendMessageRequest.ProtoReflect.Descriptor instead.

func (*SendMessageRequest) GetMessage

func (x *SendMessageRequest) GetMessage() *Message

func (*SendMessageRequest) ProtoMessage

func (*SendMessageRequest) ProtoMessage()

func (*SendMessageRequest) ProtoReflect

func (x *SendMessageRequest) ProtoReflect() protoreflect.Message

func (*SendMessageRequest) Reset

func (x *SendMessageRequest) Reset()

func (*SendMessageRequest) String

func (x *SendMessageRequest) String() string

func (*SendMessageRequest) Validate

func (m *SendMessageRequest) Validate() error

Validate checks the field values on SendMessageRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*SendMessageRequest) ValidateAll

func (m *SendMessageRequest) ValidateAll() error

ValidateAll checks the field values on SendMessageRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in SendMessageRequestMultiError, or nil if none found.

type SendMessageRequestMultiError

type SendMessageRequestMultiError []error

SendMessageRequestMultiError is an error wrapping multiple validation errors returned by SendMessageRequest.ValidateAll() if the designated constraints aren't met.

func (SendMessageRequestMultiError) AllErrors

func (m SendMessageRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (SendMessageRequestMultiError) Error

Error returns a concatenation of all the error messages it wraps.

type SendMessageRequestValidationError

type SendMessageRequestValidationError struct {
	// contains filtered or unexported fields
}

SendMessageRequestValidationError is the validation error returned by SendMessageRequest.Validate if the designated constraints aren't met.

func (SendMessageRequestValidationError) Cause

Cause function returns cause value.

func (SendMessageRequestValidationError) Error

Error satisfies the builtin error interface

func (SendMessageRequestValidationError) ErrorName

ErrorName returns error name.

func (SendMessageRequestValidationError) Field

Field function returns field value.

func (SendMessageRequestValidationError) Key

Key function returns key value.

func (SendMessageRequestValidationError) Reason

Reason function returns reason value.

type UnimplementedChatV1Server

type UnimplementedChatV1Server struct {
}

UnimplementedChatV1Server must be embedded to have forward compatible implementations.

func (UnimplementedChatV1Server) Create

func (UnimplementedChatV1Server) Delete

func (UnimplementedChatV1Server) SendMessage

type UnsafeChatV1Server

type UnsafeChatV1Server interface {
	// contains filtered or unexported methods
}

UnsafeChatV1Server may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ChatV1Server will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL