export type DeleteApiCollectionsCollectionNameArgs = {'X-Pinecone-Api-Version': string, collection_name: string}; export type DeleteApiCollectionsCollectionNameOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a collection * * DELETE /collections/{collection_name} */ export const deleteApiCollectionsCollectionName = async (args: DeleteApiCollectionsCollectionNameArgs, options?: DeleteApiCollectionsCollectionNameOptions) => { const {baseUrl = "https://api.pinecone.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['X-Pinecone-Api-Version'] != null) headers.set("X-Pinecone-Api-Version", String(args['X-Pinecone-Api-Version'])) if (ApiKeyAuth !== undefined) headers.set("Api-Key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/collections/${encodeURIComponent(String(args.collection_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 };