Skip to content

Commit

Permalink
Merge cd0eb62 into 59ef9a1
Browse files Browse the repository at this point in the history
  • Loading branch information
tali-ssky committed May 30, 2023
2 parents 59ef9a1 + cd0eb62 commit 7e8073f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/searchvideoscreative.js
Expand Up @@ -23,6 +23,7 @@ class SearchVideosCreative extends GettyApiRequest {
this.safeSearch = null;
this.sortOrder = null;
this.headers = {};
this.minClipLength = 0;
}

execute() {
Expand All @@ -42,6 +43,7 @@ class SearchVideosCreative extends GettyApiRequest {
super.addParameter("product_types", this.productTypes);
super.addParameter("safe_search", this.safeSearch);
super.addParameter("sort_order", this.sortOrder);
super.addParameter("min_clip_length", this.minClipLength);

var path = "/v3/search/videos/creative";
var query = querystring.stringify(this.params);
Expand Down Expand Up @@ -136,7 +138,10 @@ class SearchVideosCreative extends GettyApiRequest {
return this;
}


withMinClipLength(minLengthInSeconds) {
this.minClipLength = minLengthInSeconds;
return this;
}
}

module.exports = SearchVideosCreative;
11 changes: 10 additions & 1 deletion tests/searchvideoscreativetests.js
Expand Up @@ -63,7 +63,10 @@ test.beforeEach(() => {
.query({"phrase":"monkey"})
.reply(200,function(path, reqBody, cb) {
cb(null,[200, {response: "accept-language", headers: this.req.headers}]);
});
})
.get("/v3/search/videos/creative")
.query({ "min_clip_length": "15", "phrase": "cat" })
.reply(200, {response : "min_clip_length"});
});

test("SearchVideosCreative: withPhrase will include phrase in query", async t => {
Expand Down Expand Up @@ -172,3 +175,9 @@ test ("SearchVideosCreative: withAcceptLanguage will include the Accept-Language
t.is(body.headers["accept-language"], "en-us");
t.is(body.response, "accept-language");
});

test("SearchVideosCreative: withMinClipLength will include min_clip_length in query", async t => {
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");
});

0 comments on commit 7e8073f

Please sign in to comment.