export type GetApiAppsAppIdQuotesIdYousignPreviewJpgArgs = {appId: number, id: number, template?: ('delivery' | 'command' | null) | undefined}; export type GetApiAppsAppIdQuotesIdYousignPreviewJpgOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download quote as jpeg * * GET /apps/{appId}/quotes/{id}/yousign/preview.jpg */ export const getApiAppsAppIdQuotesIdYousignPreviewJpg = async (args: GetApiAppsAppIdQuotesIdYousignPreviewJpgArgs, options?: GetApiAppsAppIdQuotesIdYousignPreviewJpgOptions) => { const {baseUrl = "https://api.sinao.app/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/jpeg") if (args.template != null) query.append("template", String(args.template)) const url = `${baseUrl.replace(/\/+$/, '')}/apps/${encodeURIComponent(String(args.appId))}/quotes/${encodeURIComponent(String(args.id))}/yousign/preview.jpg${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() };