diff --git a/app/src/lib/commands/notes.svelte.ts b/app/src/lib/commands/notes.svelte.ts index 0abc3410..69b2227b 100644 --- a/app/src/lib/commands/notes.svelte.ts +++ b/app/src/lib/commands/notes.svelte.ts @@ -395,6 +395,7 @@ export class TauriWebsocketProvider extends ObservableV2; path: Record; query: Record; } -type ParamsSlotMap = Record; - -function stripEmptySlots(params: ParamsSlotMap): void { +function stripEmptySlots(params: Params): void { for (const [slot, value] of Object.entries(params)) { + if (slot === 'body') continue; if ( value && typeof value === 'object' && @@ -113,8 +112,7 @@ export function buildClientParams( args: ReadonlyArray, fields: FieldsConfig ): Params { - const params: ParamsSlotMap = { - body: Object.create(null), + const params: Params = { headers: Object.create(null), path: Object.create(null), query: Object.create(null) @@ -122,6 +120,15 @@ export function buildClientParams( const map = buildKeyMap(fields); + function writeSlot(slot: Slot, key: string, value: unknown): void { + let record = params[slot] as Record | undefined; + if (record === undefined) { + record = Object.create(null) as Record; + params[slot] = record; + } + record[key] = value; + } + let config: FieldsConfig[number] | undefined; for (const [index, arg] of args.entries()) { @@ -138,7 +145,7 @@ export function buildClientParams( const field = map.get(config.key)!; const name = field.map || config.key; if (field.in) { - (params[field.in] as Record)[name] = arg; + writeSlot(field.in, name, arg); } } else { params.body = arg; @@ -150,7 +157,7 @@ export function buildClientParams( if (field) { if (field.in) { const name = field.map || key; - (params[field.in] as Record)[name] = value; + writeSlot(field.in, name, value); } else { params[field.map] = value; } @@ -161,13 +168,11 @@ export function buildClientParams( if (extra) { const [prefix, slot] = extra; - (params[slot] as Record)[ - key.slice(prefix.length) - ] = value; + writeSlot(slot, key.slice(prefix.length), value); } else if ('allowExtra' in config && config.allowExtra) { for (const [slot, allowed] of Object.entries(config.allowExtra)) { if (allowed) { - (params[slot as Slot] as Record)[key] = value; + writeSlot(slot as Slot, key, value); break; } } @@ -179,5 +184,5 @@ export function buildClientParams( stripEmptySlots(params); - return params as Params; + return params; } diff --git a/frontend/src/lib/client/index.ts b/frontend/src/lib/client/index.ts index faeb7f3a..0831baf7 100644 --- a/frontend/src/lib/client/index.ts +++ b/frontend/src/lib/client/index.ts @@ -1,113 +1,5 @@ // This file is auto-generated by @hey-api/openapi-ts -export { - accountSettingsMswHandler, - applyNoteEditMswHandler, - authConfigMswHandler, - authorizeConfirmMswHandler, - avatarByIdMswHandler, - changePasswordMswHandler, - changeUserEmailMswHandler, - completeSetupMswHandler, - confirmEmailChangeMswHandler, - convertOidcUserMswHandler, - createGroupMswHandler, - createNoteMswHandler, - createOauthClientMswHandler, - createOAuthPolicyMswHandler, - createOAuthScopeMswHandler, - createUserMswHandler, - deleteGroupMswHandler, - deleteNoteMswHandler, - deleteNoteSnapshotMswHandler, - deleteOauthClientMswHandler, - deleteOAuthPolicyMswHandler, - deleteOAuthScopeMswHandler, - deleteUserMswHandler, - editGroupMswHandler, - editNoteMswHandler, - editOauthClientMswHandler, - editOAuthPolicyMswHandler, - editOAuthScopeMswHandler, - editPasskeyNameMswHandler, - editUserMswHandler, - exchangeAppCodeMswHandler, - finishAuthenticationMswHandler, - finishRegistrationMswHandler, - finishSpecialAccessMswHandler, - getApodImageInfoMswHandler, - getApodImageMswHandler, - getMailSettingsMswHandler, - getNoteSnapshotContentMswHandler, - getOidcSettingsMswHandler, - groupInfoMswHandler, - infoMswHandler, - infoNoteMswHandler, - infoNoteShareMswHandler, - infoNoteSnapshotMswHandler, - infoOauthClientMswHandler, - infoOAuthPolicyMswHandler, - infoOAuthScopeMswHandler, - initOidcMswHandler, - isSetupMswHandler, - keyMswHandler, - listApodMswHandler, - listGroupsMswHandler, - listGroupsOAuthClientMswHandler, - listGroupsOAuthPolicyMswHandler, - listGroupsSimpleMswHandler, - listNotesMswHandler, - listNoteSnapshotsMswHandler, - listOauthClientsMswHandler, - listOAuthPoliciesMswHandler, - listOAuthScopesMswHandler, - listPasskeysMswHandler, - listPoliciesOAuthScopeMswHandler, - listScopesOAuthClientMswHandler, - listSessionsMswHandler, - listUsersMswHandler, - listUsersNoteMswHandler, - listUsersOAuthClientMswHandler, - listUsersSimpleMswHandler, - logoutMswHandler, - mailActiveMswHandler, - noteContentMswHandler, - notesConfigMswHandler, - passwordAuthenticateMswHandler, - passwordSpecialAccessMswHandler, - refreshTokenMswHandler, - regenerateSecretOauthClientMswHandler, - removePasskeyMswHandler, - requestAppCodeMswHandler, - resetPasswordMswHandler, - resetUserAvatarMswHandler, - resetUserPasswordMswHandler, - restoreNoteSnapshotMswHandler, - retrieveAppTokenMswHandler, - revokeSessionMswHandler, - saveAccountSettingsMswHandler, - saveMailSettingsMswHandler, - sendResetLinkMswHandler, - setGoodApodMswHandler, - shareNoteMswHandler, - shareNotePublicMswHandler, - siteUrlMswHandler, - startAuthenticationMswHandler, - startEmailChangeMswHandler, - startRegistrationMswHandler, - startSpecialAccessMswHandler, - testMailMswHandler, - testTokenMswHandler, - totpConfirmMswHandler, - totpFinishSetupMswHandler, - totpRemoveMswHandler, - totpStartSetupMswHandler, - transferNoteMswHandler, - updateAccountMswHandler, - updateAvatarMswHandler, - updatePasswordMswHandler, - userInfoMswHandler -} from './msw.gen'; export { accountSettings, applyNoteEdit, diff --git a/frontend/src/lib/client/msw.gen.ts b/frontend/src/lib/client/msw.gen.ts index cd70a4d6..36f6ec4f 100644 --- a/frontend/src/lib/client/msw.gen.ts +++ b/frontend/src/lib/client/msw.gen.ts @@ -1,856 +1,4754 @@ // This file is auto-generated by @hey-api/openapi-ts -import { client, wrapMswHandler } from '$mocks/msw-runtime'; +import { + type DefaultBodyType, + http, + type HttpHandler, + HttpResponse, + type HttpResponseResolver, + type RequestHandlerOptions as RequestHandlerOptions2 +} from 'msw'; import type { - AccountSettingsData, - AccountSettingsResponse, - ApplyNoteEditData, - AuthConfigData, - AuthConfigResponse, - AuthorizeConfirmData, - AuthorizeConfirmResponse, - AvatarByIdData, - AvatarByIdResponse, + AccountSettingsResponses, + ApplyNoteEditResponses, + AuthConfigResponses, + AuthorizeConfirmResponses, + AvatarByIdResponses, ChangePasswordData, - ChangePasswordError, ChangeUserEmailData, - ChangeUserEmailError, + ChangeUserEmailResponses, + ClientOptions, CompleteSetupData, - CompleteSetupError, ConfirmEmailChangeData, - ConfirmEmailChangeError, + ConfirmEmailChangeResponses, ConvertOidcUserData, - ConvertOidcUserError, + ConvertOidcUserResponses, CreateGroupData, - CreateGroupError, - CreateGroupResponse, + CreateGroupResponses, CreateNoteData, - CreateNoteError, - CreateNoteResponse, + CreateNoteResponses, CreateOauthClientData, - CreateOauthClientError, - CreateOauthClientResponse, + CreateOauthClientResponses, CreateOAuthPolicyData, - CreateOAuthPolicyError, - CreateOAuthPolicyResponse, + CreateOAuthPolicyResponses, CreateOAuthScopeData, - CreateOAuthScopeError, - CreateOAuthScopeResponse, + CreateOAuthScopeResponses, CreateUserData, - CreateUserError, - CreateUserResponse2, + CreateUserResponses, DeleteGroupData, - DeleteGroupError, + DeleteGroupResponses, DeleteNoteData, - DeleteNoteError, + DeleteNoteResponses, DeleteNoteSnapshotData, - DeleteNoteSnapshotError, + DeleteNoteSnapshotResponses, DeleteOauthClientData, - DeleteOauthClientError, + DeleteOauthClientResponses, DeleteOAuthPolicyData, - DeleteOAuthPolicyError, + DeleteOAuthPolicyResponses, DeleteOAuthScopeData, - DeleteOAuthScopeError, + DeleteOAuthScopeResponses, DeleteUserData, - DeleteUserError, + DeleteUserResponses, EditGroupData, - EditGroupError, + EditGroupResponses, EditNoteData, - EditNoteError, + EditNoteResponses, EditOauthClientData, - EditOauthClientError, + EditOauthClientResponses, EditOAuthPolicyData, - EditOAuthPolicyError, + EditOAuthPolicyResponses, EditOAuthScopeData, - EditOAuthScopeError, + EditOAuthScopeResponses, EditPasskeyNameData, - EditPasskeyNameError, + EditPasskeyNameResponses, EditUserData, - EditUserError, + EditUserResponses, ExchangeAppCodeData, - ExchangeAppCodeError, FinishAuthenticationData, - FinishAuthenticationError, FinishRegistrationData, - FinishRegistrationError, - FinishSpecialAccessData, - FinishSpecialAccessError, - GetApodImageData, GetApodImageInfoData, - GetApodImageInfoError, - GetApodImageInfoResponse, - GetMailSettingsData, - GetMailSettingsResponse, - GetNoteSnapshotContentData, - GetOidcSettingsData, - GetOidcSettingsResponse, - GroupInfoData, - GroupInfoResponse, - InfoData, - InfoNoteData, - InfoNoteResponse, - InfoNoteShareData, - InfoNoteShareResponse, - InfoNoteSnapshotData, - InfoNoteSnapshotResponse, - InfoOauthClientData, - InfoOauthClientResponse, - InfoOAuthPolicyData, - InfoOAuthPolicyResponse, - InfoOAuthScopeData, - InfoOAuthScopeResponse, - InfoResponse, + GetApodImageInfoResponses, + GetMailSettingsResponses, + GetOidcSettingsResponses, + GroupInfoResponses, + InfoNoteResponses, + InfoNoteShareResponses, + InfoNoteSnapshotResponses, + InfoOauthClientResponses, + InfoOAuthPolicyResponses, + InfoOAuthScopeResponses, + InfoResponses, InitOidcData, - InitOidcError, - IsSetupData, - IsSetupResponse2, - KeyData, - KeyResponse, - ListApodData, - ListApodResponse, - ListGroupsData, - ListGroupsOAuthClientData, - ListGroupsOAuthClientResponse, - ListGroupsOAuthPolicyData, - ListGroupsOAuthPolicyResponse, - ListGroupsResponse, - ListGroupsSimpleData, - ListGroupsSimpleResponse, - ListNotesData, - ListNoteSnapshotsData, - ListNoteSnapshotsResponse, - ListNotesResponse, - ListOauthClientsData, - ListOauthClientsResponse, - ListOAuthPoliciesData, - ListOAuthPoliciesResponse, - ListOAuthScopesData, - ListOAuthScopesResponse, - ListPasskeysData, - ListPasskeysResponse, - ListPoliciesOAuthScopeData, - ListPoliciesOAuthScopeResponse, - ListScopesOAuthClientData, - ListScopesOAuthClientResponse, - ListSessionsData, - ListSessionsResponse, - ListUsersData, - ListUsersNoteData, - ListUsersNoteResponse, - ListUsersOAuthClientData, - ListUsersOAuthClientResponse, - ListUsersResponse, - ListUsersSimpleData, - ListUsersSimpleResponse, - LogoutData, - MailActiveData, - MailActiveResponse2, - NoteContentData, - NoteContentResponse, - NotesConfigData, - NotesConfigResponse, + InitOidcResponses, + IsSetupResponses, + KeyResponses, + ListApodResponses, + ListGroupsOAuthClientResponses, + ListGroupsOAuthPolicyResponses, + ListGroupsResponses, + ListGroupsSimpleResponses, + ListNoteSnapshotsResponses, + ListNotesResponses, + ListOauthClientsResponses, + ListOAuthPoliciesResponses, + ListOAuthScopesResponses, + ListPasskeysResponses, + ListPoliciesOAuthScopeResponses, + ListScopesOAuthClientResponses, + ListSessionsResponses, + ListUsersNoteResponses, + ListUsersOAuthClientResponses, + ListUsersResponses, + ListUsersSimpleResponses, + MailActiveResponses, + NoteContentResponses, + NotesConfigResponses, PasswordAuthenticateData, - PasswordAuthenticateError, PasswordSpecialAccessData, - PasswordSpecialAccessError, - RefreshTokenData, - RegenerateSecretOauthClientData, - RegenerateSecretOauthClientResponse, + RegenerateSecretOauthClientResponses, RemovePasskeyData, - RemovePasskeyError, + RemovePasskeyResponses, RequestAppCodeData, - RequestAppCodeError, - RequestAppCodeResponse, + RequestAppCodeResponses, ResetPasswordData, - ResetPasswordError, + ResetPasswordResponses, ResetUserAvatarData, - ResetUserAvatarError, + ResetUserAvatarResponses, ResetUserPasswordData, - ResetUserPasswordError, + ResetUserPasswordResponses, RestoreNoteSnapshotData, - RestoreNoteSnapshotError, + RestoreNoteSnapshotResponses, RetrieveAppTokenData, - RetrieveAppTokenError, RevokeSessionData, - RevokeSessionError, SaveAccountSettingsData, - SaveAccountSettingsError, + SaveAccountSettingsResponses, SaveMailSettingsData, - SaveMailSettingsError, + SaveMailSettingsResponses, SendResetLinkData, - SendResetLinkError, + SendResetLinkResponses, SetGoodApodData, - SetGoodApodError, + SetGoodApodResponses, ShareNoteData, - ShareNoteError, ShareNotePublicData, - ShareNotePublicError, - SiteUrlData, - SiteUrlResponse2, - StartAuthenticationData, - StartAuthenticationResponse, + ShareNotePublicResponses, + ShareNoteResponses, + SiteUrlResponses, + StartAuthenticationResponses, StartEmailChangeData, - StartEmailChangeError, - StartRegistrationData, - StartSpecialAccessData, - TestMailData, - TestTokenData, + StartEmailChangeResponses, + StartRegistrationResponses, + StartSpecialAccessResponses, + TestMailResponses, TotpConfirmData, - TotpConfirmError, TotpFinishSetupData, - TotpFinishSetupError, - TotpRemoveData, - TotpStartSetupData, - TotpStartSetupResponse, + TotpStartSetupResponses, TransferNoteData, - TransferNoteError, + TransferNoteResponses, UpdateAccountData, - UpdateAccountError, + UpdateAccountResponses, UpdateAvatarData, - UpdateAvatarError, + UpdateAvatarResponses, UpdatePasswordData, - UpdatePasswordError, - UserInfoData, - UserInfoResponse + UpdatePasswordResponses, + UserInfoResponses } from './types.gen'; -export const isSetupMswHandler = wrapMswHandler< - IsSetupResponse2, - never, - IsSetupData ->('/api/setup', 'get', client.getConfig); - -export const completeSetupMswHandler = wrapMswHandler< - never, - CompleteSetupError, - CompleteSetupData ->('/api/setup', 'post', client.getConfig); - -export const getOidcSettingsMswHandler = wrapMswHandler< - GetOidcSettingsResponse, - never, - GetOidcSettingsData ->('/api/setup/oidc', 'get', client.getConfig); - -export const initOidcMswHandler = wrapMswHandler< - never, - InitOidcError, - InitOidcData ->('/api/setup/oidc', 'post', client.getConfig); - -export const logoutMswHandler = wrapMswHandler( - '/api/auth/logout', - 'post', - client.getConfig -); - -export const finishRegistrationMswHandler = wrapMswHandler< - never, - FinishRegistrationError, - FinishRegistrationData ->('/api/auth/passkey/finish_registration', 'post', client.getConfig); - -export const finishAuthenticationMswHandler = wrapMswHandler< - never, - FinishAuthenticationError, - FinishAuthenticationData ->( - '/api/auth/passkey/finish_authentication/{auth_id}', - 'post', - client.getConfig -); - -export const finishSpecialAccessMswHandler = wrapMswHandler< - never, - FinishSpecialAccessError, - FinishSpecialAccessData ->('/api/auth/passkey/finish_special_access', 'post', client.getConfig); - -export const startRegistrationMswHandler = wrapMswHandler< - never, - never, - StartRegistrationData ->('/api/auth/passkey/start_registration', 'get', client.getConfig); - -export const startAuthenticationMswHandler = wrapMswHandler< - StartAuthenticationResponse, - never, - StartAuthenticationData ->('/api/auth/passkey/start_authentication', 'get', client.getConfig); - -export const startSpecialAccessMswHandler = wrapMswHandler< - never, - never, - StartSpecialAccessData ->('/api/auth/passkey/start_special_access', 'get', client.getConfig); - -export const listPasskeysMswHandler = wrapMswHandler< - ListPasskeysResponse, - never, - ListPasskeysData ->('/api/auth/passkey/list', 'get', client.getConfig); - -export const removePasskeyMswHandler = wrapMswHandler< - never, - RemovePasskeyError, - RemovePasskeyData ->('/api/auth/passkey/remove', 'post', client.getConfig); - -export const editPasskeyNameMswHandler = wrapMswHandler< - never, - EditPasskeyNameError, - EditPasskeyNameData ->('/api/auth/passkey/edit_name', 'post', client.getConfig); - -export const passwordAuthenticateMswHandler = wrapMswHandler< - never, - PasswordAuthenticateError, - PasswordAuthenticateData ->('/api/auth/password/authenticate', 'post', client.getConfig); - -export const passwordSpecialAccessMswHandler = wrapMswHandler< - never, - PasswordSpecialAccessError, - PasswordSpecialAccessData ->('/api/auth/password/special_access', 'post', client.getConfig); - -export const keyMswHandler = wrapMswHandler( - '/api/auth/password/key', - 'get', - client.getConfig -); - -export const changePasswordMswHandler = wrapMswHandler< - never, - ChangePasswordError, - ChangePasswordData ->('/api/auth/password/change', 'post', client.getConfig); - -export const totpConfirmMswHandler = wrapMswHandler< - never, - TotpConfirmError, - TotpConfirmData ->('/api/auth/totp/confirm', 'post', client.getConfig); - -export const totpStartSetupMswHandler = wrapMswHandler< - TotpStartSetupResponse, - never, - TotpStartSetupData ->('/api/auth/totp/start_setup', 'get', client.getConfig); - -export const totpFinishSetupMswHandler = wrapMswHandler< - never, - TotpFinishSetupError, - TotpFinishSetupData ->('/api/auth/totp/finish_setup', 'post', client.getConfig); - -export const totpRemoveMswHandler = wrapMswHandler< - never, - never, - TotpRemoveData ->('/api/auth/totp/remove', 'post', client.getConfig); - -export const authConfigMswHandler = wrapMswHandler< - AuthConfigResponse, - never, - AuthConfigData ->('/api/auth/config', 'get', client.getConfig); - -export const requestAppCodeMswHandler = wrapMswHandler< - RequestAppCodeResponse, - RequestAppCodeError, - RequestAppCodeData ->('/api/auth/app/code', 'post', client.getConfig); - -export const exchangeAppCodeMswHandler = wrapMswHandler< - never, - ExchangeAppCodeError, - ExchangeAppCodeData ->('/api/auth/app/exchange', 'post', client.getConfig); - -export const retrieveAppTokenMswHandler = wrapMswHandler< - never, - RetrieveAppTokenError, - RetrieveAppTokenData ->('/api/auth/app/retrieve_token', 'post', client.getConfig); - -export const testTokenMswHandler = wrapMswHandler( - '/api/auth/test_token', - 'get', - client.getConfig -); - -export const refreshTokenMswHandler = wrapMswHandler< - never, - never, - RefreshTokenData ->('/api/auth/refresh_token', 'get', client.getConfig); - -export const resetUserAvatarMswHandler = wrapMswHandler< - never, - ResetUserAvatarError, - ResetUserAvatarData ->('/api/user/management/avatar', 'delete', client.getConfig); - -export const deleteUserMswHandler = wrapMswHandler< - never, - DeleteUserError, - DeleteUserData ->('/api/user/management', 'delete', client.getConfig); - -export const listUsersMswHandler = wrapMswHandler< - ListUsersResponse, - never, - ListUsersData ->('/api/user/management', 'get', client.getConfig); - -export const createUserMswHandler = wrapMswHandler< - CreateUserResponse2, - CreateUserError, - CreateUserData ->('/api/user/management', 'post', client.getConfig); - -export const editUserMswHandler = wrapMswHandler< - never, - EditUserError, - EditUserData ->('/api/user/management', 'put', client.getConfig); - -export const userInfoMswHandler = wrapMswHandler< - UserInfoResponse, - never, - UserInfoData ->('/api/user/management/{uuid}', 'get', client.getConfig); - -export const mailActiveMswHandler = wrapMswHandler< - MailActiveResponse2, - never, - MailActiveData ->('/api/user/management/mail', 'get', client.getConfig); - -export const listGroupsSimpleMswHandler = wrapMswHandler< - ListGroupsSimpleResponse, - never, - ListGroupsSimpleData ->('/api/user/management/groups', 'get', client.getConfig); - -export const resetUserPasswordMswHandler = wrapMswHandler< - never, - ResetUserPasswordError, - ResetUserPasswordData ->('/api/user/management/password', 'put', client.getConfig); - -export const changeUserEmailMswHandler = wrapMswHandler< - never, - ChangeUserEmailError, - ChangeUserEmailData ->('/api/user/management/email', 'post', client.getConfig); - -export const convertOidcUserMswHandler = wrapMswHandler< - never, - ConvertOidcUserError, - ConvertOidcUserData ->('/api/user/management/convert-oidc', 'put', client.getConfig); - -export const updatePasswordMswHandler = wrapMswHandler< - never, - UpdatePasswordError, - UpdatePasswordData ->('/api/user/account/password', 'post', client.getConfig); - -export const startEmailChangeMswHandler = wrapMswHandler< - never, - StartEmailChangeError, - StartEmailChangeData ->('/api/user/account/email_change_start', 'post', client.getConfig); - -export const updateAccountMswHandler = wrapMswHandler< - never, - UpdateAccountError, - UpdateAccountData ->('/api/user/account/update', 'post', client.getConfig); - -export const confirmEmailChangeMswHandler = wrapMswHandler< - never, - ConfirmEmailChangeError, - ConfirmEmailChangeData ->('/api/user/account/email_change_confirm', 'post', client.getConfig); - -export const updateAvatarMswHandler = wrapMswHandler< - never, - UpdateAvatarError, - UpdateAvatarData ->('/api/user/account/avatar', 'post', client.getConfig); - -export const listSessionsMswHandler = wrapMswHandler< - ListSessionsResponse, - never, - ListSessionsData ->('/api/user/account/sessions', 'get', client.getConfig); - -export const revokeSessionMswHandler = wrapMswHandler< - never, - RevokeSessionError, - RevokeSessionData ->('/api/user/account/sessions', 'post', client.getConfig); - -export const infoMswHandler = wrapMswHandler( - '/api/user/info', - 'get', - client.getConfig -); - -export const avatarByIdMswHandler = wrapMswHandler< - AvatarByIdResponse, - never, - AvatarByIdData ->('/api/user/info/avatar/{uuid}', 'get', client.getConfig); - -export const getMailSettingsMswHandler = wrapMswHandler< - GetMailSettingsResponse, - never, - GetMailSettingsData ->('/api/settings/mail', 'get', client.getConfig); - -export const saveMailSettingsMswHandler = wrapMswHandler< - never, - SaveMailSettingsError, - SaveMailSettingsData ->('/api/settings/mail', 'post', client.getConfig); - -export const accountSettingsMswHandler = wrapMswHandler< - AccountSettingsResponse, - never, - AccountSettingsData ->('/api/settings/account', 'get', client.getConfig); - -export const saveAccountSettingsMswHandler = wrapMswHandler< - never, - SaveAccountSettingsError, - SaveAccountSettingsData ->('/api/settings/account', 'post', client.getConfig); - -export const sendResetLinkMswHandler = wrapMswHandler< - never, - SendResetLinkError, - SendResetLinkData ->('/api/mail/reset/send', 'post', client.getConfig); - -export const resetPasswordMswHandler = wrapMswHandler< - never, - ResetPasswordError, - ResetPasswordData ->('/api/mail/reset/confirm', 'post', client.getConfig); - -export const testMailMswHandler = wrapMswHandler( - '/api/mail/test', - 'post', - client.getConfig -); - -export const deleteGroupMswHandler = wrapMswHandler< - never, - DeleteGroupError, - DeleteGroupData ->('/api/group', 'delete', client.getConfig); - -export const listGroupsMswHandler = wrapMswHandler< - ListGroupsResponse, - never, - ListGroupsData ->('/api/group', 'get', client.getConfig); - -export const createGroupMswHandler = wrapMswHandler< - CreateGroupResponse, - CreateGroupError, - CreateGroupData ->('/api/group', 'post', client.getConfig); - -export const editGroupMswHandler = wrapMswHandler< - never, - EditGroupError, - EditGroupData ->('/api/group', 'put', client.getConfig); - -export const groupInfoMswHandler = wrapMswHandler< - GroupInfoResponse, - never, - GroupInfoData ->('/api/group/{uuid}', 'get', client.getConfig); - -export const listUsersSimpleMswHandler = wrapMswHandler< - ListUsersSimpleResponse, - never, - ListUsersSimpleData ->('/api/group/users', 'get', client.getConfig); - -export const listApodMswHandler = wrapMswHandler< - ListApodResponse, - never, - ListApodData ->('/api/services/apod', 'get', client.getConfig); - -export const setGoodApodMswHandler = wrapMswHandler< - never, - SetGoodApodError, - SetGoodApodData ->('/api/services/apod', 'post', client.getConfig); - -export const getApodImageInfoMswHandler = wrapMswHandler< - GetApodImageInfoResponse, - GetApodImageInfoError, - GetApodImageInfoData ->('/api/services/apod/get_image_info', 'post', client.getConfig); - -export const getApodImageMswHandler = wrapMswHandler< - never, - never, - GetApodImageData ->('/api/services/apod/get_image', 'get', client.getConfig); - -export const authorizeConfirmMswHandler = wrapMswHandler< - AuthorizeConfirmResponse, - never, - AuthorizeConfirmData ->('/api/oauth/authorize_confirm', 'post', client.getConfig); - -export const deleteOauthClientMswHandler = wrapMswHandler< - never, - DeleteOauthClientError, - DeleteOauthClientData ->('/api/oauth_management/client', 'delete', client.getConfig); - -export const listOauthClientsMswHandler = wrapMswHandler< - ListOauthClientsResponse, - never, - ListOauthClientsData ->('/api/oauth_management/client', 'get', client.getConfig); - -export const createOauthClientMswHandler = wrapMswHandler< - CreateOauthClientResponse, - CreateOauthClientError, - CreateOauthClientData ->('/api/oauth_management/client', 'post', client.getConfig); - -export const editOauthClientMswHandler = wrapMswHandler< - never, - EditOauthClientError, - EditOauthClientData ->('/api/oauth_management/client', 'put', client.getConfig); - -export const infoOauthClientMswHandler = wrapMswHandler< - InfoOauthClientResponse, - never, - InfoOauthClientData ->('/api/oauth_management/client/{uuid}', 'get', client.getConfig); - -export const regenerateSecretOauthClientMswHandler = wrapMswHandler< - RegenerateSecretOauthClientResponse, - never, - RegenerateSecretOauthClientData ->('/api/oauth_management/client/{uuid}', 'post', client.getConfig); - -export const siteUrlMswHandler = wrapMswHandler< - SiteUrlResponse2, - never, - SiteUrlData ->('/api/oauth_management/client/site_url', 'get', client.getConfig); - -export const listGroupsOAuthClientMswHandler = wrapMswHandler< - ListGroupsOAuthClientResponse, - never, - ListGroupsOAuthClientData ->('/api/oauth_management/client/groups', 'get', client.getConfig); - -export const listUsersOAuthClientMswHandler = wrapMswHandler< - ListUsersOAuthClientResponse, - never, - ListUsersOAuthClientData ->('/api/oauth_management/client/users', 'get', client.getConfig); - -export const listScopesOAuthClientMswHandler = wrapMswHandler< - ListScopesOAuthClientResponse, - never, - ListScopesOAuthClientData ->('/api/oauth_management/client/scopes', 'get', client.getConfig); - -export const deleteOAuthScopeMswHandler = wrapMswHandler< - never, - DeleteOAuthScopeError, - DeleteOAuthScopeData ->('/api/oauth_management/scope', 'delete', client.getConfig); - -export const listOAuthScopesMswHandler = wrapMswHandler< - ListOAuthScopesResponse, - never, - ListOAuthScopesData ->('/api/oauth_management/scope', 'get', client.getConfig); - -export const createOAuthScopeMswHandler = wrapMswHandler< - CreateOAuthScopeResponse, - CreateOAuthScopeError, - CreateOAuthScopeData ->('/api/oauth_management/scope', 'post', client.getConfig); - -export const editOAuthScopeMswHandler = wrapMswHandler< - never, - EditOAuthScopeError, - EditOAuthScopeData ->('/api/oauth_management/scope', 'put', client.getConfig); - -export const infoOAuthScopeMswHandler = wrapMswHandler< - InfoOAuthScopeResponse, - never, - InfoOAuthScopeData ->('/api/oauth_management/scope/{uuid}', 'get', client.getConfig); - -export const listPoliciesOAuthScopeMswHandler = wrapMswHandler< - ListPoliciesOAuthScopeResponse, - never, - ListPoliciesOAuthScopeData ->('/api/oauth_management/scope/policies', 'get', client.getConfig); - -export const deleteOAuthPolicyMswHandler = wrapMswHandler< - never, - DeleteOAuthPolicyError, - DeleteOAuthPolicyData ->('/api/oauth_management/policy', 'delete', client.getConfig); - -export const listOAuthPoliciesMswHandler = wrapMswHandler< - ListOAuthPoliciesResponse, - never, - ListOAuthPoliciesData ->('/api/oauth_management/policy', 'get', client.getConfig); - -export const createOAuthPolicyMswHandler = wrapMswHandler< - CreateOAuthPolicyResponse, - CreateOAuthPolicyError, - CreateOAuthPolicyData ->('/api/oauth_management/policy', 'post', client.getConfig); - -export const editOAuthPolicyMswHandler = wrapMswHandler< - never, - EditOAuthPolicyError, - EditOAuthPolicyData ->('/api/oauth_management/policy', 'put', client.getConfig); - -export const infoOAuthPolicyMswHandler = wrapMswHandler< - InfoOAuthPolicyResponse, - never, - InfoOAuthPolicyData ->('/api/oauth_management/policy/{uuid}', 'get', client.getConfig); - -export const listGroupsOAuthPolicyMswHandler = wrapMswHandler< - ListGroupsOAuthPolicyResponse, - never, - ListGroupsOAuthPolicyData ->('/api/oauth_management/policy/groups', 'get', client.getConfig); - -export const deleteNoteMswHandler = wrapMswHandler< - never, - DeleteNoteError, - DeleteNoteData ->('/api/notes/management', 'delete', client.getConfig); - -export const listNotesMswHandler = wrapMswHandler< - ListNotesResponse, - never, - ListNotesData ->('/api/notes/management', 'get', client.getConfig); - -export const createNoteMswHandler = wrapMswHandler< - CreateNoteResponse, - CreateNoteError, - CreateNoteData ->('/api/notes/management', 'post', client.getConfig); - -export const editNoteMswHandler = wrapMswHandler< - never, - EditNoteError, - EditNoteData ->('/api/notes/management', 'put', client.getConfig); - -export const infoNoteMswHandler = wrapMswHandler< - InfoNoteResponse, - never, - InfoNoteData ->('/api/notes/management/{uuid}', 'get', client.getConfig); - -export const applyNoteEditMswHandler = wrapMswHandler< - never, - never, - ApplyNoteEditData ->('/api/notes/management/{uuid}', 'put', client.getConfig); - -export const infoNoteShareMswHandler = wrapMswHandler< - InfoNoteShareResponse, - never, - InfoNoteShareData ->('/api/notes/management/{uuid}/public', 'get', client.getConfig); - -export const noteContentMswHandler = wrapMswHandler< - NoteContentResponse, - never, - NoteContentData ->('/api/notes/management/{uuid}/content', 'get', client.getConfig); - -export const listUsersNoteMswHandler = wrapMswHandler< - ListUsersNoteResponse, - never, - ListUsersNoteData ->('/api/notes/management/users', 'get', client.getConfig); - -export const shareNoteMswHandler = wrapMswHandler< - never, - ShareNoteError, - ShareNoteData ->('/api/notes/management/share', 'put', client.getConfig); - -export const shareNotePublicMswHandler = wrapMswHandler< - never, - ShareNotePublicError, - ShareNotePublicData ->('/api/notes/management/share/public', 'put', client.getConfig); - -export const transferNoteMswHandler = wrapMswHandler< - never, - TransferNoteError, - TransferNoteData ->('/api/notes/management/transfer', 'put', client.getConfig); - -export const notesConfigMswHandler = wrapMswHandler< - NotesConfigResponse, - never, - NotesConfigData ->('/api/notes/management/config', 'get', client.getConfig); - -export const listNoteSnapshotsMswHandler = wrapMswHandler< - ListNoteSnapshotsResponse, - never, - ListNoteSnapshotsData ->('/api/notes/snapshots/{note_uuid}', 'get', client.getConfig); - -export const deleteNoteSnapshotMswHandler = wrapMswHandler< - never, - DeleteNoteSnapshotError, - DeleteNoteSnapshotData ->('/api/notes/snapshots', 'delete', client.getConfig); - -export const restoreNoteSnapshotMswHandler = wrapMswHandler< - never, - RestoreNoteSnapshotError, - RestoreNoteSnapshotData ->('/api/notes/snapshots/restore', 'put', client.getConfig); - -export const infoNoteSnapshotMswHandler = wrapMswHandler< - InfoNoteSnapshotResponse, - never, - InfoNoteSnapshotData ->('/api/notes/snapshots/{snapshot_id}/info', 'get', client.getConfig); - -export const getNoteSnapshotContentMswHandler = wrapMswHandler< - never, - never, - GetNoteSnapshotContentData ->('/api/notes/snapshots/{snapshot_id}/content', 'get', client.getConfig); +export type RequestHandlerOptions = RequestHandlerOptions2 & { + baseUrl?: ClientOptions['baseUrl']; + responseFallback?: 'error' | 'passthrough'; +}; + +export type HandleIsSetupResponse = { + body: IsSetupResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/setup` operation. + */ +export function handleIsSetup( + response?: HandleIsSetupResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/setup`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleCompleteSetupResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/setup` operation. + */ +export function handleCompleteSetup( + response?: + | HandleCompleteSetupResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/setup`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleGetOidcSettingsResponse = { + body: GetOidcSettingsResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/setup/oidc` operation. + */ +export function handleGetOidcSettings( + response?: HandleGetOidcSettingsResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/setup/oidc`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleInitOidcResponse = { + body: InitOidcResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/setup/oidc` operation. + */ +export function handleInitOidc( + response?: + | HandleInitOidcResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/setup/oidc`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleLogoutResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/auth/logout` operation. + */ +export function handleLogout( + response?: HandleLogoutResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/logout`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleFinishRegistrationResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/auth/passkey/finish_registration` operation. + */ +export function handleFinishRegistration( + response?: + | HandleFinishRegistrationResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/passkey/finish_registration`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleFinishAuthenticationResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/auth/passkey/finish_authentication/{auth_id}` operation. + */ +export function handleFinishAuthentication( + response?: + | HandleFinishAuthenticationResponse + | HttpResponseResolver< + { + auth_id: string; + }, + FinishAuthenticationData['body'] + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.post< + { + auth_id: string; + }, + FinishAuthenticationData['body'] + >( + `${options?.baseUrl ?? '*'}/api/auth/passkey/finish_authentication/:auth_id`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleFinishSpecialAccessResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/auth/passkey/finish_special_access` operation. + */ +export function handleFinishSpecialAccess( + response?: + | HandleFinishSpecialAccessResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/passkey/finish_special_access`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleStartRegistrationResponse = { + body: StartRegistrationResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/auth/passkey/start_registration` operation. + */ +export function handleStartRegistration( + response?: + | HandleStartRegistrationResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/auth/passkey/start_registration`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleStartAuthenticationResponse = { + body: StartAuthenticationResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/auth/passkey/start_authentication` operation. + */ +export function handleStartAuthentication( + response?: + | HandleStartAuthenticationResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/auth/passkey/start_authentication`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleStartSpecialAccessResponse = { + body: StartSpecialAccessResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/auth/passkey/start_special_access` operation. + */ +export function handleStartSpecialAccess( + response?: + | HandleStartSpecialAccessResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/auth/passkey/start_special_access`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListPasskeysResponse = { + body: ListPasskeysResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/auth/passkey/list` operation. + */ +export function handleListPasskeys( + response?: HandleListPasskeysResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/auth/passkey/list`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleRemovePasskeyResponse = { + body: RemovePasskeyResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/auth/passkey/remove` operation. + */ +export function handleRemovePasskey( + response?: + | HandleRemovePasskeyResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/passkey/remove`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleEditPasskeyNameResponse = { + body: EditPasskeyNameResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/auth/passkey/edit_name` operation. + */ +export function handleEditPasskeyName( + response?: + | HandleEditPasskeyNameResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/passkey/edit_name`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandlePasswordAuthenticateResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/auth/password/authenticate` operation. + */ +export function handlePasswordAuthenticate( + response?: + | HandlePasswordAuthenticateResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/password/authenticate`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandlePasswordSpecialAccessResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/auth/password/special_access` operation. + */ +export function handlePasswordSpecialAccess( + response?: + | HandlePasswordSpecialAccessResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/password/special_access`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleKeyResponse = { + body: KeyResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/auth/password/key` operation. + */ +export function handleKey( + response?: HandleKeyResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/auth/password/key`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleChangePasswordResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/auth/password/change` operation. + */ +export function handleChangePassword( + response?: + | HandleChangePasswordResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/password/change`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleTotpConfirmResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/auth/totp/confirm` operation. + */ +export function handleTotpConfirm( + response?: + | HandleTotpConfirmResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/totp/confirm`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleTotpStartSetupResponse = { + body: TotpStartSetupResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/auth/totp/start_setup` operation. + */ +export function handleTotpStartSetup( + response?: HandleTotpStartSetupResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/auth/totp/start_setup`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleTotpFinishSetupResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/auth/totp/finish_setup` operation. + */ +export function handleTotpFinishSetup( + response?: + | HandleTotpFinishSetupResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/totp/finish_setup`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleTotpRemoveResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/auth/totp/remove` operation. + */ +export function handleTotpRemove( + response?: HandleTotpRemoveResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/totp/remove`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleAuthConfigResponse = { + body: AuthConfigResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/auth/config` operation. + */ +export function handleAuthConfig( + response?: HandleAuthConfigResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/auth/config`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleRequestAppCodeResponse = { + body: RequestAppCodeResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/auth/app/code` operation. + */ +export function handleRequestAppCode( + response?: + | HandleRequestAppCodeResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/app/code`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleExchangeAppCodeResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/auth/app/exchange` operation. + */ +export function handleExchangeAppCode( + response?: + | HandleExchangeAppCodeResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/app/exchange`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleRetrieveAppTokenResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/auth/app/retrieve_token` operation. + */ +export function handleRetrieveAppToken( + response?: + | HandleRetrieveAppTokenResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/auth/app/retrieve_token`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleTestTokenResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `GET /api/auth/test_token` operation. + */ +export function handleTestToken( + response?: HandleTestTokenResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/auth/test_token`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleRefreshTokenResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `GET /api/auth/refresh_token` operation. + */ +export function handleRefreshToken( + response?: HandleRefreshTokenResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/auth/refresh_token`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleResetUserAvatarResponse = { + body: ResetUserAvatarResponses[200]; + status?: 200; +}; + +/** + * Handler for the `DELETE /api/user/management/avatar` operation. + */ +export function handleResetUserAvatar( + response?: + | HandleResetUserAvatarResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.delete( + `${options?.baseUrl ?? '*'}/api/user/management/avatar`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleDeleteUserResponse = { + body: DeleteUserResponses[200]; + status?: 200; +}; + +/** + * Handler for the `DELETE /api/user/management` operation. + */ +export function handleDeleteUser( + response?: + | HandleDeleteUserResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.delete( + `${options?.baseUrl ?? '*'}/api/user/management`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListUsersResponse = { + body: ListUsersResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/user/management` operation. + */ +export function handleListUsers( + response?: HandleListUsersResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/user/management`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleCreateUserResponse = { + body: CreateUserResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/user/management` operation. + */ +export function handleCreateUser( + response?: + | HandleCreateUserResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/user/management`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleEditUserResponse = { + body: EditUserResponses[200]; + status?: 200; +}; + +/** + * Handler for the `PUT /api/user/management` operation. + */ +export function handleEditUser( + response?: + | HandleEditUserResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.put( + `${options?.baseUrl ?? '*'}/api/user/management`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleUserInfoResponse = { + body: UserInfoResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/user/management/{uuid}` operation. + */ +export function handleUserInfo( + response?: + | HandleUserInfoResponse + | HttpResponseResolver< + { + uuid: string; + }, + never + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.get< + { + uuid: string; + }, + never + >( + `${options?.baseUrl ?? '*'}/api/user/management/:uuid`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleMailActiveResponse = { + body: MailActiveResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/user/management/mail` operation. + */ +export function handleMailActive( + response?: HandleMailActiveResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/user/management/mail`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListGroupsSimpleResponse = { + body: ListGroupsSimpleResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/user/management/groups` operation. + */ +export function handleListGroupsSimple( + response?: + | HandleListGroupsSimpleResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/user/management/groups`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleResetUserPasswordResponse = { + body: ResetUserPasswordResponses[200]; + status?: 200; +}; + +/** + * Handler for the `PUT /api/user/management/password` operation. + */ +export function handleResetUserPassword( + response?: + | HandleResetUserPasswordResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.put( + `${options?.baseUrl ?? '*'}/api/user/management/password`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleChangeUserEmailResponse = { + body: ChangeUserEmailResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/user/management/email` operation. + */ +export function handleChangeUserEmail( + response?: + | HandleChangeUserEmailResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/user/management/email`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleConvertOidcUserResponse = { + body: ConvertOidcUserResponses[200]; + status?: 200; +}; + +/** + * Handler for the `PUT /api/user/management/convert-oidc` operation. + */ +export function handleConvertOidcUser( + response?: + | HandleConvertOidcUserResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.put( + `${options?.baseUrl ?? '*'}/api/user/management/convert-oidc`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleUpdatePasswordResponse = { + body: UpdatePasswordResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/user/account/password` operation. + */ +export function handleUpdatePassword( + response?: + | HandleUpdatePasswordResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/user/account/password`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleStartEmailChangeResponse = { + body: StartEmailChangeResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/user/account/email_change_start` operation. + */ +export function handleStartEmailChange( + response?: + | HandleStartEmailChangeResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/user/account/email_change_start`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleUpdateAccountResponse = { + body: UpdateAccountResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/user/account/update` operation. + */ +export function handleUpdateAccount( + response?: + | HandleUpdateAccountResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/user/account/update`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleConfirmEmailChangeResponse = { + body: ConfirmEmailChangeResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/user/account/email_change_confirm` operation. + */ +export function handleConfirmEmailChange( + response?: + | HandleConfirmEmailChangeResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/user/account/email_change_confirm`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleUpdateAvatarResponse = { + body: UpdateAvatarResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/user/account/avatar` operation. + */ +export function handleUpdateAvatar( + response?: + | HandleUpdateAvatarResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/user/account/avatar`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListSessionsResponse = { + body: ListSessionsResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/user/account/sessions` operation. + */ +export function handleListSessions( + response?: HandleListSessionsResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/user/account/sessions`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleRevokeSessionResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `POST /api/user/account/sessions` operation. + */ +export function handleRevokeSession( + response?: + | HandleRevokeSessionResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/user/account/sessions`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleInfoResponse = { + body: InfoResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/user/info` operation. + */ +export function handleInfo( + response?: HandleInfoResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/user/info`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleAvatarByIdResponse = { + body: AvatarByIdResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/user/info/avatar/{uuid}` operation. + */ +export function handleAvatarById( + response?: + | HandleAvatarByIdResponse + | HttpResponseResolver< + { + uuid: string; + }, + never + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.get< + { + uuid: string; + }, + never + >( + `${options?.baseUrl ?? '*'}/api/user/info/avatar/:uuid`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleGetMailSettingsResponse = { + body: GetMailSettingsResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/settings/mail` operation. + */ +export function handleGetMailSettings( + response?: HandleGetMailSettingsResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/settings/mail`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleSaveMailSettingsResponse = { + body: SaveMailSettingsResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/settings/mail` operation. + */ +export function handleSaveMailSettings( + response?: + | HandleSaveMailSettingsResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/settings/mail`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleAccountSettingsResponse = { + body: AccountSettingsResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/settings/account` operation. + */ +export function handleAccountSettings( + response?: HandleAccountSettingsResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/settings/account`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleSaveAccountSettingsResponse = { + body: SaveAccountSettingsResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/settings/account` operation. + */ +export function handleSaveAccountSettings( + response?: + | HandleSaveAccountSettingsResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/settings/account`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleSendResetLinkResponse = { + body: SendResetLinkResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/mail/reset/send` operation. + */ +export function handleSendResetLink( + response?: + | HandleSendResetLinkResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/mail/reset/send`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleResetPasswordResponse = { + body: ResetPasswordResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/mail/reset/confirm` operation. + */ +export function handleResetPassword( + response?: + | HandleResetPasswordResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/mail/reset/confirm`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleTestMailResponse = { + body: TestMailResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/mail/test` operation. + */ +export function handleTestMail( + response?: HandleTestMailResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/mail/test`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleDeleteGroupResponse = { + body: DeleteGroupResponses[200]; + status?: 200; +}; + +/** + * Handler for the `DELETE /api/group` operation. + */ +export function handleDeleteGroup( + response?: + | HandleDeleteGroupResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.delete( + `${options?.baseUrl ?? '*'}/api/group`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListGroupsResponse = { + body: ListGroupsResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/group` operation. + */ +export function handleListGroups( + response?: HandleListGroupsResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/group`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleCreateGroupResponse = { + body: CreateGroupResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/group` operation. + */ +export function handleCreateGroup( + response?: + | HandleCreateGroupResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/group`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleEditGroupResponse = { + body: EditGroupResponses[200]; + status?: 200; +}; + +/** + * Handler for the `PUT /api/group` operation. + */ +export function handleEditGroup( + response?: + | HandleEditGroupResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.put( + `${options?.baseUrl ?? '*'}/api/group`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleGroupInfoResponse = { + body: GroupInfoResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/group/{uuid}` operation. + */ +export function handleGroupInfo( + response?: + | HandleGroupInfoResponse + | HttpResponseResolver< + { + uuid: string; + }, + never + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.get< + { + uuid: string; + }, + never + >( + `${options?.baseUrl ?? '*'}/api/group/:uuid`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListUsersSimpleResponse = { + body: ListUsersSimpleResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/group/users` operation. + */ +export function handleListUsersSimple( + response?: HandleListUsersSimpleResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/group/users`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListApodResponse = { + body: ListApodResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/services/apod` operation. + */ +export function handleListApod( + response?: HandleListApodResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/services/apod`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleSetGoodApodResponse = { + body: SetGoodApodResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/services/apod` operation. + */ +export function handleSetGoodApod( + response?: + | HandleSetGoodApodResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/services/apod`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleGetApodImageInfoResponse = { + body: GetApodImageInfoResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/services/apod/get_image_info` operation. + */ +export function handleGetApodImageInfo( + response?: + | HandleGetApodImageInfoResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/services/apod/get_image_info`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleGetApodImageResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `GET /api/services/apod/get_image` operation. + */ +export function handleGetApodImage( + response?: HandleGetApodImageResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/services/apod/get_image`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleAuthorizeConfirmResponse = { + body: AuthorizeConfirmResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/oauth/authorize_confirm` operation. + */ +export function handleAuthorizeConfirm( + response?: + | HandleAuthorizeConfirmResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/oauth/authorize_confirm`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleDeleteOauthClientResponse = { + body: DeleteOauthClientResponses[200]; + status?: 200; +}; + +/** + * Handler for the `DELETE /api/oauth_management/client` operation. + */ +export function handleDeleteOauthClient( + response?: + | HandleDeleteOauthClientResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.delete( + `${options?.baseUrl ?? '*'}/api/oauth_management/client`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListOauthClientsResponse = { + body: ListOauthClientsResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/oauth_management/client` operation. + */ +export function handleListOauthClients( + response?: + | HandleListOauthClientsResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/oauth_management/client`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleCreateOauthClientResponse = { + body: CreateOauthClientResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/oauth_management/client` operation. + */ +export function handleCreateOauthClient( + response?: + | HandleCreateOauthClientResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/oauth_management/client`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleEditOauthClientResponse = { + body: EditOauthClientResponses[200]; + status?: 200; +}; + +/** + * Handler for the `PUT /api/oauth_management/client` operation. + */ +export function handleEditOauthClient( + response?: + | HandleEditOauthClientResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.put( + `${options?.baseUrl ?? '*'}/api/oauth_management/client`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleInfoOauthClientResponse = { + body: InfoOauthClientResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/oauth_management/client/{uuid}` operation. + */ +export function handleInfoOauthClient( + response?: + | HandleInfoOauthClientResponse + | HttpResponseResolver< + { + uuid: string; + }, + never + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.get< + { + uuid: string; + }, + never + >( + `${options?.baseUrl ?? '*'}/api/oauth_management/client/:uuid`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleRegenerateSecretOauthClientResponse = { + body: RegenerateSecretOauthClientResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/oauth_management/client/{uuid}` operation. + */ +export function handleRegenerateSecretOauthClient( + response?: + | HandleRegenerateSecretOauthClientResponse + | HttpResponseResolver< + { + uuid: string; + }, + never + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.post< + { + uuid: string; + }, + never + >( + `${options?.baseUrl ?? '*'}/api/oauth_management/client/:uuid`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleSiteUrlResponse = { + body: SiteUrlResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/oauth_management/client/site_url` operation. + */ +export function handleSiteUrl( + response?: HandleSiteUrlResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/oauth_management/client/site_url`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListGroupsOAuthClientResponse = { + body: ListGroupsOAuthClientResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/oauth_management/client/groups` operation. + */ +export function handleListGroupsOAuthClient( + response?: + | HandleListGroupsOAuthClientResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/oauth_management/client/groups`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListUsersOAuthClientResponse = { + body: ListUsersOAuthClientResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/oauth_management/client/users` operation. + */ +export function handleListUsersOAuthClient( + response?: + | HandleListUsersOAuthClientResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/oauth_management/client/users`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListScopesOAuthClientResponse = { + body: ListScopesOAuthClientResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/oauth_management/client/scopes` operation. + */ +export function handleListScopesOAuthClient( + response?: + | HandleListScopesOAuthClientResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/oauth_management/client/scopes`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleDeleteOAuthScopeResponse = { + body: DeleteOAuthScopeResponses[200]; + status?: 200; +}; + +/** + * Handler for the `DELETE /api/oauth_management/scope` operation. + */ +export function handleDeleteOAuthScope( + response?: + | HandleDeleteOAuthScopeResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.delete( + `${options?.baseUrl ?? '*'}/api/oauth_management/scope`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListOAuthScopesResponse = { + body: ListOAuthScopesResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/oauth_management/scope` operation. + */ +export function handleListOAuthScopes( + response?: HandleListOAuthScopesResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/oauth_management/scope`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleCreateOAuthScopeResponse = { + body: CreateOAuthScopeResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/oauth_management/scope` operation. + */ +export function handleCreateOAuthScope( + response?: + | HandleCreateOAuthScopeResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/oauth_management/scope`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleEditOAuthScopeResponse = { + body: EditOAuthScopeResponses[200]; + status?: 200; +}; + +/** + * Handler for the `PUT /api/oauth_management/scope` operation. + */ +export function handleEditOAuthScope( + response?: + | HandleEditOAuthScopeResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.put( + `${options?.baseUrl ?? '*'}/api/oauth_management/scope`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleInfoOAuthScopeResponse = { + body: InfoOAuthScopeResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/oauth_management/scope/{uuid}` operation. + */ +export function handleInfoOAuthScope( + response?: + | HandleInfoOAuthScopeResponse + | HttpResponseResolver< + { + uuid: string; + }, + never + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.get< + { + uuid: string; + }, + never + >( + `${options?.baseUrl ?? '*'}/api/oauth_management/scope/:uuid`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListPoliciesOAuthScopeResponse = { + body: ListPoliciesOAuthScopeResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/oauth_management/scope/policies` operation. + */ +export function handleListPoliciesOAuthScope( + response?: + | HandleListPoliciesOAuthScopeResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/oauth_management/scope/policies`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleDeleteOAuthPolicyResponse = { + body: DeleteOAuthPolicyResponses[200]; + status?: 200; +}; + +/** + * Handler for the `DELETE /api/oauth_management/policy` operation. + */ +export function handleDeleteOAuthPolicy( + response?: + | HandleDeleteOAuthPolicyResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.delete( + `${options?.baseUrl ?? '*'}/api/oauth_management/policy`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListOAuthPoliciesResponse = { + body: ListOAuthPoliciesResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/oauth_management/policy` operation. + */ +export function handleListOAuthPolicies( + response?: + | HandleListOAuthPoliciesResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/oauth_management/policy`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleCreateOAuthPolicyResponse = { + body: CreateOAuthPolicyResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/oauth_management/policy` operation. + */ +export function handleCreateOAuthPolicy( + response?: + | HandleCreateOAuthPolicyResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/oauth_management/policy`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleEditOAuthPolicyResponse = { + body: EditOAuthPolicyResponses[200]; + status?: 200; +}; + +/** + * Handler for the `PUT /api/oauth_management/policy` operation. + */ +export function handleEditOAuthPolicy( + response?: + | HandleEditOAuthPolicyResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.put( + `${options?.baseUrl ?? '*'}/api/oauth_management/policy`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleInfoOAuthPolicyResponse = { + body: InfoOAuthPolicyResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/oauth_management/policy/{uuid}` operation. + */ +export function handleInfoOAuthPolicy( + response?: + | HandleInfoOAuthPolicyResponse + | HttpResponseResolver< + { + uuid: string; + }, + never + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.get< + { + uuid: string; + }, + never + >( + `${options?.baseUrl ?? '*'}/api/oauth_management/policy/:uuid`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListGroupsOAuthPolicyResponse = { + body: ListGroupsOAuthPolicyResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/oauth_management/policy/groups` operation. + */ +export function handleListGroupsOAuthPolicy( + response?: + | HandleListGroupsOAuthPolicyResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/oauth_management/policy/groups`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleDeleteNoteResponse = { + body: DeleteNoteResponses[200]; + status?: 200; +}; + +/** + * Handler for the `DELETE /api/notes/management` operation. + */ +export function handleDeleteNote( + response?: + | HandleDeleteNoteResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.delete( + `${options?.baseUrl ?? '*'}/api/notes/management`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListNotesResponse = { + body: ListNotesResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/notes/management` operation. + */ +export function handleListNotes( + response?: HandleListNotesResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/notes/management`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleCreateNoteResponse = { + body: CreateNoteResponses[200]; + status?: 200; +}; + +/** + * Handler for the `POST /api/notes/management` operation. + */ +export function handleCreateNote( + response?: + | HandleCreateNoteResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.post( + `${options?.baseUrl ?? '*'}/api/notes/management`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleEditNoteResponse = { + body: EditNoteResponses[200]; + status?: 200; +}; + +/** + * Handler for the `PUT /api/notes/management` operation. + */ +export function handleEditNote( + response?: + | HandleEditNoteResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.put( + `${options?.baseUrl ?? '*'}/api/notes/management`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleInfoNoteResponse = { + body: InfoNoteResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/notes/management/{uuid}` operation. + */ +export function handleInfoNote( + response?: + | HandleInfoNoteResponse + | HttpResponseResolver< + { + uuid: string; + }, + never + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.get< + { + uuid: string; + }, + never + >( + `${options?.baseUrl ?? '*'}/api/notes/management/:uuid`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleApplyNoteEditResponse = { + body: ApplyNoteEditResponses[200]; + status?: 200; +}; + +/** + * Handler for the `PUT /api/notes/management/{uuid}` operation. + */ +export function handleApplyNoteEdit( + response?: + | HandleApplyNoteEditResponse + | HttpResponseResolver< + { + uuid: string; + }, + DefaultBodyType + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.put< + { + uuid: string; + }, + DefaultBodyType + >( + `${options?.baseUrl ?? '*'}/api/notes/management/:uuid`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleInfoNoteShareResponse = { + body: InfoNoteShareResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/notes/management/{uuid}/public` operation. + */ +export function handleInfoNoteShare( + response?: + | HandleInfoNoteShareResponse + | HttpResponseResolver< + { + uuid: string; + }, + never + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.get< + { + uuid: string; + }, + never + >( + `${options?.baseUrl ?? '*'}/api/notes/management/:uuid/public`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleNoteContentResponse = { + body: NoteContentResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/notes/management/{uuid}/content` operation. + */ +export function handleNoteContent( + response?: + | HandleNoteContentResponse + | HttpResponseResolver< + { + uuid: string; + }, + never + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.get< + { + uuid: string; + }, + never + >( + `${options?.baseUrl ?? '*'}/api/notes/management/:uuid/content`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListUsersNoteResponse = { + body: ListUsersNoteResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/notes/management/users` operation. + */ +export function handleListUsersNote( + response?: HandleListUsersNoteResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/notes/management/users`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleShareNoteResponse = { + body: ShareNoteResponses[200]; + status?: 200; +}; + +/** + * Handler for the `PUT /api/notes/management/share` operation. + */ +export function handleShareNote( + response?: + | HandleShareNoteResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.put( + `${options?.baseUrl ?? '*'}/api/notes/management/share`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleShareNotePublicResponse = { + body: ShareNotePublicResponses[200]; + status?: 200; +}; + +/** + * Handler for the `PUT /api/notes/management/share/public` operation. + */ +export function handleShareNotePublic( + response?: + | HandleShareNotePublicResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.put( + `${options?.baseUrl ?? '*'}/api/notes/management/share/public`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleTransferNoteResponse = { + body: TransferNoteResponses[200]; + status?: 200; +}; + +/** + * Handler for the `PUT /api/notes/management/transfer` operation. + */ +export function handleTransferNote( + response?: + | HandleTransferNoteResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.put( + `${options?.baseUrl ?? '*'}/api/notes/management/transfer`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleNotesConfigResponse = { + body: NotesConfigResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/notes/management/config` operation. + */ +export function handleNotesConfig( + response?: HandleNotesConfigResponse | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.get( + `${options?.baseUrl ?? '*'}/api/notes/management/config`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleListNoteSnapshotsResponse = { + body: ListNoteSnapshotsResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/notes/snapshots/{note_uuid}` operation. + */ +export function handleListNoteSnapshots( + response?: + | HandleListNoteSnapshotsResponse + | HttpResponseResolver< + { + note_uuid: string; + }, + never + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.get< + { + note_uuid: string; + }, + never + >( + `${options?.baseUrl ?? '*'}/api/notes/snapshots/:note_uuid`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleDeleteNoteSnapshotResponse = { + body: DeleteNoteSnapshotResponses[200]; + status?: 200; +}; + +/** + * Handler for the `DELETE /api/notes/snapshots` operation. + */ +export function handleDeleteNoteSnapshot( + response?: + | HandleDeleteNoteSnapshotResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.delete( + `${options?.baseUrl ?? '*'}/api/notes/snapshots`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleRestoreNoteSnapshotResponse = { + body: RestoreNoteSnapshotResponses[200]; + status?: 200; +}; + +/** + * Handler for the `PUT /api/notes/snapshots/restore` operation. + */ +export function handleRestoreNoteSnapshot( + response?: + | HandleRestoreNoteSnapshotResponse + | HttpResponseResolver, + options?: RequestHandlerOptions +): HttpHandler { + return http.put( + `${options?.baseUrl ?? '*'}/api/notes/snapshots/restore`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleInfoNoteSnapshotResponse = { + body: InfoNoteSnapshotResponses[200]; + status?: 200; +}; + +/** + * Handler for the `GET /api/notes/snapshots/{snapshot_id}/info` operation. + */ +export function handleInfoNoteSnapshot( + response?: + | HandleInfoNoteSnapshotResponse + | HttpResponseResolver< + { + snapshot_id: string; + }, + never + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.get< + { + snapshot_id: string; + }, + never + >( + `${options?.baseUrl ?? '*'}/api/notes/snapshots/:snapshot_id/info`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return HttpResponse.json(body, { status: response?.status ?? 200 }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type HandleGetNoteSnapshotContentResponse = { + body: DefaultBodyType; + status?: number; +}; + +/** + * Handler for the `GET /api/notes/snapshots/{snapshot_id}/content` operation. + */ +export function handleGetNoteSnapshotContent( + response?: + | HandleGetNoteSnapshotContentResponse + | HttpResponseResolver< + { + snapshot_id: string; + }, + never + >, + options?: RequestHandlerOptions +): HttpHandler { + return http.get< + { + snapshot_id: string; + }, + never + >( + `${options?.baseUrl ?? '*'}/api/notes/snapshots/:snapshot_id/content`, + (info) => { + if (typeof response === 'function') { + return response(info); + } + const body = response?.body; + if (body !== undefined) { + return new HttpResponse(body, { status: response?.status }); + } + if (options?.responseFallback === 'passthrough') { + return; + } + return new Response('Not Implemented', { + status: 501, + statusText: 'Not Implemented' + }); + }, + options + ); +} + +export type MswHandlerFactories = { + /** + * Handler for the `GET /api/setup` operation. + */ + isSetup: typeof handleIsSetup; + /** + * Handler for the `POST /api/setup` operation. + */ + completeSetup: typeof handleCompleteSetup; + /** + * Handler for the `GET /api/setup/oidc` operation. + */ + getOidcSettings: typeof handleGetOidcSettings; + /** + * Handler for the `POST /api/setup/oidc` operation. + */ + initOidc: typeof handleInitOidc; + /** + * Handler for the `POST /api/auth/logout` operation. + */ + logout: typeof handleLogout; + /** + * Handler for the `POST /api/auth/passkey/finish_registration` operation. + */ + finishRegistration: typeof handleFinishRegistration; + /** + * Handler for the `POST /api/auth/passkey/finish_authentication/{auth_id}` operation. + */ + finishAuthentication: typeof handleFinishAuthentication; + /** + * Handler for the `POST /api/auth/passkey/finish_special_access` operation. + */ + finishSpecialAccess: typeof handleFinishSpecialAccess; + /** + * Handler for the `GET /api/auth/passkey/start_registration` operation. + */ + startRegistration: typeof handleStartRegistration; + /** + * Handler for the `GET /api/auth/passkey/start_authentication` operation. + */ + startAuthentication: typeof handleStartAuthentication; + /** + * Handler for the `GET /api/auth/passkey/start_special_access` operation. + */ + startSpecialAccess: typeof handleStartSpecialAccess; + /** + * Handler for the `GET /api/auth/passkey/list` operation. + */ + listPasskeys: typeof handleListPasskeys; + /** + * Handler for the `POST /api/auth/passkey/remove` operation. + */ + removePasskey: typeof handleRemovePasskey; + /** + * Handler for the `POST /api/auth/passkey/edit_name` operation. + */ + editPasskeyName: typeof handleEditPasskeyName; + /** + * Handler for the `POST /api/auth/password/authenticate` operation. + */ + passwordAuthenticate: typeof handlePasswordAuthenticate; + /** + * Handler for the `POST /api/auth/password/special_access` operation. + */ + passwordSpecialAccess: typeof handlePasswordSpecialAccess; + /** + * Handler for the `GET /api/auth/password/key` operation. + */ + key: typeof handleKey; + /** + * Handler for the `POST /api/auth/password/change` operation. + */ + changePassword: typeof handleChangePassword; + /** + * Handler for the `POST /api/auth/totp/confirm` operation. + */ + totpConfirm: typeof handleTotpConfirm; + /** + * Handler for the `GET /api/auth/totp/start_setup` operation. + */ + totpStartSetup: typeof handleTotpStartSetup; + /** + * Handler for the `POST /api/auth/totp/finish_setup` operation. + */ + totpFinishSetup: typeof handleTotpFinishSetup; + /** + * Handler for the `POST /api/auth/totp/remove` operation. + */ + totpRemove: typeof handleTotpRemove; + /** + * Handler for the `GET /api/auth/config` operation. + */ + authConfig: typeof handleAuthConfig; + /** + * Handler for the `POST /api/auth/app/code` operation. + */ + requestAppCode: typeof handleRequestAppCode; + /** + * Handler for the `POST /api/auth/app/exchange` operation. + */ + exchangeAppCode: typeof handleExchangeAppCode; + /** + * Handler for the `POST /api/auth/app/retrieve_token` operation. + */ + retrieveAppToken: typeof handleRetrieveAppToken; + /** + * Handler for the `GET /api/auth/test_token` operation. + */ + testToken: typeof handleTestToken; + /** + * Handler for the `GET /api/auth/refresh_token` operation. + */ + refreshToken: typeof handleRefreshToken; + /** + * Handler for the `DELETE /api/user/management/avatar` operation. + */ + resetUserAvatar: typeof handleResetUserAvatar; + /** + * Handler for the `DELETE /api/user/management` operation. + */ + deleteUser: typeof handleDeleteUser; + /** + * Handler for the `GET /api/user/management` operation. + */ + listUsers: typeof handleListUsers; + /** + * Handler for the `POST /api/user/management` operation. + */ + createUser: typeof handleCreateUser; + /** + * Handler for the `PUT /api/user/management` operation. + */ + editUser: typeof handleEditUser; + /** + * Handler for the `GET /api/user/management/{uuid}` operation. + */ + userInfo: typeof handleUserInfo; + /** + * Handler for the `GET /api/user/management/mail` operation. + */ + mailActive: typeof handleMailActive; + /** + * Handler for the `GET /api/user/management/groups` operation. + */ + listGroupsSimple: typeof handleListGroupsSimple; + /** + * Handler for the `PUT /api/user/management/password` operation. + */ + resetUserPassword: typeof handleResetUserPassword; + /** + * Handler for the `POST /api/user/management/email` operation. + */ + changeUserEmail: typeof handleChangeUserEmail; + /** + * Handler for the `PUT /api/user/management/convert-oidc` operation. + */ + convertOidcUser: typeof handleConvertOidcUser; + /** + * Handler for the `POST /api/user/account/password` operation. + */ + updatePassword: typeof handleUpdatePassword; + /** + * Handler for the `POST /api/user/account/email_change_start` operation. + */ + startEmailChange: typeof handleStartEmailChange; + /** + * Handler for the `POST /api/user/account/update` operation. + */ + updateAccount: typeof handleUpdateAccount; + /** + * Handler for the `POST /api/user/account/email_change_confirm` operation. + */ + confirmEmailChange: typeof handleConfirmEmailChange; + /** + * Handler for the `POST /api/user/account/avatar` operation. + */ + updateAvatar: typeof handleUpdateAvatar; + /** + * Handler for the `GET /api/user/account/sessions` operation. + */ + listSessions: typeof handleListSessions; + /** + * Handler for the `POST /api/user/account/sessions` operation. + */ + revokeSession: typeof handleRevokeSession; + /** + * Handler for the `GET /api/user/info` operation. + */ + info: typeof handleInfo; + /** + * Handler for the `GET /api/user/info/avatar/{uuid}` operation. + */ + avatarById: typeof handleAvatarById; + /** + * Handler for the `GET /api/settings/mail` operation. + */ + getMailSettings: typeof handleGetMailSettings; + /** + * Handler for the `POST /api/settings/mail` operation. + */ + saveMailSettings: typeof handleSaveMailSettings; + /** + * Handler for the `GET /api/settings/account` operation. + */ + accountSettings: typeof handleAccountSettings; + /** + * Handler for the `POST /api/settings/account` operation. + */ + saveAccountSettings: typeof handleSaveAccountSettings; + /** + * Handler for the `POST /api/mail/reset/send` operation. + */ + sendResetLink: typeof handleSendResetLink; + /** + * Handler for the `POST /api/mail/reset/confirm` operation. + */ + resetPassword: typeof handleResetPassword; + /** + * Handler for the `POST /api/mail/test` operation. + */ + testMail: typeof handleTestMail; + /** + * Handler for the `DELETE /api/group` operation. + */ + deleteGroup: typeof handleDeleteGroup; + /** + * Handler for the `GET /api/group` operation. + */ + listGroups: typeof handleListGroups; + /** + * Handler for the `POST /api/group` operation. + */ + createGroup: typeof handleCreateGroup; + /** + * Handler for the `PUT /api/group` operation. + */ + editGroup: typeof handleEditGroup; + /** + * Handler for the `GET /api/group/{uuid}` operation. + */ + groupInfo: typeof handleGroupInfo; + /** + * Handler for the `GET /api/group/users` operation. + */ + listUsersSimple: typeof handleListUsersSimple; + /** + * Handler for the `GET /api/services/apod` operation. + */ + listApod: typeof handleListApod; + /** + * Handler for the `POST /api/services/apod` operation. + */ + setGoodApod: typeof handleSetGoodApod; + /** + * Handler for the `POST /api/services/apod/get_image_info` operation. + */ + getApodImageInfo: typeof handleGetApodImageInfo; + /** + * Handler for the `GET /api/services/apod/get_image` operation. + */ + getApodImage: typeof handleGetApodImage; + /** + * Handler for the `POST /api/oauth/authorize_confirm` operation. + */ + authorizeConfirm: typeof handleAuthorizeConfirm; + /** + * Handler for the `DELETE /api/oauth_management/client` operation. + */ + deleteOauthClient: typeof handleDeleteOauthClient; + /** + * Handler for the `GET /api/oauth_management/client` operation. + */ + listOauthClients: typeof handleListOauthClients; + /** + * Handler for the `POST /api/oauth_management/client` operation. + */ + createOauthClient: typeof handleCreateOauthClient; + /** + * Handler for the `PUT /api/oauth_management/client` operation. + */ + editOauthClient: typeof handleEditOauthClient; + /** + * Handler for the `GET /api/oauth_management/client/{uuid}` operation. + */ + infoOauthClient: typeof handleInfoOauthClient; + /** + * Handler for the `POST /api/oauth_management/client/{uuid}` operation. + */ + regenerateSecretOauthClient: typeof handleRegenerateSecretOauthClient; + /** + * Handler for the `GET /api/oauth_management/client/site_url` operation. + */ + siteUrl: typeof handleSiteUrl; + /** + * Handler for the `GET /api/oauth_management/client/groups` operation. + */ + listGroupsOAuthClient: typeof handleListGroupsOAuthClient; + /** + * Handler for the `GET /api/oauth_management/client/users` operation. + */ + listUsersOAuthClient: typeof handleListUsersOAuthClient; + /** + * Handler for the `GET /api/oauth_management/client/scopes` operation. + */ + listScopesOAuthClient: typeof handleListScopesOAuthClient; + /** + * Handler for the `DELETE /api/oauth_management/scope` operation. + */ + deleteOAuthScope: typeof handleDeleteOAuthScope; + /** + * Handler for the `GET /api/oauth_management/scope` operation. + */ + listOAuthScopes: typeof handleListOAuthScopes; + /** + * Handler for the `POST /api/oauth_management/scope` operation. + */ + createOAuthScope: typeof handleCreateOAuthScope; + /** + * Handler for the `PUT /api/oauth_management/scope` operation. + */ + editOAuthScope: typeof handleEditOAuthScope; + /** + * Handler for the `GET /api/oauth_management/scope/{uuid}` operation. + */ + infoOAuthScope: typeof handleInfoOAuthScope; + /** + * Handler for the `GET /api/oauth_management/scope/policies` operation. + */ + listPoliciesOAuthScope: typeof handleListPoliciesOAuthScope; + /** + * Handler for the `DELETE /api/oauth_management/policy` operation. + */ + deleteOAuthPolicy: typeof handleDeleteOAuthPolicy; + /** + * Handler for the `GET /api/oauth_management/policy` operation. + */ + listOAuthPolicies: typeof handleListOAuthPolicies; + /** + * Handler for the `POST /api/oauth_management/policy` operation. + */ + createOAuthPolicy: typeof handleCreateOAuthPolicy; + /** + * Handler for the `PUT /api/oauth_management/policy` operation. + */ + editOAuthPolicy: typeof handleEditOAuthPolicy; + /** + * Handler for the `GET /api/oauth_management/policy/{uuid}` operation. + */ + infoOAuthPolicy: typeof handleInfoOAuthPolicy; + /** + * Handler for the `GET /api/oauth_management/policy/groups` operation. + */ + listGroupsOAuthPolicy: typeof handleListGroupsOAuthPolicy; + /** + * Handler for the `DELETE /api/notes/management` operation. + */ + deleteNote: typeof handleDeleteNote; + /** + * Handler for the `GET /api/notes/management` operation. + */ + listNotes: typeof handleListNotes; + /** + * Handler for the `POST /api/notes/management` operation. + */ + createNote: typeof handleCreateNote; + /** + * Handler for the `PUT /api/notes/management` operation. + */ + editNote: typeof handleEditNote; + /** + * Handler for the `GET /api/notes/management/{uuid}` operation. + */ + infoNote: typeof handleInfoNote; + /** + * Handler for the `PUT /api/notes/management/{uuid}` operation. + */ + applyNoteEdit: typeof handleApplyNoteEdit; + /** + * Handler for the `GET /api/notes/management/{uuid}/public` operation. + */ + infoNoteShare: typeof handleInfoNoteShare; + /** + * Handler for the `GET /api/notes/management/{uuid}/content` operation. + */ + noteContent: typeof handleNoteContent; + /** + * Handler for the `GET /api/notes/management/users` operation. + */ + listUsersNote: typeof handleListUsersNote; + /** + * Handler for the `PUT /api/notes/management/share` operation. + */ + shareNote: typeof handleShareNote; + /** + * Handler for the `PUT /api/notes/management/share/public` operation. + */ + shareNotePublic: typeof handleShareNotePublic; + /** + * Handler for the `PUT /api/notes/management/transfer` operation. + */ + transferNote: typeof handleTransferNote; + /** + * Handler for the `GET /api/notes/management/config` operation. + */ + notesConfig: typeof handleNotesConfig; + /** + * Handler for the `GET /api/notes/snapshots/{note_uuid}` operation. + */ + listNoteSnapshots: typeof handleListNoteSnapshots; + /** + * Handler for the `DELETE /api/notes/snapshots` operation. + */ + deleteNoteSnapshot: typeof handleDeleteNoteSnapshot; + /** + * Handler for the `PUT /api/notes/snapshots/restore` operation. + */ + restoreNoteSnapshot: typeof handleRestoreNoteSnapshot; + /** + * Handler for the `GET /api/notes/snapshots/{snapshot_id}/info` operation. + */ + infoNoteSnapshot: typeof handleInfoNoteSnapshot; + /** + * Handler for the `GET /api/notes/snapshots/{snapshot_id}/content` operation. + */ + getNoteSnapshotContent: typeof handleGetNoteSnapshotContent; +}; + +export type CreateMswHandlersResult = { + all: (options?: { + pick?: { + [K in keyof MswHandlerFactories]?: + | Parameters[0] + | Parameters; + }; + }) => ReadonlyArray; + pick: MswHandlerFactories; +}; + +export function createMswHandlers( + config: RequestHandlerOptions = {} +): CreateMswHandlersResult { + type Handler = ( + response?: R, + options?: RequestHandlerOptions + ) => HttpHandler; + function wrap(handler: Handler): Handler { + return (response, options) => handler(response, { ...config, ...options }); + } + const pick: CreateMswHandlersResult['pick'] = { + isSetup: wrap(handleIsSetup), + completeSetup: wrap(handleCompleteSetup), + getOidcSettings: wrap(handleGetOidcSettings), + initOidc: wrap(handleInitOidc), + logout: wrap(handleLogout), + finishRegistration: wrap(handleFinishRegistration), + finishAuthentication: wrap(handleFinishAuthentication), + finishSpecialAccess: wrap(handleFinishSpecialAccess), + startRegistration: wrap(handleStartRegistration), + startAuthentication: wrap(handleStartAuthentication), + startSpecialAccess: wrap(handleStartSpecialAccess), + listPasskeys: wrap(handleListPasskeys), + removePasskey: wrap(handleRemovePasskey), + editPasskeyName: wrap(handleEditPasskeyName), + passwordAuthenticate: wrap(handlePasswordAuthenticate), + passwordSpecialAccess: wrap(handlePasswordSpecialAccess), + key: wrap(handleKey), + changePassword: wrap(handleChangePassword), + totpConfirm: wrap(handleTotpConfirm), + totpStartSetup: wrap(handleTotpStartSetup), + totpFinishSetup: wrap(handleTotpFinishSetup), + totpRemove: wrap(handleTotpRemove), + authConfig: wrap(handleAuthConfig), + requestAppCode: wrap(handleRequestAppCode), + exchangeAppCode: wrap(handleExchangeAppCode), + retrieveAppToken: wrap(handleRetrieveAppToken), + testToken: wrap(handleTestToken), + refreshToken: wrap(handleRefreshToken), + resetUserAvatar: wrap(handleResetUserAvatar), + deleteUser: wrap(handleDeleteUser), + listUsers: wrap(handleListUsers), + createUser: wrap(handleCreateUser), + editUser: wrap(handleEditUser), + userInfo: wrap(handleUserInfo), + mailActive: wrap(handleMailActive), + listGroupsSimple: wrap(handleListGroupsSimple), + resetUserPassword: wrap(handleResetUserPassword), + changeUserEmail: wrap(handleChangeUserEmail), + convertOidcUser: wrap(handleConvertOidcUser), + updatePassword: wrap(handleUpdatePassword), + startEmailChange: wrap(handleStartEmailChange), + updateAccount: wrap(handleUpdateAccount), + confirmEmailChange: wrap(handleConfirmEmailChange), + updateAvatar: wrap(handleUpdateAvatar), + listSessions: wrap(handleListSessions), + revokeSession: wrap(handleRevokeSession), + info: wrap(handleInfo), + avatarById: wrap(handleAvatarById), + getMailSettings: wrap(handleGetMailSettings), + saveMailSettings: wrap(handleSaveMailSettings), + accountSettings: wrap(handleAccountSettings), + saveAccountSettings: wrap(handleSaveAccountSettings), + sendResetLink: wrap(handleSendResetLink), + resetPassword: wrap(handleResetPassword), + testMail: wrap(handleTestMail), + deleteGroup: wrap(handleDeleteGroup), + listGroups: wrap(handleListGroups), + createGroup: wrap(handleCreateGroup), + editGroup: wrap(handleEditGroup), + groupInfo: wrap(handleGroupInfo), + listUsersSimple: wrap(handleListUsersSimple), + listApod: wrap(handleListApod), + setGoodApod: wrap(handleSetGoodApod), + getApodImageInfo: wrap(handleGetApodImageInfo), + getApodImage: wrap(handleGetApodImage), + authorizeConfirm: wrap(handleAuthorizeConfirm), + deleteOauthClient: wrap(handleDeleteOauthClient), + listOauthClients: wrap(handleListOauthClients), + createOauthClient: wrap(handleCreateOauthClient), + editOauthClient: wrap(handleEditOauthClient), + infoOauthClient: wrap(handleInfoOauthClient), + regenerateSecretOauthClient: wrap(handleRegenerateSecretOauthClient), + siteUrl: wrap(handleSiteUrl), + listGroupsOAuthClient: wrap(handleListGroupsOAuthClient), + listUsersOAuthClient: wrap(handleListUsersOAuthClient), + listScopesOAuthClient: wrap(handleListScopesOAuthClient), + deleteOAuthScope: wrap(handleDeleteOAuthScope), + listOAuthScopes: wrap(handleListOAuthScopes), + createOAuthScope: wrap(handleCreateOAuthScope), + editOAuthScope: wrap(handleEditOAuthScope), + infoOAuthScope: wrap(handleInfoOAuthScope), + listPoliciesOAuthScope: wrap(handleListPoliciesOAuthScope), + deleteOAuthPolicy: wrap(handleDeleteOAuthPolicy), + listOAuthPolicies: wrap(handleListOAuthPolicies), + createOAuthPolicy: wrap(handleCreateOAuthPolicy), + editOAuthPolicy: wrap(handleEditOAuthPolicy), + infoOAuthPolicy: wrap(handleInfoOAuthPolicy), + listGroupsOAuthPolicy: wrap(handleListGroupsOAuthPolicy), + deleteNote: wrap(handleDeleteNote), + listNotes: wrap(handleListNotes), + createNote: wrap(handleCreateNote), + editNote: wrap(handleEditNote), + infoNote: wrap(handleInfoNote), + applyNoteEdit: wrap(handleApplyNoteEdit), + infoNoteShare: wrap(handleInfoNoteShare), + noteContent: wrap(handleNoteContent), + listUsersNote: wrap(handleListUsersNote), + shareNote: wrap(handleShareNote), + shareNotePublic: wrap(handleShareNotePublic), + transferNote: wrap(handleTransferNote), + notesConfig: wrap(handleNotesConfig), + listNoteSnapshots: wrap(handleListNoteSnapshots), + deleteNoteSnapshot: wrap(handleDeleteNoteSnapshot), + restoreNoteSnapshot: wrap(handleRestoreNoteSnapshot), + infoNoteSnapshot: wrap(handleInfoNoteSnapshot), + getNoteSnapshotContent: wrap(handleGetNoteSnapshotContent) + }; + const all: CreateMswHandlersResult['all'] = (options = {}) => { + type OverrideValue = R | [response?: R, options?: RequestHandlerOptions]; + function invoke( + fn: Handler, + override?: OverrideValue + ): HttpHandler { + return Array.isArray(override) ? fn(...override) : fn(override); + } + const overrides = options.pick ?? {}; + return [ + invoke(pick.shareNotePublic, overrides.shareNotePublic), + invoke(pick.finishAuthentication, overrides.finishAuthentication), + invoke(pick.avatarById, overrides.avatarById), + invoke(pick.infoNoteShare, overrides.infoNoteShare), + invoke(pick.noteContent, overrides.noteContent), + invoke(pick.infoNoteSnapshot, overrides.infoNoteSnapshot), + invoke(pick.getNoteSnapshotContent, overrides.getNoteSnapshotContent), + invoke(pick.finishRegistration, overrides.finishRegistration), + invoke(pick.finishSpecialAccess, overrides.finishSpecialAccess), + invoke(pick.startRegistration, overrides.startRegistration), + invoke(pick.startAuthentication, overrides.startAuthentication), + invoke(pick.startSpecialAccess, overrides.startSpecialAccess), + invoke(pick.listPasskeys, overrides.listPasskeys), + invoke(pick.removePasskey, overrides.removePasskey), + invoke(pick.editPasskeyName, overrides.editPasskeyName), + invoke(pick.passwordAuthenticate, overrides.passwordAuthenticate), + invoke(pick.passwordSpecialAccess, overrides.passwordSpecialAccess), + invoke(pick.key, overrides.key), + invoke(pick.changePassword, overrides.changePassword), + invoke(pick.totpConfirm, overrides.totpConfirm), + invoke(pick.totpStartSetup, overrides.totpStartSetup), + invoke(pick.totpFinishSetup, overrides.totpFinishSetup), + invoke(pick.totpRemove, overrides.totpRemove), + invoke(pick.requestAppCode, overrides.requestAppCode), + invoke(pick.exchangeAppCode, overrides.exchangeAppCode), + invoke(pick.retrieveAppToken, overrides.retrieveAppToken), + invoke(pick.resetUserAvatar, overrides.resetUserAvatar), + invoke(pick.mailActive, overrides.mailActive), + invoke(pick.listGroupsSimple, overrides.listGroupsSimple), + invoke(pick.resetUserPassword, overrides.resetUserPassword), + invoke(pick.changeUserEmail, overrides.changeUserEmail), + invoke(pick.convertOidcUser, overrides.convertOidcUser), + invoke(pick.updatePassword, overrides.updatePassword), + invoke(pick.startEmailChange, overrides.startEmailChange), + invoke(pick.updateAccount, overrides.updateAccount), + invoke(pick.confirmEmailChange, overrides.confirmEmailChange), + invoke(pick.updateAvatar, overrides.updateAvatar), + invoke(pick.listSessions, overrides.listSessions), + invoke(pick.revokeSession, overrides.revokeSession), + invoke(pick.sendResetLink, overrides.sendResetLink), + invoke(pick.resetPassword, overrides.resetPassword), + invoke(pick.getApodImageInfo, overrides.getApodImageInfo), + invoke(pick.getApodImage, overrides.getApodImage), + invoke(pick.siteUrl, overrides.siteUrl), + invoke(pick.listGroupsOAuthClient, overrides.listGroupsOAuthClient), + invoke(pick.listUsersOAuthClient, overrides.listUsersOAuthClient), + invoke(pick.listScopesOAuthClient, overrides.listScopesOAuthClient), + invoke(pick.listPoliciesOAuthScope, overrides.listPoliciesOAuthScope), + invoke(pick.listGroupsOAuthPolicy, overrides.listGroupsOAuthPolicy), + invoke(pick.listUsersNote, overrides.listUsersNote), + invoke(pick.shareNote, overrides.shareNote), + invoke(pick.transferNote, overrides.transferNote), + invoke(pick.notesConfig, overrides.notesConfig), + invoke(pick.restoreNoteSnapshot, overrides.restoreNoteSnapshot), + invoke(pick.userInfo, overrides.userInfo), + invoke(pick.infoOauthClient, overrides.infoOauthClient), + invoke( + pick.regenerateSecretOauthClient, + overrides.regenerateSecretOauthClient + ), + invoke(pick.infoOAuthScope, overrides.infoOAuthScope), + invoke(pick.infoOAuthPolicy, overrides.infoOAuthPolicy), + invoke(pick.infoNote, overrides.infoNote), + invoke(pick.applyNoteEdit, overrides.applyNoteEdit), + invoke(pick.listNoteSnapshots, overrides.listNoteSnapshots), + invoke(pick.getOidcSettings, overrides.getOidcSettings), + invoke(pick.initOidc, overrides.initOidc), + invoke(pick.logout, overrides.logout), + invoke(pick.authConfig, overrides.authConfig), + invoke(pick.testToken, overrides.testToken), + invoke(pick.refreshToken, overrides.refreshToken), + invoke(pick.deleteUser, overrides.deleteUser), + invoke(pick.listUsers, overrides.listUsers), + invoke(pick.createUser, overrides.createUser), + invoke(pick.editUser, overrides.editUser), + invoke(pick.info, overrides.info), + invoke(pick.getMailSettings, overrides.getMailSettings), + invoke(pick.saveMailSettings, overrides.saveMailSettings), + invoke(pick.accountSettings, overrides.accountSettings), + invoke(pick.saveAccountSettings, overrides.saveAccountSettings), + invoke(pick.testMail, overrides.testMail), + invoke(pick.listUsersSimple, overrides.listUsersSimple), + invoke(pick.listApod, overrides.listApod), + invoke(pick.setGoodApod, overrides.setGoodApod), + invoke(pick.authorizeConfirm, overrides.authorizeConfirm), + invoke(pick.deleteOauthClient, overrides.deleteOauthClient), + invoke(pick.listOauthClients, overrides.listOauthClients), + invoke(pick.createOauthClient, overrides.createOauthClient), + invoke(pick.editOauthClient, overrides.editOauthClient), + invoke(pick.deleteOAuthScope, overrides.deleteOAuthScope), + invoke(pick.listOAuthScopes, overrides.listOAuthScopes), + invoke(pick.createOAuthScope, overrides.createOAuthScope), + invoke(pick.editOAuthScope, overrides.editOAuthScope), + invoke(pick.deleteOAuthPolicy, overrides.deleteOAuthPolicy), + invoke(pick.listOAuthPolicies, overrides.listOAuthPolicies), + invoke(pick.createOAuthPolicy, overrides.createOAuthPolicy), + invoke(pick.editOAuthPolicy, overrides.editOAuthPolicy), + invoke(pick.deleteNote, overrides.deleteNote), + invoke(pick.listNotes, overrides.listNotes), + invoke(pick.createNote, overrides.createNote), + invoke(pick.editNote, overrides.editNote), + invoke(pick.deleteNoteSnapshot, overrides.deleteNoteSnapshot), + invoke(pick.groupInfo, overrides.groupInfo), + invoke(pick.isSetup, overrides.isSetup), + invoke(pick.completeSetup, overrides.completeSetup), + invoke(pick.deleteGroup, overrides.deleteGroup), + invoke(pick.listGroups, overrides.listGroups), + invoke(pick.createGroup, overrides.createGroup), + invoke(pick.editGroup, overrides.editGroup) + ]; + }; + return { all, pick }; +} diff --git a/frontend/src/tests/e2e/account.spec.ts b/frontend/src/tests/e2e/account.spec.ts index 00cda3d4..5b4ab962 100644 --- a/frontend/src/tests/e2e/account.spec.ts +++ b/frontend/src/tests/e2e/account.spec.ts @@ -135,7 +135,7 @@ test.describe('account sessions', () => { test('surfaces an error when revoking fails', async ({ page, network }) => { network.use( - gen.revokeSessionMswHandler( + gen.handleRevokeSession( () => new HttpResponse(null, { status: 500 }) as never ) ); diff --git a/frontend/src/tests/e2e/auth.spec.ts b/frontend/src/tests/e2e/auth.spec.ts index 5625ef80..271cc527 100644 --- a/frontend/src/tests/e2e/auth.spec.ts +++ b/frontend/src/tests/e2e/auth.spec.ts @@ -96,7 +96,7 @@ test.describe('login page', () => { network }) => { network.use( - gen.passwordAuthenticateMswHandler(() => + gen.handlePasswordAuthenticate(() => HttpResponse.json( { user: 'user-uuid' }, { @@ -125,7 +125,7 @@ test.describe('login page', () => { // eslint-disable-next-line @typescript-eslint/no-explicit-any let body: any = undefined; network.use( - gen.passwordAuthenticateMswHandler(async ({ request }) => { + gen.handlePasswordAuthenticate(async ({ request }) => { body = await request.json(); return HttpResponse.json( { user: 'user-uuid' }, @@ -154,7 +154,7 @@ test.describe('totp login', () => { // A password login for a 2FA-enabled account succeeds but returns no `user`, // Which flips the form into the TOTP step instead of completing the login. const totpRequiredAuth = () => - gen.passwordAuthenticateMswHandler(() => HttpResponse.json({})); + gen.handlePasswordAuthenticate(() => HttpResponse.json({})); const submitPassword = async (page: Page) => { await page.getByPlaceholder('mail@example.com').fill('user@example.com'); @@ -187,7 +187,7 @@ test.describe('totp login', () => { }) => { network.use( totpRequiredAuth(), - gen.totpConfirmMswHandler(() => + gen.handleTotpConfirm(() => HttpResponse.json( { user: 'user-uuid' }, { headers: { 'Set-Cookie': 'centaurus_jwt=e2e-token; Path=/' } } @@ -212,7 +212,7 @@ test.describe('totp login', () => { test('shows an error for an invalid TOTP code', async ({ page, network }) => { network.use( totpRequiredAuth(), - gen.totpConfirmMswHandler(() => HttpResponse.json({}, { status: 401 })) + gen.handleTotpConfirm(() => HttpResponse.json({}, { status: 401 })) ); await gotoReady(page, '/login'); diff --git a/frontend/src/tests/e2e/password-reset.spec.ts b/frontend/src/tests/e2e/password-reset.spec.ts index 2cf0a8be..15dd2738 100644 --- a/frontend/src/tests/e2e/password-reset.spec.ts +++ b/frontend/src/tests/e2e/password-reset.spec.ts @@ -18,7 +18,7 @@ test.describe('password reset from an email link', () => { // `test_token` (which leaves `valid` undefined and hides the redirect), so // We model the real, logged-out response explicitly. network.use( - gen.testTokenMswHandler(() => + gen.handleTestToken(() => HttpResponse.json({ exp_short: false, valid: false }) ) ); diff --git a/frontend/src/tests/mocks/e2e/handlers.ts b/frontend/src/tests/mocks/e2e/handlers.ts index 6445b34b..c6e0beb3 100644 --- a/frontend/src/tests/mocks/e2e/handlers.ts +++ b/frontend/src/tests/mocks/e2e/handlers.ts @@ -1,7 +1,10 @@ import { HttpResponse, http, ws } from 'msw'; -import { client } from '$mocks/msw-runtime'; import * as gen from '$lib/client/msw.gen'; import * as data from './data'; +import { type Client, createClient, createConfig } from '$lib/client/client'; +import type { ClientOptions } from '$lib/client/types.gen'; + +const client: Client = createClient(createConfig()); /** * No-op WebSocket mock for the updater channel. The app opens this socket on @@ -26,7 +29,7 @@ const publicUpdaterWs = ws.link('*/api/notes/update/*'); const appLoginWs = ws.link('*/api/auth/app/device_login'); /** - * Reuses the generated `*MswHandler` factories (the same mock api the unit + * Reuses the generated `handle*` factories (the same mock api the unit * tests use). The factories build their URL from the client's `baseUrl`; in the * preview server every `/api/*` request is host-rewritten to the backend by * `handleFetch`, so we build the handlers with `baseUrl = '*'` to match any @@ -46,112 +49,108 @@ export const handlers = [ client.send('device-login-code'); }), - gen.isSetupMswHandler(({ cookies }) => j(data.isSetupOf(cookies))), - gen.getOidcSettingsMswHandler(() => j(data.oidcSettings)), - gen.infoMswHandler(({ cookies }) => + gen.handleIsSetup(({ cookies }) => j(data.isSetupOf(cookies))), + gen.handleGetOidcSettings(() => j(data.oidcSettings)), + gen.handleInfo(({ cookies }) => data.isAnonymous(cookies) ? (new HttpResponse(null, { status: 401 }) as never) : j(data.adminUser) ), - gen.authConfigMswHandler(() => j(data.authConfig)), - gen.accountSettingsMswHandler(() => j(data.accountSettings)), - gen.mailActiveMswHandler(({ cookies }) => j(data.mailActiveOf(cookies))), - gen.getMailSettingsMswHandler(() => j(data.mailSettings)), - gen.siteUrlMswHandler(() => j(data.siteUrl)), - gen.keyMswHandler(() => j({ key: 'test-public-key' })), + gen.handleAuthConfig(() => j(data.authConfig)), + gen.handleAccountSettings(() => j(data.accountSettings)), + gen.handleMailActive(({ cookies }) => j(data.mailActiveOf(cookies))), + gen.handleGetMailSettings(() => j(data.mailSettings)), + gen.handleSiteUrl(() => j(data.siteUrl)), + gen.handleKey(() => j({ key: 'test-public-key' })), // Lists (scenario-aware: `mock_scenario=empty` cookie => empty state). - gen.listGroupsMswHandler(({ cookies }) => j(data.groups[scn(cookies)])), - gen.listUsersMswHandler(({ cookies }) => j(data.users[scn(cookies)])), - gen.listNotesMswHandler(({ cookies }) => + gen.handleListGroups(({ cookies }) => j(data.groups[scn(cookies)])), + gen.handleListUsers(({ cookies }) => j(data.users[scn(cookies)])), + gen.handleListNotes(({ cookies }) => j(data.notes[data.notesScenarioOf(cookies)]) ), - gen.notesConfigMswHandler(({ cookies }) => + gen.handleNotesConfig(({ cookies }) => j(data.notesConfig[data.notesScenarioOf(cookies)]) ), - gen.listOauthClientsMswHandler(({ cookies }) => + gen.handleListOauthClients(({ cookies }) => j(data.oauthClients[scn(cookies)]) ), - gen.listOAuthScopesMswHandler(({ cookies }) => - j(data.oauthScopes[scn(cookies)]) - ), - gen.listOAuthPoliciesMswHandler(({ cookies }) => + gen.handleListOAuthScopes(({ cookies }) => j(data.oauthScopes[scn(cookies)])), + gen.handleListOAuthPolicies(({ cookies }) => j(data.oauthPolicies[scn(cookies)]) ), - gen.listPasskeysMswHandler(({ cookies }) => j(data.passkeys[scn(cookies)])), - gen.listSessionsMswHandler(({ cookies }) => j(data.sessions[scn(cookies)])), - gen.revokeSessionMswHandler( + gen.handleListPasskeys(({ cookies }) => j(data.passkeys[scn(cookies)])), + gen.handleListSessions(({ cookies }) => j(data.sessions[scn(cookies)])), + gen.handleRevokeSession( () => new HttpResponse(null, { status: 200 }) as never ), - gen.listApodMswHandler(({ cookies }) => j(data.apodList[scn(cookies)])), - gen.getApodImageInfoMswHandler(() => j(data.apodImageInfo)), + gen.handleListApod(({ cookies }) => j(data.apodList[scn(cookies)])), + gen.handleGetApodImageInfo(() => j(data.apodImageInfo)), // Simple lists used by detail/create pages. - gen.listGroupsSimpleMswHandler(({ cookies }) => + gen.handleListGroupsSimple(({ cookies }) => j(data.simpleGroups[scn(cookies)]) ), - gen.listUsersSimpleMswHandler(({ cookies }) => - j(data.simpleUsers[scn(cookies)]) - ), - gen.listUsersNoteMswHandler(({ cookies }) => j(data.noteUsers[scn(cookies)])), - gen.listGroupsOAuthClientMswHandler(({ cookies }) => + gen.handleListUsersSimple(({ cookies }) => j(data.simpleUsers[scn(cookies)])), + gen.handleListUsersNote(({ cookies }) => j(data.noteUsers[scn(cookies)])), + gen.handleListGroupsOAuthClient(({ cookies }) => j(data.simpleGroups[scn(cookies)]) ), - gen.listUsersOAuthClientMswHandler(({ cookies }) => + gen.handleListUsersOAuthClient(({ cookies }) => j(data.simpleUsers[scn(cookies)]) ), - gen.listScopesOAuthClientMswHandler(({ cookies }) => + gen.handleListScopesOAuthClient(({ cookies }) => j(data.simpleScopes[scn(cookies)]) ), - gen.listPoliciesOAuthScopeMswHandler(({ cookies }) => + gen.handleListPoliciesOAuthScope(({ cookies }) => j(data.simplePolicies[scn(cookies)]) ), - gen.listGroupsOAuthPolicyMswHandler(({ cookies }) => + gen.handleListGroupsOAuthPolicy(({ cookies }) => j(data.simpleGroups[scn(cookies)]) ), // Details. - gen.groupInfoMswHandler(({ params }) => + gen.handleGroupInfo(({ params }) => // The uuid is a path param; return a non-admin group for group-staff so its // Editable permissions matrix renders (the admin group hides it). j( params.uuid === 'group-staff' ? data.groupStaffDetails : data.groupDetails ) ), - gen.userInfoMswHandler(() => j(data.userDetails)), - gen.infoOauthClientMswHandler(() => j(data.oauthClientDetails)), - gen.infoOAuthScopeMswHandler(() => j(data.oauthScopeDetails)), - gen.infoOAuthPolicyMswHandler(() => j(data.oauthPolicyDetails)), - gen.infoNoteMswHandler(({ cookies }) => + gen.handleUserInfo(() => j(data.userDetails)), + gen.handleInfoOauthClient(() => j(data.oauthClientDetails)), + gen.handleInfoOAuthScope(() => j(data.oauthScopeDetails)), + gen.handleInfoOAuthPolicy(() => j(data.oauthPolicyDetails)), + gen.handleInfoNote(({ cookies }) => j( data.isReadonlyNote(cookies) ? data.noteDetailsReadonly : data.noteDetails ) ), - gen.infoNoteShareMswHandler(({ cookies }) => j(data.publicNoteOf(cookies))), - gen.listNoteSnapshotsMswHandler(({ cookies }) => + gen.handleInfoNoteShare(({ cookies }) => j(data.publicNoteOf(cookies))), + gen.handleListNoteSnapshots(({ cookies }) => j(data.noteSnapshots[scn(cookies)]) ), // `snapshot-missing` reports a 404 so the view page's not-found redirect // (back to the note with `?error=not_found`) can be exercised. - gen.infoNoteSnapshotMswHandler(({ params }) => + gen.handleInfoNoteSnapshot(({ params }) => params.snapshot_id === 'snapshot-missing' ? (new HttpResponse(null, { status: 404 }) as never) : j(data.noteSnapshotDetail) ), // The readonly editor applies an empty yjs update, so serve an empty body. - gen.getNoteSnapshotContentMswHandler( + gen.handleGetNoteSnapshotContent( () => new HttpResponse(new ArrayBuffer(0), { status: 200 }) as never ), - gen.deleteNoteSnapshotMswHandler( + gen.handleDeleteNoteSnapshot( () => new HttpResponse(null, { status: 200 }) as never ), - gen.restoreNoteSnapshotMswHandler( + gen.handleRestoreNoteSnapshot( () => new HttpResponse(null, { status: 200 }) as never ), - gen.shareNotePublicMswHandler( + gen.handleShareNotePublic( () => new HttpResponse(null, { status: 200 }) as never ), - gen.transferNoteMswHandler(({ cookies }) => { + gen.handleTransferNote(({ cookies }) => { if (cookies.mock_scenario === 'transfer-at-limit') { return new HttpResponse(null, { status: 409 }) as never; } @@ -159,15 +158,15 @@ export const handlers = [ }), // Mutations return a generic success so submit flows resolve. - gen.createGroupMswHandler(() => j({ uuid: 'group-new' })), - gen.createUserMswHandler(() => j({ uuid: 'user-new' })), - gen.createNoteMswHandler(() => j({ id: 'note-new' })), - gen.createOauthClientMswHandler(() => + gen.handleCreateGroup(() => j({ uuid: 'group-new' })), + gen.handleCreateUser(() => j({ uuid: 'user-new' })), + gen.handleCreateNote(() => j({ id: 'note-new' })), + gen.handleCreateOauthClient(() => j({ client_id: 'client-new', client_secret: 'secret' }) ), - gen.createOAuthScopeMswHandler(() => j({ uuid: 'scope-new' })), - gen.createOAuthPolicyMswHandler(() => j({ uuid: 'policy-new' })), - gen.sendResetLinkMswHandler(() => new HttpResponse(null, { status: 200 })), + gen.handleCreateOAuthScope(() => j({ uuid: 'scope-new' })), + gen.handleCreateOAuthPolicy(() => j({ uuid: 'policy-new' })), + gen.handleSendResetLink(() => new HttpResponse(null, { status: 200 })), // Catch-all: any other `/api/*` call resolves with an empty 200 so unmocked // Endpoints never crash a page render. diff --git a/frontend/src/tests/mocks/handlers.ts b/frontend/src/tests/mocks/handlers.ts deleted file mode 100644 index 20b46466..00000000 --- a/frontend/src/tests/mocks/handlers.ts +++ /dev/null @@ -1,27 +0,0 @@ -import type { RequestHandler } from 'msw'; - -/** - * Default request handlers loaded into the MSW server for every test. - * - * Mocks are generated from the OpenAPI schema by the MSW plugin - * (`src/lib/msw-plugin`). Running `npm run api` emits - * `src/lib/client/msw.gen.ts` with one typed factory per operation, e.g. - * `isSetupMswHandler`. Add happy-path defaults here and override per-test with - * `server.use(...)`: - * - * import { isSetupMswHandler } from '$lib/client/msw.gen'; - * import { HttpResponse } from 'msw'; - * - * export const handlers = [ - * isSetupMswHandler(() => - * HttpResponse.json({ - * db_backend: 'sqlite', - * is_setup: true, - * storage_backend: 'local' - * }) - * ) - * ]; - * - * Left empty by default so tests opt into exactly the endpoints they need. - */ -export const handlers: RequestHandler[] = []; diff --git a/frontend/src/tests/mocks/msw-plugin.test.ts b/frontend/src/tests/mocks/msw-plugin.test.ts deleted file mode 100644 index 748782c8..00000000 --- a/frontend/src/tests/mocks/msw-plugin.test.ts +++ /dev/null @@ -1,30 +0,0 @@ -import { describe, expect, it } from 'vitest'; -import { HttpResponse } from 'msw'; -import { isSetup } from '$lib/client'; -import { isSetupMswHandler } from '$lib/client/msw.gen'; -import { server } from '$mocks/server'; - -// End-to-end check of the generated MSW handler factories: register a mock for -// An operation, call the real generated SDK function, assert the mocked data -// Comes back. The MSW server lifecycle is wired in `./setup.ts`. -describe('generated msw handlers', () => { - it('mocks an operation via its generated factory', async () => { - server.use( - isSetupMswHandler(() => - HttpResponse.json({ - db_backend: 'sqlite', - is_setup: true, - storage_backend: 'local' - }) - ) - ); - - const { data } = await isSetup(); - - expect(data).toEqual({ - db_backend: 'sqlite', - is_setup: true, - storage_backend: 'local' - }); - }); -}); diff --git a/frontend/src/tests/mocks/msw-plugin/config.ts b/frontend/src/tests/mocks/msw-plugin/config.ts deleted file mode 100644 index f7035ac7..00000000 --- a/frontend/src/tests/mocks/msw-plugin/config.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { definePluginConfig } from '@hey-api/openapi-ts'; -import { handler } from './plugin'; -import type { MswPlugin } from './types'; - -export const defaultConfig: MswPlugin['Config'] = { - config: {}, - // Ensure the response/request types this plugin references are generated. - dependencies: ['@hey-api/typescript'], - handler, - name: 'msw', - tags: ['handler'] -}; - -/** - * Register in `openapi-ts.config.ts`: - * - * import { defineConfig as msw } from './openapi-ts/msw-plugin'; - * plugins: [..., msw()] - */ -export const defineConfig = definePluginConfig(defaultConfig); diff --git a/frontend/src/tests/mocks/msw-plugin/index.ts b/frontend/src/tests/mocks/msw-plugin/index.ts deleted file mode 100644 index 8316d164..00000000 --- a/frontend/src/tests/mocks/msw-plugin/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { defaultConfig, defineConfig } from './config'; -export type { Config, MswPlugin, UserConfig } from './types'; diff --git a/frontend/src/tests/mocks/msw-plugin/plugin.ts b/frontend/src/tests/mocks/msw-plugin/plugin.ts deleted file mode 100644 index e6888c08..00000000 --- a/frontend/src/tests/mocks/msw-plugin/plugin.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { $, applyNaming } from '@hey-api/openapi-ts'; -import type { MswPlugin } from './types'; - -/** - * Emits `msw.gen.ts` with a typed handler factory per operation, e.g. - * - * export const isSetupMswHandler = wrapMswHandler< - * IsSetupResponse, - * IsSetupError, - * IsSetupData - * >('/api/setup', 'get', client.getConfig); - * - * Used in tests as: - * - * server.use(isSetupMswHandler(() => HttpResponse.json({ ... }))); - */ -export const handler: MswPlugin['Handler'] = ({ plugin }) => { - // `wrapMswHandler` ships in the repo (not generated) so it can be edited. - const wrapMswHandler = plugin.symbol('wrapMswHandler', { - external: '$mocks/msw-runtime' - }); - - // The generated fetch client, used to read the configured `baseUrl`. - const client = plugin.symbol('client', { - external: '$mocks/msw-runtime' - }); - - // oxlint-disable-next-line no-array-for-each - plugin.forEach('operation', (event) => { - const { operation } = event; - - // Pull the request/response/error types the @hey-api/typescript plugin - // Already generated for this operation so the factory stays type-safe. - const responseType = plugin.querySymbol({ - category: 'type', - resource: 'operation', - resourceId: operation.id, - role: 'response' - }); - const errorType = plugin.querySymbol({ - category: 'type', - resource: 'operation', - resourceId: operation.id, - role: 'error' - }); - const dataType = plugin.querySymbol({ - category: 'type', - resource: 'operation', - resourceId: operation.id, - role: 'data' - }); - - const factory = plugin.symbol( - applyNaming(operation.id, { name: '{{name}}MswHandler' }), - { exported: true } - ); - - const statement = $.const(factory) - .export() - .assign( - $(wrapMswHandler) - .call( - $.literal(operation.path), - $.literal(operation.method), - $(client).attr('getConfig') - ) - .generics( - $.type(responseType ?? 'never'), - $.type(errorType ?? 'never'), - $.type(dataType ?? 'never') - ) - ); - - plugin.node(statement); - }); -}; diff --git a/frontend/src/tests/mocks/msw-plugin/types.ts b/frontend/src/tests/mocks/msw-plugin/types.ts deleted file mode 100644 index 41caa20e..00000000 --- a/frontend/src/tests/mocks/msw-plugin/types.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { DefinePlugin, Plugin } from '@hey-api/openapi-ts'; - -/** - * Custom plugin name. `Plugin.Name` only accepts names already registered in - * `PluginConfigMap`, so for a local plugin we type `name` as a literal instead - * (it still satisfies `AnyPluginName`). - */ -interface Name { - name: 'msw'; -} - -/** - * User-facing config. The plugin takes no options yet — it generates one MSW - * handler factory per operation. - */ -export type UserConfig = Name & Plugin.Hooks & Plugin.UserExports; - -/** Resolved config (after defaults are applied). */ -export type Config = Name & Plugin.Hooks & Plugin.Exports; - -export type MswPlugin = DefinePlugin; diff --git a/frontend/src/tests/mocks/msw-runtime.ts b/frontend/src/tests/mocks/msw-runtime.ts deleted file mode 100644 index 7f6179f7..00000000 --- a/frontend/src/tests/mocks/msw-runtime.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - type DefaultBodyType, - type HttpResponseResolver, - type PathParams, - http -} from 'msw'; -import { type Client, createClient, createConfig } from '$lib/client/client'; -import type { ClientOptions } from '$lib/client/types.gen'; - -export const client: Client = createClient(createConfig()); - -/** - * Runtime support for the generated `msw.gen.ts` factories. - * - * The hey-api MSW plugin (see `src/lib/msw-plugin`) emits one - * `MswHandler` per endpoint that calls `wrapMswHandler` with the - * operation's path, method and the request/response/error types taken straight - * from the OpenAPI schema. That keeps the mocks in sync with the API contract: - * regenerating the client (`npm run api`) regenerates the handlers too. - * - * Adapted from the community plugin shared in - * https://github.com/hey-api/openapi-ts/issues/1486. - */ - -interface RequestOptions { - body?: unknown; - path?: Record; -} - -/** - * Excludes catch-all index signatures like `{ [key: string]: unknown }` so they - * don't pollute the resolver's response type. - */ -type ExcludeCatchAll = - T extends Record ? (string extends keyof T ? never : T) : T; - -/** Transforms OpenAPI-style placeholders `{id}` into MSW-style `:id`. */ -const convertOpenApiUrlToMsw = (url: string): string => - url.replace(/{(?\w+)}/g, (_match, name) => `:${name}`); - -export const wrapMswHandler = < - TResponse = unknown, - TError = unknown, - TData extends RequestOptions = RequestOptions ->( - path: string, - method: 'head' | 'get' | 'post' | 'put' | 'delete' | 'patch' | 'options', - getConfig: () => { baseUrl?: string } -) => { - type Params = TData extends { path: infer P } - ? P extends PathParams - ? P - : never - : never; - - type RequestBodyType = TData extends { body: infer B } - ? B extends DefaultBodyType - ? B - : never - : never; - - type ResponseBodyType = [TResponse | ExcludeCatchAll] extends [ - DefaultBodyType - ] - ? TResponse | ExcludeCatchAll - : never; - - return ( - resolver: HttpResponseResolver - ) => - http[method]( - (getConfig().baseUrl ?? '') + convertOpenApiUrlToMsw(path), - resolver - ); -}; diff --git a/frontend/src/tests/mocks/server.ts b/frontend/src/tests/mocks/server.ts deleted file mode 100644 index 4cdf21f9..00000000 --- a/frontend/src/tests/mocks/server.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { setupServer } from 'msw/node'; -import { handlers } from './handlers'; - -/** - * MSW server for tests. Unit/component tests run in Node (jsdom), so the - * Node interceptor is used rather than a service worker. - * - * Import this in a test to override handlers for a single case: - * - * import { server } from '$mocks/server'; - * server.use(http.get('*\/api/setup', () => new HttpResponse(null, { status: 500 }))); - */ -export const server = setupServer(...handlers); diff --git a/frontend/src/tests/mocks/setup.ts b/frontend/src/tests/mocks/setup.ts index a46dd56d..6470f0cd 100644 --- a/frontend/src/tests/mocks/setup.ts +++ b/frontend/src/tests/mocks/setup.ts @@ -1,7 +1,5 @@ -import { afterAll, afterEach, beforeAll } from 'vitest'; -import { client } from '$mocks/msw-runtime'; +import { beforeAll } from 'vitest'; import { client as appClient } from '$lib/client/client.gen'; -import { server } from './server'; // In the browser the client uses relative `/api/...` URLs, but Node's `fetch` // (used under jsdom) rejects relative URLs, so requests must be absolute. Pin a @@ -13,22 +11,5 @@ const TEST_BASE_URL = 'http://localhost'; // Makes any un-mocked `/api/...` call fail the test loudly; non-API requests // (e.g. assets) are let through. beforeAll(() => { - // The MSW handlers (msw.gen.ts) read their `baseUrl` from the mock client, - // While the app's `load` functions issue requests through the generated SDK, - // Which uses the `client.gen` client. Pin both to the same origin so request - // URLs and handler patterns stay aligned. - client.setConfig({ ...client.getConfig(), baseUrl: TEST_BASE_URL }); appClient.setConfig({ ...appClient.getConfig(), baseUrl: TEST_BASE_URL }); - server.listen({ - onUnhandledRequest: (request, print) => { - if (new URL(request.url).pathname.startsWith('/api/')) { - print.error(); - } - } - }); }); - -// Reset any per-test handler overrides so tests stay isolated. -afterEach(() => server.resetHandlers()); - -afterAll(() => server.close()); diff --git a/package-lock.json b/package-lock.json index f88e82c2..ddff9726 100644 --- a/package-lock.json +++ b/package-lock.json @@ -103,7 +103,7 @@ "@hey-api/openapi-ts": "0.99.0", "@lucide/svelte": "1.22.0", "@msw/playwright": "0.6.7", - "@playwright/test": "=1.59.1", + "@playwright/test": "=1.60.0", "@sveltejs/adapter-node": "5.5.7", "@sveltejs/kit": "2.68.0", "@sveltejs/vite-plugin-svelte": "7.1.2", @@ -2220,13 +2220,13 @@ } }, "node_modules/@playwright/test": { - "version": "1.59.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.59.1.tgz", - "integrity": "sha512-PG6q63nQg5c9rIi4/Z5lR5IVF7yU5MqmKaPOe0HSc0O2cX1fPi96sUQu5j7eo4gKCkB2AnNGoWt7y4/Xx3Kcqg==", + "version": "1.60.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.60.0.tgz", + "integrity": "sha512-O71yZIbAh/PxDMNGns37GHBIfrVkEVyn+AXyIa5dOTfb4/xNvRWV+Vv/NMbNCtODB/pO7vLlF2OTmMVLhmr7Ag==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.59.1" + "playwright": "1.60.0" }, "bin": { "playwright": "cli.js" @@ -7795,13 +7795,13 @@ } }, "node_modules/playwright": { - "version": "1.59.1", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.59.1.tgz", - "integrity": "sha512-C8oWjPR3F81yljW9o5OxcWzfh6avkVwDD2VYdwIGqTkl+OGFISgypqzfu7dOe4QNLL2aqcWBmI3PMtLIK233lw==", + "version": "1.60.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.60.0.tgz", + "integrity": "sha512-hheHdokM8cdqCb0lcE3s+zT4t4W+vvjpGxsZlDnikarzx8tSzMebh3UiFtgqwFwnTnjYQcsyMF8ei2mCO/tpeA==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.59.1" + "playwright-core": "1.60.0" }, "bin": { "playwright": "cli.js" @@ -7814,9 +7814,9 @@ } }, "node_modules/playwright-core": { - "version": "1.59.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.59.1.tgz", - "integrity": "sha512-HBV/RJg81z5BiiZ9yPzIiClYV/QMsDCKUyogwH9p3MCP6IYjUFu/MActgYAvK0oWyV9NlwM3GLBjADyWgydVyg==", + "version": "1.60.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.60.0.tgz", + "integrity": "sha512-9bW6zvX/m0lEbgTKJ6YppOKx8H3VOPBMOCFh2irXFOT4BbHgrx5hPjwJYLT40Lu+4qtD36qKc/Hn56StUW57IA==", "dev": true, "license": "Apache-2.0", "bin": {