memos/proto/api/v2/resource_service.proto

74 lines
1.7 KiB
Protocol Buffer
Raw Normal View History

2023-09-16 00:11:07 +08:00
syntax = "proto3";
package memos.api.v2;
import "google/api/annotations.proto";
import "google/api/client.proto";
2023-10-21 12:41:55 +08:00
import "google/protobuf/field_mask.proto";
2023-09-16 11:48:53 +08:00
import "google/protobuf/timestamp.proto";
2023-09-16 00:11:07 +08:00
option go_package = "gen/api/v2";
service ResourceService {
2023-10-03 23:44:14 +08:00
rpc CreateResource(CreateResourceRequest) returns (CreateResourceResponse) {
option (google.api.http) = {post: "/api/v2/resources"};
}
2023-09-16 00:11:07 +08:00
rpc ListResources(ListResourcesRequest) returns (ListResourcesResponse) {
option (google.api.http) = {get: "/api/v2/resources"};
}
2023-10-03 23:44:14 +08:00
rpc UpdateResource(UpdateResourceRequest) returns (UpdateResourceResponse) {
2023-10-21 12:41:55 +08:00
option (google.api.http) = {
patch: "/api/v2/resources/{resource.id}",
body: "resource"
};
option (google.api.method_signature) = "resource,update_mask";
2023-10-03 23:44:14 +08:00
}
rpc DeleteResource(DeleteResourceRequest) returns (DeleteResourceResponse) {
option (google.api.http) = {get: "/api/v2/resources/{id}"};
option (google.api.method_signature) = "id";
}
2023-09-16 00:11:07 +08:00
}
message Resource {
int32 id = 1;
2023-09-16 11:48:53 +08:00
google.protobuf.Timestamp created_ts = 2;
2023-09-16 00:11:07 +08:00
string filename = 3;
string external_link = 4;
string type = 5;
int64 size = 6;
optional int32 memo_id = 7;
2023-09-16 00:11:07 +08:00
}
2023-10-03 23:44:14 +08:00
message CreateResourceRequest {
string filename = 1;
string external_link = 2;
string type = 3;
optional int32 memo_id = 4;
}
message CreateResourceResponse {
Resource resource = 1;
}
2023-09-16 00:11:07 +08:00
message ListResourcesRequest {}
message ListResourcesResponse {
repeated Resource resources = 1;
}
2023-10-03 23:44:14 +08:00
message UpdateResourceRequest {
2023-10-21 12:41:55 +08:00
Resource resource = 1;
2023-10-03 23:44:14 +08:00
2023-10-21 12:41:55 +08:00
google.protobuf.FieldMask update_mask = 2;
2023-10-03 23:44:14 +08:00
}
message UpdateResourceResponse {
Resource resource = 1;
}
message DeleteResourceRequest {
int32 id = 1;
}
message DeleteResourceResponse {}