export type GetApiApiV1WorkspacesSlugCollectionsIdArgs = {id: string, view: string}; export type GetApiApiV1WorkspacesSlugCollectionsIdOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /api/v1/workspaces/{slug}/collections/{id} */ export const getApiApiV1WorkspacesSlugCollectionsId = async (args: GetApiApiV1WorkspacesSlugCollectionsIdArgs, options?: GetApiApiV1WorkspacesSlugCollectionsIdOptions) => { const {baseUrl = "https://api.trybrein.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.view != null) query.append("view", String(args.view)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/workspaces/${encodeURIComponent(String(args.slug))}/collections/${encodeURIComponent(String(args.id))}${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 };