0

List editorial video licenses

by
Published Oct 17, 2025

This endpoint lists existing editorial video licenses.

Script shutterstock Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Shutterstock = {
3
  token: string;
4
};
5
/**
6
 * List editorial video licenses
7
 * This endpoint lists existing editorial video licenses.
8
 */
9
export async function main(
10
  auth: Shutterstock,
11
  video_id: string | undefined,
12
  license: string | undefined,
13
  page: string | undefined,
14
  per_page: string | undefined,
15
  sort: "newest" | "oldest" | undefined,
16
  username: string | undefined,
17
  start_date: string | undefined,
18
  end_date: string | undefined,
19
  download_availability:
20
    | "all"
21
    | "downloadable"
22
    | "non_downloadable"
23
    | undefined,
24
  team_history: string | undefined,
25
) {
26
  const url = new URL(
27
    `https://api.shutterstock.com/v2/editorial/videos/licenses`,
28
  );
29
  for (const [k, v] of [
30
    ["video_id", video_id],
31
    ["license", license],
32
    ["page", page],
33
    ["per_page", per_page],
34
    ["sort", sort],
35
    ["username", username],
36
    ["start_date", start_date],
37
    ["end_date", end_date],
38
    ["download_availability", download_availability],
39
    ["team_history", team_history],
40
  ]) {
41
    if (v !== undefined && v !== "" && k !== undefined) {
42
      url.searchParams.append(k, v);
43
    }
44
  }
45
  const response = await fetch(url, {
46
    method: "GET",
47
    headers: {
48
      Authorization: "Bearer " + auth.token,
49
    },
50
    body: undefined,
51
  });
52
  if (!response.ok) {
53
    const text = await response.text();
54
    throw new Error(`${response.status} ${text}`);
55
  }
56
  return await response.json();
57
}
58