export type DeleteApiDamAlbumsAlbumIdFilesFileIdArgs = {album_id: string, file_id: string}; export type DeleteApiDamAlbumsAlbumIdFilesFileIdOptions = {baseUrl: string, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes a file from an Album. * * DELETE /dam/albums/{album_id}/files/{file_id} */ export const deleteApiDamAlbumsAlbumIdFilesFileId = async (args: DeleteApiDamAlbumsAlbumIdFilesFileIdArgs, options: DeleteApiDamAlbumsAlbumIdFilesFileIdOptions) => { 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/albums/${encodeURIComponent(String(args.album_id))}/files/${encodeURIComponent(String(args.file_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 };