export type CreateApiApiCommercialPurchasesPaymentLinesArgs = {body: {data?: ({attributes?: ({cashed_vat_amount: unknown, gross_total?: number | undefined, net_total?: number | undefined, paid_value?: number | undefined, payable_id?: number | undefined, payable_type?: string | undefined, payment_id?: number | undefined, retention_total?: number | undefined, settlement_amount?: number | undefined, settlement_percentage?: number | undefined}) | undefined, type?: string | undefined}) | undefined}}; export type CreateApiApiCommercialPurchasesPaymentLinesOptions = {baseUrl: string, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Adicionar Linha a Pagamentos * * POST /api/commercial_purchases_payment_lines */ export const createApiApiCommercialPurchasesPaymentLines = async (args: CreateApiApiCommercialPurchasesPaymentLinesArgs, options: CreateApiApiCommercialPurchasesPaymentLinesOptions) => { 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_purchases_payment_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 };