225 lines
5.2 KiB
Protocol Buffer
225 lines
5.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package chat;
|
|
|
|
service ChatService {
|
|
rpc ListRooms (ListRoomsRequest) returns (ListRoomsResponse);
|
|
rpc CreateRoom (CreateRoomRequest) returns (ChatRoomResponse);
|
|
rpc CreateE2ERoom (CreateE2ERoomRequest) returns (ChatRoomResponse);
|
|
rpc UpdateRoomSettings (UpdateRoomSettingsRequest) returns (ChatRoomResponse);
|
|
rpc AddRoomMember (AddRoomMemberRequest) returns (ChatRoomResponse);
|
|
rpc RemoveRoomMember (RemoveRoomMemberRequest) returns (ChatRoomResponse);
|
|
rpc ListMessages (ListMessagesRequest) returns (ListMessagesResponse);
|
|
rpc SendMessage (SendMessageRequest) returns (ChatMessageResponse);
|
|
rpc EditMessage (EditMessageRequest) returns (ChatMessageResponse);
|
|
rpc DeleteMessage (DeleteMessageRequest) returns (ChatMessageResponse);
|
|
rpc MarkRoomRead (MarkRoomReadRequest) returns (MutationResponse);
|
|
rpc VotePoll (VotePollRequest) returns (ChatMessageResponse);
|
|
rpc SetRoomNotificationsMuted (SetRoomNotificationsMutedRequest) returns (MutationResponse);
|
|
rpc DeleteRoom (DeleteRoomRequest) returns (MutationResponse);
|
|
rpc ToggleMessageReaction (ToggleMessageReactionRequest) returns (ChatMessageResponse);
|
|
rpc ForwardMessages (ForwardMessagesRequest) returns (ForwardMessagesResponse);
|
|
rpc ReportTyping (ReportTypingRequest) returns (MutationResponse);
|
|
}
|
|
|
|
message ListRoomsRequest {
|
|
string userId = 1;
|
|
string groupId = 2;
|
|
}
|
|
|
|
message CreateRoomRequest {
|
|
string userId = 1;
|
|
string groupId = 2;
|
|
string name = 3;
|
|
repeated string memberUserIds = 4;
|
|
}
|
|
|
|
message CreateE2ERoomRequest {
|
|
string userId = 1;
|
|
string groupId = 2;
|
|
string peerUserId = 3;
|
|
}
|
|
|
|
message UpdateRoomSettingsRequest {
|
|
string userId = 1;
|
|
string roomId = 2;
|
|
optional string name = 3;
|
|
optional bool notificationsMuted = 4;
|
|
}
|
|
|
|
message AddRoomMemberRequest {
|
|
string userId = 1;
|
|
string roomId = 2;
|
|
string memberUserId = 3;
|
|
}
|
|
|
|
message RemoveRoomMemberRequest {
|
|
string userId = 1;
|
|
string roomId = 2;
|
|
string memberUserId = 3;
|
|
}
|
|
|
|
message ListMessagesRequest {
|
|
string userId = 1;
|
|
string roomId = 2;
|
|
optional string beforeMessageId = 3;
|
|
int32 limit = 4;
|
|
}
|
|
|
|
message SendMessageRequest {
|
|
string userId = 1;
|
|
string roomId = 2;
|
|
string type = 3;
|
|
optional string content = 4;
|
|
optional string replyToId = 5;
|
|
optional string storageKey = 6;
|
|
optional string mimeType = 7;
|
|
optional string metadataJson = 8;
|
|
optional PollPayload poll = 9;
|
|
optional bool isEncrypted = 10;
|
|
}
|
|
|
|
message EditMessageRequest {
|
|
string userId = 1;
|
|
string messageId = 2;
|
|
string content = 3;
|
|
}
|
|
|
|
message DeleteMessageRequest {
|
|
string userId = 1;
|
|
string messageId = 2;
|
|
}
|
|
|
|
message MarkRoomReadRequest {
|
|
string userId = 1;
|
|
string roomId = 2;
|
|
optional string lastMessageId = 3;
|
|
}
|
|
|
|
message PollPayload {
|
|
string question = 1;
|
|
repeated string options = 2;
|
|
bool allowsMultiple = 3;
|
|
bool isAnonymous = 4;
|
|
}
|
|
|
|
message VotePollRequest {
|
|
string userId = 1;
|
|
string messageId = 2;
|
|
repeated string optionIds = 3;
|
|
}
|
|
|
|
message SetRoomNotificationsMutedRequest {
|
|
string userId = 1;
|
|
string roomId = 2;
|
|
bool muted = 3;
|
|
}
|
|
|
|
message DeleteRoomRequest {
|
|
string userId = 1;
|
|
string roomId = 2;
|
|
}
|
|
|
|
message ToggleMessageReactionRequest {
|
|
string userId = 1;
|
|
string messageId = 2;
|
|
string emoji = 3;
|
|
}
|
|
|
|
message ForwardMessagesRequest {
|
|
string userId = 1;
|
|
string targetRoomId = 2;
|
|
repeated string messageIds = 3;
|
|
}
|
|
|
|
message ReportTypingRequest {
|
|
string userId = 1;
|
|
string roomId = 2;
|
|
}
|
|
|
|
message ForwardMessagesResponse {
|
|
repeated ChatMessageResponse messages = 1;
|
|
}
|
|
|
|
message ChatRoomMemberResponse {
|
|
string id = 1;
|
|
string userId = 2;
|
|
string displayName = 3;
|
|
bool hasAvatar = 4;
|
|
bool notificationsMuted = 5;
|
|
string familyRole = 6;
|
|
bool isChatCreator = 7;
|
|
}
|
|
|
|
message ChatRoomResponse {
|
|
string id = 1;
|
|
string groupId = 2;
|
|
string type = 3;
|
|
string name = 4;
|
|
bool hasAvatar = 5;
|
|
string updatedAt = 6;
|
|
repeated ChatRoomMemberResponse members = 7;
|
|
optional ChatMessageResponse lastMessage = 8;
|
|
optional string createdById = 9;
|
|
optional string peerUserId = 10;
|
|
optional string botUsername = 11;
|
|
optional bool isE2E = 12;
|
|
}
|
|
|
|
message PollOptionResponse {
|
|
string id = 1;
|
|
string text = 2;
|
|
int32 voteCount = 3;
|
|
bool votedByMe = 4;
|
|
}
|
|
|
|
message PollResponse {
|
|
string id = 1;
|
|
string question = 2;
|
|
bool allowsMultiple = 3;
|
|
bool isAnonymous = 4;
|
|
optional string closedAt = 5;
|
|
repeated PollOptionResponse options = 6;
|
|
}
|
|
|
|
message ChatMessageResponse {
|
|
string id = 1;
|
|
string roomId = 2;
|
|
string senderId = 3;
|
|
string senderName = 4;
|
|
bool senderHasAvatar = 5;
|
|
bool senderIsVerified = 17;
|
|
optional string senderVerificationIcon = 18;
|
|
string type = 6;
|
|
optional string content = 7;
|
|
optional string replyToId = 8;
|
|
optional string storageKey = 9;
|
|
optional string mimeType = 10;
|
|
optional string metadataJson = 11;
|
|
string createdAt = 12;
|
|
optional PollResponse poll = 13;
|
|
optional string editedAt = 14;
|
|
bool isDeleted = 15;
|
|
optional bool readByAll = 16;
|
|
optional bool isEncrypted = 19;
|
|
repeated MessageReactionResponse reactions = 20;
|
|
}
|
|
|
|
message MessageReactionResponse {
|
|
string emoji = 1;
|
|
int32 count = 2;
|
|
bool reactedByMe = 3;
|
|
}
|
|
|
|
message ListRoomsResponse {
|
|
repeated ChatRoomResponse rooms = 1;
|
|
}
|
|
|
|
message ListMessagesResponse {
|
|
repeated ChatMessageResponse messages = 1;
|
|
}
|
|
|
|
message MutationResponse {
|
|
int32 count = 1;
|
|
}
|