export type LinkDocumentRequest = {document_id: string}; export type CreateApiV1CustomersCustomerIdDocumentsArgs = {customer_id: string, body: LinkDocumentRequest}; export type CreateApiV1CustomersCustomerIdDocumentsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Submit a document * * POST /v1/customers/{customer_id}/documents */ export const createApiV1CustomersCustomerIdDocuments = async (args: CreateApiV1CustomersCustomerIdDocumentsArgs, options?: CreateApiV1CustomersCustomerIdDocumentsOptions) => { const {baseUrl = "https://auth-sandbox.fuse.me", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/v1/customers/${encodeURIComponent(String(args.customer_id))}/documents${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };