diff --git a/lib/searchvideoscreative.js b/lib/searchvideoscreative.js index 9036c8f..0fe5ffb 100644 --- a/lib/searchvideoscreative.js +++ b/lib/searchvideoscreative.js @@ -23,6 +23,7 @@ class SearchVideosCreative extends GettyApiRequest { this.safeSearch = null; this.sortOrder = null; this.headers = {}; + this.minClipLength = 0; } execute() { @@ -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); @@ -136,7 +138,10 @@ class SearchVideosCreative extends GettyApiRequest { return this; } - + withMinClipLength(minLengthInSeconds) { + this.minClipLength = minLengthInSeconds; + return this; + } } module.exports = SearchVideosCreative; \ No newline at end of file diff --git a/tests/searchvideoscreativetests.js b/tests/searchvideoscreativetests.js index 6d8a047..9ef7363 100644 --- a/tests/searchvideoscreativetests.js +++ b/tests/searchvideoscreativetests.js @@ -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 => { @@ -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"); +}); \ No newline at end of file