mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 19:25:16 +00:00
115 lines
2.5 KiB
Protocol Buffer
115 lines
2.5 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package threads;
|
|
|
|
option go_package = "./proto;threads";
|
|
|
|
service Threads {
|
|
// Create a thread
|
|
rpc CreateThread(CreateThreadRequest) returns (CreateThreadResponse);
|
|
// Read a thread using its ID, can filter using group ID if provided
|
|
rpc ReadThread(ReadThreadRequest) returns (ReadThreadResponse);
|
|
// Update a threads topic
|
|
rpc UpdateThread(UpdateThreadRequest) returns (UpdateThreadResponse);
|
|
// Delete a thread and all the messages within
|
|
rpc DeleteThread(DeleteThreadRequest) returns (DeleteThreadResponse);
|
|
// List all the threads for a group
|
|
rpc ListThreads(ListThreadsRequest) returns (ListThreadsResponse);
|
|
// Create a message within a thread
|
|
rpc CreateMessage(CreateMessageRequest) returns (CreateMessageResponse);
|
|
// List the messages within a thread in reverse chronological order, using sent_before to
|
|
// offset as older messages need to be loaded
|
|
rpc ListMessages(ListMessagesRequest) returns (ListMessagesResponse);
|
|
// RecentMessages returns the most recent messages in a group of threads. By default the
|
|
// most messages retrieved per thread is 25, however this can be overriden using the
|
|
// limit_per_thread option
|
|
rpc RecentMessages(RecentMessagesRequest) returns (RecentMessagesResponse);
|
|
}
|
|
|
|
message Thread {
|
|
string id = 1;
|
|
string group_id = 2;
|
|
string topic = 3;
|
|
string created_at = 4;
|
|
}
|
|
|
|
message Message {
|
|
string id = 1;
|
|
string author_id = 2;
|
|
string thread_id = 3;
|
|
string text = 4;
|
|
string sent_at = 5;
|
|
}
|
|
|
|
message CreateThreadRequest {
|
|
string group_id = 1;
|
|
string topic = 2;
|
|
}
|
|
|
|
message CreateThreadResponse {
|
|
Thread thread = 1;
|
|
}
|
|
|
|
message ReadThreadRequest {
|
|
string id = 1;
|
|
string group_id = 2;
|
|
}
|
|
|
|
message ReadThreadResponse {
|
|
Thread thread = 1;
|
|
}
|
|
|
|
message ListThreadsRequest {
|
|
string group_id = 1;
|
|
}
|
|
|
|
message ListThreadsResponse {
|
|
repeated Thread threads = 1;
|
|
}
|
|
|
|
message UpdateThreadRequest {
|
|
string id = 1;
|
|
string topic = 2;
|
|
}
|
|
|
|
message UpdateThreadResponse {
|
|
Thread thread = 1;
|
|
}
|
|
|
|
message DeleteThreadRequest {
|
|
string id = 1;
|
|
}
|
|
|
|
message DeleteThreadResponse {}
|
|
|
|
message CreateMessageRequest {
|
|
string id = 1;
|
|
string thread_id = 2;
|
|
string author_id = 3;
|
|
string text = 4;
|
|
}
|
|
|
|
message CreateMessageResponse {
|
|
Message message = 1;
|
|
}
|
|
|
|
message ListMessagesRequest {
|
|
string thread_id = 1;
|
|
int64 limit = 2;
|
|
int64 offset = 3;
|
|
string order = 4;
|
|
}
|
|
|
|
message ListMessagesResponse {
|
|
repeated Message messages = 1;
|
|
}
|
|
|
|
message RecentMessagesRequest {
|
|
repeated string thread_ids = 1;
|
|
int64 limit_per_thread = 2;
|
|
}
|
|
|
|
message RecentMessagesResponse {
|
|
repeated Message messages = 1;
|
|
}
|