export type BankBilletSendEmailObject = {form: {to?: string | undefined, subject?: string | undefined, message?: string | undefined, email_account_id: number, email_template_id?: number | undefined, bank_billet_in_pdf?: boolean | undefined, bank_billet_in_png?: boolean | undefined}}; export type CreateApiV1BankBilletsIdSendEmailArgs = {'User-Agent'?: string | undefined, 'X-Idempotency-Key'?: string | undefined, id: string, body: BankBilletSendEmailObject}; export type CreateApiV1BankBilletsIdSendEmailOptions = {baseUrl?: string | undefined, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Enviar Boleto por E-mail * * POST /v1/bank_billets/{id}/send_email */ export const createApiV1BankBilletsIdSendEmail = async (args: CreateApiV1BankBilletsIdSendEmailArgs, options?: CreateApiV1BankBilletsIdSendEmailOptions) => { const {baseUrl = "https://api-sandbox.kobana.com.br", fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['User-Agent'] != null) headers.set("User-Agent", String(args['User-Agent'])) if (args['X-Idempotency-Key'] != null) headers.set("X-Idempotency-Key", String(args['X-Idempotency-Key'])) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/bank_billets/${encodeURIComponent(String(args.id))}/send_email${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 (await res.json()) as unknown };