diff --git a/OpenAPI.json b/OpenAPI.json index 135724d..00bd2c6 100644 --- a/OpenAPI.json +++ b/OpenAPI.json @@ -3929,8 +3929,15 @@ } } }, - "204": { - "description": "Success" + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResponseVerify" + } + } + } } } } @@ -9438,6 +9445,20 @@ } } }, + { + "type": "object", + "required": [ + "type" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "LockedOut" + ] + } + } + }, { "type": "object", "required": [ @@ -9578,6 +9599,67 @@ } } }, + "ResponseVerify": { + "anyOf": [ + { + "type": "null" + }, + { + "type": "object", + "required": [ + "ticket" + ], + "properties": { + "ticket": { + "description": "Authorised MFA ticket, can be used to log in", + "allOf": [ + { + "$ref": "#/components/schemas/MFATicket" + } + ] + } + } + } + ] + }, + "MFATicket": { + "description": "Multi-factor auth ticket", + "type": "object", + "required": [ + "_id", + "account_id", + "authorised", + "token", + "validated" + ], + "properties": { + "_id": { + "description": "Unique Id", + "type": "string" + }, + "account_id": { + "description": "Account Id", + "type": "string" + }, + "token": { + "description": "Unique Token", + "type": "string" + }, + "validated": { + "description": "Whether this ticket has been validated (can be used for account actions)", + "type": "boolean" + }, + "authorised": { + "description": "Whether this ticket is authorised (can be used to log a user in)", + "type": "boolean" + }, + "last_totp_code": { + "description": "TOTP code at time of ticket creation", + "type": "string", + "nullable": true + } + } + }, "DataPasswordReset": { "title": "Password Reset", "type": "object", @@ -9593,6 +9675,11 @@ "password": { "description": "New password", "type": "string" + }, + "remove_sessions": { + "description": "Whether to logout all sessions", + "default": false, + "type": "boolean" } } }, @@ -9734,11 +9821,6 @@ "description": "Password", "type": "string" }, - "captcha": { - "description": "Captcha verification code", - "type": "string", - "nullable": true - }, "friendly_name": { "description": "Friendly name used for the session", "type": "string", @@ -9749,12 +9831,11 @@ { "type": "object", "required": [ - "mfa_response", "mfa_ticket" ], "properties": { "mfa_ticket": { - "description": "Unvalidated MFA ticket\n\nUsed to resolve the correct account", + "description": "Unvalidated or authorised MFA ticket\n\nUsed to resolve the correct account", "type": "string" }, "mfa_response": { @@ -9763,7 +9844,8 @@ { "$ref": "#/components/schemas/MFAResponse" } - ] + ], + "nullable": true }, "friendly_name": { "description": "Friendly name used for the session", @@ -9840,34 +9922,6 @@ } } }, - "MFATicket": { - "description": "Multi-factor auth ticket", - "type": "object", - "required": [ - "_id", - "account_id", - "token", - "validated" - ], - "properties": { - "_id": { - "description": "Unique Id", - "type": "string" - }, - "account_id": { - "description": "Account Id", - "type": "string" - }, - "token": { - "description": "Unique Token", - "type": "string" - }, - "validated": { - "description": "Whether this ticket has been validated", - "type": "boolean" - } - } - }, "MultiFactorStatus": { "type": "object", "required": [ diff --git a/package.json b/package.json index 2303de6..38e50dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "revolt-api", - "version": "0.5.5-4", + "version": "0.5.5-5", "description": "Revolt API Library", "main": "dist/index.js", "module": "esm/index.js", diff --git a/src/routes.ts b/src/routes.ts index 46cbd41..fd5792f 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -141,8 +141,8 @@ export type APIRoutes = | { method: 'post', path: `/auth/account/disable`, parts: 3, params: undefined, response: undefined } | { method: 'patch', path: `/auth/account/change/password`, parts: 4, params: paths['/auth/account/change/password']['patch']['requestBody']['content']['application/json'], response: undefined } | { method: 'patch', path: `/auth/account/change/email`, parts: 4, params: paths['/auth/account/change/email']['patch']['requestBody']['content']['application/json'], response: undefined } -| { method: 'post', path: `/auth/account/verify/${string}`, parts: 4, params: undefined, response: undefined } -| { method: 'post', path: '-/auth/account/verify/{code}', parts: 4, params: undefined, response: undefined } +| { method: 'post', path: `/auth/account/verify/${string}`, parts: 4, params: undefined, response: paths['/auth/account/verify/{code}']['post']['responses']['200']['content']['application/json'] } +| { method: 'post', path: '-/auth/account/verify/{code}', parts: 4, params: undefined, response: paths['/auth/account/verify/{code}']['post']['responses']['200']['content']['application/json'] } | { method: 'post', path: `/auth/account/reset_password`, parts: 3, params: paths['/auth/account/reset_password']['post']['requestBody']['content']['application/json'], response: undefined } | { method: 'patch', path: `/auth/account/reset_password`, parts: 3, params: paths['/auth/account/reset_password']['patch']['requestBody']['content']['application/json'], response: undefined } | { method: 'post', path: `/auth/session/login`, parts: 3, params: paths['/auth/session/login']['post']['requestBody']['content']['application/json'], response: paths['/auth/session/login']['post']['responses']['200']['content']['application/json'] } diff --git a/src/schema.ts b/src/schema.ts index c788752..60af657 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -2042,6 +2042,10 @@ export interface components { /** @enum {string} */ type: "Blacklisted"; } + | { + /** @enum {string} */ + type: "LockedOut"; + } | { /** @enum {string} */ type: "TotpAlreadyEnabled"; @@ -2091,12 +2095,35 @@ export interface components { /** @description Current password */ current_password: string; }; + ResponseVerify: + | unknown + | { + /** @description Authorised MFA ticket, can be used to log in */ + ticket: components["schemas"]["MFATicket"]; + }; + /** @description Multi-factor auth ticket */ + MFATicket: { + /** @description Unique Id */ + _id: string; + /** @description Account Id */ + account_id: string; + /** @description Unique Token */ + token: string; + /** @description Whether this ticket has been validated (can be used for account actions) */ + validated: boolean; + /** @description Whether this ticket is authorised (can be used to log a user in) */ + authorised: boolean; + /** @description TOTP code at time of ticket creation */ + last_totp_code?: string | null; + }; /** Password Reset */ DataPasswordReset: { /** @description Reset token */ token: string; /** @description New password */ password: string; + /** @description Whether to logout all sessions */ + remove_sessions?: boolean; }; /** Reset Information */ DataSendPasswordReset: { @@ -2144,14 +2171,12 @@ export interface components { email: string; /** @description Password */ password: string; - /** @description Captcha verification code */ - captcha?: string | null; /** @description Friendly name used for the session */ friendly_name?: string | null; } | { /** - * @description Unvalidated MFA ticket + * @description Unvalidated or authorised MFA ticket * * Used to resolve the correct account */ @@ -2161,7 +2186,7 @@ export interface components { * * This will take precedence over the `password` field where applicable */ - mfa_response: components["schemas"]["MFAResponse"]; + mfa_response?: components["schemas"]["MFAResponse"] | null; /** @description Friendly name used for the session */ friendly_name?: string | null; }; @@ -2185,17 +2210,6 @@ export interface components { /** @description Session friendly name */ friendly_name: string; }; - /** @description Multi-factor auth ticket */ - MFATicket: { - /** @description Unique Id */ - _id: string; - /** @description Account Id */ - account_id: string; - /** @description Unique Token */ - token: string; - /** @description Whether this ticket has been validated */ - validated: boolean; - }; MultiFactorStatus: { email_otp: boolean; trusted_handover: boolean; @@ -3929,8 +3943,11 @@ export interface operations { }; }; responses: { - /** Success */ - 204: never; + 200: { + content: { + "application/json": components["schemas"]["ResponseVerify"]; + }; + }; /** An error occurred. */ default: { content: { diff --git a/src/types.ts b/src/types.ts index 8fb5509..8b8cd69 100644 --- a/src/types.ts +++ b/src/types.ts @@ -101,6 +101,8 @@ export type DataAccountDeletion = components['schemas']['DataAccountDeletion']; export type AccountInfo = components['schemas']['AccountInfo']; export type DataChangePassword = components['schemas']['DataChangePassword']; export type DataChangeEmail = components['schemas']['DataChangeEmail']; +export type ResponseVerify = components['schemas']['ResponseVerify']; +export type MFATicket = components['schemas']['MFATicket']; export type DataPasswordReset = components['schemas']['DataPasswordReset']; export type DataSendPasswordReset = components['schemas']['DataSendPasswordReset']; export type ResponseLogin = components['schemas']['ResponseLogin']; @@ -110,7 +112,6 @@ export type DataLogin = components['schemas']['DataLogin']; export type MFAResponse = components['schemas']['MFAResponse']; export type SessionInfo = components['schemas']['SessionInfo']; export type DataEditSession = components['schemas']['DataEditSession']; -export type MFATicket = components['schemas']['MFATicket']; export type MultiFactorStatus = components['schemas']['MultiFactorStatus']; export type ResponseTotpSecret = components['schemas']['ResponseTotpSecret']; export type DataHello = components['schemas']['DataHello'];