Documentation ¶
Overview ¶
Package message is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterMessageServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterMessageServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MessageServiceClient) error
- func RegisterMessageServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterMessageServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MessageServiceServer) error
- func RegisterMessageServiceServer(s grpc.ServiceRegistrar, srv MessageServiceServer)
- type CreateMessageRequest
- func (*CreateMessageRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CreateMessageRequest) GetBody() string
- func (x *CreateMessageRequest) GetChannelId() string
- func (x *CreateMessageRequest) GetTtl() uint32
- func (*CreateMessageRequest) ProtoMessage()
- func (x *CreateMessageRequest) ProtoReflect() protoreflect.Message
- func (x *CreateMessageRequest) Reset()
- func (x *CreateMessageRequest) String() string
- type DeleteMessageRequest
- func (*DeleteMessageRequest) Descriptor() ([]byte, []int)deprecated
- func (x *DeleteMessageRequest) GetChannelId() string
- func (x *DeleteMessageRequest) GetId() string
- func (*DeleteMessageRequest) ProtoMessage()
- func (x *DeleteMessageRequest) ProtoReflect() protoreflect.Message
- func (x *DeleteMessageRequest) Reset()
- func (x *DeleteMessageRequest) String() string
- type ListMessagesRequest
- func (*ListMessagesRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ListMessagesRequest) GetChannelId() string
- func (x *ListMessagesRequest) GetPageSize() uint32
- func (x *ListMessagesRequest) GetPageToken() string
- func (*ListMessagesRequest) ProtoMessage()
- func (x *ListMessagesRequest) ProtoReflect() protoreflect.Message
- func (x *ListMessagesRequest) Reset()
- func (x *ListMessagesRequest) String() string
- type ListMessagesResponse
- func (*ListMessagesResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ListMessagesResponse) GetMessages() []*Message
- func (x *ListMessagesResponse) GetNextPageToken() string
- func (*ListMessagesResponse) ProtoMessage()
- func (x *ListMessagesResponse) ProtoReflect() protoreflect.Message
- func (x *ListMessagesResponse) Reset()
- func (x *ListMessagesResponse) String() string
- type Message
- func (*Message) Descriptor() ([]byte, []int)deprecated
- func (x *Message) GetBody() string
- func (x *Message) GetChannelId() string
- func (x *Message) GetCreatedAt() *timestamppb.Timestamp
- func (x *Message) GetId() string
- func (x *Message) GetTtl() uint32
- func (x *Message) GetUpdatedAt() *timestamppb.Timestamp
- func (*Message) ProtoMessage()
- func (x *Message) ProtoReflect() protoreflect.Message
- func (x *Message) Reset()
- func (x *Message) String() string
- type MessageServiceClient
- type MessageServiceServer
- type UnimplementedMessageServiceServer
- func (UnimplementedMessageServiceServer) CreateMessage(context.Context, *CreateMessageRequest) (*Message, error)
- func (UnimplementedMessageServiceServer) DeleteMessage(context.Context, *DeleteMessageRequest) (*emptypb.Empty, error)
- func (UnimplementedMessageServiceServer) ListMessages(context.Context, *ListMessagesRequest) (*ListMessagesResponse, error)
- func (UnimplementedMessageServiceServer) UpdateMessage(context.Context, *UpdateMessageRequest) (*Message, error)
- type UnsafeMessageServiceServer
- type UpdateMessageRequest
- func (*UpdateMessageRequest) Descriptor() ([]byte, []int)deprecated
- func (x *UpdateMessageRequest) GetBody() string
- func (x *UpdateMessageRequest) GetChannelId() string
- func (x *UpdateMessageRequest) GetId() string
- func (x *UpdateMessageRequest) GetTtl() uint32
- func (*UpdateMessageRequest) ProtoMessage()
- func (x *UpdateMessageRequest) ProtoReflect() protoreflect.Message
- func (x *UpdateMessageRequest) Reset()
- func (x *UpdateMessageRequest) String() string
Constants ¶
This section is empty.
Variables ¶
var File_message_message_proto protoreflect.FileDescriptor
var MessageService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "grumblechat.server.v1.MessageService", HandlerType: (*MessageServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "ListMessages", Handler: _MessageService_ListMessages_Handler, }, { MethodName: "CreateMessage", Handler: _MessageService_CreateMessage_Handler, }, { MethodName: "UpdateMessage", Handler: _MessageService_UpdateMessage_Handler, }, { MethodName: "DeleteMessage", Handler: _MessageService_DeleteMessage_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "message/message.proto", }
MessageService_ServiceDesc is the grpc.ServiceDesc for MessageService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterMessageServiceHandler ¶
func RegisterMessageServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterMessageServiceHandler registers the http handlers for service MessageService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterMessageServiceHandlerClient ¶
func RegisterMessageServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MessageServiceClient) error
RegisterMessageServiceHandlerClient registers the http handlers for service MessageService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MessageServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MessageServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "MessageServiceClient" to call the correct interceptors.
func RegisterMessageServiceHandlerFromEndpoint ¶
func RegisterMessageServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterMessageServiceHandlerFromEndpoint is same as RegisterMessageServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterMessageServiceHandlerServer ¶
func RegisterMessageServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MessageServiceServer) error
RegisterMessageServiceHandlerServer registers the http handlers for service MessageService to "mux". UnaryRPC :call MessageServiceServer 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 RegisterMessageServiceHandlerFromEndpoint instead.
func RegisterMessageServiceServer ¶
func RegisterMessageServiceServer(s grpc.ServiceRegistrar, srv MessageServiceServer)
Types ¶
type CreateMessageRequest ¶
type CreateMessageRequest struct { ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` Body string `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` Ttl uint32 `protobuf:"varint,3,opt,name=ttl,proto3" json:"ttl,omitempty"` // contains filtered or unexported fields }
Create Message
func (*CreateMessageRequest) Descriptor
deprecated
func (*CreateMessageRequest) Descriptor() ([]byte, []int)
Deprecated: Use CreateMessageRequest.ProtoReflect.Descriptor instead.
func (*CreateMessageRequest) GetBody ¶
func (x *CreateMessageRequest) GetBody() string
func (*CreateMessageRequest) GetChannelId ¶
func (x *CreateMessageRequest) GetChannelId() string
func (*CreateMessageRequest) GetTtl ¶
func (x *CreateMessageRequest) GetTtl() uint32
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
type DeleteMessageRequest ¶
type DeleteMessageRequest struct { ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` // contains filtered or unexported fields }
Delete Message
func (*DeleteMessageRequest) Descriptor
deprecated
func (*DeleteMessageRequest) Descriptor() ([]byte, []int)
Deprecated: Use DeleteMessageRequest.ProtoReflect.Descriptor instead.
func (*DeleteMessageRequest) GetChannelId ¶
func (x *DeleteMessageRequest) GetChannelId() string
func (*DeleteMessageRequest) GetId ¶
func (x *DeleteMessageRequest) GetId() string
func (*DeleteMessageRequest) ProtoMessage ¶
func (*DeleteMessageRequest) ProtoMessage()
func (*DeleteMessageRequest) ProtoReflect ¶
func (x *DeleteMessageRequest) ProtoReflect() protoreflect.Message
func (*DeleteMessageRequest) Reset ¶
func (x *DeleteMessageRequest) Reset()
func (*DeleteMessageRequest) String ¶
func (x *DeleteMessageRequest) String() string
type ListMessagesRequest ¶
type ListMessagesRequest struct { ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` // Requested page size. Server may return fewer messages than requested. // If unspecified, server will pick an appropriate default. PageSize uint32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` // A token identifying a page of results the server should return. // Typically, this is the value of [ListMessagesResponse.next_page_token] // returned from the previous call to `ListMessages` method. PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"` // contains filtered or unexported fields }
List Messages
func (*ListMessagesRequest) Descriptor
deprecated
func (*ListMessagesRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListMessagesRequest.ProtoReflect.Descriptor instead.
func (*ListMessagesRequest) GetChannelId ¶
func (x *ListMessagesRequest) GetChannelId() string
func (*ListMessagesRequest) GetPageSize ¶
func (x *ListMessagesRequest) GetPageSize() uint32
func (*ListMessagesRequest) GetPageToken ¶
func (x *ListMessagesRequest) GetPageToken() string
func (*ListMessagesRequest) ProtoMessage ¶
func (*ListMessagesRequest) ProtoMessage()
func (*ListMessagesRequest) ProtoReflect ¶
func (x *ListMessagesRequest) ProtoReflect() protoreflect.Message
func (*ListMessagesRequest) Reset ¶
func (x *ListMessagesRequest) Reset()
func (*ListMessagesRequest) String ¶
func (x *ListMessagesRequest) String() string
type ListMessagesResponse ¶
type ListMessagesResponse struct { // list of Messages Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` // A token to retrieve next page of results. // Pass this value in the [ListMessagesRequest.page_token] // field in the subsequent call to `ListMessages` method to retrieve the next // page of results. NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"` // contains filtered or unexported fields }
func (*ListMessagesResponse) Descriptor
deprecated
func (*ListMessagesResponse) Descriptor() ([]byte, []int)
Deprecated: Use ListMessagesResponse.ProtoReflect.Descriptor instead.
func (*ListMessagesResponse) GetMessages ¶
func (x *ListMessagesResponse) GetMessages() []*Message
func (*ListMessagesResponse) GetNextPageToken ¶
func (x *ListMessagesResponse) GetNextPageToken() string
func (*ListMessagesResponse) ProtoMessage ¶
func (*ListMessagesResponse) ProtoMessage()
func (*ListMessagesResponse) ProtoReflect ¶
func (x *ListMessagesResponse) ProtoReflect() protoreflect.Message
func (*ListMessagesResponse) Reset ¶
func (x *ListMessagesResponse) Reset()
func (*ListMessagesResponse) String ¶
func (x *ListMessagesResponse) String() string
type Message ¶
type Message struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ChannelId string `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` Body string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` Ttl uint32 `protobuf:"varint,4,opt,name=ttl,proto3" json:"ttl,omitempty"` CreatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` UpdatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` // contains filtered or unexported fields }
Message object
func (*Message) Descriptor
deprecated
func (*Message) GetChannelId ¶
func (*Message) GetCreatedAt ¶
func (x *Message) GetCreatedAt() *timestamppb.Timestamp
func (*Message) GetUpdatedAt ¶
func (x *Message) GetUpdatedAt() *timestamppb.Timestamp
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) ProtoReflect ¶
func (x *Message) ProtoReflect() protoreflect.Message
type MessageServiceClient ¶
type MessageServiceClient interface { // lists messages for a channel. ListMessages(ctx context.Context, in *ListMessagesRequest, opts ...grpc.CallOption) (*ListMessagesResponse, error) // create a message and return it CreateMessage(ctx context.Context, in *CreateMessageRequest, opts ...grpc.CallOption) (*Message, error) // update a message and return it UpdateMessage(ctx context.Context, in *UpdateMessageRequest, opts ...grpc.CallOption) (*Message, error) DeleteMessage(ctx context.Context, in *DeleteMessageRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) }
MessageServiceClient is the client API for MessageService 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 NewMessageServiceClient ¶
func NewMessageServiceClient(cc grpc.ClientConnInterface) MessageServiceClient
type MessageServiceServer ¶
type MessageServiceServer interface { // lists messages for a channel. ListMessages(context.Context, *ListMessagesRequest) (*ListMessagesResponse, error) // create a message and return it CreateMessage(context.Context, *CreateMessageRequest) (*Message, error) // update a message and return it UpdateMessage(context.Context, *UpdateMessageRequest) (*Message, error) DeleteMessage(context.Context, *DeleteMessageRequest) (*emptypb.Empty, error) }
MessageServiceServer is the server API for MessageService service. All implementations should embed UnimplementedMessageServiceServer for forward compatibility
type UnimplementedMessageServiceServer ¶
type UnimplementedMessageServiceServer struct { }
UnimplementedMessageServiceServer should be embedded to have forward compatible implementations.
func (UnimplementedMessageServiceServer) CreateMessage ¶
func (UnimplementedMessageServiceServer) CreateMessage(context.Context, *CreateMessageRequest) (*Message, error)
func (UnimplementedMessageServiceServer) DeleteMessage ¶
func (UnimplementedMessageServiceServer) DeleteMessage(context.Context, *DeleteMessageRequest) (*emptypb.Empty, error)
func (UnimplementedMessageServiceServer) ListMessages ¶
func (UnimplementedMessageServiceServer) ListMessages(context.Context, *ListMessagesRequest) (*ListMessagesResponse, error)
func (UnimplementedMessageServiceServer) UpdateMessage ¶
func (UnimplementedMessageServiceServer) UpdateMessage(context.Context, *UpdateMessageRequest) (*Message, error)
type UnsafeMessageServiceServer ¶
type UnsafeMessageServiceServer interface {
// contains filtered or unexported methods
}
UnsafeMessageServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to MessageServiceServer will result in compilation errors.
type UpdateMessageRequest ¶
type UpdateMessageRequest struct { ChannelId string `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"` Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` Body string `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` Ttl uint32 `protobuf:"varint,4,opt,name=ttl,proto3" json:"ttl,omitempty"` // contains filtered or unexported fields }
Update Message
func (*UpdateMessageRequest) Descriptor
deprecated
func (*UpdateMessageRequest) Descriptor() ([]byte, []int)
Deprecated: Use UpdateMessageRequest.ProtoReflect.Descriptor instead.
func (*UpdateMessageRequest) GetBody ¶
func (x *UpdateMessageRequest) GetBody() string
func (*UpdateMessageRequest) GetChannelId ¶
func (x *UpdateMessageRequest) GetChannelId() string
func (*UpdateMessageRequest) GetId ¶
func (x *UpdateMessageRequest) GetId() string
func (*UpdateMessageRequest) GetTtl ¶
func (x *UpdateMessageRequest) GetTtl() uint32
func (*UpdateMessageRequest) ProtoMessage ¶
func (*UpdateMessageRequest) ProtoMessage()
func (*UpdateMessageRequest) ProtoReflect ¶
func (x *UpdateMessageRequest) ProtoReflect() protoreflect.Message
func (*UpdateMessageRequest) Reset ¶
func (x *UpdateMessageRequest) Reset()
func (*UpdateMessageRequest) String ¶
func (x *UpdateMessageRequest) String() string