member_directory.proto 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. syntax = "proto3";
  2. package chatto.api.v1;
  3. import "buf/validate/validate.proto";
  4. import "chatto/api/v1/pagination.proto";
  5. import "chatto/api/v1/presence.proto";
  6. import "chatto/api/v1/users.proto";
  7. import "google/protobuf/timestamp.proto";
  8. // Public user/member row used by user directory, room membership, and mention
  9. // surfaces.
  10. message DirectoryMember {
  11. // Public user fields.
  12. User user = 1;
  13. // Explicit roles assigned to the user. Member listings include the virtual
  14. // `everyone` role for parity with Chatto's permission model.
  15. repeated string roles = 2;
  16. // Account creation time when known.
  17. google.protobuf.Timestamp created_at = 3;
  18. }
  19. // Request for members of one room.
  20. message ListMembersRequest {
  21. reserved 3, 4;
  22. reserved "limit", "offset";
  23. // Required. Room whose effective members should be listed. Existing members
  24. // and room.manage holders may list a channel room; other nonmembers need both
  25. // room.list and room.join.
  26. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  27. // Optional case-insensitive search against login and display name.
  28. string search = 2 [(buf.validate.field).string.max_len = 100];
  29. // Defaults to 250 results when absent or limit is zero. Maximum: 500.
  30. PageRequest page = 5;
  31. // Optional status filter applied before pagination. Empty means all statuses.
  32. // Select ONLINE, AWAY, and DO_NOT_DISTURB for all connected members.
  33. // Presence can change between pages; use realtime updates to keep it current.
  34. repeated PresenceStatus presence_statuses = 6 [(buf.validate.field).repeated = {
  35. max_items: 4
  36. unique: true
  37. items: {enum: {defined_only: true, not_in: [0]}}
  38. }];
  39. }
  40. // Room membership IDs. Resolve profiles with UserService.BatchGetUsers.
  41. // Empty searches do not read user profiles. Search results require profile
  42. // reads to match names. Both paths use ascending user ID order.
  43. message ListMembersResponse {
  44. reserved 1, 2, 3;
  45. reserved "members", "total_count", "has_more";
  46. // Current member IDs in ascending order. Missing or deleted users are omitted.
  47. repeated string user_ids = 5;
  48. // Page metadata for the members that match both filters.
  49. PageInfo page = 4;
  50. }
  51. // Request one member of one room by stable user ID.
  52. message GetMemberRequest {
  53. // Required room ID.
  54. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  55. // Required target user ID.
  56. string user_id = 2 [(buf.validate.field).string.min_len = 1];
  57. }
  58. // Room member response.
  59. message GetMemberResponse {
  60. // Requested room member.
  61. DirectoryMember member = 1;
  62. }
  63. // Request room member rows for a set of stable user IDs.
  64. message BatchGetMembersRequest {
  65. // Required room ID.
  66. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  67. // Required target user IDs. Unknown IDs and users that are not members of the
  68. // room are omitted from the response.
  69. repeated string user_ids = 2 [(buf.validate.field).repeated = {
  70. min_items: 1
  71. max_items: 100
  72. items: {
  73. string: {min_len: 1}
  74. }
  75. }];
  76. }
  77. // Batch room member response.
  78. message BatchGetMembersResponse {
  79. // Found members. The server preserves first-seen request order and
  80. // de-duplicates repeated IDs.
  81. repeated DirectoryMember members = 1;
  82. }