export type GetApiV1SchedulesCategoriesTreeArgs = {IncludeDeletedCategory?: boolean | undefined, CanComposeNFSeValueOnly?: boolean | undefined}; export type GetApiV1SchedulesCategoriesTreeOptions = {baseUrl?: string | undefined, sec0?: string | undefined, fetch?: typeof fetch | undefined}; /** * Hierarquia das Categorias de Agendamento * * GET /v1/schedules/categories/tree */ export const getApiV1SchedulesCategoriesTree = async (args: GetApiV1SchedulesCategoriesTreeArgs, options?: GetApiV1SchedulesCategoriesTreeOptions) => { 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.IncludeDeletedCategory != null) query.append("IncludeDeletedCategory", String(args.IncludeDeletedCategory)) if (args.CanComposeNFSeValueOnly != null) query.append("CanComposeNFSeValueOnly", String(args.CanComposeNFSeValueOnly)) if (sec0 !== undefined) headers.set("apitoken", sec0) const url = `${baseUrl.replace(/\/+$/, '')}/v1/schedules/categories/tree${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 };