export type GetApiApiAvatarUserIdArgs = {user_id: string}; export type GetApiApiAvatarUserIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get Avatar * * GET /api/avatar/{user_id} */ export const getApiApiAvatarUserId = async (args: GetApiApiAvatarUserIdArgs, options: GetApiApiAvatarUserIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "image/webp") const url = `${baseUrl.replace(/\/+$/, '')}/api/avatar/${encodeURIComponent(String(args.user_id))}${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() };