diff --git a/src/params.ts b/src/params.ts index 56d44e3..a553bbd 100644 --- a/src/params.ts +++ b/src/params.ts @@ -1,3 +1,3 @@ // This file was auto-generated by @insertish/oapi! -export const pathResolve = {"1":[[""],["stats"]],"2":[["users","@me"],["users",["{target}"]],["users","dms"],["users","friend"],["bots","create"],["bots",["{target}"]],["bots","@me"],["channels",["{target}"]],["channels","create"],["servers","create"],["servers",["{target}"]],["invites",["{target}"]],["safety","reports"],["safety","report"],["onboard","hello"],["onboard","complete"],["push","subscribe"],["push","unsubscribe"],["sync","unreads"]],"3":[["users",["{target}"],"flags"],["users","@me","username"],["users",["{target}"],"default_avatar"],["users",["{target}"],"profile"],["users",["{target}"],"dm"],["users",["{target}"],"mutual"],["users",["{target}"],"friend"],["users",["{target}"],"block"],["bots",["{target}"],"invite"],["channels",["{target}"],"members"],["channels",["{target}"],"invites"],["channels",["{target}"],"messages"],["channels",["{target}"],"search"],["channels",["{target}"],"join_call"],["servers",["{target}"],"ack"],["servers",["{target}"],"channels"],["servers",["{target}"],"members"],["servers",["{target}"],"bans"],["servers",["{target}"],"invites"],["servers",["{target}"],"roles"],["servers",["{target}"],"emojis"],["custom","emoji",["{id}"]],["safety","reports",["{report}"]],["safety","report",["{id}"]],["safety","snapshot",["{report_id}"]],["auth","account","create"],["auth","account","reverify"],["auth","account","delete"],["auth","account",""],["auth","account","disable"],["auth","account","reset_password"],["auth","session","login"],["auth","session","logout"],["auth","session","all"],["auth","session",["{id}"]],["auth","mfa","ticket"],["auth","mfa",""],["auth","mfa","recovery"],["auth","mfa","methods"],["auth","mfa","totp"],["sync","settings","fetch"],["sync","settings","set"]],"4":[["channels",["{target}"],"ack",["{message}"]],["channels",["{_target}"],"messages","stale"],["channels",["{target}"],"messages",["{msg}"]],["channels",["{target}"],"messages","bulk"],["channels",["{target}"],"recipients",["{member}"]],["channels",["{target}"],"permissions",["{role_id}"]],["channels",["{target}"],"permissions","default"],["servers",["{target}"],"members",["{member}"]],["servers",["{server}"],"members",["{target}"]],["servers",["{server}"],"bans",["{target}"]],["servers",["{target}"],"roles",["{role_id}"]],["servers",["{target}"],"permissions",["{role_id}"]],["servers",["{target}"],"permissions","default"],["auth","account","change","password"],["auth","account","change","email"],["auth","account","verify",["{code}"]]],"5":[["channels",["{target}"],"messages",["{msg}"],"reactions"]],"6":[["channels",["{target}"],"messages",["{msg}"],"reactions",["{emoji}"]]]}; -export const queryParams = {"/":{"get":[]},"/stats":{"get":[]},"/users/@me":{"get":[],"patch":[]},"/users/{target}":{"get":[]},"/users/{target}/flags":{"get":[]},"/users/@me/username":{"patch":[]},"/users/{target}/default_avatar":{"get":[]},"/users/{target}/profile":{"get":[]},"/users/dms":{"get":[]},"/users/{target}/dm":{"get":[]},"/users/{target}/mutual":{"get":[]},"/users/{target}/friend":{"put":[],"delete":[]},"/users/{target}/block":{"put":[],"delete":[]},"/users/friend":{"post":[]},"/bots/create":{"post":[]},"/bots/{target}/invite":{"get":[],"post":[]},"/bots/{target}":{"get":[],"delete":[],"patch":[]},"/bots/@me":{"get":[]},"/channels/{target}/ack/{message}":{"put":[]},"/channels/{target}":{"get":[],"delete":["leave_silently"],"patch":[]},"/channels/{target}/members":{"get":[]},"/channels/{target}/invites":{"post":[]},"/channels/{target}/messages":{"get":["limit","before","after","sort","nearby","include_users"],"post":[]},"/channels/{target}/search":{"post":[]},"/channels/{_target}/messages/stale":{"post":[]},"/channels/{target}/messages/{msg}":{"get":[],"delete":[],"patch":[]},"/channels/{target}/messages/bulk":{"delete":[]},"/channels/create":{"post":[]},"/channels/{target}/recipients/{member}":{"put":[],"delete":[]},"/channels/{target}/join_call":{"post":[]},"/channels/{target}/permissions/{role_id}":{"put":[]},"/channels/{target}/permissions/default":{"put":[]},"/channels/{target}/messages/{msg}/reactions/{emoji}":{"put":[],"delete":["user_id","remove_all"]},"/channels/{target}/messages/{msg}/reactions":{"delete":[]},"/servers/create":{"post":[]},"/servers/{target}":{"get":[],"delete":["leave_silently"],"patch":[]},"/servers/{target}/ack":{"put":[]},"/servers/{target}/channels":{"post":[]},"/servers/{target}/members":{"get":["exclude_offline"]},"/servers/{target}/members/{member}":{"get":[],"delete":[]},"/servers/{server}/members/{target}":{"patch":[]},"/servers/{server}/bans/{target}":{"put":[],"delete":[]},"/servers/{target}/bans":{"get":[]},"/servers/{target}/invites":{"get":[]},"/servers/{target}/roles":{"post":[]},"/servers/{target}/roles/{role_id}":{"delete":[],"patch":[]},"/servers/{target}/permissions/{role_id}":{"put":[]},"/servers/{target}/permissions/default":{"put":[]},"/servers/{target}/emojis":{"get":[]},"/invites/{target}":{"get":[],"post":[],"delete":[]},"/custom/emoji/{id}":{"get":[],"put":[],"delete":[]},"/safety/reports/{report}":{"patch":[]},"/safety/report/{id}":{"get":[]},"/safety/reports":{"get":[]},"/safety/report":{"post":[]},"/safety/snapshot/{report_id}":{"get":[]},"/auth/account/create":{"post":[]},"/auth/account/reverify":{"post":[]},"/auth/account/delete":{"put":[],"post":[]},"/auth/account/":{"get":[]},"/auth/account/disable":{"post":[]},"/auth/account/change/password":{"patch":[]},"/auth/account/change/email":{"patch":[]},"/auth/account/verify/{code}":{"post":[]},"/auth/account/reset_password":{"post":[],"patch":[]},"/auth/session/login":{"post":[]},"/auth/session/logout":{"post":[]},"/auth/session/all":{"get":[],"delete":["revoke_self"]},"/auth/session/{id}":{"delete":[],"patch":[]},"/auth/mfa/ticket":{"put":[]},"/auth/mfa/":{"get":[]},"/auth/mfa/recovery":{"post":[],"patch":[]},"/auth/mfa/methods":{"get":[]},"/auth/mfa/totp":{"put":[],"post":[],"delete":[]},"/onboard/hello":{"get":[]},"/onboard/complete":{"post":[]},"/push/subscribe":{"post":[]},"/push/unsubscribe":{"post":[]},"/sync/settings/fetch":{"post":[]},"/sync/settings/set":{"post":["timestamp"]},"/sync/unreads":{"get":[]}}; \ No newline at end of file +export const pathResolve = {"1":[[""]],"2":[["admin","stats"],["admin","messages"],["users","@me"],["users",["{target}"]],["users","dms"],["users","friend"],["bots","create"],["bots",["{target}"]],["bots","@me"],["channels",["{target}"]],["channels","create"],["servers","create"],["servers",["{target}"]],["invites",["{target}"]],["safety","reports"],["safety","report"],["onboard","hello"],["onboard","complete"],["push","subscribe"],["push","unsubscribe"],["sync","unreads"]],"3":[["users",["{target}"],"flags"],["users","@me","username"],["users",["{target}"],"default_avatar"],["users",["{target}"],"profile"],["users",["{target}"],"dm"],["users",["{target}"],"mutual"],["users",["{target}"],"friend"],["users",["{target}"],"block"],["bots",["{target}"],"invite"],["channels",["{target}"],"members"],["channels",["{target}"],"invites"],["channels",["{target}"],"messages"],["channels",["{target}"],"search"],["channels",["{target}"],"join_call"],["servers",["{target}"],"ack"],["servers",["{target}"],"channels"],["servers",["{target}"],"members"],["servers",["{target}"],"bans"],["servers",["{target}"],"invites"],["servers",["{target}"],"roles"],["servers",["{target}"],"emojis"],["custom","emoji",["{id}"]],["safety","reports",["{report}"]],["safety","report",["{id}"]],["safety","snapshot",["{report_id}"]],["auth","account","create"],["auth","account","reverify"],["auth","account","delete"],["auth","account",""],["auth","account","disable"],["auth","account","reset_password"],["auth","session","login"],["auth","session","logout"],["auth","session","all"],["auth","session",["{id}"]],["auth","mfa","ticket"],["auth","mfa",""],["auth","mfa","recovery"],["auth","mfa","methods"],["auth","mfa","totp"],["sync","settings","fetch"],["sync","settings","set"]],"4":[["channels",["{target}"],"ack",["{message}"]],["channels",["{_target}"],"messages","stale"],["channels",["{target}"],"messages",["{msg}"]],["channels",["{target}"],"messages","bulk"],["channels",["{target}"],"recipients",["{member}"]],["channels",["{target}"],"permissions",["{role_id}"]],["channels",["{target}"],"permissions","default"],["servers",["{target}"],"members",["{member}"]],["servers",["{server}"],"members",["{target}"]],["servers",["{server}"],"bans",["{target}"]],["servers",["{target}"],"roles",["{role_id}"]],["servers",["{target}"],"permissions",["{role_id}"]],["servers",["{target}"],"permissions","default"],["auth","account","change","password"],["auth","account","change","email"],["auth","account","verify",["{code}"]]],"5":[["channels",["{target}"],"messages",["{msg}"],"reactions"]],"6":[["channels",["{target}"],"messages",["{msg}"],"reactions",["{emoji}"]]]}; +export const queryParams = {"/":{"get":[]},"/admin/stats":{"get":[]},"/admin/messages":{"post":[]},"/users/@me":{"get":[]},"/users/{target}":{"get":[],"patch":[]},"/users/{target}/flags":{"get":[]},"/users/@me/username":{"patch":[]},"/users/{target}/default_avatar":{"get":[]},"/users/{target}/profile":{"get":[]},"/users/dms":{"get":[]},"/users/{target}/dm":{"get":[]},"/users/{target}/mutual":{"get":[]},"/users/{target}/friend":{"put":[],"delete":[]},"/users/{target}/block":{"put":[],"delete":[]},"/users/friend":{"post":[]},"/bots/create":{"post":[]},"/bots/{target}/invite":{"get":[],"post":[]},"/bots/{target}":{"get":[],"delete":[],"patch":[]},"/bots/@me":{"get":[]},"/channels/{target}/ack/{message}":{"put":[]},"/channels/{target}":{"get":[],"delete":["leave_silently"],"patch":[]},"/channels/{target}/members":{"get":[]},"/channels/{target}/invites":{"post":[]},"/channels/{target}/messages":{"get":["limit","before","after","sort","nearby","include_users"],"post":[]},"/channels/{target}/search":{"post":[]},"/channels/{_target}/messages/stale":{"post":[]},"/channels/{target}/messages/{msg}":{"get":[],"delete":[],"patch":[]},"/channels/{target}/messages/bulk":{"delete":[]},"/channels/create":{"post":[]},"/channels/{target}/recipients/{member}":{"put":[],"delete":[]},"/channels/{target}/join_call":{"post":[]},"/channels/{target}/permissions/{role_id}":{"put":[]},"/channels/{target}/permissions/default":{"put":[]},"/channels/{target}/messages/{msg}/reactions/{emoji}":{"put":[],"delete":["user_id","remove_all"]},"/channels/{target}/messages/{msg}/reactions":{"delete":[]},"/servers/create":{"post":[]},"/servers/{target}":{"get":[],"delete":["leave_silently"],"patch":[]},"/servers/{target}/ack":{"put":[]},"/servers/{target}/channels":{"post":[]},"/servers/{target}/members":{"get":["exclude_offline"]},"/servers/{target}/members/{member}":{"get":[],"delete":[]},"/servers/{server}/members/{target}":{"patch":[]},"/servers/{server}/bans/{target}":{"put":[],"delete":[]},"/servers/{target}/bans":{"get":[]},"/servers/{target}/invites":{"get":[]},"/servers/{target}/roles":{"post":[]},"/servers/{target}/roles/{role_id}":{"delete":[],"patch":[]},"/servers/{target}/permissions/{role_id}":{"put":[]},"/servers/{target}/permissions/default":{"put":[]},"/servers/{target}/emojis":{"get":[]},"/invites/{target}":{"get":[],"post":[],"delete":[]},"/custom/emoji/{id}":{"get":[],"put":[],"delete":[]},"/safety/reports/{report}":{"patch":[]},"/safety/report/{id}":{"get":[]},"/safety/reports":{"get":[]},"/safety/report":{"post":[]},"/safety/snapshot/{report_id}":{"get":[]},"/auth/account/create":{"post":[]},"/auth/account/reverify":{"post":[]},"/auth/account/delete":{"put":[],"post":[]},"/auth/account/":{"get":[]},"/auth/account/disable":{"post":[]},"/auth/account/change/password":{"patch":[]},"/auth/account/change/email":{"patch":[]},"/auth/account/verify/{code}":{"post":[]},"/auth/account/reset_password":{"post":[],"patch":[]},"/auth/session/login":{"post":[]},"/auth/session/logout":{"post":[]},"/auth/session/all":{"get":[],"delete":["revoke_self"]},"/auth/session/{id}":{"delete":[],"patch":[]},"/auth/mfa/ticket":{"put":[]},"/auth/mfa/":{"get":[]},"/auth/mfa/recovery":{"post":[],"patch":[]},"/auth/mfa/methods":{"get":[]},"/auth/mfa/totp":{"put":[],"post":[],"delete":[]},"/onboard/hello":{"get":[]},"/onboard/complete":{"post":[]},"/push/subscribe":{"post":[]},"/push/unsubscribe":{"post":[]},"/sync/settings/fetch":{"post":[]},"/sync/settings/set":{"post":["timestamp"]},"/sync/unreads":{"get":[]}}; \ No newline at end of file diff --git a/src/routes.ts b/src/routes.ts index 7e4b908..82a154f 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -2,11 +2,13 @@ import { paths } from './schema'; export type APIRoutes = | { method: 'get', path: `/`, parts: 1, params: undefined, response: paths['/']['get']['responses']['200']['content']['application/json'] } -| { method: 'get', path: `/stats`, parts: 1, params: undefined, response: paths['/stats']['get']['responses']['200']['content']['application/json'] } +| { method: 'get', path: `/admin/stats`, parts: 2, params: undefined, response: paths['/admin/stats']['get']['responses']['200']['content']['application/json'] } +| { method: 'post', path: `/admin/messages`, parts: 2, params: paths['/admin/messages']['post']['requestBody']['content']['application/json'], response: paths['/admin/messages']['post']['responses']['200']['content']['application/json'] } | { method: 'get', path: `/users/@me`, parts: 2, params: undefined, response: paths['/users/@me']['get']['responses']['200']['content']['application/json'] } -| { method: 'patch', path: `/users/@me`, parts: 2, params: paths['/users/@me']['patch']['requestBody']['content']['application/json'], response: paths['/users/@me']['patch']['responses']['200']['content']['application/json'] } | { method: 'get', path: `/users/${string}`, parts: 2, params: undefined, response: paths['/users/{target}']['get']['responses']['200']['content']['application/json'] } | { method: 'get', path: '-/users/{target}', parts: 2, params: undefined, response: paths['/users/{target}']['get']['responses']['200']['content']['application/json'] } +| { method: 'patch', path: `/users/${string}`, parts: 2, params: paths['/users/{target}']['patch']['requestBody']['content']['application/json'], response: paths['/users/{target}']['patch']['responses']['200']['content']['application/json'] } +| { method: 'patch', path: '-/users/{target}', parts: 2, params: paths['/users/{target}']['patch']['requestBody']['content']['application/json'], response: paths['/users/{target}']['patch']['responses']['200']['content']['application/json'] } | { method: 'get', path: `/users/${string}/flags`, parts: 3, params: undefined, response: paths['/users/{target}/flags']['get']['responses']['200']['content']['application/json'] } | { method: 'get', path: '-/users/{target}/flags', parts: 3, params: undefined, response: paths['/users/{target}/flags']['get']['responses']['200']['content']['application/json'] } | { method: 'patch', path: `/users/@me/username`, parts: 3, params: paths['/users/@me/username']['patch']['requestBody']['content']['application/json'], response: paths['/users/@me/username']['patch']['responses']['200']['content']['application/json'] } diff --git a/src/schema.ts b/src/schema.ts index 70bae66..20b9d85 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -8,19 +8,23 @@ export interface paths { /** Fetch the server configuration for this Revolt instance. */ get: operations["root_root"]; }; - "/stats": { + "/admin/stats": { /** Fetch various technical statistics. */ get: operations["stats_stats"]; }; + "/admin/messages": { + /** This is a privileged route to globally fetch messages. */ + post: operations["message_query_message_query"]; + }; "/users/@me": { /** Retrieve your user information. */ get: operations["fetch_self_req"]; - /** Edit currently authenticated user. */ - patch: operations["edit_user_req"]; }; "/users/{target}": { /** Retrieve a user's information. */ get: operations["fetch_user_req"]; + /** Edit currently authenticated user. */ + patch: operations["edit_user_req"]; }; "/users/{target}/flags": { /** Retrieve a user's flags. */ @@ -848,39 +852,112 @@ export interface components { */ nonTailable: number; }; - /** @description Representiation of a User on Revolt. */ - User: { + /** + * Bulk Message Response + * @description Response used when multiple messages are fetched + */ + BulkMessageResponse: + | components["schemas"]["Message"][] + | { + /** @description List of messages */ + messages: components["schemas"]["Message"][]; + /** @description List of users */ + users: components["schemas"]["User"][]; + /** @description List of members */ + members?: components["schemas"]["Member"][] | null; + }; + /** @description Representation of a Message on Revolt */ + Message: { /** @description Unique Id */ _id: string; - /** @description Username */ - username: string; - /** @description Avatar attachment */ - avatar?: components["schemas"]["File"] | null; - /** @description Relationships with other users */ - relations?: components["schemas"]["Relationship"][] | null; - /** - * Format: int32 - * @description Bitfield of user badges - */ - badges?: number | null; - /** @description User's current status */ - status?: components["schemas"]["UserStatus"] | null; - /** @description User's profile page */ - profile?: components["schemas"]["UserProfile"] | null; - /** - * Format: int32 - * @description Enum of user flags - */ - flags?: number | null; - /** @description Whether this user is privileged */ - privileged?: boolean; - /** @description Bot information */ - bot?: components["schemas"]["BotInformation"] | null; - /** @description Current session user's relationship with this user */ - relationship?: components["schemas"]["RelationshipStatus"] | null; - /** @description Whether this user is currently online */ - online?: boolean | null; + /** @description Unique value generated by client sending this message */ + nonce?: string | null; + /** @description Id of the channel this message was sent in */ + channel: string; + /** @description Id of the user that sent this message */ + author: string; + /** @description Message content */ + content?: string | null; + /** @description System message */ + system?: components["schemas"]["SystemMessage"] | null; + /** @description Array of attachments */ + attachments?: components["schemas"]["File"][] | null; + /** @description Time at which this message was last edited */ + edited?: components["schemas"]["ISO8601 Timestamp"] | null; + /** @description Attached embeds to this message */ + embeds?: components["schemas"]["Embed"][] | null; + /** @description Array of user ids mentioned in this message */ + mentions?: string[] | null; + /** @description Array of message ids this message is replying to */ + replies?: string[] | null; + /** @description Hashmap of emoji IDs to array of user IDs */ + reactions?: { [key: string]: string[] }; + /** @description Information about how this message should be interacted with */ + interactions?: components["schemas"]["Interactions"]; + /** @description Name and / or avatar overrides for this message */ + masquerade?: components["schemas"]["Masquerade"] | null; }; + /** @description Representation of a system event message */ + SystemMessage: + | { + /** @enum {string} */ + type: "text"; + content: string; + } + | { + /** @enum {string} */ + type: "user_added"; + id: string; + by: string; + } + | { + /** @enum {string} */ + type: "user_remove"; + id: string; + by: string; + } + | { + /** @enum {string} */ + type: "user_joined"; + id: string; + } + | { + /** @enum {string} */ + type: "user_left"; + id: string; + } + | { + /** @enum {string} */ + type: "user_kicked"; + id: string; + } + | { + /** @enum {string} */ + type: "user_banned"; + id: string; + } + | { + /** @enum {string} */ + type: "channel_renamed"; + name: string; + by: string; + } + | { + /** @enum {string} */ + type: "channel_description_changed"; + by: string; + } + | { + /** @enum {string} */ + type: "channel_icon_changed"; + by: string; + } + | { + /** @enum {string} */ + type: "channel_ownership_changed"; + from: string; + to: string; + }; /** @description Representation of a File on Revolt Generated by Autumn */ File: { /** @description Unique Id */ @@ -938,6 +1015,244 @@ export interface components { /** @enum {string} */ type: "Audio"; }; + /** @description Embed */ + Embed: + | { + /** @enum {string} */ + type: "Website"; + /** @description Direct URL to web page */ + url?: string | null; + /** @description Original direct URL */ + original_url?: string | null; + /** @description Remote content */ + special?: components["schemas"]["Special"] | null; + /** @description Title of website */ + title?: string | null; + /** @description Description of website */ + description?: string | null; + /** @description Embedded image */ + image?: components["schemas"]["Image"] | null; + /** @description Embedded video */ + video?: components["schemas"]["Video"] | null; + /** @description Site name */ + site_name?: string | null; + /** @description URL to site icon */ + icon_url?: string | null; + /** @description CSS Colour */ + colour?: string | null; + } + | { + /** @enum {string} */ + type: "Image"; + /** @description URL to the original image */ + url: string; + /** + * Format: int + * @description Width of the image + */ + width: number; + /** + * Format: int + * @description Height of the image + */ + height: number; + /** @description Positioning and size */ + size: components["schemas"]["ImageSize"]; + } + | { + /** @enum {string} */ + type: "Video"; + /** @description URL to the original video */ + url: string; + /** + * Format: int + * @description Width of the video + */ + width: number; + /** + * Format: int + * @description Height of the video + */ + height: number; + } + | { + /** @enum {string} */ + type: "Text"; + /** @description URL to icon */ + icon_url?: string | null; + /** @description URL for title */ + url?: string | null; + /** @description Title of text embed */ + title?: string | null; + /** @description Description of text embed */ + description?: string | null; + /** @description ID of uploaded autumn file */ + media?: components["schemas"]["File"] | null; + /** @description CSS Colour */ + colour?: string | null; + } + | { + /** @enum {string} */ + type: "None"; + }; + /** @description Information about special remote content */ + Special: + | { + /** @enum {string} */ + type: "None"; + } + | { + /** @enum {string} */ + type: "GIF"; + } + | { + /** @enum {string} */ + type: "YouTube"; + id: string; + timestamp?: string | null; + } + | { + /** @enum {string} */ + type: "Lightspeed"; + content_type: components["schemas"]["LightspeedType"]; + id: string; + } + | { + /** @enum {string} */ + type: "Twitch"; + content_type: components["schemas"]["TwitchType"]; + id: string; + } + | { + /** @enum {string} */ + type: "Spotify"; + content_type: string; + id: string; + } + | { + /** @enum {string} */ + type: "Soundcloud"; + } + | { + /** @enum {string} */ + type: "Bandcamp"; + content_type: components["schemas"]["BandcampType"]; + id: string; + } + | { + /** @enum {string} */ + type: "Streamable"; + id: string; + }; + /** + * @description Type of remote Lightspeed.tv content + * @enum {string} + */ + LightspeedType: "Channel"; + /** + * @description Type of remote Twitch content + * @enum {string} + */ + TwitchType: "Channel" | "Video" | "Clip"; + /** + * @description Type of remote Bandcamp content + * @enum {string} + */ + BandcampType: "Album" | "Track"; + /** @description Image */ + Image: { + /** @description URL to the original image */ + url: string; + /** + * Format: int + * @description Width of the image + */ + width: number; + /** + * Format: int + * @description Height of the image + */ + height: number; + /** @description Positioning and size */ + size: components["schemas"]["ImageSize"]; + }; + /** + * @description Image positioning and size + * @enum {string} + */ + ImageSize: "Large" | "Preview"; + /** @description Video */ + Video: { + /** @description URL to the original video */ + url: string; + /** + * Format: int + * @description Width of the video + */ + width: number; + /** + * Format: int + * @description Height of the video + */ + height: number; + }; + /** @description Information to guide interactions on this message */ + Interactions: { + /** @description Reactions which should always appear and be distinct */ + reactions?: string[] | null; + /** + * @description Whether reactions should be restricted to the given list + * + * Can only be set to true if reactions list is of at least length 1 + */ + restrict_reactions?: boolean; + }; + /** @description Name and / or avatar override information */ + Masquerade: { + /** @description Replace the display name shown on this message */ + name?: string | null; + /** @description Replace the avatar shown on this message (URL to image file) */ + avatar?: string | null; + /** + * @description Replace the display role colour shown on this message + * + * Must have `ManageRole` permission to use + */ + colour?: string | null; + }; + /** @description Representiation of a User on Revolt. */ + User: { + /** @description Unique Id */ + _id: string; + /** @description Username */ + username: string; + /** @description Avatar attachment */ + avatar?: components["schemas"]["File"] | null; + /** @description Relationships with other users */ + relations?: components["schemas"]["Relationship"][] | null; + /** + * Format: int32 + * @description Bitfield of user badges + */ + badges?: number | null; + /** @description User's current status */ + status?: components["schemas"]["UserStatus"] | null; + /** @description User's profile page */ + profile?: components["schemas"]["UserProfile"] | null; + /** + * Format: int32 + * @description Enum of user flags + */ + flags?: number | null; + /** @description Whether this user is privileged */ + privileged?: boolean; + /** @description Bot information */ + bot?: components["schemas"]["BotInformation"] | null; + /** @description Current session user's relationship with this user */ + relationship?: components["schemas"]["RelationshipStatus"] | null; + /** @description Whether this user is currently online */ + online?: boolean | null; + }; /** @description Relationship entry indicating current status with other user */ Relationship: { _id: string; @@ -979,6 +1294,70 @@ export interface components { /** @description Id of the owner of this bot */ owner: string; }; + /** @description Representation of a member of a server on Revolt */ + Member: { + /** @description Unique member id */ + _id: components["schemas"]["MemberCompositeKey"]; + /** @description Time at which this user joined the server */ + joined_at: components["schemas"]["ISO8601 Timestamp"]; + /** @description Member's nickname */ + nickname?: string | null; + /** @description Avatar attachment */ + avatar?: components["schemas"]["File"] | null; + /** @description Member's roles */ + roles?: string[]; + /** @description Timestamp this member is timed out until */ + timeout?: components["schemas"]["ISO8601 Timestamp"] | null; + }; + /** @description Composite primary key consisting of server and user id */ + MemberCompositeKey: { + /** @description Server Id */ + server: string; + /** @description User Id */ + user: string; + }; + /** + * Message Query + * @description Filter and sort messages by time + */ + MessageQuery: ( + | { + /** + * @description Message id to search around + * + * Specifying 'nearby' ignores 'before', 'after' and 'sort'. It will also take half of limit rounded as the limits to each side. It also fetches the message ID specified. + */ + nearby: string; + } + | { + /** @description Message id before which messages should be fetched */ + before?: string | null; + /** @description Message id after which messages should be fetched */ + after?: string | null; + /** @description Message sort direction */ + sort?: components["schemas"]["MessageSort"] | null; + } + ) & { + /** + * Format: int64 + * @description Maximum number of messages to fetch + * + * For fetching nearby messages, this is \`(limit + 1)\`. + */ + limit?: number | null; + /** @description Parent channel ID */ + channel?: string | null; + /** @description Message author ID */ + author?: string | null; + /** @description Search query */ + query?: string | null; + }; + /** + * Message Sort + * @description Sort used for retrieving messages + * @enum {string} + */ + MessageSort: "Relevance" | "Latest" | "Oldest"; Id: string; /** Flag Response */ FlagResponse: { @@ -990,6 +1369,8 @@ export interface components { }; /** User Data */ DataEditUser: { + /** @description Attachment Id for avatar */ + avatar?: string | null; /** @description New user status */ status?: components["schemas"]["UserStatus"] | null; /** @@ -998,8 +1379,16 @@ export interface components { * This is applied as a partial. */ profile?: components["schemas"]["UserProfileData"] | null; - /** @description Attachment Id for avatar */ - avatar?: string | null; + /** + * Format: int32 + * @description Bitfield of user badges + */ + badges?: number | null; + /** + * Format: int32 + * @description Enum of user flags + */ + flags?: number | null; /** @description Fields to remove from user object */ remove?: components["schemas"]["FieldsUser"][] | null; }; @@ -1288,303 +1677,6 @@ export interface components { /** @description Id of the group channel this invite points to */ channel: string; }; - /** @description Representation of a Message on Revolt */ - Message: { - /** @description Unique Id */ - _id: string; - /** @description Unique value generated by client sending this message */ - nonce?: string | null; - /** @description Id of the channel this message was sent in */ - channel: string; - /** @description Id of the user that sent this message */ - author: string; - /** @description Message content */ - content?: string | null; - /** @description System message */ - system?: components["schemas"]["SystemMessage"] | null; - /** @description Array of attachments */ - attachments?: components["schemas"]["File"][] | null; - /** @description Time at which this message was last edited */ - edited?: components["schemas"]["ISO8601 Timestamp"] | null; - /** @description Attached embeds to this message */ - embeds?: components["schemas"]["Embed"][] | null; - /** @description Array of user ids mentioned in this message */ - mentions?: string[] | null; - /** @description Array of message ids this message is replying to */ - replies?: string[] | null; - /** @description Hashmap of emoji IDs to array of user IDs */ - reactions?: { [key: string]: string[] }; - /** @description Information about how this message should be interacted with */ - interactions?: components["schemas"]["Interactions"]; - /** @description Name and / or avatar overrides for this message */ - masquerade?: components["schemas"]["Masquerade"] | null; - }; - /** @description Representation of a system event message */ - SystemMessage: - | { - /** @enum {string} */ - type: "text"; - content: string; - } - | { - /** @enum {string} */ - type: "user_added"; - id: string; - by: string; - } - | { - /** @enum {string} */ - type: "user_remove"; - id: string; - by: string; - } - | { - /** @enum {string} */ - type: "user_joined"; - id: string; - } - | { - /** @enum {string} */ - type: "user_left"; - id: string; - } - | { - /** @enum {string} */ - type: "user_kicked"; - id: string; - } - | { - /** @enum {string} */ - type: "user_banned"; - id: string; - } - | { - /** @enum {string} */ - type: "channel_renamed"; - name: string; - by: string; - } - | { - /** @enum {string} */ - type: "channel_description_changed"; - by: string; - } - | { - /** @enum {string} */ - type: "channel_icon_changed"; - by: string; - } - | { - /** @enum {string} */ - type: "channel_ownership_changed"; - from: string; - to: string; - }; - /** @description Embed */ - Embed: - | { - /** @enum {string} */ - type: "Website"; - /** @description Direct URL to web page */ - url?: string | null; - /** @description Original direct URL */ - original_url?: string | null; - /** @description Remote content */ - special?: components["schemas"]["Special"] | null; - /** @description Title of website */ - title?: string | null; - /** @description Description of website */ - description?: string | null; - /** @description Embedded image */ - image?: components["schemas"]["Image"] | null; - /** @description Embedded video */ - video?: components["schemas"]["Video"] | null; - /** @description Site name */ - site_name?: string | null; - /** @description URL to site icon */ - icon_url?: string | null; - /** @description CSS Colour */ - colour?: string | null; - } - | { - /** @enum {string} */ - type: "Image"; - /** @description URL to the original image */ - url: string; - /** - * Format: int - * @description Width of the image - */ - width: number; - /** - * Format: int - * @description Height of the image - */ - height: number; - /** @description Positioning and size */ - size: components["schemas"]["ImageSize"]; - } - | { - /** @enum {string} */ - type: "Video"; - /** @description URL to the original video */ - url: string; - /** - * Format: int - * @description Width of the video - */ - width: number; - /** - * Format: int - * @description Height of the video - */ - height: number; - } - | { - /** @enum {string} */ - type: "Text"; - /** @description URL to icon */ - icon_url?: string | null; - /** @description URL for title */ - url?: string | null; - /** @description Title of text embed */ - title?: string | null; - /** @description Description of text embed */ - description?: string | null; - /** @description ID of uploaded autumn file */ - media?: components["schemas"]["File"] | null; - /** @description CSS Colour */ - colour?: string | null; - } - | { - /** @enum {string} */ - type: "None"; - }; - /** @description Information about special remote content */ - Special: - | { - /** @enum {string} */ - type: "None"; - } - | { - /** @enum {string} */ - type: "GIF"; - } - | { - /** @enum {string} */ - type: "YouTube"; - id: string; - timestamp?: string | null; - } - | { - /** @enum {string} */ - type: "Lightspeed"; - content_type: components["schemas"]["LightspeedType"]; - id: string; - } - | { - /** @enum {string} */ - type: "Twitch"; - content_type: components["schemas"]["TwitchType"]; - id: string; - } - | { - /** @enum {string} */ - type: "Spotify"; - content_type: string; - id: string; - } - | { - /** @enum {string} */ - type: "Soundcloud"; - } - | { - /** @enum {string} */ - type: "Bandcamp"; - content_type: components["schemas"]["BandcampType"]; - id: string; - } - | { - /** @enum {string} */ - type: "Streamable"; - id: string; - }; - /** - * @description Type of remote Lightspeed.tv content - * @enum {string} - */ - LightspeedType: "Channel"; - /** - * @description Type of remote Twitch content - * @enum {string} - */ - TwitchType: "Channel" | "Video" | "Clip"; - /** - * @description Type of remote Bandcamp content - * @enum {string} - */ - BandcampType: "Album" | "Track"; - /** @description Image */ - Image: { - /** @description URL to the original image */ - url: string; - /** - * Format: int - * @description Width of the image - */ - width: number; - /** - * Format: int - * @description Height of the image - */ - height: number; - /** @description Positioning and size */ - size: components["schemas"]["ImageSize"]; - }; - /** - * @description Image positioning and size - * @enum {string} - */ - ImageSize: "Large" | "Preview"; - /** @description Video */ - Video: { - /** @description URL to the original video */ - url: string; - /** - * Format: int - * @description Width of the video - */ - width: number; - /** - * Format: int - * @description Height of the video - */ - height: number; - }; - /** @description Information to guide interactions on this message */ - Interactions: { - /** @description Reactions which should always appear and be distinct */ - reactions?: string[] | null; - /** - * @description Whether reactions should be restricted to the given list - * - * Can only be set to true if reactions list is of at least length 1 - */ - restrict_reactions?: boolean; - }; - /** @description Name and / or avatar override information */ - Masquerade: { - /** @description Replace the display name shown on this message */ - name?: string | null; - /** @description Replace the avatar shown on this message (URL to image file) */ - avatar?: string | null; - /** - * @description Replace the display role colour shown on this message - * - * Must have `ManageRole` permission to use - */ - colour?: string | null; - }; DataMessageSend: { /** * @description Unique token to prevent duplicate message sending @@ -1628,48 +1720,6 @@ export interface components { media?: string | null; colour?: string | null; }; - /** - * Bulk Message Response - * @description Response used when multiple messages are fetched - */ - BulkMessageResponse: - | components["schemas"]["Message"][] - | { - /** @description List of messages */ - messages: components["schemas"]["Message"][]; - /** @description List of users */ - users: components["schemas"]["User"][]; - /** @description List of members */ - members?: components["schemas"]["Member"][] | null; - }; - /** @description Representation of a member of a server on Revolt */ - Member: { - /** @description Unique member id */ - _id: components["schemas"]["MemberCompositeKey"]; - /** @description Time at which this user joined the server */ - joined_at: components["schemas"]["ISO8601 Timestamp"]; - /** @description Member's nickname */ - nickname?: string | null; - /** @description Avatar attachment */ - avatar?: components["schemas"]["File"] | null; - /** @description Member's roles */ - roles?: string[]; - /** @description Timestamp this member is timed out until */ - timeout?: components["schemas"]["ISO8601 Timestamp"] | null; - }; - /** @description Composite primary key consisting of server and user id */ - MemberCompositeKey: { - /** @description Server Id */ - server: string; - /** @description User Id */ - user: string; - }; - /** - * Message Sort - * @description Sort used for retrieving messages - * @enum {string} - */ - MessageSort: "Relevance" | "Latest" | "Oldest"; /** Search Parameters */ OptionsMessageSearch: { /** @@ -1690,7 +1740,7 @@ export interface components { /** * @description Message sort direction * - * By default, it will be sorted by relevance. + * By default, it will be sorted by latest. * @default Relevance */ sort?: components["schemas"]["MessageSort"]; @@ -1801,7 +1851,7 @@ export interface components { banner?: components["schemas"]["File"] | null; /** * Format: int32 - * @description Enum of server flags + * @description Bitfield of server flags */ flags?: number | null; /** @description Whether this server is flagged as not safe for work */ @@ -1874,6 +1924,11 @@ export interface components { categories?: components["schemas"]["Category"][] | null; /** @description System message configuration */ system_messages?: components["schemas"]["SystemMessageChannels"] | null; + /** + * Format: int32 + * @description Bitfield of server flags + */ + flags?: number | null; /** @description Whether this server is public and should show up on [Revolt Discover](https://rvlt.gg) */ discoverable?: boolean | null; /** @@ -2319,7 +2374,7 @@ export interface components { banner?: components["schemas"]["File"] | null; /** * Format: int32 - * @description Enum of server flags + * @description Bitfield of server flags */ flags?: number | null; /** @description Whether this server is flagged as not safe for work */ @@ -2696,6 +2751,27 @@ export interface operations { }; }; }; + /** This is a privileged route to globally fetch messages. */ + message_query_message_query: { + responses: { + 200: { + content: { + "application/json": components["schemas"]["BulkMessageResponse"]; + }; + }; + /** An error occurred. */ + default: { + content: { + "application/json": components["schemas"]["Error"]; + }; + }; + }; + requestBody: { + content: { + "application/json": components["schemas"]["MessageQuery"]; + }; + }; + }; /** Retrieve your user information. */ fetch_self_req: { responses: { @@ -2712,27 +2788,6 @@ export interface operations { }; }; }; - /** Edit currently authenticated user. */ - edit_user_req: { - responses: { - 200: { - content: { - "application/json": components["schemas"]["User"]; - }; - }; - /** An error occurred. */ - default: { - content: { - "application/json": components["schemas"]["Error"]; - }; - }; - }; - requestBody: { - content: { - "application/json": components["schemas"]["DataEditUser"]; - }; - }; - }; /** Retrieve a user's information. */ fetch_user_req: { parameters: { @@ -2754,6 +2809,32 @@ export interface operations { }; }; }; + /** Edit currently authenticated user. */ + edit_user_req: { + parameters: { + path: { + target: components["schemas"]["Id"]; + }; + }; + responses: { + 200: { + content: { + "application/json": components["schemas"]["User"]; + }; + }; + /** An error occurred. */ + default: { + content: { + "application/json": components["schemas"]["Error"]; + }; + }; + }; + requestBody: { + content: { + "application/json": components["schemas"]["DataEditUser"]; + }; + }; + }; /** Retrieve a user's flags. */ fetch_user_flags_fetch_user_flags: { parameters: { diff --git a/src/types.ts b/src/types.ts index abdd512..ef73c94 100644 --- a/src/types.ts +++ b/src/types.ts @@ -18,15 +18,32 @@ export type LatencyStats = components['schemas']['LatencyStats']; export type LatencyHistogramEntry = components['schemas']['LatencyHistogramEntry']; export type QueryExecStats = components['schemas']['QueryExecStats']; export type CollectionScans = components['schemas']['CollectionScans']; -export type User = components['schemas']['User']; +export type BulkMessageResponse = components['schemas']['BulkMessageResponse']; +export type Message = components['schemas']['Message']; +export type SystemMessage = components['schemas']['SystemMessage']; export type File = components['schemas']['File']; export type Metadata = components['schemas']['Metadata']; +export type Embed = components['schemas']['Embed']; +export type Special = components['schemas']['Special']; +export type LightspeedType = components['schemas']['LightspeedType']; +export type TwitchType = components['schemas']['TwitchType']; +export type BandcampType = components['schemas']['BandcampType']; +export type Image = components['schemas']['Image']; +export type ImageSize = components['schemas']['ImageSize']; +export type Video = components['schemas']['Video']; +export type Interactions = components['schemas']['Interactions']; +export type Masquerade = components['schemas']['Masquerade']; +export type User = components['schemas']['User']; export type Relationship = components['schemas']['Relationship']; export type RelationshipStatus = components['schemas']['RelationshipStatus']; export type UserStatus = components['schemas']['UserStatus']; export type Presence = components['schemas']['Presence']; export type UserProfile = components['schemas']['UserProfile']; export type BotInformation = components['schemas']['BotInformation']; +export type Member = components['schemas']['Member']; +export type MemberCompositeKey = components['schemas']['MemberCompositeKey']; +export type MessageQuery = components['schemas']['MessageQuery']; +export type MessageSort = components['schemas']['MessageSort']; export type Id = components['schemas']['Id']; export type FlagResponse = components['schemas']['FlagResponse']; export type DataEditUser = components['schemas']['DataEditUser']; @@ -48,25 +65,9 @@ export type FieldsBot = components['schemas']['FieldsBot']; export type DataEditChannel = components['schemas']['DataEditChannel']; export type FieldsChannel = components['schemas']['FieldsChannel']; export type Invite = components['schemas']['Invite']; -export type Message = components['schemas']['Message']; -export type SystemMessage = components['schemas']['SystemMessage']; -export type Embed = components['schemas']['Embed']; -export type Special = components['schemas']['Special']; -export type LightspeedType = components['schemas']['LightspeedType']; -export type TwitchType = components['schemas']['TwitchType']; -export type BandcampType = components['schemas']['BandcampType']; -export type Image = components['schemas']['Image']; -export type ImageSize = components['schemas']['ImageSize']; -export type Video = components['schemas']['Video']; -export type Interactions = components['schemas']['Interactions']; -export type Masquerade = components['schemas']['Masquerade']; export type DataMessageSend = components['schemas']['DataMessageSend']; export type Reply = components['schemas']['Reply']; export type SendableEmbed = components['schemas']['SendableEmbed']; -export type BulkMessageResponse = components['schemas']['BulkMessageResponse']; -export type Member = components['schemas']['Member']; -export type MemberCompositeKey = components['schemas']['MemberCompositeKey']; -export type MessageSort = components['schemas']['MessageSort']; export type OptionsMessageSearch = components['schemas']['OptionsMessageSearch']; export type OptionsQueryStale = components['schemas']['OptionsQueryStale']; export type DataEditMessage = components['schemas']['DataEditMessage'];