common.proto 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. syntax = "proto3";
  2. package chatto.api.v1;
  3. import "buf/validate/validate.proto";
  4. // Fit mode used when generating transformed image URLs.
  5. enum ImageFitMode {
  6. // The fit mode was not specified.
  7. IMAGE_FIT_MODE_UNSPECIFIED = 0;
  8. // Preserve the whole source image within the requested bounds.
  9. IMAGE_FIT_MODE_CONTAIN = 1;
  10. // Fill the requested bounds, cropping when needed.
  11. IMAGE_FIT_MODE_COVER = 2;
  12. }
  13. // Policy governing thread creation and reply placement in a channel room.
  14. // Direct-message rooms do not support threads and use UNSPECIFIED.
  15. enum RoomThreadingMode {
  16. // No mode was supplied. CreateRoom treats this as ENABLED so older stored
  17. // rooms and omitted request fields preserve Chatto's default behavior.
  18. ROOM_THREADING_MODE_UNSPECIFIED = 0;
  19. // Every new root message establishes a thread, and replies to root messages
  20. // must be posted in that root's thread.
  21. ROOM_THREADING_MODE_REQUIRED = 1;
  22. // Clients should steer replies into threads, but the server accepts both
  23. // threaded and ordinary in-room replies.
  24. ROOM_THREADING_MODE_ENCOURAGED = 2;
  25. // Threads are available and clients may freely choose whether to use them.
  26. ROOM_THREADING_MODE_ENABLED = 3;
  27. // New threads, thread replies, and channel echoes are rejected. Existing
  28. // threads and echoes remain readable and ordinary in-room reply attribution
  29. // remains available.
  30. ROOM_THREADING_MODE_DISABLED = 4;
  31. }
  32. // Image transform parameters for generated image URLs.
  33. message ImageTransformOptions {
  34. // Target image width in pixels.
  35. int32 width = 1 [(buf.validate.field).int32 = {
  36. gte: 1
  37. lte: 4096
  38. }];
  39. // Target image height in pixels.
  40. int32 height = 2 [(buf.validate.field).int32 = {
  41. gte: 1
  42. lte: 4096
  43. }];
  44. // Image crop/fit behavior.
  45. ImageFitMode fit = 3 [(buf.validate.field).enum.defined_only = true];
  46. }
  47. // Browser-supplied image upload payload.
  48. message ImageUpload {
  49. // Raw image bytes.
  50. bytes image = 1;
  51. // Original browser filename, for diagnostics and future compatibility.
  52. string filename = 2;
  53. // Browser-provided content type, for diagnostics and future compatibility.
  54. string content_type = 3;
  55. }
  56. // Public login/provider metadata shared by discovery and account-linking APIs.
  57. message ProviderMetadata {
  58. // Stable configured provider ID.
  59. string id = 1;
  60. // Provider type, such as "password", "oidc", "github", or "discord".
  61. string type = 2;
  62. // Human-readable provider label.
  63. string label = 3;
  64. // URL that starts login for this provider.
  65. string login_url = 4;
  66. // OIDC issuer URL. Absent for providers that do not use OpenID Connect.
  67. // Clients can compare this value with their own trusted issuer selection;
  68. // the server does not select the client's identity provider.
  69. optional string issuer_url = 5;
  70. // Whether an unlinked identity may create a new account through this provider.
  71. optional bool auto_provision = 6;
  72. }