export type DeleteApiDamFoldersFolderIdArgs = {folder_id: string}; export type DeleteApiDamFoldersFolderIdOptions = {baseUrl: string, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes a single DAM folder and its containing files. * * DELETE /dam/folders/{folder_id} */ export const deleteApiDamFoldersFolderId = async (args: DeleteApiDamFoldersFolderIdArgs, options: DeleteApiDamFoldersFolderIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/vnd.api+json") if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/dam/folders/${encodeURIComponent(String(args.folder_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 (await res.json()) as unknown };