mirror of
https://github.com/usememos/memos.git
synced 2024-11-10 17:02:21 +08:00
107 lines
2.4 KiB
Protocol Buffer
107 lines
2.4 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package memos.api.v2;
|
|
|
|
import "google/api/annotations.proto";
|
|
import "google/api/client.proto";
|
|
import "google/protobuf/field_mask.proto";
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
option go_package = "gen/api/v2";
|
|
|
|
service ResourceService {
|
|
rpc CreateResource(CreateResourceRequest) returns (CreateResourceResponse) {
|
|
option (google.api.http) = {post: "/api/v2/resources"};
|
|
}
|
|
rpc ListResources(ListResourcesRequest) returns (ListResourcesResponse) {
|
|
option (google.api.http) = {get: "/api/v2/resources"};
|
|
}
|
|
rpc GetResource(GetResourceRequest) returns (GetResourceResponse) {
|
|
option (google.api.http) = {get: "/api/v2/resources/{id}"};
|
|
option (google.api.method_signature) = "id";
|
|
}
|
|
rpc GetResourceByName(GetResourceByNameRequest) returns (GetResourceByNameResponse) {
|
|
option (google.api.http) = {get: "/api/v2/resources/{name}"};
|
|
option (google.api.method_signature) = "name";
|
|
}
|
|
rpc UpdateResource(UpdateResourceRequest) returns (UpdateResourceResponse) {
|
|
option (google.api.http) = {
|
|
patch: "/api/v2/resources/{resource.id}",
|
|
body: "resource"
|
|
};
|
|
option (google.api.method_signature) = "resource,update_mask";
|
|
}
|
|
rpc DeleteResource(DeleteResourceRequest) returns (DeleteResourceResponse) {
|
|
option (google.api.http) = {delete: "/api/v2/resources/{id}"};
|
|
option (google.api.method_signature) = "id";
|
|
}
|
|
}
|
|
|
|
message Resource {
|
|
// id is the system generated unique identifier.
|
|
int32 id = 1;
|
|
|
|
// name is the user provided name.
|
|
string name = 2;
|
|
|
|
google.protobuf.Timestamp create_time = 3;
|
|
|
|
string filename = 4;
|
|
|
|
string external_link = 5;
|
|
|
|
string type = 6;
|
|
|
|
int64 size = 7;
|
|
|
|
optional int32 memo_id = 8;
|
|
}
|
|
|
|
message CreateResourceRequest {
|
|
string filename = 1;
|
|
string external_link = 2;
|
|
string type = 3;
|
|
optional int32 memo_id = 4;
|
|
}
|
|
|
|
message CreateResourceResponse {
|
|
Resource resource = 1;
|
|
}
|
|
|
|
message ListResourcesRequest {}
|
|
|
|
message ListResourcesResponse {
|
|
repeated Resource resources = 1;
|
|
}
|
|
|
|
message GetResourceRequest {
|
|
int32 id = 1;
|
|
}
|
|
|
|
message GetResourceResponse {
|
|
Resource resource = 1;
|
|
}
|
|
|
|
message GetResourceByNameRequest {
|
|
string name = 1;
|
|
}
|
|
|
|
message GetResourceByNameResponse {
|
|
Resource resource = 1;
|
|
}
|
|
|
|
message UpdateResourceRequest {
|
|
Resource resource = 1;
|
|
|
|
google.protobuf.FieldMask update_mask = 2;
|
|
}
|
|
|
|
message UpdateResourceResponse {
|
|
Resource resource = 1;
|
|
}
|
|
|
|
message DeleteResourceRequest {
|
|
int32 id = 1;
|
|
}
|
|
|
|
message DeleteResourceResponse {}
|