Skip to content

Commit

Permalink
Merge pull request #48 from gettyimages/allow-calls-with-api-key-only
Browse files Browse the repository at this point in the history
Allow making some calls with only an API key
  • Loading branch information
mapitman committed May 16, 2023
2 parents 52ea031 + 93932cb commit 3798901
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 0 additions & 4 deletions gettyimages-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
6 changes: 6 additions & 0 deletions tests/searchimagescreativetests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});

0 comments on commit 3798901

Please sign in to comment.