chat_v1

package
v0.0.0-...-72a0cfa Latest Latest
Warning

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

Go to latest
Published: Oct 5, 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: "CreateChat",
			Handler:    _ChatV1_CreateChat_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _ChatV1_Delete_Handler,
		},
		{
			MethodName: "CreateMessage",
			Handler:    _ChatV1_CreateMessage_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. This client ignores the HTTP middlewares.

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. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.

func RegisterChatV1Server

func RegisterChatV1Server(s grpc.ServiceRegistrar, srv ChatV1Server)

Types

type ChatV1Client

type ChatV1Client interface {
	CreateChat(ctx context.Context, in *CreateChatRequest, opts ...grpc.CallOption) (*CreateChatResponse, error)
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
	CreateMessage(ctx context.Context, in *CreateMessageRequest, opts ...grpc.CallOption) (*emptypb.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 {
	CreateChat(context.Context, *CreateChatRequest) (*CreateChatResponse, error)
	Delete(context.Context, *DeleteRequest) (*emptypb.Empty, error)
	CreateMessage(context.Context, *CreateMessageRequest) (*emptypb.Empty, error)
	// contains filtered or unexported methods
}

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

type CreateChatRequest

type CreateChatRequest struct {
	Usernames []string `protobuf:"bytes,1,rep,name=usernames,proto3" json:"usernames,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateChatRequest) Descriptor deprecated

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

Deprecated: Use CreateChatRequest.ProtoReflect.Descriptor instead.

func (*CreateChatRequest) GetUsernames

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

func (*CreateChatRequest) ProtoMessage

func (*CreateChatRequest) ProtoMessage()

func (*CreateChatRequest) ProtoReflect

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

func (*CreateChatRequest) Reset

func (x *CreateChatRequest) Reset()

func (*CreateChatRequest) String

func (x *CreateChatRequest) String() string

func (*CreateChatRequest) Validate

func (m *CreateChatRequest) Validate() error

Validate checks the field values on CreateChatRequest 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 (*CreateChatRequest) ValidateAll

func (m *CreateChatRequest) ValidateAll() error

ValidateAll checks the field values on CreateChatRequest 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 CreateChatRequestMultiError, or nil if none found.

type CreateChatRequestMultiError

type CreateChatRequestMultiError []error

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

func (CreateChatRequestMultiError) AllErrors

func (m CreateChatRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (CreateChatRequestMultiError) Error

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

type CreateChatRequestValidationError

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

CreateChatRequestValidationError is the validation error returned by CreateChatRequest.Validate if the designated constraints aren't met.

func (CreateChatRequestValidationError) Cause

Cause function returns cause value.

func (CreateChatRequestValidationError) Error

Error satisfies the builtin error interface

func (CreateChatRequestValidationError) ErrorName

ErrorName returns error name.

func (CreateChatRequestValidationError) Field

Field function returns field value.

func (CreateChatRequestValidationError) Key

Key function returns key value.

func (CreateChatRequestValidationError) Reason

Reason function returns reason value.

type CreateChatResponse

type CreateChatResponse struct {
	Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateChatResponse) Descriptor deprecated

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

Deprecated: Use CreateChatResponse.ProtoReflect.Descriptor instead.

func (*CreateChatResponse) GetId

func (x *CreateChatResponse) GetId() int64

func (*CreateChatResponse) ProtoMessage

func (*CreateChatResponse) ProtoMessage()

func (*CreateChatResponse) ProtoReflect

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

func (*CreateChatResponse) Reset

func (x *CreateChatResponse) Reset()

func (*CreateChatResponse) String

func (x *CreateChatResponse) String() string

func (*CreateChatResponse) Validate

func (m *CreateChatResponse) Validate() error

Validate checks the field values on CreateChatResponse 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 (*CreateChatResponse) ValidateAll

func (m *CreateChatResponse) ValidateAll() error

ValidateAll checks the field values on CreateChatResponse 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 CreateChatResponseMultiError, or nil if none found.

type CreateChatResponseMultiError

type CreateChatResponseMultiError []error

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

func (CreateChatResponseMultiError) AllErrors

func (m CreateChatResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (CreateChatResponseMultiError) Error

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

type CreateChatResponseValidationError

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

CreateChatResponseValidationError is the validation error returned by CreateChatResponse.Validate if the designated constraints aren't met.

func (CreateChatResponseValidationError) Cause

Cause function returns cause value.

func (CreateChatResponseValidationError) Error

Error satisfies the builtin error interface

func (CreateChatResponseValidationError) ErrorName

ErrorName returns error name.

func (CreateChatResponseValidationError) Field

Field function returns field value.

func (CreateChatResponseValidationError) Key

Key function returns key value.

func (CreateChatResponseValidationError) Reason

Reason function returns reason value.

type CreateMessageRequest

type CreateMessageRequest struct {
	ChatId    int64                  `protobuf:"varint,1,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"`
	From      string                 `protobuf:"bytes,2,opt,name=from,proto3" json:"from,omitempty"`
	Text      string                 `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"`
	Timestamp *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateMessageRequest) Descriptor deprecated

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

Deprecated: Use CreateMessageRequest.ProtoReflect.Descriptor instead.

func (*CreateMessageRequest) GetChatId

func (x *CreateMessageRequest) GetChatId() int64

func (*CreateMessageRequest) GetFrom

func (x *CreateMessageRequest) GetFrom() string

func (*CreateMessageRequest) GetText

func (x *CreateMessageRequest) GetText() string

func (*CreateMessageRequest) GetTimestamp

func (x *CreateMessageRequest) GetTimestamp() *timestamppb.Timestamp

func (*CreateMessageRequest) ProtoMessage

func (*CreateMessageRequest) ProtoMessage()

func (*CreateMessageRequest) ProtoReflect

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

func (*CreateMessageRequest) Reset

func (x *CreateMessageRequest) Reset()

func (*CreateMessageRequest) String

func (x *CreateMessageRequest) String() string

func (*CreateMessageRequest) Validate

func (m *CreateMessageRequest) Validate() error

Validate checks the field values on CreateMessageRequest 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 (*CreateMessageRequest) ValidateAll

func (m *CreateMessageRequest) ValidateAll() error

ValidateAll checks the field values on CreateMessageRequest 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 CreateMessageRequestMultiError, or nil if none found.

type CreateMessageRequestMultiError

type CreateMessageRequestMultiError []error

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

func (CreateMessageRequestMultiError) AllErrors

func (m CreateMessageRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (CreateMessageRequestMultiError) Error

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

type CreateMessageRequestValidationError

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

CreateMessageRequestValidationError is the validation error returned by CreateMessageRequest.Validate if the designated constraints aren't met.

func (CreateMessageRequestValidationError) Cause

Cause function returns cause value.

func (CreateMessageRequestValidationError) Error

Error satisfies the builtin error interface

func (CreateMessageRequestValidationError) ErrorName

ErrorName returns error name.

func (CreateMessageRequestValidationError) Field

Field function returns field value.

func (CreateMessageRequestValidationError) Key

Key function returns key value.

func (CreateMessageRequestValidationError) 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 UnimplementedChatV1Server

type UnimplementedChatV1Server struct {
}

UnimplementedChatV1Server must be embedded to have forward compatible implementations.

func (UnimplementedChatV1Server) CreateChat

func (UnimplementedChatV1Server) CreateMessage

func (UnimplementedChatV1Server) Delete

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