account.proto 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. // Whether the stored time zone may appear on the user's public profile.
  75. optional bool share_timezone = 3;
  76. }
  77. // Result of updating display preferences.
  78. message UpdateSettingsResponse {
  79. // Stored settings after merging the request.
  80. UserSettings settings = 1;
  81. }
  82. // Request a short-lived confirmation token for deleting the authenticated
  83. // account.
  84. message RequestAccountDeletionRequest {}
  85. // Result of issuing an account deletion confirmation token.
  86. message RequestAccountDeletionResponse {
  87. // Confirmation token. Clients must pass this to DeleteMyAccount.
  88. string confirmation_token = 1;
  89. }
  90. // Request to permanently delete the authenticated account.
  91. message DeleteMyAccountRequest {
  92. // Confirmation token obtained from RequestAccountDeletion.
  93. string confirmation_token = 1;
  94. }
  95. // Result of deleting the authenticated account.
  96. message DeleteMyAccountResponse {
  97. // True when the account was deleted.
  98. bool deleted = 1;
  99. }
  100. // Self-service account, profile, avatar, display preference, presence,
  101. // custom-status, external identity, and account lifecycle commands for the
  102. // authenticated user.
  103. service MyAccountService {
  104. // Updates the authenticated user's login, display name, and/or bio.
  105. rpc UpdateProfile(UpdateProfileRequest) returns (UpdateProfileResponse);
  106. // Uploads and sets the authenticated user's avatar.
  107. rpc UploadAvatar(UploadAvatarRequest) returns (UploadAvatarResponse);
  108. // Deletes the authenticated user's avatar. The call is idempotent.
  109. rpc DeleteAvatar(DeleteAvatarRequest) returns (DeleteAvatarResponse) {
  110. option idempotency_level = IDEMPOTENT;
  111. }
  112. // Updates or adds the authenticated user's password.
  113. rpc UpdatePassword(UpdatePasswordRequest) returns (UpdatePasswordResponse);
  114. // Updates the authenticated user's display preferences.
  115. rpc UpdateSettings(UpdateSettingsRequest) returns (UpdateSettingsResponse);
  116. // Lists configured external identity providers and identities linked to the
  117. // authenticated account.
  118. rpc ListExternalIdentities(ListExternalIdentitiesRequest) returns (ListExternalIdentitiesResponse);
  119. // Creates a short-lived browser handoff URL for linking a provider identity
  120. // to the authenticated account. The provider callback completes through
  121. // chatto.auth.v1.ExternalIdentityAuthService.ConfirmExternalIdentityLink.
  122. rpc StartExternalIdentityLink(StartExternalIdentityLinkRequest) returns (StartExternalIdentityLinkResponse);
  123. // Disconnects a provider identity from the authenticated account.
  124. rpc DisconnectExternalIdentity(DisconnectExternalIdentityRequest) returns (DisconnectExternalIdentityResponse);
  125. // Updates the current user's live presence status. This state is transient:
  126. // clients should refresh it periodically while visible, and should stop
  127. // calling this RPC when the user chooses to appear offline.
  128. rpc UpdatePresence(UpdatePresenceRequest) returns (UpdatePresenceResponse);
  129. // Updates or replaces the current user's custom status. Emoji and text are
  130. // required, and expires_at must be omitted or in the future.
  131. rpc UpdateCustomStatus(UpdateCustomStatusRequest) returns (UpdateCustomStatusResponse);
  132. // Deletes the current user's custom status. The call is idempotent and returns
  133. // the resulting empty status state.
  134. rpc DeleteCustomStatus(DeleteCustomStatusRequest) returns (DeleteCustomStatusResponse) {
  135. option idempotency_level = IDEMPOTENT;
  136. }
  137. // Issues a short-lived token used to confirm self-deletion. Requires
  138. // user.delete-self.
  139. rpc RequestAccountDeletion(RequestAccountDeletionRequest) returns (RequestAccountDeletionResponse);
  140. // Permanently deletes the authenticated account after token validation.
  141. // Requires user.delete-self.
  142. rpc DeleteMyAccount(DeleteMyAccountRequest) returns (DeleteMyAccountResponse);
  143. }