export type ProfileImageCommand = {content?: string | undefined, contentType?: string | undefined, type?: ('PHOTO' | 'DOCUMENT' | 'AVATAR') | undefined}; export type CreateApiApiAccountProfileAddImageArgs = {name?: string | undefined, body: ProfileImageCommand}; export type CreateApiApiAccountProfileAddImageOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * createNewProfileImage * * POST /api/account/profile/add/image */ export const createApiApiAccountProfileAddImage = async (args: CreateApiApiAccountProfileAddImageArgs, options: CreateApiApiAccountProfileAddImageOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (args.name != null) query.append("name", String(args.name)) const url = `${baseUrl.replace(/\/+$/, '')}/api/account/profile/add/image${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 res.blob() };