export type CreateTemplateDto = {type: 'ResetPassword' | 'ActivateUser' | 'InviteToTenant' | 'PwnedPassword' | 'MagicLink' | 'OTC' | 'ConnectNewDevice' | 'UserUsedInvitation' | 'ResetPhoneNumber' | 'BulkInvitesToTenant' | 'MFAEnroll' | 'MFAUnenroll' | 'NewMFAMethod' | 'MFARecoveryCode' | 'RemoveMFAMethod' | 'EmailVerification' | 'BruteForceProtection' | 'SuspiciousIP' | 'MFAOTC' | 'ImpossibleTravel' | 'BotDetection' | 'SmsAuthenticationEnabled' | 'UnlockUser' | 'UnlockUserSuccess' | 'ActivateUserWithCode' | 'InviteToTenantWithCode', senderEmail?: string | undefined, redirectURL?: string | undefined, htmlTemplate?: string | undefined, subject?: string | undefined, fromName?: string | undefined, successRedirectUrl?: string | undefined, active?: boolean | undefined}; export type CreateApiResourcesMailV1ConfigsTemplatesArgs = {body: CreateTemplateDto}; export type CreateApiResourcesMailV1ConfigsTemplatesOptions = {baseUrl?: string | undefined, bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Add or update template * * POST /resources/mail/v1/configs/templates */ export const createApiResourcesMailV1ConfigsTemplates = async (args: CreateApiResourcesMailV1ConfigsTemplatesArgs, options?: CreateApiResourcesMailV1ConfigsTemplatesOptions) => { const {baseUrl = "http://localhost:8181", fetch: fetchFn = fetch, bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (bearer !== undefined) headers.set('authorization', `Bearer ${bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/resources/mail/v1/configs/templates${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };