account.proto 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. syntax = "proto3";
  2. package chatto.api.v1;
  3. import "buf/validate/validate.proto";
  4. import "chatto/api/v1/common.proto";
  5. import "chatto/api/v1/external_identities.proto";
  6. import "chatto/api/v1/presence.proto";
  7. import "chatto/api/v1/user_status.proto";
  8. import "chatto/api/v1/users.proto";
  9. import "chatto/api/v1/viewer.proto";
  10. import "google/protobuf/descriptor.proto";
  11. // Request to update the authenticated user's profile. Human and bot accounts
  12. // use this same self-service operation. At least one field must be present.
  13. message UpdateProfileRequest {
  14. // New display name, when changing it. Empty clears the explicit display
  15. // name. The server also rejects control and confusing invisible characters.
  16. optional string display_name = 1 [(buf.validate.field).string.max_len = 32];
  17. // New login identifier, when changing it. The server accepts ASCII letters,
  18. // digits, period, underscore, and hyphen, starting with a letter or digit.
  19. optional string login = 2 [(buf.validate.field).string = {
  20. min_len: 2
  21. max_len: 32
  22. }];
  23. // New Markdown biography, when changing it. Empty clears the bio.
  24. optional string bio = 3 [(buf.validate.field).string.max_len = 1000];
  25. }
  26. // Result of a profile update.
  27. message UpdateProfileResponse {
  28. // Updated user profile.
  29. User user = 1;
  30. }
  31. // Request to upload and set the authenticated user's avatar.
  32. message UploadAvatarRequest {
  33. reserved 1 to 3;
  34. reserved "filename", "content_type";
  35. // Image payload. The server validates, resizes, and stores a WebP avatar.
  36. ImageUpload image = 4;
  37. }
  38. // Result of uploading the authenticated user's avatar.
  39. message UploadAvatarResponse {
  40. // Updated user profile.
  41. User user = 1;
  42. }
  43. // Request to delete the authenticated user's avatar.
  44. message DeleteAvatarRequest {}
  45. // Result of deleting the authenticated user's avatar.
  46. message DeleteAvatarResponse {
  47. // Updated user profile.
  48. User user = 1;
  49. }
  50. // Request to update or add the authenticated user's password.
  51. message UpdatePasswordRequest {
  52. // New password. The server applies the same password policy as registration
  53. // and password reset.
  54. string password = 1 [(buf.validate.field).string = {
  55. min_len: 8
  56. max_len: 128
  57. }];
  58. // Current password. Required when the account already has a password; omitted
  59. // when adding the first password to a passwordless account.
  60. string current_password = 2 [(buf.validate.field).string.max_len = 128];
  61. }
  62. // Result of updating or adding the authenticated account password.
  63. message UpdatePasswordResponse {
  64. // Current authenticated user profile after the password update.
  65. User user = 1;
  66. }
  67. // Request to update the authenticated user's display preferences. Omitted
  68. // fields are left unchanged. An empty timezone clears the explicit timezone.
  69. message UpdateSettingsRequest {
  70. // IANA timezone override. Empty clears the override.
  71. optional string timezone = 1;
  72. // Preferred time format.
  73. optional TimeFormat time_format = 2;
  74. }
  75. // Result of updating display preferences.
  76. message UpdateSettingsResponse {
  77. // Stored settings after merging the request.
  78. UserSettings settings = 1;
  79. }
  80. // Request a short-lived confirmation token for deleting the authenticated
  81. // account.
  82. message RequestAccountDeletionRequest {}
  83. // Result of issuing an account deletion confirmation token.
  84. message RequestAccountDeletionResponse {
  85. // Confirmation token. Clients must pass this to DeleteMyAccount.
  86. string confirmation_token = 1;
  87. }
  88. // Request to permanently delete the authenticated account.
  89. message DeleteMyAccountRequest {
  90. // Confirmation token obtained from RequestAccountDeletion.
  91. string confirmation_token = 1;
  92. }
  93. // Result of deleting the authenticated account.
  94. message DeleteMyAccountResponse {
  95. // True when the account was deleted.
  96. bool deleted = 1;
  97. }
  98. // Self-service account, profile, avatar, display preference, presence,
  99. // custom-status, external identity, and account lifecycle commands for the
  100. // authenticated user.
  101. service MyAccountService {
  102. // Updates the authenticated user's login, display name, and/or bio.
  103. rpc UpdateProfile(UpdateProfileRequest) returns (UpdateProfileResponse);
  104. // Uploads and sets the authenticated user's avatar.
  105. rpc UploadAvatar(UploadAvatarRequest) returns (UploadAvatarResponse);
  106. // Deletes the authenticated user's avatar. The call is idempotent.
  107. rpc DeleteAvatar(DeleteAvatarRequest) returns (DeleteAvatarResponse) {
  108. option idempotency_level = IDEMPOTENT;
  109. }
  110. // Updates or adds the authenticated user's password.
  111. rpc UpdatePassword(UpdatePasswordRequest) returns (UpdatePasswordResponse);
  112. // Updates the authenticated user's display preferences.
  113. rpc UpdateSettings(UpdateSettingsRequest) returns (UpdateSettingsResponse);
  114. // Lists configured external identity providers and identities linked to the
  115. // authenticated account.
  116. rpc ListExternalIdentities(ListExternalIdentitiesRequest) returns (ListExternalIdentitiesResponse);
  117. // Creates a short-lived browser handoff URL for linking a provider identity
  118. // to the authenticated account. The provider callback completes through
  119. // chatto.auth.v1.ExternalIdentityAuthService.ConfirmExternalIdentityLink.
  120. rpc StartExternalIdentityLink(StartExternalIdentityLinkRequest) returns (StartExternalIdentityLinkResponse);
  121. // Disconnects a provider identity from the authenticated account.
  122. rpc DisconnectExternalIdentity(DisconnectExternalIdentityRequest) returns (DisconnectExternalIdentityResponse);
  123. // Updates the current user's live presence status. This state is transient:
  124. // clients should refresh it periodically while visible, and should stop
  125. // calling this RPC when the user chooses to appear offline.
  126. rpc UpdatePresence(UpdatePresenceRequest) returns (UpdatePresenceResponse);
  127. // Updates or replaces the current user's custom status. Emoji and text are
  128. // required, and expires_at must be omitted or in the future.
  129. rpc UpdateCustomStatus(UpdateCustomStatusRequest) returns (UpdateCustomStatusResponse);
  130. // Deletes the current user's custom status. The call is idempotent and returns
  131. // the resulting empty status state.
  132. rpc DeleteCustomStatus(DeleteCustomStatusRequest) returns (DeleteCustomStatusResponse) {
  133. option idempotency_level = IDEMPOTENT;
  134. }
  135. // Issues a short-lived token used to confirm self-deletion. Requires
  136. // user.delete-self.
  137. rpc RequestAccountDeletion(RequestAccountDeletionRequest) returns (RequestAccountDeletionResponse);
  138. // Permanently deletes the authenticated account after token validation.
  139. // Requires user.delete-self.
  140. rpc DeleteMyAccount(DeleteMyAccountRequest) returns (DeleteMyAccountResponse);
  141. }