export type GetApiV1SchedulesCreditArgs = {$filter?: string | undefined, $skip?: string | undefined, $top?: string | undefined, $orderby?: string | undefined}; export type GetApiV1SchedulesCreditOptions = {baseUrl?: string | undefined, sec0?: string | undefined, fetch?: typeof fetch | undefined}; /** * Listar recebimentos agendados (Contas a receber) * * GET /v1/schedules/credit */ export const getApiV1SchedulesCredit = async (args: GetApiV1SchedulesCreditArgs, options?: GetApiV1SchedulesCreditOptions) => { const {baseUrl = "https://api.nibo.com.br/empresas", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/json") if (args.$filter != null) query.append("$filter", String(args.$filter)) if (args.$skip != null) query.append("$skip", String(args.$skip)) if (args.$top != null) query.append("$top", String(args.$top)) if (args.$orderby != null) query.append("$orderby", String(args.$orderby)) if (sec0 !== undefined) headers.set("apitoken", sec0) const url = `${baseUrl.replace(/\/+$/, '')}/v1/schedules/credit${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) 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 };