account.proto 6.1 KB

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