export type DeleteApiCatalogsNameArgs = {name: string, force?: boolean | undefined}; export type DeleteApiCatalogsNameOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete a catalog * * DELETE /catalogs/{name} */ export const deleteApiCatalogsName = async (args: DeleteApiCatalogsNameArgs, options: DeleteApiCatalogsNameOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.force != null) query.append("force", String(args.force)) const url = `${baseUrl.replace(/\/+$/, '')}/catalogs/${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 };