mirror of
https://github.com/Alexander-D-Karpov/concord.git
synced 2026-03-16 22:04:15 +03:00
245 lines
4.9 KiB
Protocol Buffer
245 lines
4.9 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package concord.dm.v1;
|
|
|
|
option go_package = "github.com/Alexander-D-Karpov/concord/api/gen/go/dm/v1;dmv1";
|
|
|
|
import "google/api/annotations.proto";
|
|
import "google/protobuf/timestamp.proto";
|
|
import "call/v1/call.proto";
|
|
|
|
message DMChannel {
|
|
string id = 1;
|
|
repeated DMParticipant participants = 2;
|
|
google.protobuf.Timestamp created_at = 3;
|
|
DMMessage last_message = 4;
|
|
string last_read_message_id = 5;
|
|
int32 unread_count = 6;
|
|
}
|
|
|
|
message DMParticipant {
|
|
string user_id = 1;
|
|
string handle = 2;
|
|
string display_name = 3;
|
|
string avatar_url = 4;
|
|
string status = 5;
|
|
}
|
|
|
|
message DMMessage {
|
|
string id = 1;
|
|
string channel_id = 2;
|
|
string author_id = 3;
|
|
string content = 4;
|
|
google.protobuf.Timestamp created_at = 5;
|
|
google.protobuf.Timestamp edited_at = 6;
|
|
bool deleted = 7;
|
|
string reply_to_id = 8;
|
|
repeated DMAttachment attachments = 9;
|
|
repeated ReadReceipt read_by = 10;
|
|
}
|
|
|
|
message DMAttachment {
|
|
string id = 1;
|
|
string url = 2;
|
|
string filename = 3;
|
|
string content_type = 4;
|
|
int64 size = 5;
|
|
int32 width = 6;
|
|
int32 height = 7;
|
|
}
|
|
|
|
message ReadReceipt {
|
|
string user_id = 1;
|
|
google.protobuf.Timestamp read_at = 2;
|
|
}
|
|
|
|
message CreateDMRequest {
|
|
string user_id = 1;
|
|
}
|
|
|
|
message CreateDMResponse {
|
|
DMChannel channel = 1;
|
|
}
|
|
|
|
message GetDMChannelRequest {
|
|
string channel_id = 1;
|
|
}
|
|
|
|
message GetDMChannelResponse {
|
|
DMChannel channel = 1;
|
|
}
|
|
|
|
message ListDMChannelsRequest {
|
|
int32 limit = 1;
|
|
string cursor = 2;
|
|
}
|
|
|
|
message ListDMChannelsResponse {
|
|
repeated DMChannel channels = 1;
|
|
string next_cursor = 2;
|
|
int32 total_unread = 3;
|
|
}
|
|
|
|
message SendDMAttachment {
|
|
string filename = 1;
|
|
string content_type = 2;
|
|
bytes data = 3;
|
|
int32 width = 4;
|
|
int32 height = 5;
|
|
}
|
|
|
|
message SendDMRequest {
|
|
string channel_id = 1;
|
|
string content = 2;
|
|
string reply_to_id = 3;
|
|
repeated SendDMAttachment attachments = 4;
|
|
}
|
|
|
|
message SendDMResponse {
|
|
DMMessage message = 1;
|
|
}
|
|
|
|
message EditDMRequest {
|
|
string channel_id = 1;
|
|
string message_id = 2;
|
|
string content = 3;
|
|
}
|
|
|
|
message EditDMResponse {
|
|
DMMessage message = 1;
|
|
}
|
|
|
|
message DeleteDMRequest {
|
|
string channel_id = 1;
|
|
string message_id = 2;
|
|
}
|
|
|
|
message ListDMMessagesRequest {
|
|
string channel_id = 1;
|
|
string before = 2;
|
|
string after = 3;
|
|
int32 limit = 4;
|
|
}
|
|
|
|
message ListDMMessagesResponse {
|
|
repeated DMMessage messages = 1;
|
|
bool has_more = 2;
|
|
string last_read_message_id = 3;
|
|
}
|
|
|
|
message MarkDMAsReadRequest {
|
|
string channel_id = 1;
|
|
string message_id = 2;
|
|
}
|
|
|
|
message MarkDMAsReadResponse {
|
|
string last_read_message_id = 1;
|
|
int32 unread_count = 2;
|
|
}
|
|
|
|
message StartDMTypingRequest {
|
|
string channel_id = 1;
|
|
}
|
|
|
|
message StopDMTypingRequest {
|
|
string channel_id = 1;
|
|
}
|
|
|
|
message JoinDMCallRequest {
|
|
string channel_id = 1;
|
|
bool audio_only = 2;
|
|
}
|
|
|
|
message JoinDMCallResponse {
|
|
concord.call.v1.UdpEndpoint endpoint = 1;
|
|
string server_id = 2;
|
|
string voice_token = 3;
|
|
concord.call.v1.CodecHint codec = 4;
|
|
concord.call.v1.CryptoSuite crypto = 5;
|
|
repeated concord.call.v1.Participant participants = 6;
|
|
}
|
|
|
|
message LeaveDMCallRequest {
|
|
string channel_id = 1;
|
|
}
|
|
|
|
message EmptyResponse {}
|
|
|
|
service DMService {
|
|
rpc CreateDM(CreateDMRequest) returns (CreateDMResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/dm"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc GetDMChannel(GetDMChannelRequest) returns (GetDMChannelResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/dm/{channel_id}"
|
|
};
|
|
}
|
|
|
|
rpc ListDMChannels(ListDMChannelsRequest) returns (ListDMChannelsResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/dm"
|
|
};
|
|
}
|
|
|
|
rpc SendDM(SendDMRequest) returns (SendDMResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/dm/{channel_id}/messages"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc EditDM(EditDMRequest) returns (EditDMResponse) {
|
|
option (google.api.http) = {
|
|
patch: "/v1/dm/{channel_id}/messages/{message_id}"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc DeleteDM(DeleteDMRequest) returns (EmptyResponse) {
|
|
option (google.api.http) = {
|
|
delete: "/v1/dm/{channel_id}/messages/{message_id}"
|
|
};
|
|
}
|
|
|
|
rpc ListDMMessages(ListDMMessagesRequest) returns (ListDMMessagesResponse) {
|
|
option (google.api.http) = {
|
|
get: "/v1/dm/{channel_id}/messages"
|
|
};
|
|
}
|
|
|
|
rpc MarkDMAsRead(MarkDMAsReadRequest) returns (MarkDMAsReadResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/dm/{channel_id}/read"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc StartDMTyping(StartDMTypingRequest) returns (EmptyResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/dm/{channel_id}/typing"
|
|
};
|
|
}
|
|
|
|
rpc StopDMTyping(StopDMTypingRequest) returns (EmptyResponse) {
|
|
option (google.api.http) = {
|
|
delete: "/v1/dm/{channel_id}/typing"
|
|
};
|
|
}
|
|
|
|
rpc JoinDMCall(JoinDMCallRequest) returns (JoinDMCallResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/dm/{channel_id}/call/join"
|
|
body: "*"
|
|
};
|
|
}
|
|
|
|
rpc LeaveDMCall(LeaveDMCallRequest) returns (EmptyResponse) {
|
|
option (google.api.http) = {
|
|
post: "/v1/dm/{channel_id}/call/leave"
|
|
};
|
|
}
|
|
} |