Skip to content

Commit

Permalink
fix(client): set client options argument as optional (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored and cleb11 committed Aug 1, 2023
1 parent 40a3e9e commit 9f2ac54
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export class ModernTreasury extends Core.APIClient {

private _options: ClientOptions;

constructor(opts: ClientOptions) {
constructor(opts?: ClientOptions) {
const options: ClientOptions = {
apiKey: typeof process === 'undefined' ? '' : process.env['MODERN_TREASURY_API_KEY'] || '',
baseURL: 'https://app.moderntreasury.com',
Expand All @@ -105,14 +105,14 @@ export class ModernTreasury extends Core.APIClient {
this._options = options;
this.idempotencyHeader = 'Idempotency-Key';

const organizationId = opts.organizationId || process.env['MODERN_TREASURY_ORGANIZATION_ID'];
const organizationId = opts?.organizationId || process.env['MODERN_TREASURY_ORGANIZATION_ID'];
if (!organizationId) {
throw new Error(
"The MODERN_TREASURY_ORGANIZATION_ID environment variable is missing or empty; either provide it, or instantiate the ModernTreasury client with an organizationId option, like new ModernTreasury({ organizationId: 'my-organization-ID' }).",
);
}
this.organizationId = organizationId;
this.webhookKey = opts.webhookKey || process.env['MODERN_TREASURY_WEBHOOK_KEY'] || null;
this.webhookKey = opts?.webhookKey || process.env['MODERN_TREASURY_WEBHOOK_KEY'] || null;
}

connections: API.Connections = new API.Connections(this);
Expand Down

0 comments on commit 9f2ac54

Please sign in to comment.