export type DeleteApiMeAvatarsImageHashArgs = {imageHash: string}; export type DeleteApiMeAvatarsImageHashOptions = {baseUrl?: string | undefined, oauth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete avatar * * DELETE /me/avatars/{imageHash} */ export const deleteApiMeAvatarsImageHash = async (args: DeleteApiMeAvatarsImageHashArgs, options?: DeleteApiMeAvatarsImageHashOptions) => { const {baseUrl = "https://api.gravatar.com/v3", fetch: fetchFn = fetch, oauth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (oauth !== undefined) headers.set('authorization', `Bearer ${oauth}`) const url = `${baseUrl.replace(/\/+$/, '')}/me/avatars/${encodeURIComponent(String(args.imageHash))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };