export type ProfilePictureUrl = string; export type ProfilePictureSelected = 'gravatar' | 'initials' | 'uploaded'; export type ProfilePictureInfo = {profilePictureUrl?: ProfilePictureUrl | undefined, profilePictureSelected: ProfilePictureSelected}; export type UpdateApiV2UserCustomerAccountProfilePictureInfoArgs = {body: ProfilePictureInfo}; export type UpdateApiV2UserCustomerAccountProfilePictureInfoOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Change user picture information * * PUT /v2/user/customer/account/profilePictureInfo */ export const updateApiV2UserCustomerAccountProfilePictureInfo = async (args: UpdateApiV2UserCustomerAccountProfilePictureInfoArgs, options?: UpdateApiV2UserCustomerAccountProfilePictureInfoOptions) => { const {baseUrl = "https://api.beezup.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v2/user/customer/account/profilePictureInfo${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };