export type PatchSubjectRequest = {displayName?: string | undefined, email?: string | undefined, imageUrl?: string | undefined, metadata?: {[key: string]: Record} | undefined}; export type PatchApiV1SubjectsIdArgs = {id: string, body: PatchSubjectRequest}; export type PatchApiV1SubjectsIdOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Patch subject * * PATCH /v1/subjects/{id} */ export const patchApiV1SubjectsId = async (args: PatchApiV1SubjectsIdArgs, options?: PatchApiV1SubjectsIdOptions) => { const {baseUrl = "https://idaas.yourflexpay.com/api", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/subjects/${encodeURIComponent(String(args.id))}${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 res.blob() };