//native
type Shutterstock = {
token: string;
};
/**
* List updated videos
* This endpoint lists videos that have been updated in the specified time period to update content management systems (CMS) or digital asset management (DAM) systems. In most cases, use the `interval` parameter to show videos that were updated recently, but you can also use the `start_date` and `end_date` parameters to specify a range of no more than three days. Do not use the `interval` parameter with either `start_date` or `end_date`.
*/
export async function main(
auth: Shutterstock,
start_date: string | undefined,
end_date: string | undefined,
interval: string | undefined,
page: string | undefined,
per_page: string | undefined,
sort: "newest" | "oldest" | undefined,
) {
const url = new URL(`https://api.shutterstock.com/v2/videos/updated`);
for (const [k, v] of [
["start_date", start_date],
["end_date", end_date],
["interval", interval],
["page", page],
["per_page", per_page],
["sort", sort],
]) {
if (v !== undefined && v !== "" && k !== undefined) {
url.searchParams.append(k, v);
}
}
const response = await fetch(url, {
method: "GET",
headers: {
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 235 days ago