memos/proto/api/v1/workspace_setting_service.proto

109 lines
3.2 KiB
Protocol Buffer
Raw Normal View History

syntax = "proto3";
2024-04-28 00:44:29 +08:00
package memos.api.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
2024-04-28 00:44:29 +08:00
option go_package = "gen/api/v1";
service WorkspaceSettingService {
// GetWorkspaceSetting returns the setting by name.
2024-04-27 23:14:58 +08:00
rpc GetWorkspaceSetting(GetWorkspaceSettingRequest) returns (WorkspaceSetting) {
2024-04-28 00:44:29 +08:00
option (google.api.http) = {get: "/api/v1/workspace/{name=settings/*}"};
option (google.api.method_signature) = "name";
}
// SetWorkspaceSetting updates the setting.
2024-04-27 23:14:58 +08:00
rpc SetWorkspaceSetting(SetWorkspaceSettingRequest) returns (WorkspaceSetting) {
option (google.api.http) = {
2024-06-19 22:07:51 +08:00
patch: "/api/v1/workspace/{setting.name=settings/*}"
body: "setting"
};
option (google.api.method_signature) = "setting";
}
}
message WorkspaceSetting {
// name is the name of the setting.
// Format: settings/{setting}
string name = 1;
oneof value {
WorkspaceGeneralSetting general_setting = 2;
WorkspaceStorageSetting storage_setting = 3;
WorkspaceMemoRelatedSetting memo_related_setting = 4;
}
}
message WorkspaceGeneralSetting {
// additional_script is the additional script.
2024-05-30 07:19:38 +08:00
string additional_script = 3;
// additional_style is the additional style.
2024-05-30 07:19:38 +08:00
string additional_style = 4;
2024-04-12 08:32:54 +08:00
// custom_profile is the custom profile.
2024-05-30 07:19:38 +08:00
WorkspaceCustomProfile custom_profile = 5;
2024-04-12 08:32:54 +08:00
}
message WorkspaceCustomProfile {
string title = 1;
string description = 2;
string logo_url = 3;
string locale = 4;
string appearance = 5;
}
message WorkspaceStorageSetting {
enum StorageType {
STORAGE_TYPE_UNSPECIFIED = 0;
2024-05-13 20:03:04 +08:00
// DATABASE is the database storage type.
DATABASE = 1;
// LOCAL is the local storage type.
LOCAL = 2;
// S3 is the S3 storage type.
S3 = 3;
2024-04-28 21:36:22 +08:00
}
// storage_type is the storage type.
StorageType storage_type = 1;
// The template of file path.
// e.g. assets/{timestamp}_{filename}
string filepath_template = 2;
// The max upload size in megabytes.
int64 upload_size_limit_mb = 3;
// Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
message S3Config {
string access_key_id = 1;
string access_key_secret = 2;
string endpoint = 3;
string region = 4;
string bucket = 5;
}
2024-04-28 21:36:22 +08:00
// The S3 config.
S3Config s3_config = 4;
}
message WorkspaceMemoRelatedSetting {
// disallow_public_visibility disallows set memo as public visibility.
bool disallow_public_visibility = 1;
// display_with_update_time orders and displays memo with update time.
bool display_with_update_time = 2;
2024-05-06 19:12:30 +08:00
// content_length_limit is the limit of content length. Unit is byte.
int32 content_length_limit = 3;
2024-05-29 23:17:53 +08:00
// enable_auto_compact enables auto compact for large content.
bool enable_auto_compact = 4;
// enable_double_click_edit enables editing on double click.
bool enable_double_click_edit = 5;
// enable_link_preview enables links preview.
bool enable_link_preview = 6;
}
2024-04-27 23:14:58 +08:00
message GetWorkspaceSettingRequest {
// The resource name of the workspace setting.
// Format: settings/{setting}
string name = 1 [(google.api.field_behavior) = REQUIRED];
}
message SetWorkspaceSettingRequest {
// setting is the setting to update.
WorkspaceSetting setting = 1;
}