Documentation ¶
Overview ¶
Package chats is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterChatsHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterChatsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChatsClient) error
- func RegisterChatsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterChatsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChatsServer) error
- func RegisterChatsServer(s grpc.ServiceRegistrar, srv ChatsServer)
- type Chat
- type ChatsClient
- type ChatsList
- type ChatsServer
- type ListChatsRequest
- type Message
- func (*Message) Descriptor() ([]byte, []int)deprecated
- func (x *Message) GetChatId() string
- func (x *Message) GetCreatedAt() *timestamppb.Timestamp
- func (x *Message) GetId() string
- func (x *Message) GetSenderId() string
- func (x *Message) GetSenderName() string
- func (x *Message) GetText() string
- func (*Message) ProtoMessage()
- func (x *Message) ProtoReflect() protoreflect.Message
- func (x *Message) Reset()
- func (x *Message) String() string
- type MessageSentEvent
- func (*MessageSentEvent) Descriptor() ([]byte, []int)deprecated
- func (x *MessageSentEvent) GetHappenedAt() *timestamppb.Timestamp
- func (x *MessageSentEvent) GetMessage() *Message
- func (*MessageSentEvent) ProtoMessage()
- func (x *MessageSentEvent) ProtoReflect() protoreflect.Message
- func (x *MessageSentEvent) Reset()
- func (x *MessageSentEvent) String() string
- type SendMessageRequest
- func (*SendMessageRequest) Descriptor() ([]byte, []int)deprecated
- func (x *SendMessageRequest) GetChatId() string
- func (x *SendMessageRequest) GetText() string
- func (*SendMessageRequest) ProtoMessage()
- func (x *SendMessageRequest) ProtoReflect() protoreflect.Message
- func (x *SendMessageRequest) Reset()
- func (x *SendMessageRequest) String() string
- type UnimplementedChatsServer
- type UnsafeChatsServer
Constants ¶
const ( Chats_ListChats_FullMethodName = "/foundation.examples.clubchat.chats.Chats/ListChats" Chats_SendMessage_FullMethodName = "/foundation.examples.clubchat.chats.Chats/SendMessage" )
Variables ¶
var Chats_ServiceDesc = grpc.ServiceDesc{ ServiceName: "foundation.examples.clubchat.chats.Chats", HandlerType: (*ChatsServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "ListChats", Handler: _Chats_ListChats_Handler, }, { MethodName: "SendMessage", Handler: _Chats_SendMessage_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "examples/clubchat/protos/chats/service.proto", }
Chats_ServiceDesc is the grpc.ServiceDesc for Chats service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_examples_clubchat_protos_chats_events_proto protoreflect.FileDescriptor
var File_examples_clubchat_protos_chats_objects_proto protoreflect.FileDescriptor
var File_examples_clubchat_protos_chats_service_proto protoreflect.FileDescriptor
Functions ¶
func RegisterChatsHandler ¶
RegisterChatsHandler registers the http handlers for service Chats to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterChatsHandlerClient ¶
func RegisterChatsHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ChatsClient) error
RegisterChatsHandlerClient registers the http handlers for service Chats to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ChatsClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ChatsClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "ChatsClient" to call the correct interceptors.
func RegisterChatsHandlerFromEndpoint ¶
func RegisterChatsHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterChatsHandlerFromEndpoint is same as RegisterChatsHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterChatsHandlerServer ¶
func RegisterChatsHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ChatsServer) error
RegisterChatsHandlerServer registers the http handlers for service Chats to "mux". UnaryRPC :call ChatsServer 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 RegisterChatsHandlerFromEndpoint instead.
func RegisterChatsServer ¶
func RegisterChatsServer(s grpc.ServiceRegistrar, srv ChatsServer)
Types ¶
type Chat ¶
type Chat struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // contains filtered or unexported fields }
func (*Chat) Descriptor
deprecated
func (*Chat) ProtoMessage ¶
func (*Chat) ProtoMessage()
func (*Chat) ProtoReflect ¶
func (x *Chat) ProtoReflect() protoreflect.Message
type ChatsClient ¶
type ChatsClient interface { // ListChats returns a list of chats ListChats(ctx context.Context, in *ListChatsRequest, opts ...grpc.CallOption) (*ChatsList, error) // SendMessage sends a message to a chat SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*Message, error) }
ChatsClient is the client API for Chats 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 NewChatsClient ¶
func NewChatsClient(cc grpc.ClientConnInterface) ChatsClient
type ChatsList ¶
type ChatsList struct { Chats []*Chat `protobuf:"bytes,1,rep,name=chats,proto3" json:"chats,omitempty"` // contains filtered or unexported fields }
func (*ChatsList) Descriptor
deprecated
func (*ChatsList) ProtoMessage ¶
func (*ChatsList) ProtoMessage()
func (*ChatsList) ProtoReflect ¶
func (x *ChatsList) ProtoReflect() protoreflect.Message
type ChatsServer ¶
type ChatsServer interface { // ListChats returns a list of chats ListChats(context.Context, *ListChatsRequest) (*ChatsList, error) // SendMessage sends a message to a chat SendMessage(context.Context, *SendMessageRequest) (*Message, error) // contains filtered or unexported methods }
ChatsServer is the server API for Chats service. All implementations must embed UnimplementedChatsServer for forward compatibility
type ListChatsRequest ¶
type ListChatsRequest struct {
// contains filtered or unexported fields
}
func (*ListChatsRequest) Descriptor
deprecated
func (*ListChatsRequest) Descriptor() ([]byte, []int)
Deprecated: Use ListChatsRequest.ProtoReflect.Descriptor instead.
func (*ListChatsRequest) ProtoMessage ¶
func (*ListChatsRequest) ProtoMessage()
func (*ListChatsRequest) ProtoReflect ¶
func (x *ListChatsRequest) ProtoReflect() protoreflect.Message
func (*ListChatsRequest) Reset ¶
func (x *ListChatsRequest) Reset()
func (*ListChatsRequest) String ¶
func (x *ListChatsRequest) String() string
type Message ¶
type Message struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ChatId string `protobuf:"bytes,2,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"` SenderId string `protobuf:"bytes,3,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"` SenderName string `protobuf:"bytes,4,opt,name=sender_name,json=senderName,proto3" json:"sender_name,omitempty"` Text string `protobuf:"bytes,5,opt,name=text,proto3" json:"text,omitempty"` CreatedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` // contains filtered or unexported fields }
func (*Message) Descriptor
deprecated
func (*Message) GetCreatedAt ¶
func (x *Message) GetCreatedAt() *timestamppb.Timestamp
func (*Message) GetSenderId ¶
func (*Message) GetSenderName ¶
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) ProtoReflect ¶
func (x *Message) ProtoReflect() protoreflect.Message
type MessageSentEvent ¶
type MessageSentEvent struct { Message *Message `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` HappenedAt *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=happened_at,json=happenedAt,proto3" json:"happened_at,omitempty"` // contains filtered or unexported fields }
func (*MessageSentEvent) Descriptor
deprecated
func (*MessageSentEvent) Descriptor() ([]byte, []int)
Deprecated: Use MessageSentEvent.ProtoReflect.Descriptor instead.
func (*MessageSentEvent) GetHappenedAt ¶
func (x *MessageSentEvent) GetHappenedAt() *timestamppb.Timestamp
func (*MessageSentEvent) GetMessage ¶
func (x *MessageSentEvent) GetMessage() *Message
func (*MessageSentEvent) ProtoMessage ¶
func (*MessageSentEvent) ProtoMessage()
func (*MessageSentEvent) ProtoReflect ¶
func (x *MessageSentEvent) ProtoReflect() protoreflect.Message
func (*MessageSentEvent) Reset ¶
func (x *MessageSentEvent) Reset()
func (*MessageSentEvent) String ¶
func (x *MessageSentEvent) String() string
type SendMessageRequest ¶
type SendMessageRequest struct { ChatId string `protobuf:"bytes,1,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"` Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` // contains filtered or unexported fields }
func (*SendMessageRequest) Descriptor
deprecated
func (*SendMessageRequest) Descriptor() ([]byte, []int)
Deprecated: Use SendMessageRequest.ProtoReflect.Descriptor instead.
func (*SendMessageRequest) GetChatId ¶
func (x *SendMessageRequest) GetChatId() string
func (*SendMessageRequest) GetText ¶
func (x *SendMessageRequest) GetText() string
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
type UnimplementedChatsServer ¶
type UnimplementedChatsServer struct { }
UnimplementedChatsServer must be embedded to have forward compatible implementations.
func (UnimplementedChatsServer) ListChats ¶
func (UnimplementedChatsServer) ListChats(context.Context, *ListChatsRequest) (*ChatsList, error)
func (UnimplementedChatsServer) SendMessage ¶
func (UnimplementedChatsServer) SendMessage(context.Context, *SendMessageRequest) (*Message, error)
type UnsafeChatsServer ¶
type UnsafeChatsServer interface {
// contains filtered or unexported methods
}
UnsafeChatsServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ChatsServer will result in compilation errors.