export type GetApiApiV1WorkspacesSlugLunaSessionsArgs = {include_archived: string, cursor: string, limit: string, q: string}; export type GetApiApiV1WorkspacesSlugLunaSessionsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /api/v1/workspaces/{slug}/luna/sessions */ export const getApiApiV1WorkspacesSlugLunaSessions = async (args: GetApiApiV1WorkspacesSlugLunaSessionsArgs, options?: GetApiApiV1WorkspacesSlugLunaSessionsOptions) => { const {baseUrl = "https://api.trybrein.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.include_archived != null) query.append("include_archived", String(args.include_archived)) if (args.cursor != null) query.append("cursor", String(args.cursor)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.q != null) query.append("q", String(args.q)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/workspaces/${encodeURIComponent(String(args.slug))}/luna/sessions${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 };