mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-23 07:41:25 +00:00
Chats (#96)
* stash * replace chats sql with store * strip unused method
This commit is contained in:
@@ -1,17 +1,14 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.25.0
|
||||
// protoc v3.15.5
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.15.6
|
||||
// source: proto/chats.proto
|
||||
|
||||
package chats
|
||||
|
||||
import (
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
|
||||
wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
)
|
||||
@@ -23,18 +20,17 @@ const (
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// This is a compile-time assertion that a sufficiently up-to-date version
|
||||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
type Chat struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
UserIds []string `protobuf:"bytes,2,rep,name=user_ids,json=userIds,proto3" json:"user_ids,omitempty"`
|
||||
CreatedAt *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
// unique id of the chat
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
// list of users in the chat
|
||||
UserIds []string `protobuf:"bytes,2,rep,name=user_ids,json=userIds,proto3" json:"user_ids,omitempty"`
|
||||
// unix nanosecond timestamp
|
||||
CreatedAt int64 `protobuf:"varint,3,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Chat) Reset() {
|
||||
@@ -83,11 +79,11 @@ func (x *Chat) GetUserIds() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Chat) GetCreatedAt() *timestamppb.Timestamp {
|
||||
func (x *Chat) GetCreatedAt() int64 {
|
||||
if x != nil {
|
||||
return x.CreatedAt
|
||||
}
|
||||
return nil
|
||||
return 0
|
||||
}
|
||||
|
||||
type Message struct {
|
||||
@@ -95,11 +91,16 @@ type Message struct {
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
AuthorId string `protobuf:"bytes,2,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty"`
|
||||
ChatId string `protobuf:"bytes,3,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"`
|
||||
Text string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"`
|
||||
SentAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=sent_at,json=sentAt,proto3" json:"sent_at,omitempty"`
|
||||
// unique id of the message
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
// user id of the message
|
||||
AuthorId string `protobuf:"bytes,2,opt,name=author_id,json=authorId,proto3" json:"author_id,omitempty"`
|
||||
// chat id the message belongs to
|
||||
ChatId string `protobuf:"bytes,3,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"`
|
||||
// text within the message
|
||||
Text string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"`
|
||||
// unix nanosecond timestamp
|
||||
SentAt int64 `protobuf:"varint,5,opt,name=sent_at,json=sentAt,proto3" json:"sent_at,omitempty"`
|
||||
}
|
||||
|
||||
func (x *Message) Reset() {
|
||||
@@ -162,19 +163,23 @@ func (x *Message) GetText() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Message) GetSentAt() *timestamppb.Timestamp {
|
||||
func (x *Message) GetSentAt() int64 {
|
||||
if x != nil {
|
||||
return x.SentAt
|
||||
}
|
||||
return nil
|
||||
return 0
|
||||
}
|
||||
|
||||
// Create a new chat between mulitple users
|
||||
type CreateChatRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
UserIds []string `protobuf:"bytes,1,rep,name=user_ids,json=userIds,proto3" json:"user_ids,omitempty"`
|
||||
// The chat ID
|
||||
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
// List of users in the chat
|
||||
UserIds []string `protobuf:"bytes,2,rep,name=user_ids,json=userIds,proto3" json:"user_ids,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CreateChatRequest) Reset() {
|
||||
@@ -209,6 +214,13 @@ func (*CreateChatRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_chats_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *CreateChatRequest) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateChatRequest) GetUserIds() []string {
|
||||
if x != nil {
|
||||
return x.UserIds
|
||||
@@ -263,7 +275,8 @@ func (x *CreateChatResponse) GetChat() *Chat {
|
||||
return nil
|
||||
}
|
||||
|
||||
type CreateMessageRequest struct {
|
||||
// Send a message to a chat room
|
||||
type SendMessageRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
@@ -274,8 +287,8 @@ type CreateMessageRequest struct {
|
||||
Text string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CreateMessageRequest) Reset() {
|
||||
*x = CreateMessageRequest{}
|
||||
func (x *SendMessageRequest) Reset() {
|
||||
*x = SendMessageRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_chats_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -283,13 +296,13 @@ func (x *CreateMessageRequest) Reset() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CreateMessageRequest) String() string {
|
||||
func (x *SendMessageRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateMessageRequest) ProtoMessage() {}
|
||||
func (*SendMessageRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CreateMessageRequest) ProtoReflect() protoreflect.Message {
|
||||
func (x *SendMessageRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_chats_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -301,40 +314,40 @@ func (x *CreateMessageRequest) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateMessageRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CreateMessageRequest) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use SendMessageRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SendMessageRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_chats_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *CreateMessageRequest) GetId() string {
|
||||
func (x *SendMessageRequest) GetId() string {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateMessageRequest) GetChatId() string {
|
||||
func (x *SendMessageRequest) GetChatId() string {
|
||||
if x != nil {
|
||||
return x.ChatId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateMessageRequest) GetAuthorId() string {
|
||||
func (x *SendMessageRequest) GetAuthorId() string {
|
||||
if x != nil {
|
||||
return x.AuthorId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *CreateMessageRequest) GetText() string {
|
||||
func (x *SendMessageRequest) GetText() string {
|
||||
if x != nil {
|
||||
return x.Text
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type CreateMessageResponse struct {
|
||||
type SendMessageResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
@@ -342,8 +355,8 @@ type CreateMessageResponse struct {
|
||||
Message *Message `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
|
||||
}
|
||||
|
||||
func (x *CreateMessageResponse) Reset() {
|
||||
*x = CreateMessageResponse{}
|
||||
func (x *SendMessageResponse) Reset() {
|
||||
*x = SendMessageResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_proto_chats_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -351,13 +364,13 @@ func (x *CreateMessageResponse) Reset() {
|
||||
}
|
||||
}
|
||||
|
||||
func (x *CreateMessageResponse) String() string {
|
||||
func (x *SendMessageResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CreateMessageResponse) ProtoMessage() {}
|
||||
func (*SendMessageResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CreateMessageResponse) ProtoReflect() protoreflect.Message {
|
||||
func (x *SendMessageResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_chats_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
@@ -369,26 +382,32 @@ func (x *CreateMessageResponse) ProtoReflect() protoreflect.Message {
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CreateMessageResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CreateMessageResponse) Descriptor() ([]byte, []int) {
|
||||
// Deprecated: Use SendMessageResponse.ProtoReflect.Descriptor instead.
|
||||
func (*SendMessageResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_chats_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *CreateMessageResponse) GetMessage() *Message {
|
||||
func (x *SendMessageResponse) GetMessage() *Message {
|
||||
if x != nil {
|
||||
return x.Message
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// List messages within a chat
|
||||
type ListMessagesRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ChatId string `protobuf:"bytes,1,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"`
|
||||
SentBefore *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=sent_before,json=sentBefore,proto3" json:"sent_before,omitempty"`
|
||||
Limit *wrapperspb.Int32Value `protobuf:"bytes,3,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||
// unique id of the chat
|
||||
ChatId string `protobuf:"bytes,1,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"`
|
||||
// limit the number of messages
|
||||
Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||
// offset for the messages
|
||||
Offset int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset,omitempty"`
|
||||
// order "asc" or "desc" (defaults to reverse chronological)
|
||||
Order string `protobuf:"bytes,4,opt,name=order,proto3" json:"order,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListMessagesRequest) Reset() {
|
||||
@@ -430,18 +449,25 @@ func (x *ListMessagesRequest) GetChatId() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ListMessagesRequest) GetSentBefore() *timestamppb.Timestamp {
|
||||
if x != nil {
|
||||
return x.SentBefore
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ListMessagesRequest) GetLimit() *wrapperspb.Int32Value {
|
||||
func (x *ListMessagesRequest) GetLimit() int64 {
|
||||
if x != nil {
|
||||
return x.Limit
|
||||
}
|
||||
return nil
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ListMessagesRequest) GetOffset() int64 {
|
||||
if x != nil {
|
||||
return x.Offset
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ListMessagesRequest) GetOrder() string {
|
||||
if x != nil {
|
||||
return x.Order
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ListMessagesResponse struct {
|
||||
@@ -495,75 +521,65 @@ var File_proto_chats_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_proto_chats_proto_rawDesc = []byte{
|
||||
0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x68, 0x61, 0x74, 0x73, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x12, 0x05, 0x63, 0x68, 0x61, 0x74, 0x73, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67,
|
||||
0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65,
|
||||
0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x67, 0x6f, 0x6f,
|
||||
0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x77, 0x72, 0x61,
|
||||
0x70, 0x70, 0x65, 0x72, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6c, 0x0a, 0x04, 0x43,
|
||||
0x68, 0x61, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x02, 0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18,
|
||||
0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x12, 0x39,
|
||||
0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09,
|
||||
0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x07, 0x4d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x5f,
|
||||
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72,
|
||||
0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x68, 0x61, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74,
|
||||
0x65, 0x78, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12,
|
||||
0x33, 0x0a, 0x07, 0x73, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x06, 0x73, 0x65,
|
||||
0x6e, 0x74, 0x41, 0x74, 0x22, 0x2e, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68,
|
||||
0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x73, 0x65,
|
||||
0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x75, 0x73, 0x65,
|
||||
0x72, 0x49, 0x64, 0x73, 0x22, 0x35, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68,
|
||||
0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x63, 0x68,
|
||||
0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x63, 0x68, 0x61, 0x74, 0x73,
|
||||
0x2e, 0x43, 0x68, 0x61, 0x74, 0x52, 0x04, 0x63, 0x68, 0x61, 0x74, 0x22, 0x70, 0x0a, 0x14, 0x43,
|
||||
0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x68, 0x61, 0x74, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09,
|
||||
0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x08, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78,
|
||||
0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0x41, 0x0a,
|
||||
0x15, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x68, 0x61, 0x74, 0x73, 0x2e,
|
||||
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x22, 0x9e, 0x01, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x74,
|
||||
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x68, 0x61, 0x74, 0x49,
|
||||
0x64, 0x12, 0x3b, 0x0a, 0x0b, 0x73, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
|
||||
0x6d, 0x70, 0x52, 0x0a, 0x73, 0x65, 0x6e, 0x74, 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x12, 0x31,
|
||||
0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e,
|
||||
0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e,
|
||||
0x49, 0x6e, 0x74, 0x33, 0x32, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69,
|
||||
0x74, 0x22, 0x42, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x08, 0x6d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x68,
|
||||
0x61, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x08, 0x6d, 0x65, 0x73,
|
||||
0x73, 0x61, 0x67, 0x65, 0x73, 0x32, 0xdf, 0x01, 0x0a, 0x05, 0x43, 0x68, 0x61, 0x74, 0x73, 0x12,
|
||||
0x41, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x12, 0x18, 0x2e,
|
||||
0x63, 0x68, 0x61, 0x74, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x63, 0x68, 0x61, 0x74, 0x73, 0x2e,
|
||||
0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x4a, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x73, 0x73,
|
||||
0x61, 0x67, 0x65, 0x12, 0x1b, 0x2e, 0x63, 0x68, 0x61, 0x74, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61,
|
||||
0x74, 0x65, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x1c, 0x2e, 0x63, 0x68, 0x61, 0x74, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47,
|
||||
0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1a,
|
||||
0x2e, 0x63, 0x68, 0x61, 0x74, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x63, 0x68, 0x61,
|
||||
0x74, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x3b, 0x63, 0x68, 0x61, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x6f, 0x74, 0x6f, 0x12, 0x05, 0x63, 0x68, 0x61, 0x74, 0x73, 0x22, 0x50, 0x0a, 0x04, 0x43, 0x68,
|
||||
0x61, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02,
|
||||
0x69, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02,
|
||||
0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x12, 0x1d, 0x0a,
|
||||
0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0x7c, 0x0a, 0x07,
|
||||
0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f,
|
||||
0x72, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68,
|
||||
0x6f, 0x72, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x74, 0x5f, 0x69, 0x64, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x68, 0x61, 0x74, 0x49, 0x64, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78,
|
||||
0x74, 0x12, 0x17, 0x0a, 0x07, 0x73, 0x65, 0x6e, 0x74, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01,
|
||||
0x28, 0x03, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x22, 0x3e, 0x0a, 0x11, 0x43, 0x72,
|
||||
0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||
0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12,
|
||||
0x19, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28,
|
||||
0x09, 0x52, 0x07, 0x75, 0x73, 0x65, 0x72, 0x49, 0x64, 0x73, 0x22, 0x35, 0x0a, 0x12, 0x43, 0x72,
|
||||
0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x1f, 0x0a, 0x04, 0x63, 0x68, 0x61, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b,
|
||||
0x2e, 0x63, 0x68, 0x61, 0x74, 0x73, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x52, 0x04, 0x63, 0x68, 0x61,
|
||||
0x74, 0x22, 0x6e, 0x0a, 0x12, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x74, 0x5f,
|
||||
0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x68, 0x61, 0x74, 0x49, 0x64,
|
||||
0x12, 0x1b, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x08, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x49, 0x64, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78,
|
||||
0x74, 0x22, 0x3f, 0x0a, 0x13, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x28, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73,
|
||||
0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x68, 0x61, 0x74,
|
||||
0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61,
|
||||
0x67, 0x65, 0x22, 0x72, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x63, 0x68, 0x61,
|
||||
0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x63, 0x68, 0x61, 0x74,
|
||||
0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x03, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73,
|
||||
0x65, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
|
||||
0x12, 0x14, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x22, 0x42, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a,
|
||||
0x0a, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
|
||||
0x32, 0x0e, 0x2e, 0x63, 0x68, 0x61, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65,
|
||||
0x52, 0x08, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x32, 0xd9, 0x01, 0x0a, 0x05, 0x43,
|
||||
0x68, 0x61, 0x74, 0x73, 0x12, 0x41, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68,
|
||||
0x61, 0x74, 0x12, 0x18, 0x2e, 0x63, 0x68, 0x61, 0x74, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74,
|
||||
0x65, 0x43, 0x68, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x63,
|
||||
0x68, 0x61, 0x74, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x43, 0x68, 0x61, 0x74, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0b, 0x53, 0x65, 0x6e, 0x64, 0x4d,
|
||||
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x19, 0x2e, 0x63, 0x68, 0x61, 0x74, 0x73, 0x2e, 0x53,
|
||||
0x65, 0x6e, 0x64, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x1a, 0x2e, 0x63, 0x68, 0x61, 0x74, 0x73, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x4d, 0x65,
|
||||
0x73, 0x73, 0x61, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x47, 0x0a,
|
||||
0x0c, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x12, 0x1a, 0x2e,
|
||||
0x63, 0x68, 0x61, 0x74, 0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67,
|
||||
0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x63, 0x68, 0x61, 0x74,
|
||||
0x73, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x3b, 0x63, 0x68, 0x61, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -580,36 +596,30 @@ func file_proto_chats_proto_rawDescGZIP() []byte {
|
||||
|
||||
var file_proto_chats_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_proto_chats_proto_goTypes = []interface{}{
|
||||
(*Chat)(nil), // 0: chats.Chat
|
||||
(*Message)(nil), // 1: chats.Message
|
||||
(*CreateChatRequest)(nil), // 2: chats.CreateChatRequest
|
||||
(*CreateChatResponse)(nil), // 3: chats.CreateChatResponse
|
||||
(*CreateMessageRequest)(nil), // 4: chats.CreateMessageRequest
|
||||
(*CreateMessageResponse)(nil), // 5: chats.CreateMessageResponse
|
||||
(*ListMessagesRequest)(nil), // 6: chats.ListMessagesRequest
|
||||
(*ListMessagesResponse)(nil), // 7: chats.ListMessagesResponse
|
||||
(*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp
|
||||
(*wrapperspb.Int32Value)(nil), // 9: google.protobuf.Int32Value
|
||||
(*Chat)(nil), // 0: chats.Chat
|
||||
(*Message)(nil), // 1: chats.Message
|
||||
(*CreateChatRequest)(nil), // 2: chats.CreateChatRequest
|
||||
(*CreateChatResponse)(nil), // 3: chats.CreateChatResponse
|
||||
(*SendMessageRequest)(nil), // 4: chats.SendMessageRequest
|
||||
(*SendMessageResponse)(nil), // 5: chats.SendMessageResponse
|
||||
(*ListMessagesRequest)(nil), // 6: chats.ListMessagesRequest
|
||||
(*ListMessagesResponse)(nil), // 7: chats.ListMessagesResponse
|
||||
}
|
||||
var file_proto_chats_proto_depIdxs = []int32{
|
||||
8, // 0: chats.Chat.created_at:type_name -> google.protobuf.Timestamp
|
||||
8, // 1: chats.Message.sent_at:type_name -> google.protobuf.Timestamp
|
||||
0, // 2: chats.CreateChatResponse.chat:type_name -> chats.Chat
|
||||
1, // 3: chats.CreateMessageResponse.message:type_name -> chats.Message
|
||||
8, // 4: chats.ListMessagesRequest.sent_before:type_name -> google.protobuf.Timestamp
|
||||
9, // 5: chats.ListMessagesRequest.limit:type_name -> google.protobuf.Int32Value
|
||||
1, // 6: chats.ListMessagesResponse.messages:type_name -> chats.Message
|
||||
2, // 7: chats.Chats.CreateChat:input_type -> chats.CreateChatRequest
|
||||
4, // 8: chats.Chats.CreateMessage:input_type -> chats.CreateMessageRequest
|
||||
6, // 9: chats.Chats.ListMessages:input_type -> chats.ListMessagesRequest
|
||||
3, // 10: chats.Chats.CreateChat:output_type -> chats.CreateChatResponse
|
||||
5, // 11: chats.Chats.CreateMessage:output_type -> chats.CreateMessageResponse
|
||||
7, // 12: chats.Chats.ListMessages:output_type -> chats.ListMessagesResponse
|
||||
10, // [10:13] is the sub-list for method output_type
|
||||
7, // [7:10] is the sub-list for method input_type
|
||||
7, // [7:7] is the sub-list for extension type_name
|
||||
7, // [7:7] is the sub-list for extension extendee
|
||||
0, // [0:7] is the sub-list for field type_name
|
||||
0, // 0: chats.CreateChatResponse.chat:type_name -> chats.Chat
|
||||
1, // 1: chats.SendMessageResponse.message:type_name -> chats.Message
|
||||
1, // 2: chats.ListMessagesResponse.messages:type_name -> chats.Message
|
||||
2, // 3: chats.Chats.CreateChat:input_type -> chats.CreateChatRequest
|
||||
4, // 4: chats.Chats.SendMessage:input_type -> chats.SendMessageRequest
|
||||
6, // 5: chats.Chats.ListMessages:input_type -> chats.ListMessagesRequest
|
||||
3, // 6: chats.Chats.CreateChat:output_type -> chats.CreateChatResponse
|
||||
5, // 7: chats.Chats.SendMessage:output_type -> chats.SendMessageResponse
|
||||
7, // 8: chats.Chats.ListMessages:output_type -> chats.ListMessagesResponse
|
||||
6, // [6:9] is the sub-list for method output_type
|
||||
3, // [3:6] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_chats_proto_init() }
|
||||
@@ -667,7 +677,7 @@ func file_proto_chats_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_chats_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CreateMessageRequest); i {
|
||||
switch v := v.(*SendMessageRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -679,7 +689,7 @@ func file_proto_chats_proto_init() {
|
||||
}
|
||||
}
|
||||
file_proto_chats_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CreateMessageResponse); i {
|
||||
switch v := v.(*SendMessageResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
||||
@@ -6,8 +6,6 @@ package chats
|
||||
import (
|
||||
fmt "fmt"
|
||||
proto "github.com/golang/protobuf/proto"
|
||||
_ "google.golang.org/protobuf/types/known/timestamppb"
|
||||
_ "google.golang.org/protobuf/types/known/wrapperspb"
|
||||
math "math"
|
||||
)
|
||||
|
||||
@@ -48,7 +46,7 @@ type ChatsService interface {
|
||||
// chat will be returned
|
||||
CreateChat(ctx context.Context, in *CreateChatRequest, opts ...client.CallOption) (*CreateChatResponse, error)
|
||||
// Create a message within a chat
|
||||
CreateMessage(ctx context.Context, in *CreateMessageRequest, opts ...client.CallOption) (*CreateMessageResponse, error)
|
||||
SendMessage(ctx context.Context, in *SendMessageRequest, opts ...client.CallOption) (*SendMessageResponse, error)
|
||||
// List the messages within a chat in reverse chronological order, using sent_before to
|
||||
// offset as older messages need to be loaded
|
||||
ListMessages(ctx context.Context, in *ListMessagesRequest, opts ...client.CallOption) (*ListMessagesResponse, error)
|
||||
@@ -76,9 +74,9 @@ func (c *chatsService) CreateChat(ctx context.Context, in *CreateChatRequest, op
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *chatsService) CreateMessage(ctx context.Context, in *CreateMessageRequest, opts ...client.CallOption) (*CreateMessageResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Chats.CreateMessage", in)
|
||||
out := new(CreateMessageResponse)
|
||||
func (c *chatsService) SendMessage(ctx context.Context, in *SendMessageRequest, opts ...client.CallOption) (*SendMessageResponse, error) {
|
||||
req := c.c.NewRequest(c.name, "Chats.SendMessage", in)
|
||||
out := new(SendMessageResponse)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -103,7 +101,7 @@ type ChatsHandler interface {
|
||||
// chat will be returned
|
||||
CreateChat(context.Context, *CreateChatRequest, *CreateChatResponse) error
|
||||
// Create a message within a chat
|
||||
CreateMessage(context.Context, *CreateMessageRequest, *CreateMessageResponse) error
|
||||
SendMessage(context.Context, *SendMessageRequest, *SendMessageResponse) error
|
||||
// List the messages within a chat in reverse chronological order, using sent_before to
|
||||
// offset as older messages need to be loaded
|
||||
ListMessages(context.Context, *ListMessagesRequest, *ListMessagesResponse) error
|
||||
@@ -112,7 +110,7 @@ type ChatsHandler interface {
|
||||
func RegisterChatsHandler(s server.Server, hdlr ChatsHandler, opts ...server.HandlerOption) error {
|
||||
type chats interface {
|
||||
CreateChat(ctx context.Context, in *CreateChatRequest, out *CreateChatResponse) error
|
||||
CreateMessage(ctx context.Context, in *CreateMessageRequest, out *CreateMessageResponse) error
|
||||
SendMessage(ctx context.Context, in *SendMessageRequest, out *SendMessageResponse) error
|
||||
ListMessages(ctx context.Context, in *ListMessagesRequest, out *ListMessagesResponse) error
|
||||
}
|
||||
type Chats struct {
|
||||
@@ -130,8 +128,8 @@ func (h *chatsHandler) CreateChat(ctx context.Context, in *CreateChatRequest, ou
|
||||
return h.ChatsHandler.CreateChat(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *chatsHandler) CreateMessage(ctx context.Context, in *CreateMessageRequest, out *CreateMessageResponse) error {
|
||||
return h.ChatsHandler.CreateMessage(ctx, in, out)
|
||||
func (h *chatsHandler) SendMessage(ctx context.Context, in *SendMessageRequest, out *SendMessageResponse) error {
|
||||
return h.ChatsHandler.SendMessage(ctx, in, out)
|
||||
}
|
||||
|
||||
func (h *chatsHandler) ListMessages(ctx context.Context, in *ListMessagesRequest, out *ListMessagesResponse) error {
|
||||
|
||||
@@ -4,57 +4,73 @@ package chats;
|
||||
|
||||
option go_package = "./proto;chats";
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
|
||||
service Chats {
|
||||
// Create a chat between two or more users, if a chat already exists for these users, the existing
|
||||
// chat will be returned
|
||||
rpc CreateChat(CreateChatRequest) returns (CreateChatResponse);
|
||||
// Create a message within a chat
|
||||
rpc CreateMessage(CreateMessageRequest) returns (CreateMessageResponse);
|
||||
rpc SendMessage(SendMessageRequest) returns (SendMessageResponse);
|
||||
// List the messages within a chat in reverse chronological order, using sent_before to
|
||||
// offset as older messages need to be loaded
|
||||
rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse);
|
||||
}
|
||||
|
||||
message Chat {
|
||||
// unique id of the chat
|
||||
string id = 1;
|
||||
// list of users in the chat
|
||||
repeated string user_ids = 2;
|
||||
google.protobuf.Timestamp created_at = 3;
|
||||
// unix nanosecond timestamp
|
||||
int64 created_at = 3;
|
||||
}
|
||||
|
||||
message Message {
|
||||
// unique id of the message
|
||||
string id = 1;
|
||||
// user id of the message
|
||||
string author_id = 2;
|
||||
// chat id the message belongs to
|
||||
string chat_id = 3;
|
||||
// text within the message
|
||||
string text = 4;
|
||||
google.protobuf.Timestamp sent_at = 5;
|
||||
// unix nanosecond timestamp
|
||||
int64 sent_at = 5;
|
||||
}
|
||||
|
||||
// Create a new chat between mulitple users
|
||||
message CreateChatRequest {
|
||||
repeated string user_ids = 1;
|
||||
// The chat ID
|
||||
string id = 1;
|
||||
// List of users in the chat
|
||||
repeated string user_ids = 2;
|
||||
}
|
||||
|
||||
message CreateChatResponse {
|
||||
Chat chat = 1;
|
||||
}
|
||||
|
||||
message CreateMessageRequest {
|
||||
// Send a message to a chat room
|
||||
message SendMessageRequest {
|
||||
string id = 1;
|
||||
string chat_id = 2;
|
||||
string author_id = 3;
|
||||
string text = 4;
|
||||
}
|
||||
|
||||
message CreateMessageResponse {
|
||||
message SendMessageResponse {
|
||||
Message message = 1;
|
||||
}
|
||||
|
||||
// List messages within a chat
|
||||
message ListMessagesRequest {
|
||||
// unique id of the chat
|
||||
string chat_id = 1;
|
||||
google.protobuf.Timestamp sent_before = 2;
|
||||
google.protobuf.Int32Value limit = 3;
|
||||
// limit the number of messages
|
||||
int64 limit = 2;
|
||||
// offset for the messages
|
||||
int64 offset = 3;
|
||||
// order "asc" or "desc" (defaults to reverse chronological)
|
||||
string order = 4;
|
||||
}
|
||||
|
||||
message ListMessagesResponse {
|
||||
|
||||
Reference in New Issue
Block a user