This commit is contained in:
royalcat 2024-12-23 15:54:51 +03:00
commit 530c24b019
35 changed files with 3601 additions and 0 deletions
proto/konfa

View file

@ -0,0 +1,27 @@
syntax = "proto3";
package konfa.channel.v1;
option go_package = "/channelv1";
// import "google/protobuf/timestamp.proto";
message Channel {
oneof channel {
TextChannel text_channel = 1;
VoiceChannel voice_channel = 2;
}
}
message TextChannel {
string server_id = 1;
string channel_id = 2;
string name = 3;
}
message VoiceChannel {
string server_id = 1;
string channel_id = 2;
string name = 3;
}

View file

@ -0,0 +1,69 @@
syntax = "proto3";
package konfa.chat.v1;
option go_package = "/chatv1";
import "google/protobuf/timestamp.proto";
service ChatService {
rpc SendMessage(SendMessageRequest) returns (SendMessageResponse) {}
rpc GetMessageHistory(GetMessageHistoryRequest) returns (GetMessageHistoryResponse) {}
rpc GetMessage(GetMessageRequest) returns (GetMessageResponse) {}
rpc StreamNewMessages(StreamNewMessagesRequest)
returns (stream StreamNewMessagesResponse) {}
rpc UploadAttachment(stream UploadAttachmentRequest) returns (UploadAttachmentResponse) {}
}
message TextChannelRef {
string server_id = 1;
string channel_id = 2;
}
message SendMessageRequest {
TextChannelRef channel = 1;
string content = 2;
}
message SendMessageResponse {
string message_id = 1;
}
message Message {
string message_id = 1;
string sender_id = 4;
string content = 5;
google.protobuf.Timestamp timestamp = 6;
}
message GetMessageHistoryRequest {
TextChannelRef channel = 1;
google.protobuf.Timestamp from = 2;
int32 count = 3;
}
message GetMessageHistoryResponse { repeated Message messages = 1; }
message GetMessageRequest {
TextChannelRef channel = 1;
string message_id = 2;
}
message GetMessageResponse { Message message = 1; }
message StreamNewMessagesRequest { TextChannelRef channel = 1; }
message StreamNewMessagesResponse { string message_id = 1; }
message UploadAttachmentRequest {
oneof payload {
AttachmentUploadInfo info = 1;
bytes data = 2 ;
}
}
message AttachmentUploadInfo {
string name = 1;
}
message UploadAttachmentResponse { string attachmen_id = 1; }

View file

@ -0,0 +1,20 @@
syntax = "proto3";
package konfa.server.v1;
option go_package = "/serverv1";
// import "google/protobuf/timestamp.proto";
import "konfa/channel/v1/channels.proto";
service ServerService {
rpc ListServerChannels(ListServerChannelsRequest) returns (ListServerChannelsResponse) {}
}
message ListServerChannelsRequest {
string server_id = 1;
}
message ListServerChannelsResponse {
repeated konfa.channel.v1.Channel channels = 1;
}