export type DeleteApiV2AudioCollectionsIdItemsArgs = {id: string, item_id?: Array | undefined}; export type DeleteApiV2AudioCollectionsIdItemsOptions = {baseUrl?: string | undefined, customerAccessCode?: string | undefined, fetch?: typeof fetch | undefined}; /** * Remove audio tracks from collections * * DELETE /v2/audio/collections/{id}/items */ export const deleteApiV2AudioCollectionsIdItems = async (args: DeleteApiV2AudioCollectionsIdItemsArgs, options?: DeleteApiV2AudioCollectionsIdItemsOptions) => { const {baseUrl = "https://api.shutterstock.com", fetch: fetchFn = fetch, customerAccessCode} = options ?? {} const query = new URLSearchParams() const headers = new Headers() for (const item of args.item_id ?? []) query.append("item_id", String(item)) if (customerAccessCode !== undefined) headers.set('authorization', `Bearer ${customerAccessCode}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/audio/collections/${encodeURIComponent(String(args.id))}/items${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 };