//native
type Shutterstock = {
token: string;
};
/**
* License sound effects
* This endpoint licenses sounds effect assets.
*/
export async function main(
auth: Shutterstock,
body: {
sound_effects: {
sfx_id: string;
audio_layout?: "ambisonic" | "5.1" | "stereo";
format?: "wav" | "mp3";
search_id?: string;
subscription_id: string;
}[];
},
) {
const url = new URL(`https://api.shutterstock.com/v2/sfx/licenses`);
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