export type AttachedProfile = {id: string, type: 'AttachedProfile', attributes: {referenceId?: string | undefined, stableReferenceId?: string | undefined, email?: string | undefined, phoneNumber?: string | undefined}}; export type PatchApiApiV1UsersUserReferenceAttachedProfileArgs = {userReference: string, 'Client-ID': string, Authorization: string, body: AttachedProfile}; export type PatchApiApiV1UsersUserReferenceAttachedProfileOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update User * * PATCH /api/v1/users/:userReference/attached-profile */ export const patchApiApiV1UsersUserReferenceAttachedProfile = async (args: PatchApiApiV1UsersUserReferenceAttachedProfileArgs, options?: PatchApiApiV1UsersUserReferenceAttachedProfileOptions) => { const {baseUrl = "https://merchant-api.accruesavings.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/vnd.api+json") if (args['Client-ID'] != null) headers.set("Client-ID", String(args['Client-ID'])) if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/users/:userReference/attached-profile${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };