From 93932cb131590dec1e2146ab039f93e900e77524 Mon Sep 17 00:00:00 2001 From: Mark Pitman Date: Tue, 16 May 2023 12:52:28 -0700 Subject: [PATCH] Allow making some calls with only an API key Some users of the API want to be able to make calls like search with only an API key. --- gettyimages-api.js | 4 ---- tests/searchimagescreativetests.js | 6 ++++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gettyimages-api.js b/gettyimages-api.js index 19b0046..b327019 100644 --- a/gettyimages-api.js +++ b/gettyimages-api.js @@ -47,10 +47,6 @@ class GettyImagesApi { throw new SdkException("must specify an apiKey"); } - if (!credentials.apiSecret) { - throw new SdkException("must specify an apiSecret"); - } - if (!hostName) { hostName = "api.gettyimages.com"; } diff --git a/tests/searchimagescreativetests.js b/tests/searchimagescreativetests.js index 8d18d41..76d5a9a 100644 --- a/tests/searchimagescreativetests.js +++ b/tests/searchimagescreativetests.js @@ -242,3 +242,9 @@ test ("SearchImagesCreative: withAcceptLanguage will include the Accept-Language t.is(body.headers["accept-language"], "en-us"); t.is(body.response, "accept-language"); }); + +test("SearchImagesCreative: succeeds with only API Key and withPhrase will include phrase in query", async t => { + var client = new api({ apiKey: "apikey" }, null); + const res = await client.searchimagescreative().withPhrase("cat").execute(); + t.is(res.response, "phrase"); +});