rooms

package
v0.0.0-...-0451d2a Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package rooms is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var (
	MemberStatus_name = map[int32]string{
		0: "UNKNOWN",
		1: "ONLINE",
		2: "OFFLINE",
	}
	MemberStatus_value = map[string]int32{
		"UNKNOWN": 0,
		"ONLINE":  1,
		"OFFLINE": 2,
	}
)

Enum value maps for MemberStatus.

View Source
var (
	RoomStatus_name = map[int32]string{
		0: "CREATED",
		1: "MATCHING",
		2: "MATCHED",
		3: "CANCELLED",
	}
	RoomStatus_value = map[string]int32{
		"CREATED":   0,
		"MATCHING":  1,
		"MATCHED":   2,
		"CANCELLED": 3,
	}
)

Enum value maps for RoomStatus.

View Source
var File_rooms_v1_rooms_proto protoreflect.FileDescriptor
View Source
var RoomsService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "rooms.RoomsService",
	HandlerType: (*RoomsServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "CreateRoom",
			Handler:    _RoomsService_CreateRoom_Handler,
		},
		{
			MethodName: "GetRoom",
			Handler:    _RoomsService_GetRoom_Handler,
		},
		{
			MethodName: "GetRooms",
			Handler:    _RoomsService_GetRooms_Handler,
		},
		{
			MethodName: "JoinMember",
			Handler:    _RoomsService_JoinMember_Handler,
		},
		{
			MethodName: "LeaveMember",
			Handler:    _RoomsService_LeaveMember_Handler,
		},
		{
			MethodName: "GetRoomMessages",
			Handler:    _RoomsService_GetRoomMessages_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "rooms/v1/rooms.proto",
}

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

Functions

func RegisterRoomsServiceHandler

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

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

func RegisterRoomsServiceHandlerClient

func RegisterRoomsServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client RoomsServiceClient) error

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

func RegisterRoomsServiceHandlerFromEndpoint

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

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

func RegisterRoomsServiceHandlerServer

func RegisterRoomsServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server RoomsServiceServer) error

RegisterRoomsServiceHandlerServer registers the http handlers for service RoomsService to "mux". UnaryRPC :call RoomsServiceServer 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 RegisterRoomsServiceHandlerFromEndpoint instead.

func RegisterRoomsServiceServer

func RegisterRoomsServiceServer(s grpc.ServiceRegistrar, srv RoomsServiceServer)

Types

type CreateRoomRequest

