export type GetApiHdDesksDeskIdAvatarsAvatarHandleArgs = {desk_id: string, avatar_handle: string}; export type GetApiHdDesksDeskIdAvatarsAvatarHandleOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Read an operator's avatar * * GET /hd/desks/{desk_id}/avatars/{avatar_handle} */ export const getApiHdDesksDeskIdAvatarsAvatarHandle = async (args: GetApiHdDesksDeskIdAvatarsAvatarHandleArgs, options?: GetApiHdDesksDeskIdAvatarsAvatarHandleOptions) => { const {baseUrl = "https://api.sparkvault.com/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/png") const url = `${baseUrl.replace(/\/+$/, '')}/hd/desks/${encodeURIComponent(String(args.desk_id))}/avatars/${encodeURIComponent(String(args.avatar_handle))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };