workspace_setting_service.proto 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. syntax = "proto3";
  2. package memos.api.v1;
  3. import "google/api/annotations.proto";
  4. import "google/api/client.proto";
  5. import "google/api/field_behavior.proto";
  6. option go_package = "gen/api/v1";
  7. service WorkspaceSettingService {
  8. // GetWorkspaceSetting returns the setting by name.
  9. rpc GetWorkspaceSetting(GetWorkspaceSettingRequest) returns (WorkspaceSetting) {
  10. option (google.api.http) = {get: "/api/v1/workspace/{name=settings/*}"};
  11. option (google.api.method_signature) = "name";
  12. }
  13. // SetWorkspaceSetting updates the setting.
  14. rpc SetWorkspaceSetting(SetWorkspaceSettingRequest) returns (WorkspaceSetting) {
  15. option (google.api.http) = {
  16. patch: "/api/v1/workspace/{setting.name=settings/*}"
  17. body: "setting"
  18. };
  19. option (google.api.method_signature) = "setting";
  20. }
  21. }
  22. message WorkspaceSetting {
  23. // name is the name of the setting.
  24. // Format: settings/{setting}
  25. string name = 1;
  26. oneof value {
  27. WorkspaceGeneralSetting general_setting = 2;
  28. WorkspaceStorageSetting storage_setting = 3;
  29. WorkspaceMemoRelatedSetting memo_related_setting = 4;
  30. }
  31. }
  32. message WorkspaceGeneralSetting {
  33. // disallow_user_registration disallows user registration.
  34. bool disallow_user_registration = 1;
  35. // disallow_password_auth disallows password authentication.
  36. bool disallow_password_auth = 2;
  37. // additional_script is the additional script.
  38. string additional_script = 3;
  39. // additional_style is the additional style.
  40. string additional_style = 4;
  41. // custom_profile is the custom profile.
  42. WorkspaceCustomProfile custom_profile = 5;
  43. // week_start_day_offset is the week start day offset from Sunday.
  44. // 0: Sunday, 1: Monday, 2: Tuesday, 3: Wednesday, 4: Thursday, 5: Friday, 6: Saturday
  45. // Default is Sunday.
  46. int32 week_start_day_offset = 6;
  47. // disallow_change_username disallows changing username.
  48. bool disallow_change_username = 7;
  49. // disallow_change_nickname disallows changing nickname.
  50. bool disallow_change_nickname = 8;
  51. }
  52. message WorkspaceCustomProfile {
  53. string title = 1;
  54. string description = 2;
  55. string logo_url = 3;
  56. string locale = 4;
  57. string appearance = 5;
  58. }
  59. message WorkspaceStorageSetting {
  60. enum StorageType {
  61. STORAGE_TYPE_UNSPECIFIED = 0;
  62. // DATABASE is the database storage type.
  63. DATABASE = 1;
  64. // LOCAL is the local storage type.
  65. LOCAL = 2;
  66. // S3 is the S3 storage type.
  67. S3 = 3;
  68. }
  69. // storage_type is the storage type.
  70. StorageType storage_type = 1;
  71. // The template of file path.
  72. // e.g. assets/{timestamp}_{filename}
  73. string filepath_template = 2;
  74. // The max upload size in megabytes.
  75. int64 upload_size_limit_mb = 3;
  76. // Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
  77. message S3Config {
  78. string access_key_id = 1;
  79. string access_key_secret = 2;
  80. string endpoint = 3;
  81. string region = 4;
  82. string bucket = 5;
  83. }
  84. // The S3 config.
  85. S3Config s3_config = 4;
  86. }
  87. message WorkspaceMemoRelatedSetting {
  88. // disallow_public_visibility disallows set memo as public visibility.
  89. bool disallow_public_visibility = 1;
  90. // display_with_update_time orders and displays memo with update time.
  91. bool display_with_update_time = 2;
  92. // content_length_limit is the limit of content length. Unit is byte.
  93. int32 content_length_limit = 3;
  94. // enable_auto_compact enables auto compact for large content.
  95. bool enable_auto_compact = 4;
  96. // enable_double_click_edit enables editing on double click.
  97. bool enable_double_click_edit = 5;
  98. // enable_link_preview enables links preview.
  99. bool enable_link_preview = 6;
  100. // enable_comment enables comment.
  101. bool enable_comment = 7;
  102. // enable_location enables setting location for memo.
  103. bool enable_location = 8;
  104. }
  105. message GetWorkspaceSettingRequest {
  106. // The resource name of the workspace setting.
  107. // Format: settings/{setting}
  108. string name = 1 [(google.api.field_behavior) = REQUIRED];
  109. }
  110. message SetWorkspaceSettingRequest {
  111. // setting is the setting to update.
  112. WorkspaceSetting setting = 1;
  113. }