export type OcapiV1LoyaltyMembersMemberSecureActionValidationType = 'ValidatePassword' | 'None'; export type OcapiV1LoyaltyDeleteExternallyAuthenticatedMemberDelete = {type: OcapiV1LoyaltyMembersMemberSecureActionValidationType}; export type OcapiV1LoyaltyDeleteLoyaltyAuthenticatedMemberDelete = {type: OcapiV1LoyaltyMembersMemberSecureActionValidationType}; export type DeleteApiOcapiV1MembersCurrentArgs = {'Connect-Region-Code'?: string | undefined, body: OcapiV1LoyaltyDeleteExternallyAuthenticatedMemberDelete | OcapiV1LoyaltyDeleteLoyaltyAuthenticatedMemberDelete}; export type DeleteApiOcapiV1MembersCurrentOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Deletes the currently authenticated member * * DELETE /ocapi/v1/members/current */ export const deleteApiOcapiV1MembersCurrent = async (args: DeleteApiOcapiV1MembersCurrentArgs, options: DeleteApiOcapiV1MembersCurrentOptions) => { 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/current${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", 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 };