export type ExternalIdSourceType = 'QUICKBOOKS' | 'NETSUITE' | 'RILLET' | 'SAGE_INTACCT' | 'SALESFORCE' | 'HUBSPOT' | 'AVALARA' | 'ANROK' | 'STRIPE'; export type InvoiceExternalIdV3Dto = {type: ExternalIdSourceType, id: string}; export type UpdateInvoiceExternalIdsDto = {externalIds: Array}; export type PatchApiV3CustomersIdInvoicesInvoiceIdExternalIdsArgs = {id: string, invoiceId: string, body: UpdateInvoiceExternalIdsDto}; export type PatchApiV3CustomersIdInvoicesInvoiceIdExternalIdsOptions = {baseUrl?: string | undefined, customHeader?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update invoice external IDs * * PATCH /v3/customers/{id}/invoices/{invoiceId}/external-ids */ export const patchApiV3CustomersIdInvoicesInvoiceIdExternalIds = async (args: PatchApiV3CustomersIdInvoicesInvoiceIdExternalIdsArgs, options?: PatchApiV3CustomersIdInvoicesInvoiceIdExternalIdsOptions) => { const {baseUrl = "https://integrators.prod.api.tabsplatform.com", fetch: fetchFn = fetch, customHeader} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (customHeader !== undefined) headers.set("Authorization", customHeader) const url = `${baseUrl.replace(/\/+$/, '')}/v3/customers/${encodeURIComponent(String(args.id))}/invoices/${encodeURIComponent(String(args.invoiceId))}/external-ids${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };