@sendly/node 3.18.2 → 3.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -25,6 +25,7 @@ interface SendlyConfig {
25
25
  * @default 3
26
26
  */
27
27
  maxRetries?: number;
28
+ organizationId?: string;
28
29
  }
29
30
  /**
30
31
  * Message type for compliance classification
@@ -1875,6 +1876,7 @@ interface HttpClientConfig {
1875
1876
  baseUrl: string;
1876
1877
  timeout: number;
1877
1878
  maxRetries: number;
1879
+ organizationId?: string;
1878
1880
  }
1879
1881
  /**
1880
1882
  * HTTP client for making API requests
@@ -1882,6 +1884,7 @@ interface HttpClientConfig {
1882
1884
  declare class HttpClient {
1883
1885
  private readonly config;
1884
1886
  private rateLimitInfo?;
1887
+ organizationId?: string;
1885
1888
  constructor(config: Partial<HttpClientConfig> & {
1886
1889
  apiKey: string;
1887
1890
  });
@@ -3418,6 +3421,19 @@ declare class WorkspacesSubResource {
3418
3421
  workspaces: EnterpriseWorkspace[];
3419
3422
  maxWorkspaces: number;
3420
3423
  workspacesUsed: number;
3424
+ pagination?: {
3425
+ page: number;
3426
+ limit: number;
3427
+ total: number;
3428
+ totalPages: number;
3429
+ };
3430
+ summary?: {
3431
+ totalCredits: number;
3432
+ totalMessages30d: number;
3433
+ verified: number;
3434
+ pending: number;
3435
+ unverified: number;
3436
+ };
3421
3437
  }>;
3422
3438
  get(workspaceId: string): Promise<EnterpriseWorkspaceDetail>;
3423
3439
  delete(workspaceId: string): Promise<void>;
@@ -3762,6 +3778,7 @@ declare class Sendly {
3762
3778
  * Get the configured base URL
3763
3779
  */
3764
3780
  getBaseUrl(): string;
3781
+ setOrganizationId(id: string): void;
3765
3782
  }
3766
3783
 
3767
3784
  /**
package/dist/index.d.ts CHANGED
@@ -25,6 +25,7 @@ interface SendlyConfig {
25
25
  * @default 3
26
26
  */
27
27
  maxRetries?: number;
28
+ organizationId?: string;
28
29
  }
29
30
  /**
30
31
  * Message type for compliance classification
@@ -1875,6 +1876,7 @@ interface HttpClientConfig {
1875
1876
  baseUrl: string;
1876
1877
  timeout: number;
1877
1878
  maxRetries: number;
1879
+ organizationId?: string;
1878
1880
  }
1879
1881
  /**
1880
1882
  * HTTP client for making API requests
@@ -1882,6 +1884,7 @@ interface HttpClientConfig {
1882
1884
  declare class HttpClient {
1883
1885
  private readonly config;
1884
1886
  private rateLimitInfo?;
1887
+ organizationId?: string;
1885
1888
  constructor(config: Partial<HttpClientConfig> & {
1886
1889
  apiKey: string;
1887
1890
  });
@@ -3418,6 +3421,19 @@ declare class WorkspacesSubResource {
3418
3421
  workspaces: EnterpriseWorkspace[];
3419
3422
  maxWorkspaces: number;
3420
3423
  workspacesUsed: number;
3424
+ pagination?: {
3425
+ page: number;
3426
+ limit: number;
3427
+ total: number;
3428
+ totalPages: number;
3429
+ };
3430
+ summary?: {
3431
+ totalCredits: number;
3432
+ totalMessages30d: number;
3433
+ verified: number;
3434
+ pending: number;
3435
+ unverified: number;
3436
+ };
3421
3437
  }>;
3422
3438
  get(workspaceId: string): Promise<EnterpriseWorkspaceDetail>;
3423
3439
  delete(workspaceId: string): Promise<void>;
@@ -3762,6 +3778,7 @@ declare class Sendly {
3762
3778
  * Get the configured base URL
3763
3779
  */
3764
3780
  getBaseUrl(): string;
3781
+ setOrganizationId(id: string): void;
3765
3782
  }
3766
3783
 
3767
3784
  /**
package/dist/index.js CHANGED
@@ -189,6 +189,7 @@ var DEFAULT_MAX_RETRIES = 3;
189
189
  var HttpClient = class {
190
190
  config;
191
191
  rateLimitInfo;
192
+ organizationId;
192
193
  constructor(config) {
193
194
  this.config = {
194
195
  apiKey: config.apiKey,
@@ -196,6 +197,7 @@ var HttpClient = class {
196
197
  timeout: config.timeout || DEFAULT_TIMEOUT,
197
198
  maxRetries: config.maxRetries ?? DEFAULT_MAX_RETRIES
198
199
  };
200
+ this.organizationId = config.organizationId || process.env.SENDLY_ORG_ID || void 0;
199
201
  if (!this.isValidApiKey(this.config.apiKey)) {
200
202
  throw new Error(
201
203
  "Invalid API key format. Expected sk_test_v1_xxx or sk_live_v1_xxx"
@@ -374,13 +376,17 @@ var HttpClient = class {
374
376
  * Build request headers
375
377
  */
376
378
  buildHeaders(additionalHeaders) {
377
- return {
379
+ const headers = {
378
380
  Authorization: `Bearer ${this.config.apiKey}`,
379
381
  "Content-Type": "application/json",
380
382
  Accept: "application/json",
381
383
  "User-Agent": "@sendly/node/1.0.5",
382
384
  ...additionalHeaders
383
385
  };
386
+ if (this.organizationId) {
387
+ headers["X-Organization-Id"] = this.organizationId;
388
+ }
389
+ return headers;
384
390
  }
385
391
  /**
386
392
  * Update rate limit info from response headers
@@ -3511,7 +3517,8 @@ var Sendly = class {
3511
3517
  apiKey: this.config.apiKey,
3512
3518
  baseUrl: this.config.baseUrl,
3513
3519
  timeout: this.config.timeout,
3514
- maxRetries: this.config.maxRetries
3520
+ maxRetries: this.config.maxRetries,
3521
+ organizationId: typeof configOrApiKey === "string" ? void 0 : configOrApiKey.organizationId
3515
3522
  });
3516
3523
  this.messages = new MessagesResource(this.http);
3517
3524
  this.webhooks = new WebhooksResource(this.http);
@@ -3565,6 +3572,9 @@ var Sendly = class {
3565
3572
  getBaseUrl() {
3566
3573
  return this.config.baseUrl;
3567
3574
  }
3575
+ setOrganizationId(id) {
3576
+ this.http.organizationId = id;
3577
+ }
3568
3578
  };
3569
3579
 
3570
3580
  // src/utils/webhooks.ts
package/dist/index.mjs CHANGED
@@ -129,6 +129,7 @@ var DEFAULT_MAX_RETRIES = 3;
129
129
  var HttpClient = class {
130
130
  config;
131
131
  rateLimitInfo;
132
+ organizationId;
132
133
  constructor(config) {
133
134
  this.config = {
134
135
  apiKey: config.apiKey,
@@ -136,6 +137,7 @@ var HttpClient = class {
136
137
  timeout: config.timeout || DEFAULT_TIMEOUT,
137
138
  maxRetries: config.maxRetries ?? DEFAULT_MAX_RETRIES
138
139
  };
140
+ this.organizationId = config.organizationId || process.env.SENDLY_ORG_ID || void 0;
139
141
  if (!this.isValidApiKey(this.config.apiKey)) {
140
142
  throw new Error(
141
143
  "Invalid API key format. Expected sk_test_v1_xxx or sk_live_v1_xxx"
@@ -314,13 +316,17 @@ var HttpClient = class {
314
316
  * Build request headers
315
317
  */
316
318
  buildHeaders(additionalHeaders) {
317
- return {
319
+ const headers = {
318
320
  Authorization: `Bearer ${this.config.apiKey}`,
319
321
  "Content-Type": "application/json",
320
322
  Accept: "application/json",
321
323
  "User-Agent": "@sendly/node/1.0.5",
322
324
  ...additionalHeaders
323
325
  };
326
+ if (this.organizationId) {
327
+ headers["X-Organization-Id"] = this.organizationId;
328
+ }
329
+ return headers;
324
330
  }
325
331
  /**
326
332
  * Update rate limit info from response headers
@@ -3451,7 +3457,8 @@ var Sendly = class {
3451
3457
  apiKey: this.config.apiKey,
3452
3458
  baseUrl: this.config.baseUrl,
3453
3459
  timeout: this.config.timeout,
3454
- maxRetries: this.config.maxRetries
3460
+ maxRetries: this.config.maxRetries,
3461
+ organizationId: typeof configOrApiKey === "string" ? void 0 : configOrApiKey.organizationId
3455
3462
  });
3456
3463
  this.messages = new MessagesResource(this.http);
3457
3464
  this.webhooks = new WebhooksResource(this.http);
@@ -3505,6 +3512,9 @@ var Sendly = class {
3505
3512
  getBaseUrl() {
3506
3513
  return this.config.baseUrl;
3507
3514
  }
3515
+ setOrganizationId(id) {
3516
+ this.http.organizationId = id;
3517
+ }
3508
3518
  };
3509
3519
 
3510
3520
  // src/utils/webhooks.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sendly/node",
3
- "version": "3.18.2",
3
+ "version": "3.19.0",
4
4
  "description": "Official Sendly Node.js SDK for SMS messaging",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",