Skip to content

Commit

Permalink
Allow making some calls with only an API key
Browse files Browse the repository at this point in the history
Some users of the API want to be able to make calls like search with
only an API key.
  • Loading branch information
mapitman committed May 16, 2023
1 parent 52ea031 commit 93932cb
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 93932cb

Please sign in to comment.