export type CreateApiApiCommercialSalesReceiptLinesArgs = {body: {data?: ({attributes?: ({cashed_vat_amount: unknown, gross_total?: number | undefined, net_total?: number | undefined, receipt_id?: number | undefined, receivable_id?: number | undefined, receivable_type?: string | undefined, received_value?: number | undefined, retention_total?: number | undefined, settlement_amount?: number | undefined, settlement_percentage?: number | undefined}) | undefined, type?: string | undefined}) | undefined}}; export type CreateApiApiCommercialSalesReceiptLinesOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Adicionar Linha a Recibo de Venda * * POST /api/commercial_sales_receipt_lines */ export const createApiApiCommercialSalesReceiptLines = async (args: CreateApiApiCommercialSalesReceiptLinesArgs, options: CreateApiApiCommercialSalesReceiptLinesOptions) => { const {baseUrl, fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/commercial_sales_receipt_lines${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 };