reactions.proto 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. syntax = "proto3";
  2. package chatto.api.v1;
  3. import "buf/validate/validate.proto";
  4. import "chatto/api/v1/message_types.proto";
  5. import "chatto/api/v1/pagination.proto";
  6. // Request to add the current user's reaction to a message.
  7. //
  8. // When `message_event_id` names a channel echo of a thread reply, the server
  9. // treats it as an alias for the original thread reply and stores the reaction
  10. // on that original event. The server returns `RESOURCE_EXHAUSTED` when the
  11. // current user already has 20 distinct emoji reactions on the canonical
  12. // message; adding an emoji that already exists remains an idempotent success.
  13. message AddReactionRequest {
  14. // Required. Room containing the message event.
  15. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  16. // Required. Event ID of the message being reacted to, or a channel echo of
  17. // the message.
  18. string message_event_id = 2 [(buf.validate.field).string.min_len = 1];
  19. // Required. Emoji shortcode name, such as "thumbsup" or "heart".
  20. string emoji = 3 [(buf.validate.field).string.min_len = 1];
  21. }
  22. // Result of adding a reaction.
  23. message AddReactionResponse {
  24. // True when the reaction was newly added, false when it already existed.
  25. bool added = 1;
  26. // Updated aggregate reaction state for this emoji.
  27. MessageReaction reaction = 2;
  28. }
  29. // Request to remove the current user's reaction from a message.
  30. //
  31. // When `message_event_id` names a channel echo of a thread reply, the server
  32. // treats it as an alias for the original thread reply and removes the reaction
  33. // from that original event.
  34. message RemoveReactionRequest {
  35. // Required. Room containing the message event.
  36. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  37. // Required. Event ID of the message whose reaction should be removed, or a
  38. // channel echo of the message.
  39. string message_event_id = 2 [(buf.validate.field).string.min_len = 1];
  40. // Required. Emoji shortcode name, such as "thumbsup" or "heart".
  41. string emoji = 3 [(buf.validate.field).string.min_len = 1];
  42. }
  43. // Result of removing a reaction.
  44. message RemoveReactionResponse {
  45. // True when the reaction was removed, false when it did not exist.
  46. bool removed = 1;
  47. // Updated aggregate reaction state for this emoji. Empty when no reactions for
  48. // the emoji remain.
  49. MessageReaction reaction = 2;
  50. }
  51. // Request all users with one emoji reaction on a message. Echo IDs resolve to
  52. // the original message. Users are ordered by user ID ascending.
  53. message ListReactionUsersRequest {
  54. // Room containing the message.
  55. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  56. // Message or channel echo ID.
  57. string message_event_id = 2 [(buf.validate.field).string.min_len = 1];
  58. // Emoji shortcode, such as "thumbsup".
  59. string emoji = 3 [(buf.validate.field).string.min_len = 1];
  60. // Defaults to 50 results. Maximum: 100. Zero uses the default.
  61. PageRequest page = 4;
  62. }
  63. // Complete reaction membership is available by paging this collection.
  64. message ListReactionUsersResponse {
  65. // User IDs in this page. Use UserService.BatchGetUsers for profiles.
  66. repeated string user_ids = 1;
  67. // Count and continuation for the matching reaction users.
  68. PageInfo page = 2;
  69. }