2023-08-05 09:32:52 +08:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package memos.api.v2;
|
|
|
|
|
|
|
|
import "api/v2/common.proto";
|
2023-12-17 09:53:22 +08:00
|
|
|
import "api/v2/markdown_service.proto";
|
2023-08-05 09:32:52 +08:00
|
|
|
import "google/api/annotations.proto";
|
|
|
|
import "google/api/client.proto";
|
2023-12-20 23:14:15 +08:00
|
|
|
import "google/protobuf/field_mask.proto";
|
2023-12-19 23:49:24 +08:00
|
|
|
import "google/protobuf/timestamp.proto";
|
2023-08-05 09:32:52 +08:00
|
|
|
|
|
|
|
option go_package = "gen/api/v2";
|
|
|
|
|
|
|
|
service MemoService {
|
2023-10-01 14:44:10 +08:00
|
|
|
rpc CreateMemo(CreateMemoRequest) returns (CreateMemoResponse) {
|
2023-12-20 23:14:15 +08:00
|
|
|
option (google.api.http) = {
|
|
|
|
post: "/api/v2/memos"
|
|
|
|
body: "*"
|
|
|
|
};
|
2023-10-01 14:44:10 +08:00
|
|
|
}
|
|
|
|
|
2023-08-05 09:32:52 +08:00
|
|
|
rpc ListMemos(ListMemosRequest) returns (ListMemosResponse) {
|
|
|
|
option (google.api.http) = {get: "/api/v2/memos"};
|
|
|
|
}
|
|
|
|
|
|
|
|
rpc GetMemo(GetMemoRequest) returns (GetMemoResponse) {
|
|
|
|
option (google.api.http) = {get: "/api/v2/memos/{id}"};
|
|
|
|
option (google.api.method_signature) = "id";
|
|
|
|
}
|
2023-10-01 14:44:10 +08:00
|
|
|
|
2023-12-20 23:14:15 +08:00
|
|
|
rpc UpdateMemo(UpdateMemoRequest) returns (UpdateMemoResponse) {
|
|
|
|
option (google.api.http) = {
|
|
|
|
patch: "/api/v2/memos/{id}"
|
|
|
|
body: "*"
|
|
|
|
};
|
|
|
|
option (google.api.method_signature) = "id, update_mask";
|
|
|
|
}
|
|
|
|
|
|
|
|
rpc DeleteMemo(DeleteMemoRequest) returns (DeleteMemoResponse) {
|
|
|
|
option (google.api.http) = {delete: "/api/v2/memos/{id}"};
|
|
|
|
option (google.api.method_signature) = "id";
|
|
|
|
}
|
|
|
|
|
2023-10-01 14:44:10 +08:00
|
|
|
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;
|
2023-08-05 09:32:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
message Memo {
|
|
|
|
int32 id = 1;
|
|
|
|
|
|
|
|
RowStatus row_status = 2;
|
|
|
|
|
|
|
|
int32 creator_id = 3;
|
|
|
|
|
2023-12-19 23:49:24 +08:00
|
|
|
google.protobuf.Timestamp create_time = 4;
|
2023-08-05 09:32:52 +08:00
|
|
|
|
2023-12-19 23:49:24 +08:00
|
|
|
google.protobuf.Timestamp update_time = 5;
|
2023-08-05 09:32:52 +08:00
|
|
|
|
2023-12-19 23:49:24 +08:00
|
|
|
google.protobuf.Timestamp display_time = 6;
|
2023-08-05 09:32:52 +08:00
|
|
|
|
2023-12-19 23:49:24 +08:00
|
|
|
string content = 7;
|
2023-08-05 09:32:52 +08:00
|
|
|
|
2023-12-19 23:49:24 +08:00
|
|
|
repeated Node nodes = 8;
|
2023-12-17 09:53:22 +08:00
|
|
|
|
2023-12-19 23:49:24 +08:00
|
|
|
Visibility visibility = 9;
|
|
|
|
|
|
|
|
bool pinned = 10;
|
2023-08-05 09:32:52 +08:00
|
|
|
}
|
|
|
|
|
2023-10-01 14:44:10 +08:00
|
|
|
message CreateMemoRequest {
|
|
|
|
string content = 1;
|
|
|
|
|
|
|
|
Visibility visibility = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message CreateMemoResponse {
|
|
|
|
Memo memo = 1;
|
|
|
|
}
|
|
|
|
|
2023-08-05 09:32:52 +08:00
|
|
|
message ListMemosRequest {
|
|
|
|
int32 page = 1;
|
|
|
|
|
|
|
|
int32 page_size = 2;
|
|
|
|
|
|
|
|
// Filter is used to filter memos returned in the list.
|
|
|
|
string filter = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ListMemosResponse {
|
|
|
|
repeated Memo memos = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message GetMemoRequest {
|
|
|
|
int32 id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message GetMemoResponse {
|
|
|
|
Memo memo = 1;
|
|
|
|
}
|
|
|
|
|
2023-12-20 23:14:15 +08:00
|
|
|
message UpdateMemoRequest {
|
|
|
|
int32 id = 1;
|
|
|
|
|
|
|
|
Memo memo = 2;
|
|
|
|
|
|
|
|
google.protobuf.FieldMask update_mask = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message UpdateMemoResponse {
|
|
|
|
Memo memo = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message DeleteMemoRequest {
|
|
|
|
int32 id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message DeleteMemoResponse {}
|
|
|
|
|
2023-10-01 14:44:10 +08:00
|
|
|
message CreateMemoCommentRequest {
|
|
|
|
// id is the memo id to create comment for.
|
|
|
|
int32 id = 1;
|
2023-08-05 09:32:52 +08:00
|
|
|
|
2023-10-01 14:44:10 +08:00
|
|
|
CreateMemoRequest create = 2;
|
|
|
|
}
|
2023-08-05 09:32:52 +08:00
|
|
|
|
2023-10-01 14:44:10 +08:00
|
|
|
message CreateMemoCommentResponse {
|
|
|
|
Memo memo = 1;
|
|
|
|
}
|
2023-08-05 09:32:52 +08:00
|
|
|
|
2023-10-01 14:44:10 +08:00
|
|
|
message ListMemoCommentsRequest {
|
|
|
|
int32 id = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ListMemoCommentsResponse {
|
|
|
|
repeated Memo memos = 1;
|
2023-08-05 09:32:52 +08:00
|
|
|
}
|