export type OrganizationIndexRequest = {per_page?: number | undefined, order_by?: string | undefined, order?: string | undefined, name?: string | undefined, types?: string | undefined, contract_statuses?: string | undefined, contract_payment_types?: string | undefined, contract_auto_renew?: string | undefined, sales_account?: string | undefined, account_manager?: string | undefined}; export type GetApiApiOrganizationArgs = {OrganizationIndexRequest?: OrganizationIndexRequest | undefined}; export type GetApiApiOrganizationOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * List organizations * * GET /api/organization */ export const getApiApiOrganization = async (args: GetApiApiOrganizationArgs, options: GetApiApiOrganizationOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.OrganizationIndexRequest != null) query.append("OrganizationIndexRequest", JSON.stringify(args.OrganizationIndexRequest)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/organization${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 undefined };