diff --git a/gen/chat/chat.ts b/gen/chat/chat.ts new file mode 100644 index 0000000..400c88f --- /dev/null +++ b/gen/chat/chat.ts @@ -0,0 +1,227 @@ +// Code generated by protoc-gen-ts_proto. DO NOT EDIT. +// versions: +// protoc-gen-ts_proto v2.11.6 +// protoc v4.25.9 +// source: chat/chat.proto + +/* eslint-disable */ +import type { Metadata } from "@grpc/grpc-js"; +import { GrpcMethod, GrpcStreamMethod } from "@nestjs/microservices"; +import { Observable } from "rxjs"; + +export const protobufPackage = "chat.v1"; + +export interface MessageDto { + id: string; + chatId: string; + senderId: string; + /** TEXT, VOICE, VIDEO_NOTE, STICKER */ + type: string; + content: string; + /** JSON string */ + metadata: string; + replyToId: string; + isEdited: boolean; + createdAt: string; +} + +export interface ChatDto { + id: string; + /** DIRECT, GROUP, CHANNEL */ + type: string; + title: string; + avatarUrl: string; + unreadCount: number; + /** Нужно для рендера списка чатов слева! */ + lastMessage: MessageDto | undefined; +} + +export interface CreateChatRequest { + /** ID того кто создает */ + creatorId: string; + /** GROUP, DIRECT, CHANNEL */ + type: string; + /** Имя (при type=GROUP|CHANNEL) */ + title: string; + /** Кого сразу добавить (собеседник в личке или юзеры в группе) */ + participantIds: string[]; +} + +export interface CreateChatResponse { + chat: ChatDto | undefined; +} + +export interface GetUserChatsRequest { + userId: string; + /** для пагинации (бесконечный скролл в левой панели) */ + offset: number; + limit: number; +} + +export interface GetUserChatsResponse { + chats: ChatDto[]; +} + +export interface JoinChatRequest { + userId: string; + /** либо join_hash */ + chatId: string; +} + +export interface JoinChatResponse { + success: boolean; +} + +export interface LeaveChatRequest { + userId: string; + chatId: string; +} + +export interface LeaveChatResponse { + success: boolean; +} + +export interface GetMessagesRequest { + userId: string; + chatId: string; + limit: number; + /** курсорная пагинация, как в Telegram */ + beforeMsgId: string; +} + +export interface GetMessagesResponse { + messages: MessageDto[]; +} + +export interface SendMessageRequest { + chatId: string; + senderId: string; + type: string; + content: string; + replyToId: string; +} + +export interface DeleteMessageRequest { + userId: string; + messageId: string; + /** "Удалить для всех" */ + forEveryone: boolean; +} + +export interface DeleteMessageResponse { + success: boolean; +} + +export interface MarkAsReadRequest { + userId: string; + chatId: string; + messageId: string; +} + +export interface MarkAsReadResponse { + success: boolean; +} + +export const CHAT_V1_PACKAGE_NAME = "chat.v1"; + +export interface ChatServiceClient { + /** Управление чатами */ + + createChat(request: CreateChatRequest, metadata?: Metadata): Observable; + + getUserChats(request: GetUserChatsRequest, metadata?: Metadata): Observable; + + joinChat(request: JoinChatRequest, metadata?: Metadata): Observable; + + leaveChat(request: LeaveChatRequest, metadata?: Metadata): Observable; + + /** Управление сообщениями (история) */ + + getMessages(request: GetMessagesRequest, metadata?: Metadata): Observable; + + /** вызывается либо из Gateway (для фото/аудио), либо напрямую */ + + sendMessage(request: SendMessageRequest, metadata?: Metadata): Observable; + + deleteMessage(request: DeleteMessageRequest, metadata?: Metadata): Observable; + + /** Статусы */ + + markAsRead(request: MarkAsReadRequest, metadata?: Metadata): Observable; +} + +export interface ChatServiceController { + /** Управление чатами */ + + createChat( + request: CreateChatRequest, + metadata?: Metadata, + ): Promise | Observable | CreateChatResponse; + + getUserChats( + request: GetUserChatsRequest, + metadata?: Metadata, + ): Promise | Observable | GetUserChatsResponse; + + joinChat( + request: JoinChatRequest, + metadata?: Metadata, + ): Promise | Observable | JoinChatResponse; + + leaveChat( + request: LeaveChatRequest, + metadata?: Metadata, + ): Promise | Observable | LeaveChatResponse; + + /** Управление сообщениями (история) */ + + getMessages( + request: GetMessagesRequest, + metadata?: Metadata, + ): Promise | Observable | GetMessagesResponse; + + /** вызывается либо из Gateway (для фото/аудио), либо напрямую */ + + sendMessage( + request: SendMessageRequest, + metadata?: Metadata, + ): Promise | Observable | MessageDto; + + deleteMessage( + request: DeleteMessageRequest, + metadata?: Metadata, + ): Promise | Observable | DeleteMessageResponse; + + /** Статусы */ + + markAsRead( + request: MarkAsReadRequest, + metadata?: Metadata, + ): Promise | Observable | MarkAsReadResponse; +} + +export function ChatServiceControllerMethods() { + return function (constructor: Function) { + const grpcMethods: string[] = [ + "createChat", + "getUserChats", + "joinChat", + "leaveChat", + "getMessages", + "sendMessage", + "deleteMessage", + "markAsRead", + ]; + for (const method of grpcMethods) { + const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); + GrpcMethod("ChatService", method)(constructor.prototype[method], method, descriptor); + } + const grpcStreamMethods: string[] = []; + for (const method of grpcStreamMethods) { + const descriptor: any = Reflect.getOwnPropertyDescriptor(constructor.prototype, method); + GrpcStreamMethod("ChatService", method)(constructor.prototype[method], method, descriptor); + } + }; +} + +export const CHAT_SERVICE_NAME = "ChatService"; diff --git a/gen/go/chat/chat.pb.go b/gen/go/chat/chat.pb.go new file mode 100644 index 0000000..3cdd0f7 --- /dev/null +++ b/gen/go/chat/chat.pb.go @@ -0,0 +1,1190 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.11 +// protoc v4.25.9 +// source: chat/chat.proto + +package pb + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type MessageDto struct { + state protoimpl.MessageState `protogen:"open.v1"` + 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"` + Type string `protobuf:"bytes,4,opt,name=type,proto3" json:"type,omitempty"` // TEXT, VOICE, VIDEO_NOTE, STICKER + Content string `protobuf:"bytes,5,opt,name=content,proto3" json:"content,omitempty"` + Metadata string `protobuf:"bytes,6,opt,name=metadata,proto3" json:"metadata,omitempty"` // JSON string + ReplyToId string `protobuf:"bytes,7,opt,name=reply_to_id,json=replyToId,proto3" json:"reply_to_id,omitempty"` + IsEdited bool `protobuf:"varint,8,opt,name=is_edited,json=isEdited,proto3" json:"is_edited,omitempty"` + CreatedAt string `protobuf:"bytes,9,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MessageDto) Reset() { + *x = MessageDto{} + mi := &file_chat_chat_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MessageDto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageDto) ProtoMessage() {} + +func (x *MessageDto) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageDto.ProtoReflect.Descriptor instead. +func (*MessageDto) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{0} +} + +func (x *MessageDto) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *MessageDto) GetChatId() string { + if x != nil { + return x.ChatId + } + return "" +} + +func (x *MessageDto) GetSenderId() string { + if x != nil { + return x.SenderId + } + return "" +} + +func (x *MessageDto) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *MessageDto) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *MessageDto) GetMetadata() string { + if x != nil { + return x.Metadata + } + return "" +} + +func (x *MessageDto) GetReplyToId() string { + if x != nil { + return x.ReplyToId + } + return "" +} + +func (x *MessageDto) GetIsEdited() bool { + if x != nil { + return x.IsEdited + } + return false +} + +func (x *MessageDto) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +type ChatDto struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // DIRECT, GROUP, CHANNEL + Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` + AvatarUrl string `protobuf:"bytes,4,opt,name=avatar_url,json=avatarUrl,proto3" json:"avatar_url,omitempty"` + UnreadCount int32 `protobuf:"varint,5,opt,name=unread_count,json=unreadCount,proto3" json:"unread_count,omitempty"` + LastMessage *MessageDto `protobuf:"bytes,6,opt,name=last_message,json=lastMessage,proto3" json:"last_message,omitempty"` // Нужно для рендера списка чатов слева! + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ChatDto) Reset() { + *x = ChatDto{} + mi := &file_chat_chat_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ChatDto) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChatDto) ProtoMessage() {} + +func (x *ChatDto) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChatDto.ProtoReflect.Descriptor instead. +func (*ChatDto) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{1} +} + +func (x *ChatDto) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *ChatDto) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *ChatDto) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *ChatDto) GetAvatarUrl() string { + if x != nil { + return x.AvatarUrl + } + return "" +} + +func (x *ChatDto) GetUnreadCount() int32 { + if x != nil { + return x.UnreadCount + } + return 0 +} + +func (x *ChatDto) GetLastMessage() *MessageDto { + if x != nil { + return x.LastMessage + } + return nil +} + +type CreateChatRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + CreatorId string `protobuf:"bytes,1,opt,name=creator_id,json=creatorId,proto3" json:"creator_id,omitempty"` // ID того кто создает + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` // GROUP, DIRECT, CHANNEL + Title string `protobuf:"bytes,3,opt,name=title,proto3" json:"title,omitempty"` // Имя (при type=GROUP|CHANNEL) + ParticipantIds []string `protobuf:"bytes,4,rep,name=participant_ids,json=participantIds,proto3" json:"participant_ids,omitempty"` // Кого сразу добавить (собеседник в личке или юзеры в группе) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateChatRequest) Reset() { + *x = CreateChatRequest{} + mi := &file_chat_chat_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateChatRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateChatRequest) ProtoMessage() {} + +func (x *CreateChatRequest) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateChatRequest.ProtoReflect.Descriptor instead. +func (*CreateChatRequest) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateChatRequest) GetCreatorId() string { + if x != nil { + return x.CreatorId + } + return "" +} + +func (x *CreateChatRequest) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *CreateChatRequest) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *CreateChatRequest) GetParticipantIds() []string { + if x != nil { + return x.ParticipantIds + } + return nil +} + +type CreateChatResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Chat *ChatDto `protobuf:"bytes,1,opt,name=chat,proto3" json:"chat,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateChatResponse) Reset() { + *x = CreateChatResponse{} + mi := &file_chat_chat_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateChatResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateChatResponse) ProtoMessage() {} + +func (x *CreateChatResponse) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateChatResponse.ProtoReflect.Descriptor instead. +func (*CreateChatResponse) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{3} +} + +func (x *CreateChatResponse) GetChat() *ChatDto { + if x != nil { + return x.Chat + } + return nil +} + +type GetUserChatsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + Offset int32 `protobuf:"varint,2,opt,name=offset,proto3" json:"offset,omitempty"` // для пагинации (бесконечный скролл в левой панели) + Limit int32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserChatsRequest) Reset() { + *x = GetUserChatsRequest{} + mi := &file_chat_chat_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserChatsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserChatsRequest) ProtoMessage() {} + +func (x *GetUserChatsRequest) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserChatsRequest.ProtoReflect.Descriptor instead. +func (*GetUserChatsRequest) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{4} +} + +func (x *GetUserChatsRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *GetUserChatsRequest) GetOffset() int32 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *GetUserChatsRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +type GetUserChatsResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Chats []*ChatDto `protobuf:"bytes,1,rep,name=chats,proto3" json:"chats,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetUserChatsResponse) Reset() { + *x = GetUserChatsResponse{} + mi := &file_chat_chat_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetUserChatsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetUserChatsResponse) ProtoMessage() {} + +func (x *GetUserChatsResponse) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetUserChatsResponse.ProtoReflect.Descriptor instead. +func (*GetUserChatsResponse) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{5} +} + +func (x *GetUserChatsResponse) GetChats() []*ChatDto { + if x != nil { + return x.Chats + } + return nil +} + +type JoinChatRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + ChatId string `protobuf:"bytes,2,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"` // либо join_hash + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *JoinChatRequest) Reset() { + *x = JoinChatRequest{} + mi := &file_chat_chat_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *JoinChatRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinChatRequest) ProtoMessage() {} + +func (x *JoinChatRequest) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JoinChatRequest.ProtoReflect.Descriptor instead. +func (*JoinChatRequest) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{6} +} + +func (x *JoinChatRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *JoinChatRequest) GetChatId() string { + if x != nil { + return x.ChatId + } + return "" +} + +type JoinChatResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *JoinChatResponse) Reset() { + *x = JoinChatResponse{} + mi := &file_chat_chat_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *JoinChatResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*JoinChatResponse) ProtoMessage() {} + +func (x *JoinChatResponse) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use JoinChatResponse.ProtoReflect.Descriptor instead. +func (*JoinChatResponse) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{7} +} + +func (x *JoinChatResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +type LeaveChatRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + ChatId string `protobuf:"bytes,2,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaveChatRequest) Reset() { + *x = LeaveChatRequest{} + mi := &file_chat_chat_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaveChatRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaveChatRequest) ProtoMessage() {} + +func (x *LeaveChatRequest) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LeaveChatRequest.ProtoReflect.Descriptor instead. +func (*LeaveChatRequest) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{8} +} + +func (x *LeaveChatRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *LeaveChatRequest) GetChatId() string { + if x != nil { + return x.ChatId + } + return "" +} + +type LeaveChatResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LeaveChatResponse) Reset() { + *x = LeaveChatResponse{} + mi := &file_chat_chat_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LeaveChatResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LeaveChatResponse) ProtoMessage() {} + +func (x *LeaveChatResponse) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LeaveChatResponse.ProtoReflect.Descriptor instead. +func (*LeaveChatResponse) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{9} +} + +func (x *LeaveChatResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +type GetMessagesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + ChatId string `protobuf:"bytes,2,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"` + Limit int32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + BeforeMsgId string `protobuf:"bytes,4,opt,name=before_msg_id,json=beforeMsgId,proto3" json:"before_msg_id,omitempty"` // курсорная пагинация, как в Telegram + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMessagesRequest) Reset() { + *x = GetMessagesRequest{} + mi := &file_chat_chat_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMessagesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMessagesRequest) ProtoMessage() {} + +func (x *GetMessagesRequest) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMessagesRequest.ProtoReflect.Descriptor instead. +func (*GetMessagesRequest) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{10} +} + +func (x *GetMessagesRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *GetMessagesRequest) GetChatId() string { + if x != nil { + return x.ChatId + } + return "" +} + +func (x *GetMessagesRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *GetMessagesRequest) GetBeforeMsgId() string { + if x != nil { + return x.BeforeMsgId + } + return "" +} + +type GetMessagesResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Messages []*MessageDto `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMessagesResponse) Reset() { + *x = GetMessagesResponse{} + mi := &file_chat_chat_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMessagesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMessagesResponse) ProtoMessage() {} + +func (x *GetMessagesResponse) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMessagesResponse.ProtoReflect.Descriptor instead. +func (*GetMessagesResponse) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{11} +} + +func (x *GetMessagesResponse) GetMessages() []*MessageDto { + if x != nil { + return x.Messages + } + return nil +} + +type SendMessageRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ChatId string `protobuf:"bytes,1,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"` + SenderId string `protobuf:"bytes,2,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"` + Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"` + Content string `protobuf:"bytes,4,opt,name=content,proto3" json:"content,omitempty"` + ReplyToId string `protobuf:"bytes,5,opt,name=reply_to_id,json=replyToId,proto3" json:"reply_to_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SendMessageRequest) Reset() { + *x = SendMessageRequest{} + mi := &file_chat_chat_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SendMessageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SendMessageRequest) ProtoMessage() {} + +func (x *SendMessageRequest) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SendMessageRequest.ProtoReflect.Descriptor instead. +func (*SendMessageRequest) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{12} +} + +func (x *SendMessageRequest) GetChatId() string { + if x != nil { + return x.ChatId + } + return "" +} + +func (x *SendMessageRequest) GetSenderId() string { + if x != nil { + return x.SenderId + } + return "" +} + +func (x *SendMessageRequest) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *SendMessageRequest) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *SendMessageRequest) GetReplyToId() string { + if x != nil { + return x.ReplyToId + } + return "" +} + +type DeleteMessageRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + MessageId string `protobuf:"bytes,2,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` + ForEveryone bool `protobuf:"varint,3,opt,name=for_everyone,json=forEveryone,proto3" json:"for_everyone,omitempty"` // "Удалить для всех" + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteMessageRequest) Reset() { + *x = DeleteMessageRequest{} + mi := &file_chat_chat_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteMessageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteMessageRequest) ProtoMessage() {} + +func (x *DeleteMessageRequest) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteMessageRequest.ProtoReflect.Descriptor instead. +func (*DeleteMessageRequest) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{13} +} + +func (x *DeleteMessageRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *DeleteMessageRequest) GetMessageId() string { + if x != nil { + return x.MessageId + } + return "" +} + +func (x *DeleteMessageRequest) GetForEveryone() bool { + if x != nil { + return x.ForEveryone + } + return false +} + +type DeleteMessageResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DeleteMessageResponse) Reset() { + *x = DeleteMessageResponse{} + mi := &file_chat_chat_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DeleteMessageResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteMessageResponse) ProtoMessage() {} + +func (x *DeleteMessageResponse) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteMessageResponse.ProtoReflect.Descriptor instead. +func (*DeleteMessageResponse) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{14} +} + +func (x *DeleteMessageResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +type MarkAsReadRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` + ChatId string `protobuf:"bytes,2,opt,name=chat_id,json=chatId,proto3" json:"chat_id,omitempty"` + MessageId string `protobuf:"bytes,3,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkAsReadRequest) Reset() { + *x = MarkAsReadRequest{} + mi := &file_chat_chat_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkAsReadRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkAsReadRequest) ProtoMessage() {} + +func (x *MarkAsReadRequest) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MarkAsReadRequest.ProtoReflect.Descriptor instead. +func (*MarkAsReadRequest) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{15} +} + +func (x *MarkAsReadRequest) GetUserId() string { + if x != nil { + return x.UserId + } + return "" +} + +func (x *MarkAsReadRequest) GetChatId() string { + if x != nil { + return x.ChatId + } + return "" +} + +func (x *MarkAsReadRequest) GetMessageId() string { + if x != nil { + return x.MessageId + } + return "" +} + +type MarkAsReadResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MarkAsReadResponse) Reset() { + *x = MarkAsReadResponse{} + mi := &file_chat_chat_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MarkAsReadResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarkAsReadResponse) ProtoMessage() {} + +func (x *MarkAsReadResponse) ProtoReflect() protoreflect.Message { + mi := &file_chat_chat_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MarkAsReadResponse.ProtoReflect.Descriptor instead. +func (*MarkAsReadResponse) Descriptor() ([]byte, []int) { + return file_chat_chat_proto_rawDescGZIP(), []int{16} +} + +func (x *MarkAsReadResponse) GetSuccess() bool { + if x != nil { + return x.Success + } + return false +} + +var File_chat_chat_proto protoreflect.FileDescriptor + +const file_chat_chat_proto_rawDesc = "" + + "\n" + + "\x0fchat/chat.proto\x12\achat.v1\"\xf8\x01\n" + + "\n" + + "MessageDto\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x17\n" + + "\achat_id\x18\x02 \x01(\tR\x06chatId\x12\x1b\n" + + "\tsender_id\x18\x03 \x01(\tR\bsenderId\x12\x12\n" + + "\x04type\x18\x04 \x01(\tR\x04type\x12\x18\n" + + "\acontent\x18\x05 \x01(\tR\acontent\x12\x1a\n" + + "\bmetadata\x18\x06 \x01(\tR\bmetadata\x12\x1e\n" + + "\vreply_to_id\x18\a \x01(\tR\treplyToId\x12\x1b\n" + + "\tis_edited\x18\b \x01(\bR\bisEdited\x12\x1d\n" + + "\n" + + "created_at\x18\t \x01(\tR\tcreatedAt\"\xbd\x01\n" + + "\aChatDto\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12\x12\n" + + "\x04type\x18\x02 \x01(\tR\x04type\x12\x14\n" + + "\x05title\x18\x03 \x01(\tR\x05title\x12\x1d\n" + + "\n" + + "avatar_url\x18\x04 \x01(\tR\tavatarUrl\x12!\n" + + "\funread_count\x18\x05 \x01(\x05R\vunreadCount\x126\n" + + "\flast_message\x18\x06 \x01(\v2\x13.chat.v1.MessageDtoR\vlastMessage\"\x85\x01\n" + + "\x11CreateChatRequest\x12\x1d\n" + + "\n" + + "creator_id\x18\x01 \x01(\tR\tcreatorId\x12\x12\n" + + "\x04type\x18\x02 \x01(\tR\x04type\x12\x14\n" + + "\x05title\x18\x03 \x01(\tR\x05title\x12'\n" + + "\x0fparticipant_ids\x18\x04 \x03(\tR\x0eparticipantIds\":\n" + + "\x12CreateChatResponse\x12$\n" + + "\x04chat\x18\x01 \x01(\v2\x10.chat.v1.ChatDtoR\x04chat\"\\\n" + + "\x13GetUserChatsRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x16\n" + + "\x06offset\x18\x02 \x01(\x05R\x06offset\x12\x14\n" + + "\x05limit\x18\x03 \x01(\x05R\x05limit\">\n" + + "\x14GetUserChatsResponse\x12&\n" + + "\x05chats\x18\x01 \x03(\v2\x10.chat.v1.ChatDtoR\x05chats\"C\n" + + "\x0fJoinChatRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x17\n" + + "\achat_id\x18\x02 \x01(\tR\x06chatId\",\n" + + "\x10JoinChatResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\"D\n" + + "\x10LeaveChatRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x17\n" + + "\achat_id\x18\x02 \x01(\tR\x06chatId\"-\n" + + "\x11LeaveChatResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\"\x80\x01\n" + + "\x12GetMessagesRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x17\n" + + "\achat_id\x18\x02 \x01(\tR\x06chatId\x12\x14\n" + + "\x05limit\x18\x03 \x01(\x05R\x05limit\x12\"\n" + + "\rbefore_msg_id\x18\x04 \x01(\tR\vbeforeMsgId\"F\n" + + "\x13GetMessagesResponse\x12/\n" + + "\bmessages\x18\x01 \x03(\v2\x13.chat.v1.MessageDtoR\bmessages\"\x98\x01\n" + + "\x12SendMessageRequest\x12\x17\n" + + "\achat_id\x18\x01 \x01(\tR\x06chatId\x12\x1b\n" + + "\tsender_id\x18\x02 \x01(\tR\bsenderId\x12\x12\n" + + "\x04type\x18\x03 \x01(\tR\x04type\x12\x18\n" + + "\acontent\x18\x04 \x01(\tR\acontent\x12\x1e\n" + + "\vreply_to_id\x18\x05 \x01(\tR\treplyToId\"q\n" + + "\x14DeleteMessageRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x1d\n" + + "\n" + + "message_id\x18\x02 \x01(\tR\tmessageId\x12!\n" + + "\ffor_everyone\x18\x03 \x01(\bR\vforEveryone\"1\n" + + "\x15DeleteMessageResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess\"d\n" + + "\x11MarkAsReadRequest\x12\x17\n" + + "\auser_id\x18\x01 \x01(\tR\x06userId\x12\x17\n" + + "\achat_id\x18\x02 \x01(\tR\x06chatId\x12\x1d\n" + + "\n" + + "message_id\x18\x03 \x01(\tR\tmessageId\".\n" + + "\x12MarkAsReadResponse\x12\x18\n" + + "\asuccess\x18\x01 \x01(\bR\asuccess2\xc8\x04\n" + + "\vChatService\x12E\n" + + "\n" + + "CreateChat\x12\x1a.chat.v1.CreateChatRequest\x1a\x1b.chat.v1.CreateChatResponse\x12K\n" + + "\fGetUserChats\x12\x1c.chat.v1.GetUserChatsRequest\x1a\x1d.chat.v1.GetUserChatsResponse\x12?\n" + + "\bJoinChat\x12\x18.chat.v1.JoinChatRequest\x1a\x19.chat.v1.JoinChatResponse\x12B\n" + + "\tLeaveChat\x12\x19.chat.v1.LeaveChatRequest\x1a\x1a.chat.v1.LeaveChatResponse\x12H\n" + + "\vGetMessages\x12\x1b.chat.v1.GetMessagesRequest\x1a\x1c.chat.v1.GetMessagesResponse\x12?\n" + + "\vSendMessage\x12\x1b.chat.v1.SendMessageRequest\x1a\x13.chat.v1.MessageDto\x12N\n" + + "\rDeleteMessage\x12\x1d.chat.v1.DeleteMessageRequest\x1a\x1e.chat.v1.DeleteMessageResponse\x12E\n" + + "\n" + + "MarkAsRead\x12\x1a.chat.v1.MarkAsReadRequest\x1a\x1b.chat.v1.MarkAsReadResponseB*Z(git.lendry.ru/lendry-erp/proto.git/go;pbb\x06proto3" + +var ( + file_chat_chat_proto_rawDescOnce sync.Once + file_chat_chat_proto_rawDescData []byte +) + +func file_chat_chat_proto_rawDescGZIP() []byte { + file_chat_chat_proto_rawDescOnce.Do(func() { + file_chat_chat_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_chat_chat_proto_rawDesc), len(file_chat_chat_proto_rawDesc))) + }) + return file_chat_chat_proto_rawDescData +} + +var file_chat_chat_proto_msgTypes = make([]protoimpl.MessageInfo, 17) +var file_chat_chat_proto_goTypes = []any{ + (*MessageDto)(nil), // 0: chat.v1.MessageDto + (*ChatDto)(nil), // 1: chat.v1.ChatDto + (*CreateChatRequest)(nil), // 2: chat.v1.CreateChatRequest + (*CreateChatResponse)(nil), // 3: chat.v1.CreateChatResponse + (*GetUserChatsRequest)(nil), // 4: chat.v1.GetUserChatsRequest + (*GetUserChatsResponse)(nil), // 5: chat.v1.GetUserChatsResponse + (*JoinChatRequest)(nil), // 6: chat.v1.JoinChatRequest + (*JoinChatResponse)(nil), // 7: chat.v1.JoinChatResponse + (*LeaveChatRequest)(nil), // 8: chat.v1.LeaveChatRequest + (*LeaveChatResponse)(nil), // 9: chat.v1.LeaveChatResponse + (*GetMessagesRequest)(nil), // 10: chat.v1.GetMessagesRequest + (*GetMessagesResponse)(nil), // 11: chat.v1.GetMessagesResponse + (*SendMessageRequest)(nil), // 12: chat.v1.SendMessageRequest + (*DeleteMessageRequest)(nil), // 13: chat.v1.DeleteMessageRequest + (*DeleteMessageResponse)(nil), // 14: chat.v1.DeleteMessageResponse + (*MarkAsReadRequest)(nil), // 15: chat.v1.MarkAsReadRequest + (*MarkAsReadResponse)(nil), // 16: chat.v1.MarkAsReadResponse +} +var file_chat_chat_proto_depIdxs = []int32{ + 0, // 0: chat.v1.ChatDto.last_message:type_name -> chat.v1.MessageDto + 1, // 1: chat.v1.CreateChatResponse.chat:type_name -> chat.v1.ChatDto + 1, // 2: chat.v1.GetUserChatsResponse.chats:type_name -> chat.v1.ChatDto + 0, // 3: chat.v1.GetMessagesResponse.messages:type_name -> chat.v1.MessageDto + 2, // 4: chat.v1.ChatService.CreateChat:input_type -> chat.v1.CreateChatRequest + 4, // 5: chat.v1.ChatService.GetUserChats:input_type -> chat.v1.GetUserChatsRequest + 6, // 6: chat.v1.ChatService.JoinChat:input_type -> chat.v1.JoinChatRequest + 8, // 7: chat.v1.ChatService.LeaveChat:input_type -> chat.v1.LeaveChatRequest + 10, // 8: chat.v1.ChatService.GetMessages:input_type -> chat.v1.GetMessagesRequest + 12, // 9: chat.v1.ChatService.SendMessage:input_type -> chat.v1.SendMessageRequest + 13, // 10: chat.v1.ChatService.DeleteMessage:input_type -> chat.v1.DeleteMessageRequest + 15, // 11: chat.v1.ChatService.MarkAsRead:input_type -> chat.v1.MarkAsReadRequest + 3, // 12: chat.v1.ChatService.CreateChat:output_type -> chat.v1.CreateChatResponse + 5, // 13: chat.v1.ChatService.GetUserChats:output_type -> chat.v1.GetUserChatsResponse + 7, // 14: chat.v1.ChatService.JoinChat:output_type -> chat.v1.JoinChatResponse + 9, // 15: chat.v1.ChatService.LeaveChat:output_type -> chat.v1.LeaveChatResponse + 11, // 16: chat.v1.ChatService.GetMessages:output_type -> chat.v1.GetMessagesResponse + 0, // 17: chat.v1.ChatService.SendMessage:output_type -> chat.v1.MessageDto + 14, // 18: chat.v1.ChatService.DeleteMessage:output_type -> chat.v1.DeleteMessageResponse + 16, // 19: chat.v1.ChatService.MarkAsRead:output_type -> chat.v1.MarkAsReadResponse + 12, // [12:20] is the sub-list for method output_type + 4, // [4:12] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_chat_chat_proto_init() } +func file_chat_chat_proto_init() { + if File_chat_chat_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_chat_chat_proto_rawDesc), len(file_chat_chat_proto_rawDesc)), + NumEnums: 0, + NumMessages: 17, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_chat_chat_proto_goTypes, + DependencyIndexes: file_chat_chat_proto_depIdxs, + MessageInfos: file_chat_chat_proto_msgTypes, + }.Build() + File_chat_chat_proto = out.File + file_chat_chat_proto_goTypes = nil + file_chat_chat_proto_depIdxs = nil +} diff --git a/gen/go/chat/chat_grpc.pb.go b/gen/go/chat/chat_grpc.pb.go new file mode 100644 index 0000000..48e6c07 --- /dev/null +++ b/gen/go/chat/chat_grpc.pb.go @@ -0,0 +1,393 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.6.1 +// - protoc v4.25.9 +// source: chat/chat.proto + +package pb + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + ChatService_CreateChat_FullMethodName = "/chat.v1.ChatService/CreateChat" + ChatService_GetUserChats_FullMethodName = "/chat.v1.ChatService/GetUserChats" + ChatService_JoinChat_FullMethodName = "/chat.v1.ChatService/JoinChat" + ChatService_LeaveChat_FullMethodName = "/chat.v1.ChatService/LeaveChat" + ChatService_GetMessages_FullMethodName = "/chat.v1.ChatService/GetMessages" + ChatService_SendMessage_FullMethodName = "/chat.v1.ChatService/SendMessage" + ChatService_DeleteMessage_FullMethodName = "/chat.v1.ChatService/DeleteMessage" + ChatService_MarkAsRead_FullMethodName = "/chat.v1.ChatService/MarkAsRead" +) + +// ChatServiceClient is the client API for ChatService 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 ChatServiceClient interface { + // Управление чатами + CreateChat(ctx context.Context, in *CreateChatRequest, opts ...grpc.CallOption) (*CreateChatResponse, error) + GetUserChats(ctx context.Context, in *GetUserChatsRequest, opts ...grpc.CallOption) (*GetUserChatsResponse, error) + JoinChat(ctx context.Context, in *JoinChatRequest, opts ...grpc.CallOption) (*JoinChatResponse, error) + LeaveChat(ctx context.Context, in *LeaveChatRequest, opts ...grpc.CallOption) (*LeaveChatResponse, error) + // Управление сообщениями (история) + GetMessages(ctx context.Context, in *GetMessagesRequest, opts ...grpc.CallOption) (*GetMessagesResponse, error) + SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*MessageDto, error) + DeleteMessage(ctx context.Context, in *DeleteMessageRequest, opts ...grpc.CallOption) (*DeleteMessageResponse, error) + // Статусы + MarkAsRead(ctx context.Context, in *MarkAsReadRequest, opts ...grpc.CallOption) (*MarkAsReadResponse, error) +} + +type chatServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewChatServiceClient(cc grpc.ClientConnInterface) ChatServiceClient { + return &chatServiceClient{cc} +} + +func (c *chatServiceClient) CreateChat(ctx context.Context, in *CreateChatRequest, opts ...grpc.CallOption) (*CreateChatResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(CreateChatResponse) + err := c.cc.Invoke(ctx, ChatService_CreateChat_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *chatServiceClient) GetUserChats(ctx context.Context, in *GetUserChatsRequest, opts ...grpc.CallOption) (*GetUserChatsResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetUserChatsResponse) + err := c.cc.Invoke(ctx, ChatService_GetUserChats_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *chatServiceClient) JoinChat(ctx context.Context, in *JoinChatRequest, opts ...grpc.CallOption) (*JoinChatResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(JoinChatResponse) + err := c.cc.Invoke(ctx, ChatService_JoinChat_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *chatServiceClient) LeaveChat(ctx context.Context, in *LeaveChatRequest, opts ...grpc.CallOption) (*LeaveChatResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(LeaveChatResponse) + err := c.cc.Invoke(ctx, ChatService_LeaveChat_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *chatServiceClient) GetMessages(ctx context.Context, in *GetMessagesRequest, opts ...grpc.CallOption) (*GetMessagesResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetMessagesResponse) + err := c.cc.Invoke(ctx, ChatService_GetMessages_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *chatServiceClient) SendMessage(ctx context.Context, in *SendMessageRequest, opts ...grpc.CallOption) (*MessageDto, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MessageDto) + err := c.cc.Invoke(ctx, ChatService_SendMessage_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *chatServiceClient) DeleteMessage(ctx context.Context, in *DeleteMessageRequest, opts ...grpc.CallOption) (*DeleteMessageResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(DeleteMessageResponse) + err := c.cc.Invoke(ctx, ChatService_DeleteMessage_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *chatServiceClient) MarkAsRead(ctx context.Context, in *MarkAsReadRequest, opts ...grpc.CallOption) (*MarkAsReadResponse, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(MarkAsReadResponse) + err := c.cc.Invoke(ctx, ChatService_MarkAsRead_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// ChatServiceServer is the server API for ChatService service. +// All implementations must embed UnimplementedChatServiceServer +// for forward compatibility. +type ChatServiceServer interface { + // Управление чатами + CreateChat(context.Context, *CreateChatRequest) (*CreateChatResponse, error) + GetUserChats(context.Context, *GetUserChatsRequest) (*GetUserChatsResponse, error) + JoinChat(context.Context, *JoinChatRequest) (*JoinChatResponse, error) + LeaveChat(context.Context, *LeaveChatRequest) (*LeaveChatResponse, error) + // Управление сообщениями (история) + GetMessages(context.Context, *GetMessagesRequest) (*GetMessagesResponse, error) + SendMessage(context.Context, *SendMessageRequest) (*MessageDto, error) + DeleteMessage(context.Context, *DeleteMessageRequest) (*DeleteMessageResponse, error) + // Статусы + MarkAsRead(context.Context, *MarkAsReadRequest) (*MarkAsReadResponse, error) + mustEmbedUnimplementedChatServiceServer() +} + +// UnimplementedChatServiceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedChatServiceServer struct{} + +func (UnimplementedChatServiceServer) CreateChat(context.Context, *CreateChatRequest) (*CreateChatResponse, error) { + return nil, status.Error(codes.Unimplemented, "method CreateChat not implemented") +} +func (UnimplementedChatServiceServer) GetUserChats(context.Context, *GetUserChatsRequest) (*GetUserChatsResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetUserChats not implemented") +} +func (UnimplementedChatServiceServer) JoinChat(context.Context, *JoinChatRequest) (*JoinChatResponse, error) { + return nil, status.Error(codes.Unimplemented, "method JoinChat not implemented") +} +func (UnimplementedChatServiceServer) LeaveChat(context.Context, *LeaveChatRequest) (*LeaveChatResponse, error) { + return nil, status.Error(codes.Unimplemented, "method LeaveChat not implemented") +} +func (UnimplementedChatServiceServer) GetMessages(context.Context, *GetMessagesRequest) (*GetMessagesResponse, error) { + return nil, status.Error(codes.Unimplemented, "method GetMessages not implemented") +} +func (UnimplementedChatServiceServer) SendMessage(context.Context, *SendMessageRequest) (*MessageDto, error) { + return nil, status.Error(codes.Unimplemented, "method SendMessage not implemented") +} +func (UnimplementedChatServiceServer) DeleteMessage(context.Context, *DeleteMessageRequest) (*DeleteMessageResponse, error) { + return nil, status.Error(codes.Unimplemented, "method DeleteMessage not implemented") +} +func (UnimplementedChatServiceServer) MarkAsRead(context.Context, *MarkAsReadRequest) (*MarkAsReadResponse, error) { + return nil, status.Error(codes.Unimplemented, "method MarkAsRead not implemented") +} +func (UnimplementedChatServiceServer) mustEmbedUnimplementedChatServiceServer() {} +func (UnimplementedChatServiceServer) testEmbeddedByValue() {} + +// UnsafeChatServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to ChatServiceServer will +// result in compilation errors. +type UnsafeChatServiceServer interface { + mustEmbedUnimplementedChatServiceServer() +} + +func RegisterChatServiceServer(s grpc.ServiceRegistrar, srv ChatServiceServer) { + // If the following call panics, it indicates UnimplementedChatServiceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&ChatService_ServiceDesc, srv) +} + +func _ChatService_CreateChat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateChatRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChatServiceServer).CreateChat(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ChatService_CreateChat_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChatServiceServer).CreateChat(ctx, req.(*CreateChatRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ChatService_GetUserChats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetUserChatsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChatServiceServer).GetUserChats(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ChatService_GetUserChats_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChatServiceServer).GetUserChats(ctx, req.(*GetUserChatsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ChatService_JoinChat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(JoinChatRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChatServiceServer).JoinChat(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ChatService_JoinChat_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChatServiceServer).JoinChat(ctx, req.(*JoinChatRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ChatService_LeaveChat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(LeaveChatRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChatServiceServer).LeaveChat(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ChatService_LeaveChat_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChatServiceServer).LeaveChat(ctx, req.(*LeaveChatRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ChatService_GetMessages_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMessagesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChatServiceServer).GetMessages(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ChatService_GetMessages_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChatServiceServer).GetMessages(ctx, req.(*GetMessagesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ChatService_SendMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SendMessageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChatServiceServer).SendMessage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ChatService_SendMessage_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChatServiceServer).SendMessage(ctx, req.(*SendMessageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ChatService_DeleteMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteMessageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChatServiceServer).DeleteMessage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ChatService_DeleteMessage_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChatServiceServer).DeleteMessage(ctx, req.(*DeleteMessageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _ChatService_MarkAsRead_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MarkAsReadRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChatServiceServer).MarkAsRead(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ChatService_MarkAsRead_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChatServiceServer).MarkAsRead(ctx, req.(*MarkAsReadRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// ChatService_ServiceDesc is the grpc.ServiceDesc for ChatService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var ChatService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "chat.v1.ChatService", + HandlerType: (*ChatServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateChat", + Handler: _ChatService_CreateChat_Handler, + }, + { + MethodName: "GetUserChats", + Handler: _ChatService_GetUserChats_Handler, + }, + { + MethodName: "JoinChat", + Handler: _ChatService_JoinChat_Handler, + }, + { + MethodName: "LeaveChat", + Handler: _ChatService_LeaveChat_Handler, + }, + { + MethodName: "GetMessages", + Handler: _ChatService_GetMessages_Handler, + }, + { + MethodName: "SendMessage", + Handler: _ChatService_SendMessage_Handler, + }, + { + MethodName: "DeleteMessage", + Handler: _ChatService_DeleteMessage_Handler, + }, + { + MethodName: "MarkAsRead", + Handler: _ChatService_MarkAsRead_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "chat/chat.proto", +}