Skip to content

Commit 7ab6b37

Browse files
feat(docs): improve descriptions for private API key and password fields in client settings
1 parent 2f37641 commit 7ab6b37

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 42
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-3d7da4b8ef2ed30aa32c4fb3e98e498e67402e91aaa5fd4c628fc080bfe82ea1.yml
33
openapi_spec_hash: aaa50fcbccec6f2cf1165f34bc6ac886
4-
config_hash: 4ef178e13ecfdb97211f284f13a21e83
4+
config_hash: 7218b2df6efd609f88bac0ac591a70e9

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import ImageKit from '@imagekit/nodejs';
2727

2828
const client = new ImageKit({
2929
privateAPIKey: process.env['IMAGEKIT_PRIVATE_API_KEY'], // This is the default and can be omitted
30-
password: process.env['ORG_MY_PASSWORD_TOKEN'], // This is the default and can be omitted
30+
password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted
3131
});
3232

3333
const response = await client.files.upload({
@@ -48,7 +48,7 @@ import ImageKit from '@imagekit/nodejs';
4848

4949
const client = new ImageKit({
5050
privateAPIKey: process.env['IMAGEKIT_PRIVATE_API_KEY'], // This is the default and can be omitted
51-
password: process.env['ORG_MY_PASSWORD_TOKEN'], // This is the default and can be omitted
51+
password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted
5252
});
5353

5454
const params: ImageKit.FileUploadParams = {

src/client.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,16 @@ import { isEmptyObj } from './internal/utils/values';
8686

8787
export interface ClientOptions {
8888
/**
89-
* Your ImageKit private key starts with `private_`.
89+
* Your ImageKit private API key (it starts with `private_`).
90+
* You can view and manage API keys in the [dashboard](https://imagekit.io/dashboard/developer/api-keys).
91+
*
9092
*/
9193
privateAPIKey?: string | undefined;
9294

9395
/**
94-
* Do not set this, its value is ignored
96+
* ImageKit Basic Auth only uses the username field and ignores the password.
97+
* This field is unused.
98+
*
9599
*/
96100
password?: string | null | undefined;
97101

@@ -187,7 +191,7 @@ export class ImageKit {
187191
* API Client for interfacing with the Image Kit API.
188192
*
189193
* @param {string | undefined} [opts.privateAPIKey=process.env['IMAGEKIT_PRIVATE_API_KEY'] ?? undefined]
190-
* @param {string | null | undefined} [opts.password=process.env['ORG_MY_PASSWORD_TOKEN'] ?? does_not_matter]
194+
* @param {string | null | undefined} [opts.password=process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'] ?? do_not_set]
191195
* @param {string} [opts.baseURL=process.env['IMAGE_KIT_BASE_URL'] ?? https://api.imagekit.io] - Override the default base URL for the API.
192196
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
193197
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
@@ -199,7 +203,7 @@ export class ImageKit {
199203
constructor({
200204
baseURL = readEnv('IMAGE_KIT_BASE_URL'),
201205
privateAPIKey = readEnv('IMAGEKIT_PRIVATE_API_KEY'),
202-
password = readEnv('ORG_MY_PASSWORD_TOKEN') ?? 'does_not_matter',
206+
password = readEnv('OPTIONAL_IMAGEKIT_IGNORES_THIS') ?? 'do_not_set',
203207
...opts
204208
}: ClientOptions = {}) {
205209
if (privateAPIKey === undefined) {

tests/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ describe('instantiate client', () => {
485485
test('with environment variable arguments', () => {
486486
// set options via env var
487487
process.env['IMAGEKIT_PRIVATE_API_KEY'] = 'My Private API Key';
488-
process.env['ORG_MY_PASSWORD_TOKEN'] = 'My Password';
488+
process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'] = 'My Password';
489489
const client = new ImageKit();
490490
expect(client.privateAPIKey).toBe('My Private API Key');
491491
expect(client.password).toBe('My Password');
@@ -494,7 +494,7 @@ describe('instantiate client', () => {
494494
test('with overridden environment variable arguments', () => {
495495
// set options via env var
496496
process.env['IMAGEKIT_PRIVATE_API_KEY'] = 'another My Private API Key';
497-
process.env['ORG_MY_PASSWORD_TOKEN'] = 'another My Password';
497+
process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'] = 'another My Password';
498498
const client = new ImageKit({ privateAPIKey: 'My Private API Key', password: 'My Password' });
499499
expect(client.privateAPIKey).toBe('My Private API Key');
500500
expect(client.password).toBe('My Password');

0 commit comments

Comments
 (0)