export type CreateApiDocumentTenantLocatorDocumentsRenderArgs = {tenantLocator: string, referenceType: 'quote' | 'policy' | 'invoice' | 'transaction' | 'segment' | 'term' | 'quoteGroup', referenceLocator: unknown, productName?: string | undefined, templateFormat?: ('liquid' | 'velocity') | undefined, documentConfig?: string | undefined, staticName?: string | undefined, templateName?: string | undefined, body: BodyInit}; export type CreateApiDocumentTenantLocatorDocumentsRenderOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /document/{tenantLocator}/documents/render */ export const createApiDocumentTenantLocatorDocumentsRender = async (args: CreateApiDocumentTenantLocatorDocumentsRenderArgs, options: CreateApiDocumentTenantLocatorDocumentsRenderOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.referenceType != null) query.append("referenceType", String(args.referenceType)) if (args.referenceLocator != null) query.append("referenceLocator", String(args.referenceLocator)) if (args.productName != null) query.append("productName", String(args.productName)) if (args.templateFormat != null) query.append("templateFormat", String(args.templateFormat)) if (args.documentConfig != null) query.append("documentConfig", String(args.documentConfig)) if (args.staticName != null) query.append("staticName", String(args.staticName)) if (args.templateName != null) query.append("templateName", String(args.templateName)) const url = `${baseUrl.replace(/\/+$/, '')}/document/${encodeURIComponent(String(args.tenantLocator))}/documents/render${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };