export type DeleteApiApiV1ContextIdScopesArgs = {context_id: string, path: string}; export type DeleteApiApiV1ContextIdScopesOptions = {baseUrl: string, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Tombstone a scope node (soft-delete: sets tombstoned_at = time::now()). The root scope `/` is reserved and cannot be tombstoned. * * DELETE /api/v1/{context_id}/scopes */ export const deleteApiApiV1ContextIdScopes = async (args: DeleteApiApiV1ContextIdScopesArgs, options: DeleteApiApiV1ContextIdScopesOptions) => { const {baseUrl, fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.path != null) query.append("path", String(args.path)) if (apiKey !== undefined) headers.set('authorization', `Bearer ${apiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/${encodeURIComponent(String(args.context_id))}/scopes${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };