From 941496672e4ec29b84aaa1d83f2ab0f968e11a90 Mon Sep 17 00:00:00 2001 From: Faiz Date: Tue, 18 Aug 2026 04:47:50 +0500 Subject: [PATCH] Add orientations parameter to SearchVideosCreative and update date parameter naming in SearchImages and SearchVideosEditorial --- lib/searchimageseditorial.js | 2 +- lib/searchvideoscreative.js | 7 +++++++ lib/searchvideoseditorial.js | 2 +- tests/searchimageseditorialtests.js | 8 ++++---- tests/searchvideoscreativetests.js | 11 ++++++++++- tests/searchvideoseditorialtests.js | 8 ++++---- 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/lib/searchimageseditorial.js b/lib/searchimageseditorial.js index c87c6da..51aa3e2 100644 --- a/lib/searchimageseditorial.js +++ b/lib/searchimageseditorial.js @@ -46,7 +46,7 @@ class SearchImages extends GettyApiRequest { super.addParameter("compositions", this.compositions); super.addParameter("editorial_segments", this.editorialSegments); super.addParameter("embed_content_only", this.embedContentOnly); - super.addParameter("end_date", this.endDate); + super.addParameter("date_to", this.endDate); super.addParameter("entity_uris", this.entityUris); super.addParameter("ethnicity", this.ethnicities); super.addParameter("event_ids", this.eventIds); diff --git a/lib/searchvideoscreative.js b/lib/searchvideoscreative.js index 0fe5ffb..7ce7980 100644 --- a/lib/searchvideoscreative.js +++ b/lib/searchvideoscreative.js @@ -24,6 +24,7 @@ class SearchVideosCreative extends GettyApiRequest { this.sortOrder = null; this.headers = {}; this.minClipLength = 0; + this.orientations = []; } execute() { @@ -44,6 +45,7 @@ class SearchVideosCreative extends GettyApiRequest { super.addParameter("safe_search", this.safeSearch); super.addParameter("sort_order", this.sortOrder); super.addParameter("min_clip_length", this.minClipLength); + super.addParameter("orientations", this.orientations); var path = "/v3/search/videos/creative"; var query = querystring.stringify(this.params); @@ -142,6 +144,11 @@ class SearchVideosCreative extends GettyApiRequest { this.minClipLength = minLengthInSeconds; return this; } + + withOrientation(orientation) { + this.orientations[this.orientations.length] = orientation; + return this; + } } module.exports = SearchVideosCreative; \ No newline at end of file diff --git a/lib/searchvideoseditorial.js b/lib/searchvideoseditorial.js index a95c068..02563f6 100644 --- a/lib/searchvideoseditorial.js +++ b/lib/searchvideoseditorial.js @@ -46,7 +46,7 @@ class SearchVideosEditorial extends GettyApiRequest { super.addParameter("sort_order", this.sortOrder); super.addParameter("specific_people", this.specificPeople); super.addParameter("date_from", this.startDate); - super.addParameter("end_date", this.endDate); + super.addParameter("date_to", this.endDate); super.addParameter("orientations", this.orientations); var path = "/v3/search/videos/editorial"; diff --git a/tests/searchimageseditorialtests.js b/tests/searchimageseditorialtests.js index 96f748c..bc05a88 100644 --- a/tests/searchimageseditorialtests.js +++ b/tests/searchimageseditorialtests.js @@ -39,8 +39,8 @@ test.beforeEach(() => { .query({ "embed_content_only": "true", "phrase": "cat" }) .reply(200, {response : "embed_content_only"}) .get("/v3/search/images/editorial") - .query({ "end_date": "2015-04-01", "phrase": "cat" }) - .reply(200, {response : "end_date"}) + .query({ "date_to": "2015-04-01", "phrase": "cat" }) + .reply(200, {response : "date_to"}) .get("/v3/search/images/editorial") .query({ "entity_uris": [123, 456].join(","), "phrase": "cat" }) .reply(200, {response : "entity_uris"}) @@ -156,10 +156,10 @@ test("SearchImagesEditorial: withEmbedContentOnly will include embed_content_onl t.is(res.response, "embed_content_only"); }); -test("SearchImagesEditorial: withEndDate will include end_date in query", async t => { +test("SearchImagesEditorial: withEndDate will include date_to in query", async t => { var client = new api({ apiKey: "apikey", apiSecret: "apisecret" }, null); const res = await client.searchimageseditorial().withPhrase("cat").withEndDate("2015-04-01").execute(); - t.is(res.response, "end_date"); + t.is(res.response, "date_to"); }); test("SearchImagesEditorial: withEntityUris will include entity_uris in query", async t => { diff --git a/tests/searchvideoscreativetests.js b/tests/searchvideoscreativetests.js index 11af5f2..a31cf41 100644 --- a/tests/searchvideoscreativetests.js +++ b/tests/searchvideoscreativetests.js @@ -66,7 +66,10 @@ test.beforeEach(() => { }) .get("/v3/search/videos/creative") .query({ "min_clip_length": "15", "phrase": "cat" }) - .reply(200, {response : "min_clip_length"}); + .reply(200, {response : "min_clip_length"}) + .get("/v3/search/videos/creative") + .query({ "orientations": ["horizontal", "vertical"].join(","), "phrase": "cat" }) + .reply(200, {response : "orientations"}); }); test("SearchVideosCreative: withPhrase will include phrase in query", async t => { @@ -180,4 +183,10 @@ test("SearchVideosCreative: withMinClipLength will include min_clip_length in qu var client = new api({ apiKey: "apikey", apiSecret: "apisecret" }, null); const res = await client.searchvideoscreative().withMinClipLength(15).withPhrase("cat").execute(); t.is(res.response, "min_clip_length"); +}); + +test("SearchVideosCreative: withOrientation will include orientations in query", async t => { + var client = new api({ apiKey: "apikey", apiSecret: "apisecret" }, null); + const res = await client.searchvideoscreative().withPhrase("cat").withOrientation(["horizontal", "vertical"]).execute(); + t.is(res.response, "orientations"); }); \ No newline at end of file diff --git a/tests/searchvideoseditorialtests.js b/tests/searchvideoseditorialtests.js index 8f97a8f..63780a0 100644 --- a/tests/searchvideoseditorialtests.js +++ b/tests/searchvideoseditorialtests.js @@ -63,8 +63,8 @@ test.beforeEach(() => { .query({ "date_from": "2023-01-01", "phrase": "cat" }) .reply(200, {response : "date_from"}) .get("/v3/search/videos/editorial") - .query({ "end_date": "2023-12-31", "phrase": "cat" }) - .reply(200, {response : "end_date"}) + .query({ "date_to": "2023-12-31", "phrase": "cat" }) + .reply(200, {response : "date_to"}) .get("/v3/search/videos/editorial") .query({ "orientations": ["horizontal", "vertical"].join(","), "phrase": "cat" }) .reply(200, {response : "orientations"}) @@ -177,10 +177,10 @@ test("SearchVideosEditorial: withStartDate will include date_from in query", asy t.is(res.response, "date_from"); }); -test("SearchVideosEditorial: withEndDate will include end_date in query", async t => { +test("SearchVideosEditorial: withEndDate will include date_to in query", async t => { var client = new api({ apiKey: "apikey", apiSecret: "apisecret" }, null); const res = await client.searchvideoseditorial().withPhrase("cat").withEndDate("2023-12-31").execute(); - t.is(res.response, "end_date"); + t.is(res.response, "date_to"); }); test("SearchVideosEditorial: withOrientation will include orientations in query", async t => {