export type CreateApiStorageProfilePictureArgs = {email: string, body: BodyInit}; export type CreateApiStorageProfilePictureOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Uploads profile picture of a user by provided user email * * POST /storage/profilePicture */ export const createApiStorageProfilePicture = async (args: CreateApiStorageProfilePictureArgs, options?: CreateApiStorageProfilePictureOptions) => { const {baseUrl = "http://localhost:9090", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.email != null) query.append("email", String(args.email)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/storage/profilePicture${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };