Skip to content

Commit e972f9b

Browse files
authored
feat(javascript): expose current apiKey on the client instance [skip-bc] (#4285)
1 parent a57612a commit e972f9b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

clients/algoliasearch-client-javascript/packages/algoliasearch/__tests__/algoliasearch.common.test.ts

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ describe('api', () => {
2020
expect(client.appId).toEqual('APP_ID');
2121
});
2222

23+
test('exposes the `apiKey` currently in use at the root of the API', () => {
24+
expect(client.apiKey).toEqual('API_KEY');
25+
});
26+
2327
test('provides a `clearCache` method', () => {
2428
expect(client.clearCache).not.toBeUndefined();
2529
expect(() => client.clearCache()).not.toThrow();

templates/javascript/clients/api-single.mustache

+6-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ export function create{{#lambda.titlecase}}{{clientName}}{{/lambda.titlecase}}({
4747
*/
4848
appId: appIdOption,
4949
50+
/**
51+
* The `apiKey` currently in use.
52+
*/
53+
apiKey: apiKeyOption,
54+
5055
/**
5156
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
5257
*/
@@ -177,4 +182,4 @@ export function create{{#lambda.titlecase}}{{clientName}}{{/lambda.titlecase}}({
177182
};
178183
}
179184

180-
{{/operations}}
185+
{{/operations}}

0 commit comments

Comments
 (0)