chats

package
v0.0.0-...-0d5a881 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: MIT Imports: 16 Imported by: 3

Documentation

Overview

Package chats is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	Chats_ListChats_FullMethodName   = "/foundation.examples.clubchat.chats.Chats/ListChats"
	Chats_SendMessage_FullMethodName = "/foundation.examples.clubchat.chats.Chats/SendMessage"
)

Variables

View Source
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)

View Source
var File_examples_clubchat_protos_chats_events_proto protoreflect.FileDescriptor
View Source
var File_examples_clubchat_protos_chats_objects_proto protoreflect.FileDescriptor
View Source
var File_examples_clubchat_protos_chats_service_proto protoreflect.FileDescriptor

Functions

func RegisterChatsHandler

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

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) Descriptor() ([]byte, []int)

Deprecated: Use Chat.ProtoReflect.Descriptor instead.

func (*Chat) GetId

func (x *Chat) GetId() string

func (*Chat) GetName

func (x *Chat) GetName() string

func (*Chat) ProtoMessage

func (*Chat) ProtoMessage()

func (*Chat) ProtoReflect

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

func (*Chat) Reset

func (x *Chat) Reset()

func (*Chat) String

func (x *Chat) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use ChatsList.ProtoReflect.Descriptor instead.

func (*ChatsList) GetChats

func (x *ChatsList) GetChats() []*Chat

func (*ChatsList) ProtoMessage

func (*ChatsList) ProtoMessage()

func (*ChatsList) ProtoReflect

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

func (*ChatsList) Reset

func (x *ChatsList) Reset()

func (*ChatsList) String

func (x *ChatsList) String() string

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) Descriptor() ([]byte, []int)

Deprecated: Use Message.ProtoReflect.Descriptor instead.

func (*Message) GetChatId

func (x *Message) GetChatId() string

func (*Message) GetCreatedAt

func (x *Message) GetCreatedAt() *timestamppb.Timestamp

func (*Message) GetId

func (x *Message) GetId() string

func (*Message) GetSenderId

func (x *Message) GetSenderId() string

func (*Message) GetSenderName

func (x *Message) GetSenderName() string

func (*Message) GetText

func (x *Message) GetText() string

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

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) SendMessage

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.

Jump to

Keyboard shortcuts

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