mirror of
https://github.com/usememos/memos.git
synced 2024-12-26 07:01:17 +08:00
109 lines
2.3 KiB
Protocol Buffer
109 lines
2.3 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";
|
|
|
|
option go_package = "gen/api/v2";
|
|
|
|
service StorageService {
|
|
// CreateStorage creates a new storage.
|
|
rpc CreateStorage(CreateStorageRequest) returns (CreateStorageResponse) {
|
|
option (google.api.http) = {
|
|
post: "/api/v2/storages"
|
|
body: "*"
|
|
};
|
|
}
|
|
// GetStorage returns a storage by id.
|
|
rpc GetStorage(GetStorageRequest) returns (GetStorageResponse) {
|
|
option (google.api.http) = {get: "/api/v2/storages/{id}"};
|
|
option (google.api.method_signature) = "id";
|
|
}
|
|
// ListStorages returns a list of storages.
|
|
rpc ListStorages(ListStoragesRequest) returns (ListStoragesResponse) {
|
|
option (google.api.http) = {get: "/api/v2/storages"};
|
|
}
|
|
// UpdateStorage updates a storage.
|
|
rpc UpdateStorage(UpdateStorageRequest) returns (UpdateStorageResponse) {
|
|
option (google.api.http) = {
|
|
patch: "/api/v2/storages/{storage.id}"
|
|
body: "storage"
|
|
};
|
|
option (google.api.method_signature) = "storage,update_mask";
|
|
}
|
|
// DeleteStorage deletes a storage by id.
|
|
rpc DeleteStorage(DeleteStorageRequest) returns (DeleteStorageResponse) {
|
|
option (google.api.http) = {delete: "/api/v2/storages/{id}"};
|
|
option (google.api.method_signature) = "id";
|
|
}
|
|
}
|
|
|
|
message Storage {
|
|
int32 id = 1;
|
|
string title = 2;
|
|
|
|
enum Type {
|
|
TYPE_UNSPECIFIED = 0;
|
|
S3 = 1;
|
|
}
|
|
Type type = 3;
|
|
StorageConfig config = 4;
|
|
}
|
|
|
|
message StorageConfig {
|
|
oneof config {
|
|
S3Config s3_config = 1;
|
|
}
|
|
}
|
|
|
|
message S3Config {
|
|
string end_point = 1;
|
|
string path = 2;
|
|
string region = 3;
|
|
string access_key = 4;
|
|
string secret_key = 5;
|
|
string bucket = 6;
|
|
string url_prefix = 7;
|
|
string url_suffix = 8;
|
|
bool pre_sign = 9;
|
|
}
|
|
|
|
message CreateStorageRequest {
|
|
Storage storage = 1;
|
|
}
|
|
|
|
message CreateStorageResponse {
|
|
Storage storage = 1;
|
|
}
|
|
|
|
message GetStorageRequest {
|
|
int32 id = 1;
|
|
}
|
|
|
|
message GetStorageResponse {
|
|
Storage storage = 1;
|
|
}
|
|
|
|
message ListStoragesRequest {}
|
|
|
|
message ListStoragesResponse {
|
|
repeated Storage storages = 1;
|
|
}
|
|
|
|
message UpdateStorageRequest {
|
|
Storage storage = 1;
|
|
|
|
google.protobuf.FieldMask update_mask = 2;
|
|
}
|
|
|
|
message UpdateStorageResponse {
|
|
Storage storage = 1;
|
|
}
|
|
|
|
message DeleteStorageRequest {
|
|
int32 id = 1;
|
|
}
|
|
|
|
message DeleteStorageResponse {}
|