//native
type Shutterstock = {
token: string;
};
/**
* Create audio collections
* This endpoint creates one or more collections (soundboxes). To add tracks, use `POST /v2/audio/collections/{id}/items`.
*/
export async function main(auth: Shutterstock, body: { name: string }) {
const url = new URL(`https://api.shutterstock.com/v2/audio/collections`);
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.json();
}
Submitted by hugo697 235 days ago