//native
type Shutterstock = {
token: string;
};
/**
* Remove items from catalog collection
* This endpoint removes assets from a catalog collection. It does not remove the assets from the user's account's catalog.
*/
export async function main(
auth: Shutterstock,
collection_id: string,
body: { items: { id: string }[] },
) {
const url = new URL(
`https://api.shutterstock.com/v2/catalog/collections/${collection_id}/items`,
);
const response = await fetch(url, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago