syntax = "proto3"; package protocol.chat.v1; import "harmonytypes/v1/types.proto"; import "chat/v1/channels.proto"; import "chat/v1/guilds.proto"; import "chat/v1/messages.proto"; import "chat/v1/permissions.proto"; import "emote/v1/stream.proto"; import "profile/v1/stream.proto"; option go_package = "github.com/harmony-development/legato/gen/chat/v1"; // Request type for use in the `StreamEvents` endpoint. // By default, this endpoint will subscribe to all events. // Any guilds joined in the future will be added to the subscription as well. // Use the UnsubscribeFromAll event for unsubscribing from all current subscriptions and disable the automatic guild subscriptions message StreamEventsRequest { // Event source for guilds' events. message SubscribeToGuild { // the guild id to subscribe to uint64 guild_id = 1; } // Event source for actions' events. message SubscribeToActions {} // Event source for homeserver events. message SubscribeToHomeserverEvents {} // Event to unsubscribe from all events. message UnsubscribeFromAll {} // Describes which event source to subscribe to. oneof request { // Subscribe to the guild event source. SubscribeToGuild subscribe_to_guild = 1; // Subscribe to the action event source. SubscribeToActions subscribe_to_actions = 2; // Subscribe to the homeserver event source. SubscribeToHomeserverEvents subscribe_to_homeserver_events = 3; // Unsubscribe from all events. UnsubscribeFromAll unsubscribe_from_all = 4; } } // Used in the `StreamEvents` endpoint. message StreamEventsResponse { // Possible events. oneof event { // A chat event. StreamEvent chat = 1; // A emote event. emote.v1.StreamEvent emote = 2; // A profile event. profile.v1.StreamEvent profile = 3; } } // Describes an event. message StreamEvent { // Event sent when a new message is sent. message MessageSent { // ID that is sent by your client it can use to confirm that the message is sent. optional uint64 echo_id = 1; // Guild ID of the guild where this event happened. uint64 guild_id = 2; // Channel ID of the channel where this event happened. uint64 channel_id = 3; // Message ID of the message that was updated. uint64 message_id = 4; // The actual message. Message message = 5; } // Event sent when a message's text content is updated. message MessageUpdated { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // Channel ID of the channel where this event happened. uint64 channel_id = 2; // Message ID of the message that was updated. uint64 message_id = 3; // When this message was edited, in milliseconds since unix epoch uint64 edited_at = 4; // New message content. chat.v1.FormattedText new_content = 5; } // Event sent when a message is deleted. message MessageDeleted { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // Channel ID of the channel where this event happened. uint64 channel_id = 2; // Message ID of the message that was deleted. uint64 message_id = 3; } // Event sent when a new channel is created. message ChannelCreated { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // Channel ID of the channel where this event happened. uint64 channel_id = 2; // Name of this channel. string name = 3; // The position in the channel list. harmonytypes.v1.ItemPosition position = 4; // The kind of this channel. chat.v1.ChannelKind kind = 5; // Metadata for this channel. optional harmonytypes.v1.Metadata metadata = 6; } // Event sent when a channel's information is changed. message ChannelUpdated { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // Channel ID of the channel that was changed. uint64 channel_id = 2; // The new name of the channel. optional string new_name = 3; // The new metadata of the channel. optional harmonytypes.v1.Metadata new_metadata = 4; } // Event sent when a channel's position in the channel list is changed. message ChannelPositionUpdated { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // Channel ID of the channel that was changed. uint64 channel_id = 2; // The new position of the channel. optional harmonytypes.v1.ItemPosition new_position = 3; } // Event sent when all channels have been reordered message ChannelsReordered { // guild_id: the guild whose channels are being reordered uint64 guild_id = 2; // channel_ids: the new order of channel IDs repeated uint64 channel_ids = 1; } // Event sent when a channel is deleted. message ChannelDeleted { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // Channel ID of the channel that was deleted. uint64 channel_id = 2; } // Event sent when a guild's information is changed. message GuildUpdated { // Guild ID of the guild that was changed. uint64 guild_id = 1; // The new name of the guild. optional string new_name = 2; // The new picture of the guild. optional string new_picture = 3; // The new metadata of the guild. optional harmonytypes.v1.Metadata new_metadata = 4; } // Event sent when a guild is deleted. message GuildDeleted { // Guild ID of the guild that was deleted. uint64 guild_id = 1; } // Event sent a user joins to a guild. message MemberJoined { // Member ID of the member that joined the guild. uint64 member_id = 1; // Guild ID of the guild where this event happened. uint64 guild_id = 2; } // Event sent when a member of a guild leaves said guild for whatever reason. message MemberLeft { // User ID of the member that left the guild. uint64 member_id = 1; // Guild ID of the guild where this event happened. uint64 guild_id = 2; // Why this member left the guild. chat.v1.LeaveReason leave_reason = 3; } // Event sent when you join a new guild. message GuildAddedToList { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // The homeserver this guild is on. string homeserver = 2; } // Event sent when you leave a guild. message GuildRemovedFromList { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // The homeserver this guild is on. string homeserver = 2; } // Event sent when an action is performed. message ActionPerformed { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // Channel ID of the channel where this event happened. uint64 channel_id = 2; // Message ID where this event happened. uint64 message_id = 3; // User ID of the user that triggered the action uint64 user_id = 4; // The action data payload ActionPayload payload = 5; } // Event sent when a role's position in the role list is changed. message RoleMoved { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // Role ID of the role that was moved. uint64 role_id = 2; // New position of the role. harmonytypes.v1.ItemPosition new_position = 3; } // Event sent when a role is deleted. message RoleDeleted { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // Role ID of the role that was deleted. uint64 role_id = 2; } // Event sent when a role is created. message RoleCreated { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // Role ID of the role that was created. uint64 role_id = 2; // The name of the role. string name = 3; // The color of the role. int32 color = 4; // The hoist status of the role. bool hoist = 5; // The pingable status of the role. bool pingable = 6; } // Event sent when a role's information is changed. message RoleUpdated { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // Role ID of the role that was changed. uint64 role_id = 2; // The new name of the role. optional string new_name = 3; // The new color of the role. optional int32 new_color = 4; // The new hoist status of the role. optional bool new_hoist = 5; // The new pingable status of the role. optional bool new_pingable = 6; } // Event sent when a role's permissions are changed. // // This event will only be sent to users with the "guild.manage" permission. message RolePermissionsUpdated { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // Channel ID of the channel where this event happened. optional uint64 channel_id = 2; // Role ID of the role that had it's permissions changed. uint64 role_id = 3; // The new permissions. repeated chat.v1.Permission new_perms = 4; } // Event sent when a user's roles are changed. message UserRolesUpdated { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // User ID of the user that had it's roles changed. uint64 user_id = 2; // The new role IDs. repeated uint64 new_role_ids = 3; } // Event sent when a user sends a typing notification in a guild channel. message Typing { // User ID of the user that sent the typing notification. uint64 user_id = 1; // Guild ID of the guild where this event happened. uint64 guild_id = 2; // Channel ID of the channel where this event happened. uint64 channel_id = 3; } // Event sent when a permission is changed that matters to you. // // Servers should calculate which users to send this event to when a permission is set. // It should only be sent if a user is subscribed to the guild the permission pertains to. message PermissionUpdated { // Guild ID of the guild where this event happened. uint64 guild_id = 1; // Channel ID of the channel where this event happened. optional uint64 channel_id = 2; // The permission node that was changed. string query = 3; // Whether you have the permission or not. bool ok = 4; } // Sent when a message is pinned in a guild channel. // // Should only be sent to users who have the "message.view" permission for // the guild channel where the message was pinned. message MessagePinned { // Guild ID of the guild where this event occured. uint64 guild_id = 1; // Channel ID of the channel where this event occured. uint64 channel_id = 2; // Message ID of the message that was pinned. uint64 message_id = 3; } // Sent when a message is unpinned in a guild channel. // // Should only be sent to users who have the "message.view" permission for // the guild channel where the message was unpinned. message MessageUnpinned { // Guild ID of the guild where this event occured. uint64 guild_id = 1; // Channel ID of the channel where this event occured. uint64 channel_id = 2; // Message ID of the message that was unpinned. uint64 message_id = 3; } // Sent when a message's reaction is changed. message ReactionUpdated { // Guild ID of the guild where this event occured. uint64 guild_id = 1; // Channel ID of the channel where this event occured. uint64 channel_id = 2; // Message ID of the message that had a reaction updated. uint64 message_id = 3; // The reaction. chat.v1.Reaction reaction = 4; } // Sent when there's a new owner. message OwnerAdded { // User ID of the new owner. uint64 user_id = 1; } // Sent when an owner gives up their ownership. message OwnerRemoved { // User ID of the user who is no longer owner. uint64 user_id = 1; } // Sent when a guild invite is received. message InviteReceived { // ID of the invite received. string invite_id = 1; // Server ID of the server the inviter is on. optional string server_id = 2; // User ID of the inviter. uint64 inviter_id = 3; } // Sent when a guild invite is rejected by the invitee. message InviteRejected { // Guild ID of the guild that this occured for. uint64 guild_id = 1; // ID of the invite rejected. string invite_id = 2; // User ID of the invitee. uint64 user_id = 3; } // Which event to send. oneof event { // Send the guild added to list event. GuildAddedToList guild_added_to_list = 1; // Send the guild removed from list event. GuildRemovedFromList guild_removed_from_list = 2; // Send the action performed event. ActionPerformed action_performed = 3; // Send the message sent event. MessageSent sent_message = 4; // Send the message updated event. MessageUpdated edited_message = 5; // Send the message deleted event. MessageDeleted deleted_message = 6; // Send the channel created event. ChannelCreated created_channel = 7; // Send the channel updated event. ChannelUpdated edited_channel = 8; // Send the channel deleted event. ChannelDeleted deleted_channel = 9; // Send the guild updated event. GuildUpdated edited_guild = 10; // Send the guild deleted event. GuildDeleted deleted_guild = 11; // Send the member joined event. MemberJoined joined_member = 12; // Send the member left event. MemberLeft left_member = 13; // Send the typing event. Typing typing = 14; // Send the role created event. RoleCreated role_created = 15; // Send the role deleted event. RoleDeleted role_deleted = 16; // Send the role moved event. RoleMoved role_moved = 17; // Send the role updated event. RoleUpdated role_updated = 18; // Send the role perms updated event. RolePermissionsUpdated role_perms_updated = 19; // Send the user roles updated event. UserRolesUpdated user_roles_updated = 20; // Send the permission updated event. PermissionUpdated permission_updated = 21; // The channels have been completely reordered. ChannelsReordered channels_reordered = 22; // Send the channel position updated event. ChannelPositionUpdated edited_channel_position = 23; // Send the message pinned event. MessagePinned message_pinned = 24; // Send the message unpinned event. MessageUnpinned message_unpinned = 25; // Send the reaction updated event. ReactionUpdated reaction_updated = 26; // Send the owner added event. OwnerAdded owner_added = 27; // Send the owner removed event. OwnerRemoved owner_removed = 28; // Send the guild invite received event. InviteReceived invite_received = 29; // Send the guild invite rejected event. InviteRejected invite_rejected = 30; } }