feat: impl memo comment api

This commit is contained in:
Steven
2023-10-01 14:44:10 +08:00
parent 7549c807ac
commit 922de07751
7 changed files with 1181 additions and 94 deletions

View File

@@ -9,6 +9,10 @@ import "google/api/client.proto";
option go_package = "gen/api/v2";
service MemoService {
rpc CreateMemo(CreateMemoRequest) returns (CreateMemoResponse) {
option (google.api.http) = {post: "/api/v2/memos"};
}
rpc ListMemos(ListMemosRequest) returns (ListMemosResponse) {
option (google.api.http) = {get: "/api/v2/memos"};
}
@@ -17,6 +21,26 @@ service MemoService {
option (google.api.http) = {get: "/api/v2/memos/{id}"};
option (google.api.method_signature) = "id";
}
rpc CreateMemoComment(CreateMemoCommentRequest) returns (CreateMemoCommentResponse) {
option (google.api.http) = {post: "/api/v2/memos/{id}/comments"};
option (google.api.method_signature) = "id";
}
rpc ListMemoComments(ListMemoCommentsRequest) returns (ListMemoCommentsResponse) {
option (google.api.http) = {get: "/api/v2/memos/{id}/comments"};
option (google.api.method_signature) = "id";
}
}
enum Visibility {
VISIBILITY_UNSPECIFIED = 0;
PRIVATE = 1;
PROTECTED = 2;
PUBLIC = 3;
}
message Memo {
@@ -37,6 +61,16 @@ message Memo {
bool pinned = 8;
}
message CreateMemoRequest {
string content = 1;
Visibility visibility = 2;
}
message CreateMemoResponse {
Memo memo = 1;
}
message ListMemosRequest {
int32 page = 1;
@@ -58,12 +92,21 @@ message GetMemoResponse {
Memo memo = 1;
}
enum Visibility {
VISIBILITY_UNSPECIFIED = 0;
message CreateMemoCommentRequest {
// id is the memo id to create comment for.
int32 id = 1;
PRIVATE = 1;
PROTECTED = 2;
PUBLIC = 3;
CreateMemoRequest create = 2;
}
message CreateMemoCommentResponse {
Memo memo = 1;
}
message ListMemoCommentsRequest {
int32 id = 1;
}
message ListMemoCommentsResponse {
repeated Memo memos = 1;
}