export type CreateApiV1DomainProfilePictureUploadArgs = {body: BodyInit}; export type CreateApiV1DomainProfilePictureUploadOptions = {baseUrl: string, xApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Upload a profile picture for a sending domain mailbox * * POST /v1/domain/profile-picture/upload */ export const createApiV1DomainProfilePictureUpload = async (args: CreateApiV1DomainProfilePictureUploadArgs, options: CreateApiV1DomainProfilePictureUploadOptions) => { const {baseUrl, fetch: fetchFn = fetch, xApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (xApiKey !== undefined) headers.set("x-api-key", xApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/v1/domain/profile-picture/upload${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 };