reactions.proto 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. syntax = "proto3";
  2. package chatto.api.v1;
  3. import "buf/validate/validate.proto";
  4. import "chatto/api/v1/message_types.proto";
  5. // Request to add the current user's reaction to a message.
  6. //
  7. // When `message_event_id` names a channel echo of a thread reply, the server
  8. // treats it as an alias for the original thread reply and stores the reaction
  9. // on that original event. The server returns `RESOURCE_EXHAUSTED` when the
  10. // current user already has 20 distinct emoji reactions on the canonical
  11. // message; adding an emoji that already exists remains an idempotent success.
  12. message AddReactionRequest {
  13. // Required. Room containing the message event.
  14. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  15. // Required. Event ID of the message being reacted to, or a channel echo of
  16. // the message.
  17. string message_event_id = 2 [(buf.validate.field).string.min_len = 1];
  18. // Required. Emoji shortcode name, such as "thumbsup" or "heart".
  19. string emoji = 3 [(buf.validate.field).string.min_len = 1];
  20. }
  21. // Result of adding a reaction.
  22. message AddReactionResponse {
  23. // True when the reaction was newly added, false when it already existed.
  24. bool added = 1;
  25. // Updated aggregate reaction state for this emoji.
  26. MessageReaction reaction = 2;
  27. }
  28. // Request to remove the current user's reaction from a message.
  29. //
  30. // When `message_event_id` names a channel echo of a thread reply, the server
  31. // treats it as an alias for the original thread reply and removes the reaction
  32. // from that original event.
  33. message RemoveReactionRequest {
  34. // Required. Room containing the message event.
  35. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  36. // Required. Event ID of the message whose reaction should be removed, or a
  37. // channel echo of the message.
  38. string message_event_id = 2 [(buf.validate.field).string.min_len = 1];
  39. // Required. Emoji shortcode name, such as "thumbsup" or "heart".
  40. string emoji = 3 [(buf.validate.field).string.min_len = 1];
  41. }
  42. // Result of removing a reaction.
  43. message RemoveReactionResponse {
  44. // True when the reaction was removed, false when it did not exist.
  45. bool removed = 1;
  46. // Updated aggregate reaction state for this emoji. Empty when no reactions for
  47. // the emoji remain.
  48. MessageReaction reaction = 2;
  49. }