//native
type Shutterstock = {
token: string;
};
/**
* Add videos to collections
* This endpoint adds one or more videos to a collection by video IDs.
*/
export async function main(
auth: Shutterstock,
id: string,
body: { items: { added_time?: string; id: string; media_type?: string }[] },
) {
const url = new URL(
`https://api.shutterstock.com/v2/videos/collections/${id}/items`,
);
const response = await fetch(url, {
method: "POST",
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.text();
}
Submitted by hugo697 235 days ago