type CreateRoomRequest 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"`
	SecretKey   string `protobuf:"bytes,3,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"`
	MaxMembers  int64  `protobuf:"varint,4,opt,name=max_members,json=maxMembers,proto3" json:"max_members,omitempty"`
	MaxMessages int64  `protobuf:"varint,5,opt,name=max_messages,json=maxMessages,proto3" json:"max_messages,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRoomRequest) Descriptor deprecated

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

Deprecated: Use CreateRoomRequest.ProtoReflect.Descriptor instead.

func (*CreateRoomRequest) GetId

func (x *CreateRoomRequest) GetId() string

func (*CreateRoomRequest) GetMaxMembers

func (x *CreateRoomRequest) GetMaxMembers() int64

func (*CreateRoomRequest) GetMaxMessages

func (x *CreateRoomRequest) GetMaxMessages() int64

func (*CreateRoomRequest) GetName

func (x *CreateRoomRequest) GetName() string

func (*CreateRoomRequest) GetSecretKey

func (x *CreateRoomRequest) GetSecretKey() string

func (*CreateRoomRequest) ProtoMessage

func (*CreateRoomRequest) ProtoMessage()

func (*CreateRoomRequest) ProtoReflect

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

func (*CreateRoomRequest) Reset

func (x *CreateRoomRequest) Reset()

func (*CreateRoomRequest) String

func (x *CreateRoomRequest) String() string

type Empty

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

func (*Empty) Descriptor deprecated

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

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

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

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

type GetRoomMessagesRequest

type GetRoomMessagesRequest struct {
	RoomId         string `protobuf:"bytes,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"`
	StartTimestamp int64  `protobuf:"varint,2,opt,name=start_timestamp,json=startTimestamp,proto3" json:"start_timestamp,omitempty"`
	EndTimestamp   int64  `protobuf:"varint,3,opt,name=end_timestamp,json=endTimestamp,proto3" json:"end_timestamp,omitempty"`
	// contains filtered or unexported fields
}

func (*GetRoomMessagesRequest) Descriptor deprecated

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

Deprecated: Use GetRoomMessagesRequest.ProtoReflect.Descriptor instead.

func (*GetRoomMessagesRequest) GetEndTimestamp

func (x *GetRoomMessagesRequest) GetEndTimestamp() int64

func (*GetRoomMessagesRequest) GetRoomId

func (x *GetRoomMessagesRequest) GetRoomId() string

func (*GetRoomMessagesRequest) GetStartTimestamp

func (x *GetRoomMessagesRequest) GetStartTimestamp() int64

func (*GetRoomMessagesRequest) ProtoMessage

func (*GetRoomMessagesRequest) ProtoMessage()

func (*GetRoomMessagesRequest) ProtoReflect

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

func (*GetRoomMessagesRequest) Reset

func (x *GetRoomMessagesRequest) Reset()

func (*GetRoomMessagesRequest) String

func (x *GetRoomMessagesRequest) String() string

type GetRoomRequest

type GetRoomRequest struct {
	RoomId string `protobuf:"bytes,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"`
	// contains filtered or unexported fields
}

func (*GetRoomRequest) Descriptor deprecated

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

Deprecated: Use GetRoomRequest.ProtoReflect.Descriptor instead.

func (*GetRoomRequest) GetRoomId

func (x *GetRoomRequest) GetRoomId() string

func (*GetRoomRequest) ProtoMessage

func (*GetRoomRequest) ProtoMessage()

func (*GetRoomRequest) ProtoReflect

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

func (*GetRoomRequest) Reset

func (x *GetRoomRequest) Reset()

func (*GetRoomRequest) String

func (x *GetRoomRequest) String() string

type GetRoomsRequest

type GetRoomsRequest struct {
	OrderBy string `protobuf:"bytes,1,opt,name=order_by,json=orderBy,proto3" json:"order_by,omitempty"`
	// contains filtered or unexported fields
}

func (*GetRoomsRequest) Descriptor deprecated

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

Deprecated: Use GetRoomsRequest.ProtoReflect.Descriptor instead.

func (*GetRoomsRequest) GetOrderBy

func (x *GetRoomsRequest) GetOrderBy() string

func (*GetRoomsRequest) ProtoMessage

func (*GetRoomsRequest) ProtoMessage()

func (*GetRoomsRequest) ProtoReflect

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

func (*GetRoomsRequest) Reset

func (x *GetRoomsRequest) Reset()

func (*GetRoomsRequest) String

func (x *GetRoomsRequest) String() string

type ID

type ID struct {
	Id        string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	SecretKey string `protobuf:"bytes,2,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"`
	// contains filtered or unexported fields
}

func (*ID) Descriptor deprecated

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

Deprecated: Use ID.ProtoReflect.Descriptor instead.

func (*ID) GetId

func (x *ID) GetId() string

func (*ID) GetSecretKey

func (x *ID) GetSecretKey() string

func (*ID) ProtoMessage

func (*ID) ProtoMessage()

func (*ID) ProtoReflect

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

func (*ID) Reset

func (x *ID) Reset()

func (*ID) String

func (x *ID) String() string

type JoinMemberRequest

type JoinMemberRequest struct {
	RoomId    string `protobuf:"bytes,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"`
	MemberId  string `protobuf:"bytes,2,opt,name=member_id,json=memberId,proto3" json:"member_id,omitempty"`
	SecretKey string `protobuf:"bytes,3,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"`
	// contains filtered or unexported fields
}

func (*JoinMemberRequest) Descriptor deprecated

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

Deprecated: Use JoinMemberRequest.ProtoReflect.Descriptor instead.

func (*JoinMemberRequest) GetMemberId

func (x *JoinMemberRequest) GetMemberId() string

func (*JoinMemberRequest) GetRoomId

func (x *JoinMemberRequest) GetRoomId() string

func (*JoinMemberRequest) GetSecretKey

func (x *JoinMemberRequest) GetSecretKey() string

func (*JoinMemberRequest) ProtoMessage

func (*JoinMemberRequest) ProtoMessage()

func (*JoinMemberRequest) ProtoReflect

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

func (*JoinMemberRequest) Reset

func (x *JoinMemberRequest) Reset()

func (*JoinMemberRequest) String

func (x *JoinMemberRequest) String() string

type LeaveMemberRequest

type LeaveMemberRequest struct {
	RoomId   string `protobuf:"bytes,1,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"`
	MemberId string `protobuf:"bytes,2,opt,name=member_id,json=memberId,proto3" json:"member_id,omitempty"`
	// contains filtered or unexported fields
}

func (*LeaveMemberRequest) Descriptor deprecated

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

Deprecated: Use LeaveMemberRequest.ProtoReflect.Descriptor instead.

func (*LeaveMemberRequest) GetMemberId

func (x *LeaveMemberRequest) GetMemberId() string

func (*LeaveMemberRequest) GetRoomId

func (x *LeaveMemberRequest) GetRoomId() string

func (*LeaveMemberRequest) ProtoMessage

func (*LeaveMemberRequest) ProtoMessage()

func (*LeaveMemberRequest) ProtoReflect

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

func (*LeaveMemberRequest) Reset

func (x *LeaveMemberRequest) Reset()

func (*LeaveMemberRequest) String

func (x *LeaveMemberRequest) String() string

type Member

type Member struct {
	Id     string       `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	Status MemberStatus `protobuf:"varint,3,opt,name=status,proto3,enum=rooms.MemberStatus" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*Member) Descriptor deprecated

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

Deprecated: Use Member.ProtoReflect.Descriptor instead.

func (*Member) GetId

func (x *Member) GetId() string

func (*Member) GetStatus

func (x *Member) GetStatus() MemberStatus

func (*Member) ProtoMessage

func (*Member) ProtoMessage()

func (*Member) ProtoReflect

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

func (*Member) Reset

func (x *Member) Reset()

func (*Member) String

func (x *Member) String() string

type MemberStatus

type MemberStatus int32
const (
	MemberStatus_UNKNOWN MemberStatus = 0
	MemberStatus_ONLINE  MemberStatus = 1
	MemberStatus_OFFLINE MemberStatus = 2
)

func (MemberStatus) Descriptor

func (MemberStatus) Enum

func (x MemberStatus) Enum() *MemberStatus

func (MemberStatus) EnumDescriptor deprecated

func (MemberStatus) EnumDescriptor() ([]byte, []int)

Deprecated: Use MemberStatus.Descriptor instead.

func (MemberStatus) Number

func (MemberStatus) String

func (x MemberStatus) String() string

func (MemberStatus) Type

type Message

type Message struct {
	Id        string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	RoomId    string `protobuf:"bytes,2,opt,name=room_id,json=roomId,proto3" json:"room_id,omitempty"`
	MemberId  string `protobuf:"bytes,3,opt,name=member_id,json=memberId,proto3" json:"member_id,omitempty"`
	Content   string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"`
	Timestamp int64  `protobuf:"varint,5,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) GetContent

func (x *Message) GetContent() string

func (*Message) GetId

func (x *Message) GetId() string

func (*Message) GetMemberId

func (x *Message) GetMemberId() string

func (*Message) GetRoomId

func (x *Message) GetRoomId() string

func (*Message) GetTimestamp

func (x *Message) GetTimestamp() int64

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 Messages

type Messages struct {
	Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
	// contains filtered or unexported fields
}

func (*Messages) Descriptor deprecated

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

Deprecated: Use Messages.ProtoReflect.Descriptor instead.

func (*Messages) GetMessages

func (x *Messages) GetMessages() []*Message

func (*Messages) ProtoMessage

func (*Messages) ProtoMessage()

func (*Messages) ProtoReflect

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

func (*Messages) Reset

func (x *Messages) Reset()

func (*Messages) String

func (x *Messages) String() string

type Room

type Room 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"`
	SecretKey string     `protobuf:"bytes,3,opt,name=secret_key,json=secretKey,proto3" json:"secret_key,omitempty"`
	Status    RoomStatus `protobuf:"varint,4,opt,name=status,proto3,enum=rooms.RoomStatus" json:"status,omitempty"`
	Members   []*Member  `protobuf:"bytes,5,rep,name=members,proto3" json:"members,omitempty"`
	// contains filtered or unexported fields
}

