export type PatchApiApiV1WorkspacesSlugWatchersTopicSlugArgs = {topicSlug: string}; export type PatchApiApiV1WorkspacesSlugWatchersTopicSlugOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * PATCH /api/v1/workspaces/{slug}/watchers/{topicSlug} */ export const patchApiApiV1WorkspacesSlugWatchersTopicSlug = async (args: PatchApiApiV1WorkspacesSlugWatchersTopicSlugArgs, options?: PatchApiApiV1WorkspacesSlugWatchersTopicSlugOptions) => { const {baseUrl = "https://api.trybrein.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/workspaces/${encodeURIComponent(String(args.slug))}/watchers/${encodeURIComponent(String(args.topicSlug))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };