syntax = "proto3"; package memos.api.v2; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; option go_package = "gen/api/v2"; service ResourceService { // CreateResource creates a new resource. rpc CreateResource(CreateResourceRequest) returns (CreateResourceResponse) { option (google.api.http) = {post: "/api/v2/resources"}; } // ListResources lists all resources. rpc ListResources(ListResourcesRequest) returns (ListResourcesResponse) { option (google.api.http) = {get: "/api/v2/resources"}; } // SearchResources searches memos. rpc SearchResources(SearchResourcesRequest) returns (SearchResourcesResponse) { option (google.api.http) = {get: "/api/v2/resources:search"}; } // GetResource returns a resource by name. rpc GetResource(GetResourceRequest) returns (GetResourceResponse) { option (google.api.http) = {get: "/api/v2/{name=resources/*}"}; option (google.api.method_signature) = "name"; } // UpdateResource updates a resource. rpc UpdateResource(UpdateResourceRequest) returns (UpdateResourceResponse) { option (google.api.http) = { patch: "/api/v2/{resource.name=resources/*}", body: "resource" }; option (google.api.method_signature) = "resource,update_mask"; } // DeleteResource deletes a resource by name. rpc DeleteResource(DeleteResourceRequest) returns (DeleteResourceResponse) { option (google.api.http) = {delete: "/api/v2/{name=resources/*}"}; option (google.api.method_signature) = "name"; } } message Resource { // The name of the resource. // Format: resources/{id} // id is the system generated unique identifier. string name = 1; // The user defined id of the resource. string uid = 2; google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; string filename = 4; bytes content = 5 [(google.api.field_behavior) = INPUT_ONLY]; string external_link = 6; string type = 7; int64 size = 8; // The related memo. // Format: memos/{id} optional string memo = 9; } message CreateResourceRequest { Resource resource = 1; } message CreateResourceResponse { Resource resource = 1; } message ListResourcesRequest {} message ListResourcesResponse { repeated Resource resources = 1; } message SearchResourcesRequest { string filter = 1; } message SearchResourcesResponse { repeated Resource resources = 1; } message GetResourceRequest { // The name of the resource. // Format: resources/{id} // id is the system generated unique identifier. string name = 1; } message GetResourceResponse { Resource resource = 1; } message UpdateResourceRequest { Resource resource = 1; google.protobuf.FieldMask update_mask = 2; } message UpdateResourceResponse { Resource resource = 1; } message DeleteResourceRequest { // The name of the resource. // Format: resources/{id} // id is the system generated unique identifier. string name = 1; } message DeleteResourceResponse {}