workspace_setting_service.proto 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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_signup disallows signup for new users.
  34. bool disallow_signup = 1;
  35. // disallow_password_signin disallows user to sign in with password. Except for the admins.
  36. bool disallow_password_signin = 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. }
  48. message WorkspaceCustomProfile {
  49. string title = 1;
  50. string description = 2;
  51. string logo_url = 3;
  52. string locale = 4;
  53. string appearance = 5;
  54. }
  55. message WorkspaceStorageSetting {
  56. enum StorageType {
  57. STORAGE_TYPE_UNSPECIFIED = 0;
  58. // DATABASE is the database storage type.
  59. DATABASE = 1;
  60. // LOCAL is the local storage type.
  61. LOCAL = 2;
  62. // S3 is the S3 storage type.
  63. S3 = 3;
  64. }
  65. // storage_type is the storage type.
  66. StorageType storage_type = 1;
  67. // The template of file path.
  68. // e.g. assets/{timestamp}_{filename}
  69. string filepath_template = 2;
  70. // The max upload size in megabytes.
  71. int64 upload_size_limit_mb = 3;
  72. // Reference: https://developers.cloudflare.com/r2/examples/aws/aws-sdk-go/
  73. message S3Config {
  74. string access_key_id = 1;
  75. string access_key_secret = 2;
  76. string endpoint = 3;
  77. string region = 4;
  78. string bucket = 5;
  79. }
  80. // The S3 config.
  81. S3Config s3_config = 4;
  82. }
  83. message WorkspaceMemoRelatedSetting {
  84. // disallow_public_visibility disallows set memo as public visibility.
  85. bool disallow_public_visibility = 1;
  86. // display_with_update_time orders and displays memo with update time.
  87. bool display_with_update_time = 2;
  88. // content_length_limit is the limit of content length. Unit is byte.
  89. int32 content_length_limit = 3;
  90. // enable_auto_compact enables auto compact for large content.
  91. bool enable_auto_compact = 4;
  92. // enable_double_click_edit enables editing on double click.
  93. bool enable_double_click_edit = 5;
  94. // enable_link_preview enables links preview.
  95. bool enable_link_preview = 6;
  96. // enable_comment enables comment.
  97. bool enable_comment = 7;
  98. }
  99. message GetWorkspaceSettingRequest {
  100. // The resource name of the workspace setting.
  101. // Format: settings/{setting}
  102. string name = 1 [(google.api.field_behavior) = REQUIRED];
  103. }
  104. message SetWorkspaceSettingRequest {
  105. // setting is the setting to update.
  106. WorkspaceSetting setting = 1;
  107. }