memos/proto/api/v1/inbox_service.proto

81 lines
1.8 KiB
Protocol Buffer
Raw Normal View History

2023-10-27 09:01:17 +08:00
syntax = "proto3";
2024-04-28 00:44:29 +08:00
package memos.api.v1;
2023-10-27 09:01:17 +08:00
import "google/api/annotations.proto";
import "google/api/client.proto";
2024-04-27 22:02:15 +08:00
import "google/protobuf/empty.proto";
2023-10-27 09:01:17 +08:00
import "google/protobuf/field_mask.proto";
2023-10-28 00:08:42 +08:00
import "google/protobuf/timestamp.proto";
2023-10-27 09:01:17 +08:00
2024-04-28 00:44:29 +08:00
option go_package = "gen/api/v1";
2023-10-27 09:01:17 +08:00
service InboxService {
2024-02-01 21:26:09 +08:00
// ListInboxes lists inboxes for a user.
2023-10-28 00:08:42 +08:00
rpc ListInboxes(ListInboxesRequest) returns (ListInboxesResponse) {
2024-04-28 00:44:29 +08:00
option (google.api.http) = {get: "/api/v1/inboxes"};
2023-10-27 09:01:17 +08:00
}
2024-02-01 21:26:09 +08:00
// UpdateInbox updates an inbox.
2024-04-27 22:02:15 +08:00
rpc UpdateInbox(UpdateInboxRequest) returns (Inbox) {
2023-10-27 09:01:17 +08:00
option (google.api.http) = {
2024-04-28 00:44:29 +08:00
patch: "/api/v1/{inbox.name=inboxes/*}"
2023-10-27 09:01:17 +08:00
body: "inbox"
};
2024-02-06 20:55:27 +08:00
option (google.api.method_signature) = "inbox,update_mask";
2023-10-27 09:01:17 +08:00
}
2024-02-01 21:26:09 +08:00
// DeleteInbox deletes an inbox.
2024-04-27 22:02:15 +08:00
rpc DeleteInbox(DeleteInboxRequest) returns (google.protobuf.Empty) {
2024-04-28 00:44:29 +08:00
option (google.api.http) = {delete: "/api/v1/{name=inboxes/*}"};
2023-10-27 09:01:17 +08:00
option (google.api.method_signature) = "name";
}
}
message Inbox {
// The name of the inbox.
2024-03-30 14:58:47 +08:00
// Format: inboxes/{id}
2023-10-27 09:01:17 +08:00
string name = 1;
2024-03-30 14:58:47 +08:00
// Format: users/{id}
2023-10-27 09:01:17 +08:00
string sender = 2;
2024-03-30 14:58:47 +08:00
// Format: users/{id}
2023-10-27 09:01:17 +08:00
string receiver = 3;
enum Status {
STATUS_UNSPECIFIED = 0;
UNREAD = 1;
2023-10-28 02:49:35 +08:00
ARCHIVED = 2;
2023-10-27 09:01:17 +08:00
}
Status status = 4;
2023-10-28 00:08:42 +08:00
google.protobuf.Timestamp create_time = 5;
enum Type {
TYPE_UNSPECIFIED = 0;
2024-05-13 20:03:04 +08:00
MEMO_COMMENT = 1;
VERSION_UPDATE = 2;
}
2023-10-28 00:08:42 +08:00
Type type = 6;
2023-10-27 09:01:17 +08:00
2023-10-28 00:08:42 +08:00
optional int32 activity_id = 7;
2023-10-27 09:01:17 +08:00
}
2023-10-28 00:08:42 +08:00
message ListInboxesRequest {
2024-03-30 14:58:47 +08:00
// Format: users/{id}
2023-10-27 09:01:17 +08:00
string user = 1;
}
2023-10-28 00:08:42 +08:00
message ListInboxesResponse {
repeated Inbox inboxes = 1;
2023-10-27 09:01:17 +08:00
}
message UpdateInboxRequest {
2024-02-06 20:55:27 +08:00
Inbox inbox = 1;
2023-10-27 09:01:17 +08:00
2024-02-06 20:55:27 +08:00
google.protobuf.FieldMask update_mask = 2;
2023-10-27 09:01:17 +08:00
}
message DeleteInboxRequest {
// The name of the inbox to delete.
2024-03-30 14:58:47 +08:00
// Format: inboxes/{id}
2023-10-27 09:01:17 +08:00
string name = 1;
}