export type GetApiAccountsUserIdThumbnailFaxIdArgs = {user_id: string, fax_id: string}; export type GetApiAccountsUserIdThumbnailFaxIdOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get fax thumbnail * * GET /accounts/{user_id}/thumbnail/{fax_id} * * Also accepts auth: personal_access_token */ export const getApiAccountsUserIdThumbnailFaxId = async (args: GetApiAccountsUserIdThumbnailFaxIdArgs, options?: GetApiAccountsUserIdThumbnailFaxIdOptions) => { const {baseUrl = "https://restapi.fax.plus/v3", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/pdf") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/accounts/${encodeURIComponent(String(args.user_id))}/thumbnail/${encodeURIComponent(String(args.fax_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() };