export type DeleteApiV2CatalogCollectionsCollectionIdArgs = {collection_id: string}; export type DeleteApiV2CatalogCollectionsCollectionIdOptions = {baseUrl?: string | undefined, customerAccessCode?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete catalog collections * * DELETE /v2/catalog/collections/{collection_id} */ export const deleteApiV2CatalogCollectionsCollectionId = async (args: DeleteApiV2CatalogCollectionsCollectionIdArgs, options?: DeleteApiV2CatalogCollectionsCollectionIdOptions) => { const {baseUrl = "https://api.shutterstock.com", fetch: fetchFn = fetch, customerAccessCode} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (customerAccessCode !== undefined) headers.set('authorization', `Bearer ${customerAccessCode}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/catalog/collections/${encodeURIComponent(String(args.collection_id))}${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 };