account.proto 6.2 KB

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