export type GetApiV3AdminOrganizationsArgs = {q?: string | undefined, pending?: '1' | undefined, page?: number | undefined, limit?: number | undefined}; export type GetApiV3AdminOrganizationsOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * List organizations * * GET /v3/admin/organizations */ export const getApiV3AdminOrganizations = async (args: GetApiV3AdminOrganizationsArgs, options?: GetApiV3AdminOrganizationsOptions) => { const {baseUrl = "https://api.rhinoartisan.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.q != null) query.append("q", String(args.q)) if (args.pending != null) query.append("pending", String(args.pending)) if (args.page != null) query.append("page", String(args.page)) if (args.limit != null) query.append("limit", String(args.limit)) if (ApiKeyAuth !== undefined) headers.set("apikey", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v3/admin/organizations${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 };