export type DeleteApiCatalogsCatalogFactsNameArgs = {catalog: string, name: string, environment?: string | undefined}; export type DeleteApiCatalogsCatalogFactsNameOptions = {baseUrl?: string | undefined, AccessTokenAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a catalog fact * * DELETE /catalogs/{catalog}/facts/{name} * * Also accepts auth: APIKeyAuth */ export const deleteApiCatalogsCatalogFactsName = async (args: DeleteApiCatalogsCatalogFactsNameArgs, options?: DeleteApiCatalogsCatalogFactsNameOptions) => { const {baseUrl = "https://api.tower.dev/v1", fetch: fetchFn = fetch, AccessTokenAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.environment != null) query.append("environment", String(args.environment)) if (AccessTokenAuth !== undefined) headers.set('authorization', `Bearer ${AccessTokenAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/catalogs/${encodeURIComponent(String(args.catalog))}/facts/${encodeURIComponent(String(args.name))}${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 };