export type DeleteApiV1CollectionsCollectionIdArgs = {collectionId: number}; export type DeleteApiV1CollectionsCollectionIdOptions = {baseUrl?: string | undefined, managerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete account-level collection * * DELETE /v1/collections/{collectionId} * * Also accepts auth: management_key */ export const deleteApiV1CollectionsCollectionId = async (args: DeleteApiV1CollectionsCollectionIdArgs, options?: DeleteApiV1CollectionsCollectionIdOptions) => { const {baseUrl = "https://yourbaseurl.talon.one", fetch: fetchFn = fetch, managerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (managerAuth !== undefined) headers.set("Authorization", managerAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/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 };