export type DeleteApiCollectionsCollectionIdArgs = {collectionId: string}; export type DeleteApiCollectionsCollectionIdOptions = {baseUrl?: string | undefined, JWT?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Collection * * DELETE /collections/{collectionId} * * Also accepts auth: BasicAuth */ export const deleteApiCollectionsCollectionId = async (args: DeleteApiCollectionsCollectionIdArgs, options?: DeleteApiCollectionsCollectionIdOptions) => { const {baseUrl = "https://api.planet.com/features/v1/ogc/my", fetch: fetchFn = fetch, JWT} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (JWT !== undefined) headers.set('authorization', `Bearer ${JWT}`) const url = `${baseUrl.replace(/\/+$/, '')}/collections/${encodeURIComponent(String(args.collectionId))}${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 };