func (*Room) Descriptor deprecated

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

Deprecated: Use Room.ProtoReflect.Descriptor instead.

func (*Room) GetId

func (x *Room) GetId() string

func (*Room) GetMembers

func (x *Room) GetMembers() []*Member

func (*Room) GetName

func (x *Room) GetName() string

func (*Room) GetSecretKey

func (x *Room) GetSecretKey() string

func (*Room) GetStatus

func (x *Room) GetStatus() RoomStatus

func (*Room) ProtoMessage

func (*Room) ProtoMessage()

func (*Room) ProtoReflect

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

func (*Room) Reset

func (x *Room) Reset()

func (*Room) String

func (x *Room) String() string

type RoomStatus

type RoomStatus int32
const (
	RoomStatus_CREATED   RoomStatus = 0
	RoomStatus_MATCHING  RoomStatus = 1
	RoomStatus_MATCHED   RoomStatus = 2
	RoomStatus_CANCELLED RoomStatus = 3
)

func (RoomStatus) Descriptor

func (RoomStatus) Descriptor() protoreflect.EnumDescriptor

func (RoomStatus) Enum

func (x RoomStatus) Enum() *RoomStatus

func (RoomStatus) EnumDescriptor deprecated

func (RoomStatus) EnumDescriptor() ([]byte, []int)

