//native
type Shutterstock = {
token: string;
};
/**
* Rename audio collections
* This endpoint sets a new name for a collection.
*/
export async function main(
auth: Shutterstock,
id: string,
body: { name: string },
) {
const url = new URL(
`https://api.shutterstock.com/v2/audio/collections/${id}`,
);
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