export type GetApiApiV1WorkspacesSlugWatchersArgs = {stale: string, docs: string, auto: string, manual: string, repo: string, status: string, tags: string, limit: string, offset: string, has_external: string, view: string}; export type GetApiApiV1WorkspacesSlugWatchersOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /api/v1/workspaces/{slug}/watchers */ export const getApiApiV1WorkspacesSlugWatchers = async (args: GetApiApiV1WorkspacesSlugWatchersArgs, options?: GetApiApiV1WorkspacesSlugWatchersOptions) => { const {baseUrl = "https://api.trybrein.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.stale != null) query.append("stale", String(args.stale)) if (args.docs != null) query.append("docs", String(args.docs)) if (args.auto != null) query.append("auto", String(args.auto)) if (args.manual != null) query.append("manual", String(args.manual)) if (args.repo != null) query.append("repo", String(args.repo)) if (args.status != null) query.append("status", String(args.status)) if (args.tags != null) query.append("tags", String(args.tags)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.offset != null) query.append("offset", String(args.offset)) if (args.has_external != null) query.append("has_external", String(args.has_external)) if (args.view != null) query.append("view", String(args.view)) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/workspaces/${encodeURIComponent(String(args.slug))}/watchers${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 };