export type PropertiesIdentifier = string; export type DeleteApiV3CollectionsIdentifierArgs = {identifier: PropertiesIdentifier}; export type DeleteApiV3CollectionsIdentifierOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a collection * * DELETE /v3/collections/{identifier} */ export const deleteApiV3CollectionsIdentifier = async (args: DeleteApiV3CollectionsIdentifierArgs, options?: DeleteApiV3CollectionsIdentifierOptions) => { const {baseUrl = "https://api.affinda.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ApiKeyAuth !== undefined) headers.set('authorization', `Bearer ${ApiKeyAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v3/collections/${encodeURIComponent(String(args.identifier))}${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 };