export type OcapiV1LoyaltyMembersPasswordResetMemberPasswordResetCodeCreate = {email?: (string | null) | undefined, username?: (string | null) | undefined, languageTag?: (string | null) | undefined}; export type CreateApiOcapiV1MembersPasswordResetCodeArgs = {'Connect-Region-Code'?: string | undefined, body: OcapiV1LoyaltyMembersPasswordResetMemberPasswordResetCodeCreate}; export type CreateApiOcapiV1MembersPasswordResetCodeOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Creates a password reset code for a member * * POST /ocapi/v1/members/password-reset-code */ export const createApiOcapiV1MembersPasswordResetCode = async (args: CreateApiOcapiV1MembersPasswordResetCodeArgs, options: CreateApiOcapiV1MembersPasswordResetCodeOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Connect-Region-Code'] != null) headers.set("Connect-Region-Code", String(args['Connect-Region-Code'])) const url = `${baseUrl.replace(/\/+$/, '')}/ocapi/v1/members/password-reset-code${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 };