Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/searchimageseditorial.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions lib/searchvideoscreative.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class SearchVideosCreative extends GettyApiRequest {
this.sortOrder = null;
this.headers = {};
this.minClipLength = 0;
this.orientations = [];
}

execute() {
Expand All @@ -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);
Expand Down Expand Up @@ -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;
2 changes: 1 addition & 1 deletion lib/searchvideoseditorial.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
8 changes: 4 additions & 4 deletions tests/searchimageseditorialtests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down Expand Up @@ -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 => {
Expand Down
11 changes: 10 additions & 1 deletion tests/searchvideoscreativetests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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");
});
8 changes: 4 additions & 4 deletions tests/searchvideoseditorialtests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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"})
Expand Down Expand Up @@ -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 => {
Expand Down
Loading