Deprecated: Use RoomStatus.Descriptor instead.

func (RoomStatus) Number

func (x RoomStatus) Number() protoreflect.EnumNumber

func (RoomStatus) String

func (x RoomStatus) String() string

func (RoomStatus) Type

type Rooms

type Rooms struct {
	Rooms []*Room `protobuf:"bytes,1,rep,name=rooms,proto3" json:"rooms,omitempty"`
	// contains filtered or unexported fields
}

func (*Rooms) Descriptor deprecated

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

Deprecated: Use Rooms.ProtoReflect.Descriptor instead.

func (*Rooms) GetRooms

func (x *Rooms) GetRooms() []*Room

func (*Rooms) ProtoMessage

func (*Rooms) ProtoMessage()

func (*Rooms) ProtoReflect

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

func (*Rooms) Reset

func (x *Rooms) Reset()

func (*Rooms) String

func (x *Rooms) String() string

type RoomsServiceClient

type RoomsServiceClient interface {
	CreateRoom(ctx context.Context, in *CreateRoomRequest, opts ...grpc.CallOption) (*ID, error)
	GetRoom(ctx context.Context, in *GetRoomRequest, opts ...grpc.CallOption) (*Room, error)
	GetRooms(ctx context.Context, in *GetRoomsRequest, opts ...grpc.CallOption) (*Rooms, error)
	JoinMember(ctx context.Context, in *JoinMemberRequest, opts ...grpc.CallOption) (*Empty, error)
	LeaveMember(ctx context.Context, in *LeaveMemberRequest, opts ...grpc.CallOption) (*Empty, error)
	GetRoomMessages(ctx context.Context, in *GetRoomMessagesRequest, opts ...grpc.CallOption) (*Messages, error)
}

RoomsServiceClient is the client API for RoomsService 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.

type RoomsServiceServer

type RoomsServiceServer interface {
	CreateRoom(context.Context, *CreateRoomRequest) (*ID, error)
	GetRoom(context.Context, *GetRoomRequest) (*Room, error)
	GetRooms(context.Context, *GetRoomsRequest) (*Rooms, error)
	JoinMember(context.Context, *JoinMemberRequest) (*Empty, error)
	LeaveMember(context.Context, *LeaveMemberRequest) (*Empty, error)
	GetRoomMessages(context.Context, *GetRoomMessagesRequest) (*Messages, error)
	// contains filtered or unexported methods
}

RoomsServiceServer is the server API for RoomsService service. All implementations must embed UnimplementedRoomsServiceServer for forward compatibility

type UnimplementedRoomsServiceServer

type UnimplementedRoomsServiceServer struct {
}

UnimplementedRoomsServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedRoomsServiceServer) CreateRoom

func (UnimplementedRoomsServiceServer) GetRoom

func (UnimplementedRoomsServiceServer) GetRoomMessages

func (UnimplementedRoomsServiceServer) GetRooms

func (UnimplementedRoomsServiceServer) JoinMember

func (UnimplementedRoomsServiceServer) LeaveMember

type UnsafeRoomsServiceServer

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

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

Jump to

Keyboard shortcuts

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