@atribu/node 0.1.2 → 0.2.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.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { H as HttpClientLike, p as paths, R as RequestOptions } from './api.d-BXINTQo6.js';
2
- import { A as AtribuError } from './errors-D3ApBz8J.js';
3
- export { a as ApiErrorBody, b as ApiErrorCode, c as AtribuApiError, d as AtribuConfigError, e as AtribuOauthError, f as AtribuTransportError, g as AtribuWebhookError, O as OauthErrorCode, R as RetryHint, W as WebhookErrorCode } from './errors-D3ApBz8J.js';
1
+ import { H as HttpClientLike, p as paths, R as RequestOptions } from './api.d-CRypizsD.js';
2
+ import { d as AtribuError } from './errors-BLELoojK.js';
3
+ export { A as ApiErrorBody, a as ApiErrorCode, b as AtribuApiError, c as AtribuConfigError, e as AtribuOauthError, f as AtribuTransportError, g as AtribuWebhookError, O as OauthErrorCode, R as RetryHint, W as WebhookErrorCode } from './errors-BLELoojK.js';
4
4
 
5
5
  interface AtribuClientConfig {
6
6
  apiKey: string;
@@ -47,21 +47,46 @@ declare class CommentsResource {
47
47
  privateReply(input: CommentPrivateReplyInput, opts?: CommentReplyOptions): Promise<CommentReplyResponse>;
48
48
  }
49
49
 
50
- type ListResponse = paths["/api/v1/webhooks/subscriptions"]["get"]["responses"][200]["content"]["application/json"];
51
- type CreateBody = NonNullable<paths["/api/v1/webhooks/subscriptions"]["post"]["requestBody"]>["content"]["application/json"];
52
- type CreateResponse = paths["/api/v1/webhooks/subscriptions"]["post"]["responses"][201]["content"]["application/json"];
53
- type UpdateBody = NonNullable<paths["/api/v1/webhooks/subscriptions/{id}"]["patch"]["requestBody"]>["content"]["application/json"];
50
+ type ListResponse$4 = paths["/api/v1/connections"]["get"]["responses"][200]["content"]["application/json"];
51
+ type Connection = ListResponse$4["data"][number];
52
+ interface ListOptions$3 {
53
+ channel?: "whatsapp" | "instagram";
54
+ signal?: AbortSignal;
55
+ }
56
+ interface MutationOptions$3 {
57
+ idempotencyKey?: string;
58
+ signal?: AbortSignal;
59
+ }
60
+ declare class ConnectionsResource {
61
+ private readonly http;
62
+ constructor(http: HttpClientLike);
63
+ list(opts?: ListOptions$3): Promise<Connection[]>;
64
+ get(id: string, opts?: {
65
+ signal?: AbortSignal;
66
+ }): Promise<Connection>;
67
+ /**
68
+ * Revoke this OAuth app's authorization for the connection. Does NOT
69
+ * disconnect the underlying data_connection (other consumers + the
70
+ * Atribu UI still see it). Direct admin keys reject this call with 400.
71
+ */
72
+ revoke(id: string, opts?: MutationOptions$3): Promise<void>;
73
+ }
74
+
75
+ type ListResponse$3 = paths["/api/v1/webhooks/subscriptions"]["get"]["responses"][200]["content"]["application/json"];
76
+ type CreateBody$3 = NonNullable<paths["/api/v1/webhooks/subscriptions"]["post"]["requestBody"]>["content"]["application/json"];
77
+ type CreateResponse$1 = paths["/api/v1/webhooks/subscriptions"]["post"]["responses"][201]["content"]["application/json"];
78
+ type UpdateBody$1 = NonNullable<paths["/api/v1/webhooks/subscriptions/{id}"]["patch"]["requestBody"]>["content"]["application/json"];
54
79
  type RotateBody = NonNullable<NonNullable<paths["/api/v1/webhooks/subscriptions/{id}/rotate-secret"]["post"]["requestBody"]>["content"]["application/json"]>;
55
80
  type RotateResponse = paths["/api/v1/webhooks/subscriptions/{id}/rotate-secret"]["post"]["responses"][200]["content"]["application/json"];
56
81
  type TestResponse = paths["/api/v1/webhooks/test/{id}"]["post"]["responses"][200]["content"]["application/json"];
57
- type WebhookSubscription = ListResponse["data"][number];
58
- type WebhookSubscriptionWithSecret = CreateResponse["data"];
59
- type WebhookSubscriptionCreateInput = CreateBody;
60
- type WebhookSubscriptionUpdateInput = UpdateBody;
82
+ type WebhookSubscription = ListResponse$3["data"][number];
83
+ type WebhookSubscriptionWithSecret = CreateResponse$1["data"];
84
+ type WebhookSubscriptionCreateInput = CreateBody$3;
85
+ type WebhookSubscriptionUpdateInput = UpdateBody$1;
61
86
  type WebhookSubscriptionRotateOptions = RotateBody;
62
87
  type WebhookSubscriptionRotateResult = RotateResponse["data"];
63
88
  type WebhookSubscriptionTestResult = TestResponse["data"];
64
- interface MutationOptions {
89
+ interface MutationOptions$2 {
65
90
  idempotencyKey?: string;
66
91
  signal?: AbortSignal;
67
92
  }
@@ -71,11 +96,11 @@ declare class WebhookSubscriptionsResource {
71
96
  list(opts?: {
72
97
  signal?: AbortSignal;
73
98
  }): Promise<WebhookSubscription[]>;
74
- create(input: WebhookSubscriptionCreateInput, opts?: MutationOptions): Promise<WebhookSubscriptionWithSecret>;
75
- update(id: string, input: WebhookSubscriptionUpdateInput, opts?: MutationOptions): Promise<WebhookSubscription>;
76
- delete(id: string, opts?: MutationOptions): Promise<void>;
77
- rotateSecret(id: string, options?: WebhookSubscriptionRotateOptions, opts?: MutationOptions): Promise<WebhookSubscriptionRotateResult>;
78
- test(id: string, opts?: MutationOptions): Promise<WebhookSubscriptionTestResult>;
99
+ create(input: WebhookSubscriptionCreateInput, opts?: MutationOptions$2): Promise<WebhookSubscriptionWithSecret>;
100
+ update(id: string, input: WebhookSubscriptionUpdateInput, opts?: MutationOptions$2): Promise<WebhookSubscription>;
101
+ delete(id: string, opts?: MutationOptions$2): Promise<void>;
102
+ rotateSecret(id: string, options?: WebhookSubscriptionRotateOptions, opts?: MutationOptions$2): Promise<WebhookSubscriptionRotateResult>;
103
+ test(id: string, opts?: MutationOptions$2): Promise<WebhookSubscriptionTestResult>;
79
104
  }
80
105
 
81
106
  type ReplayResponse = paths["/api/v1/webhooks/deliveries/{id}/replay"]["post"]["responses"][200]["content"]["application/json"];
@@ -90,6 +115,126 @@ declare class WebhookDeliveriesResource {
90
115
  replay(id: string, opts?: ReplayOptions): Promise<WebhookDeliveryReplayResult>;
91
116
  }
92
117
 
118
+ type ListResponse$2 = paths["/api/v1/whatsapp/templates"]["get"]["responses"][200]["content"]["application/json"];
119
+ type CreateBody$2 = NonNullable<paths["/api/v1/whatsapp/templates"]["post"]["requestBody"]>["content"]["application/json"];
120
+ type CreateResponse = paths["/api/v1/whatsapp/templates"]["post"]["responses"][201]["content"]["application/json"];
121
+ type WhatsAppTemplate = ListResponse$2["data"][number];
122
+ type WhatsAppTemplateCreateInput = CreateBody$2;
123
+ type WhatsAppTemplateCreateResult = CreateResponse["data"];
124
+ interface ListOptions$2 {
125
+ connectionId: string;
126
+ signal?: AbortSignal;
127
+ }
128
+ interface DeleteOptions {
129
+ connectionId: string;
130
+ idempotencyKey?: string;
131
+ signal?: AbortSignal;
132
+ }
133
+ interface CreateOptions {
134
+ idempotencyKey?: string;
135
+ signal?: AbortSignal;
136
+ }
137
+ declare class WhatsAppTemplatesResource {
138
+ private readonly http;
139
+ constructor(http: HttpClientLike);
140
+ list(opts: ListOptions$2): Promise<WhatsAppTemplate[]>;
141
+ create(input: WhatsAppTemplateCreateInput, opts?: CreateOptions): Promise<WhatsAppTemplateCreateResult>;
142
+ delete(name: string, opts: DeleteOptions): Promise<void>;
143
+ }
144
+
145
+ type ListResponse$1 = paths["/api/v1/whatsapp/broadcasts"]["get"]["responses"][200]["content"]["application/json"];
146
+ type CreateBody$1 = NonNullable<paths["/api/v1/whatsapp/broadcasts"]["post"]["requestBody"]>["content"]["application/json"];
147
+ type GetResponse = paths["/api/v1/whatsapp/broadcasts/{id}"]["get"]["responses"][200]["content"]["application/json"];
148
+ type WhatsAppBroadcast = ListResponse$1["data"][number];
149
+ type WhatsAppBroadcastDetail = GetResponse["data"];
150
+ type WhatsAppBroadcastCreateInput = CreateBody$1;
151
+ interface ListOptions$1 {
152
+ connectionId: string;
153
+ signal?: AbortSignal;
154
+ }
155
+ interface MutationOptions$1 {
156
+ idempotencyKey?: string;
157
+ signal?: AbortSignal;
158
+ }
159
+ declare class WhatsAppBroadcastsResource {
160
+ private readonly http;
161
+ constructor(http: HttpClientLike);
162
+ list(opts: ListOptions$1): Promise<WhatsAppBroadcast[]>;
163
+ create(input: WhatsAppBroadcastCreateInput, opts?: MutationOptions$1): Promise<WhatsAppBroadcast>;
164
+ get(id: string, opts?: {
165
+ signal?: AbortSignal;
166
+ }): Promise<WhatsAppBroadcastDetail>;
167
+ cancel(id: string, opts?: MutationOptions$1): Promise<WhatsAppBroadcast>;
168
+ /**
169
+ * Execute the broadcast. Long-running — iterates recipients with 100ms
170
+ * pacing between sends. Consider extending your HTTP client's timeout
171
+ * for broadcasts over a few hundred recipients (the Atribu server caps
172
+ * the route at 300s).
173
+ */
174
+ send(id: string, opts?: MutationOptions$1): Promise<WhatsAppBroadcast>;
175
+ }
176
+
177
+ /**
178
+ * WhatsApp-specific resource namespace. Mounted on `AtribuClient.whatsapp`.
179
+ * Cross-channel messaging stays on `AtribuClient.messages`.
180
+ */
181
+ declare class WhatsAppNamespace {
182
+ readonly templates: WhatsAppTemplatesResource;
183
+ readonly broadcasts: WhatsAppBroadcastsResource;
184
+ constructor(http: HttpClientLike);
185
+ }
186
+
187
+ type ListResponse = paths["/api/v1/instagram/triggers"]["get"]["responses"][200]["content"]["application/json"];
188
+ type CreateBody = NonNullable<paths["/api/v1/instagram/triggers"]["post"]["requestBody"]>["content"]["application/json"];
189
+ type UpdateBody = NonNullable<paths["/api/v1/instagram/triggers/{id}"]["patch"]["requestBody"]>["content"]["application/json"];
190
+ type TestDmBody = NonNullable<paths["/api/v1/instagram/triggers/{id}/test-dm"]["post"]["requestBody"]>["content"]["application/json"];
191
+ type TestDmResponse = paths["/api/v1/instagram/triggers/{id}/test-dm"]["post"]["responses"][200]["content"]["application/json"];
192
+ type ResumeResponse = paths["/api/v1/instagram/triggers/resume"]["post"]["responses"][200]["content"]["application/json"];
193
+ type InstagramTrigger = ListResponse["data"][number];
194
+ type InstagramTriggerCreateInput = CreateBody;
195
+ type InstagramTriggerUpdateInput = UpdateBody;
196
+ interface ListOptions {
197
+ connectionId: string;
198
+ signal?: AbortSignal;
199
+ }
200
+ interface MutationOptions {
201
+ idempotencyKey?: string;
202
+ signal?: AbortSignal;
203
+ }
204
+ interface ResumeOptions extends MutationOptions {
205
+ connectionId: string;
206
+ }
207
+ declare class InstagramTriggersResource {
208
+ private readonly http;
209
+ constructor(http: HttpClientLike);
210
+ list(opts: ListOptions): Promise<InstagramTrigger[]>;
211
+ create(input: InstagramTriggerCreateInput, opts?: MutationOptions): Promise<InstagramTrigger>;
212
+ update(id: string, input: InstagramTriggerUpdateInput, opts?: MutationOptions): Promise<InstagramTrigger>;
213
+ delete(id: string, opts?: MutationOptions): Promise<void>;
214
+ /**
215
+ * Send the trigger's `opening_message` as a one-off DM to a test IGSID.
216
+ * Uses Meta's HUMAN_AGENT tag — recipient must have DMed the IG account
217
+ * in the past 7 days, otherwise Meta rejects the send.
218
+ */
219
+ testDm(id: string, input: TestDmBody, opts?: MutationOptions): Promise<TestDmResponse["data"]>;
220
+ /**
221
+ * Manually clear the comment-to-DM circuit breaker for the connection's
222
+ * IG account. The breaker normally clears itself once spam signals
223
+ * subside; this method exists for ops intervention.
224
+ */
225
+ resumeCircuit(opts: ResumeOptions): Promise<ResumeResponse["data"]>;
226
+ }
227
+
228
+ /**
229
+ * Instagram-specific resource namespace. Mounted on `AtribuClient.instagram`.
230
+ * Cross-channel messaging stays on `AtribuClient.messages` and
231
+ * `AtribuClient.comments`.
232
+ */
233
+ declare class InstagramNamespace {
234
+ readonly triggers: InstagramTriggersResource;
235
+ constructor(http: HttpClientLike);
236
+ }
237
+
93
238
  /**
94
239
  * Opt-in retry layer.
95
240
  *
@@ -158,15 +303,21 @@ declare function isRetryableError(err: unknown): err is AtribuError;
158
303
  interface ResourceBundle {
159
304
  messages: MessagesResource;
160
305
  comments: CommentsResource;
306
+ connections: ConnectionsResource;
161
307
  webhooks: {
162
308
  subscriptions: WebhookSubscriptionsResource;
163
309
  deliveries: WebhookDeliveriesResource;
164
310
  };
311
+ whatsapp: WhatsAppNamespace;
312
+ instagram: InstagramNamespace;
165
313
  }
166
314
  declare class AtribuClient {
167
315
  readonly messages: MessagesResource;
168
316
  readonly comments: CommentsResource;
317
+ readonly connections: ConnectionsResource;
169
318
  readonly webhooks: ResourceBundle["webhooks"];
319
+ readonly whatsapp: WhatsAppNamespace;
320
+ readonly instagram: InstagramNamespace;
170
321
  /** @internal — exposed for `withRetry` chaining; do not depend on this. */
171
322
  protected readonly _http: HttpClientLike;
172
323
  constructor(config: AtribuClientConfig);
@@ -189,10 +340,10 @@ declare class AtribuClient {
189
340
  private static _fromHttp;
190
341
  }
191
342
 
192
- declare const SDK_VERSION = "0.1.2";
343
+ declare const SDK_VERSION = "0.1.4";
193
344
 
194
345
  type Runtime = "node" | "bun" | "deno" | "edge" | "browser" | "unknown";
195
346
  declare function detectRuntime(): Runtime;
196
347
  declare function runtimeTag(): string;
197
348
 
198
- export { AtribuClient, type AtribuClientConfig, AtribuError, type BackoffStrategy, type CommentPrivateReplyInput, type CommentReplyInput, type CommentReplyOptions, type CommentReplyResponse, type MessageContent, type MessageSendInput, type MessageSendResponse, type MutationOptions, type ReplayOptions, type RetryOptions, RetryingHttpClient, type Runtime, SDK_VERSION, type SendOptions, type WebhookDeliveryReplayResult, type WebhookSubscription, type WebhookSubscriptionCreateInput, type WebhookSubscriptionRotateOptions, type WebhookSubscriptionRotateResult, type WebhookSubscriptionTestResult, type WebhookSubscriptionUpdateInput, type WebhookSubscriptionWithSecret, detectRuntime, isRetryableError, runtimeTag };
349
+ export { AtribuClient, type AtribuClientConfig, AtribuError, type BackoffStrategy, type CommentPrivateReplyInput, type CommentReplyInput, type CommentReplyOptions, type CommentReplyResponse, type Connection, type InstagramTrigger, type InstagramTriggerCreateInput, type InstagramTriggerUpdateInput, type MessageContent, type MessageSendInput, type MessageSendResponse, type MutationOptions$2 as MutationOptions, type ReplayOptions, type RetryOptions, RetryingHttpClient, type Runtime, SDK_VERSION, type SendOptions, type WebhookDeliveryReplayResult, type WebhookSubscription, type WebhookSubscriptionCreateInput, type WebhookSubscriptionRotateOptions, type WebhookSubscriptionRotateResult, type WebhookSubscriptionTestResult, type WebhookSubscriptionUpdateInput, type WebhookSubscriptionWithSecret, type WhatsAppBroadcast, type WhatsAppBroadcastCreateInput, type WhatsAppBroadcastDetail, type WhatsAppTemplate, type WhatsAppTemplateCreateInput, type WhatsAppTemplateCreateResult, detectRuntime, isRetryableError, runtimeTag };
package/dist/index.js CHANGED
@@ -126,7 +126,7 @@ function parseRetryAfter(header) {
126
126
  }
127
127
 
128
128
  // src/version.ts
129
- var SDK_VERSION = "0.1.2";
129
+ var SDK_VERSION = "0.1.4";
130
130
 
131
131
  // src/runtime.ts
132
132
  function detectRuntime() {
@@ -154,6 +154,7 @@ var HttpClient = class {
154
154
  constructor(cfg) {
155
155
  this.cfg = cfg;
156
156
  }
157
+ cfg;
157
158
  async request(opts) {
158
159
  const url = this.buildUrl(opts.path, opts.query);
159
160
  const headers = this.buildHeaders(opts);
@@ -284,6 +285,7 @@ var MessagesResource = class {
284
285
  constructor(http) {
285
286
  this.http = http;
286
287
  }
288
+ http;
287
289
  async send(input, opts = {}) {
288
290
  const res = await this.http.request({
289
291
  method: "POST",
@@ -301,6 +303,7 @@ var CommentsResource = class {
301
303
  constructor(http) {
302
304
  this.http = http;
303
305
  }
306
+ http;
304
307
  async reply(input, opts = {}) {
305
308
  const { comment_id, ...body } = input;
306
309
  const res = await this.http.request({
@@ -325,11 +328,51 @@ var CommentsResource = class {
325
328
  }
326
329
  };
327
330
 
331
+ // src/resources/connections.ts
332
+ var ConnectionsResource = class {
333
+ constructor(http) {
334
+ this.http = http;
335
+ }
336
+ http;
337
+ async list(opts = {}) {
338
+ const qs = opts.channel ? `?channel=${encodeURIComponent(opts.channel)}` : "";
339
+ const res = await this.http.request({
340
+ method: "GET",
341
+ path: `/api/v1/connections${qs}`,
342
+ signal: opts.signal
343
+ });
344
+ return res.data;
345
+ }
346
+ async get(id, opts = {}) {
347
+ const res = await this.http.request({
348
+ method: "GET",
349
+ path: `/api/v1/connections/${encodeURIComponent(id)}`,
350
+ signal: opts.signal
351
+ });
352
+ return res.data;
353
+ }
354
+ /**
355
+ * Revoke this OAuth app's authorization for the connection. Does NOT
356
+ * disconnect the underlying data_connection (other consumers + the
357
+ * Atribu UI still see it). Direct admin keys reject this call with 400.
358
+ */
359
+ async revoke(id, opts = {}) {
360
+ await this.http.request({
361
+ method: "DELETE",
362
+ path: `/api/v1/connections/${encodeURIComponent(id)}`,
363
+ idempotencyKey: opts.idempotencyKey,
364
+ signal: opts.signal,
365
+ expectEmpty: true
366
+ });
367
+ }
368
+ };
369
+
328
370
  // src/resources/webhook-subscriptions.ts
329
371
  var WebhookSubscriptionsResource = class {
330
372
  constructor(http) {
331
373
  this.http = http;
332
374
  }
375
+ http;
333
376
  async list(opts = {}) {
334
377
  const res = await this.http.request({
335
378
  method: "GET",
@@ -393,6 +436,7 @@ var WebhookDeliveriesResource = class {
393
436
  constructor(http) {
394
437
  this.http = http;
395
438
  }
439
+ http;
396
440
  async replay(id, opts = {}) {
397
441
  const res = await this.http.request({
398
442
  method: "POST",
@@ -404,6 +448,195 @@ var WebhookDeliveriesResource = class {
404
448
  }
405
449
  };
406
450
 
451
+ // src/resources/whatsapp/templates.ts
452
+ var WhatsAppTemplatesResource = class {
453
+ constructor(http) {
454
+ this.http = http;
455
+ }
456
+ http;
457
+ async list(opts) {
458
+ const res = await this.http.request({
459
+ method: "GET",
460
+ path: `/api/v1/whatsapp/templates?connection_id=${encodeURIComponent(opts.connectionId)}`,
461
+ signal: opts.signal
462
+ });
463
+ return res.data;
464
+ }
465
+ async create(input, opts = {}) {
466
+ const res = await this.http.request({
467
+ method: "POST",
468
+ path: "/api/v1/whatsapp/templates",
469
+ body: input,
470
+ idempotencyKey: opts.idempotencyKey,
471
+ signal: opts.signal
472
+ });
473
+ return res.data;
474
+ }
475
+ async delete(name, opts) {
476
+ await this.http.request({
477
+ method: "DELETE",
478
+ path: `/api/v1/whatsapp/templates/${encodeURIComponent(name)}?connection_id=${encodeURIComponent(opts.connectionId)}`,
479
+ idempotencyKey: opts.idempotencyKey,
480
+ signal: opts.signal,
481
+ expectEmpty: true
482
+ });
483
+ }
484
+ };
485
+
486
+ // src/resources/whatsapp/broadcasts.ts
487
+ var WhatsAppBroadcastsResource = class {
488
+ constructor(http) {
489
+ this.http = http;
490
+ }
491
+ http;
492
+ async list(opts) {
493
+ const res = await this.http.request({
494
+ method: "GET",
495
+ path: `/api/v1/whatsapp/broadcasts?connection_id=${encodeURIComponent(opts.connectionId)}`,
496
+ signal: opts.signal
497
+ });
498
+ return res.data;
499
+ }
500
+ async create(input, opts = {}) {
501
+ const res = await this.http.request({
502
+ method: "POST",
503
+ path: "/api/v1/whatsapp/broadcasts",
504
+ body: input,
505
+ idempotencyKey: opts.idempotencyKey,
506
+ signal: opts.signal
507
+ });
508
+ return res.data;
509
+ }
510
+ async get(id, opts = {}) {
511
+ const res = await this.http.request({
512
+ method: "GET",
513
+ path: `/api/v1/whatsapp/broadcasts/${encodeURIComponent(id)}`,
514
+ signal: opts.signal
515
+ });
516
+ return res.data;
517
+ }
518
+ async cancel(id, opts = {}) {
519
+ const body = { status: "cancelled" };
520
+ const res = await this.http.request({
521
+ method: "PATCH",
522
+ path: `/api/v1/whatsapp/broadcasts/${encodeURIComponent(id)}`,
523
+ body,
524
+ idempotencyKey: opts.idempotencyKey,
525
+ signal: opts.signal
526
+ });
527
+ return res.data;
528
+ }
529
+ /**
530
+ * Execute the broadcast. Long-running — iterates recipients with 100ms
531
+ * pacing between sends. Consider extending your HTTP client's timeout
532
+ * for broadcasts over a few hundred recipients (the Atribu server caps
533
+ * the route at 300s).
534
+ */
535
+ async send(id, opts = {}) {
536
+ const res = await this.http.request({
537
+ method: "POST",
538
+ path: `/api/v1/whatsapp/broadcasts/${encodeURIComponent(id)}/send`,
539
+ idempotencyKey: opts.idempotencyKey,
540
+ signal: opts.signal
541
+ });
542
+ return res.data;
543
+ }
544
+ };
545
+
546
+ // src/resources/whatsapp/index.ts
547
+ var WhatsAppNamespace = class {
548
+ templates;
549
+ broadcasts;
550
+ constructor(http) {
551
+ this.templates = new WhatsAppTemplatesResource(http);
552
+ this.broadcasts = new WhatsAppBroadcastsResource(http);
553
+ }
554
+ };
555
+
556
+ // src/resources/instagram/triggers.ts
557
+ var InstagramTriggersResource = class {
558
+ constructor(http) {
559
+ this.http = http;
560
+ }
561
+ http;
562
+ async list(opts) {
563
+ const res = await this.http.request({
564
+ method: "GET",
565
+ path: `/api/v1/instagram/triggers?connection_id=${encodeURIComponent(opts.connectionId)}`,
566
+ signal: opts.signal
567
+ });
568
+ return res.data;
569
+ }
570
+ async create(input, opts = {}) {
571
+ const res = await this.http.request({
572
+ method: "POST",
573
+ path: "/api/v1/instagram/triggers",
574
+ body: input,
575
+ idempotencyKey: opts.idempotencyKey,
576
+ signal: opts.signal
577
+ });
578
+ return res.data;
579
+ }
580
+ async update(id, input, opts = {}) {
581
+ const res = await this.http.request({
582
+ method: "PATCH",
583
+ path: `/api/v1/instagram/triggers/${encodeURIComponent(id)}`,
584
+ body: input,
585
+ idempotencyKey: opts.idempotencyKey,
586
+ signal: opts.signal
587
+ });
588
+ return res.data;
589
+ }
590
+ async delete(id, opts = {}) {
591
+ await this.http.request({
592
+ method: "DELETE",
593
+ path: `/api/v1/instagram/triggers/${encodeURIComponent(id)}`,
594
+ idempotencyKey: opts.idempotencyKey,
595
+ signal: opts.signal,
596
+ expectEmpty: true
597
+ });
598
+ }
599
+ /**
600
+ * Send the trigger's `opening_message` as a one-off DM to a test IGSID.
601
+ * Uses Meta's HUMAN_AGENT tag — recipient must have DMed the IG account
602
+ * in the past 7 days, otherwise Meta rejects the send.
603
+ */
604
+ async testDm(id, input, opts = {}) {
605
+ const res = await this.http.request({
606
+ method: "POST",
607
+ path: `/api/v1/instagram/triggers/${encodeURIComponent(id)}/test-dm`,
608
+ body: input,
609
+ idempotencyKey: opts.idempotencyKey,
610
+ signal: opts.signal
611
+ });
612
+ return res.data;
613
+ }
614
+ /**
615
+ * Manually clear the comment-to-DM circuit breaker for the connection's
616
+ * IG account. The breaker normally clears itself once spam signals
617
+ * subside; this method exists for ops intervention.
618
+ */
619
+ async resumeCircuit(opts) {
620
+ const body = { connection_id: opts.connectionId };
621
+ const res = await this.http.request({
622
+ method: "POST",
623
+ path: "/api/v1/instagram/triggers/resume",
624
+ body,
625
+ idempotencyKey: opts.idempotencyKey,
626
+ signal: opts.signal
627
+ });
628
+ return res.data;
629
+ }
630
+ };
631
+
632
+ // src/resources/instagram/index.ts
633
+ var InstagramNamespace = class {
634
+ triggers;
635
+ constructor(http) {
636
+ this.triggers = new InstagramTriggersResource(http);
637
+ }
638
+ };
639
+
407
640
  // src/retry-wrapper.ts
408
641
  function resolveRetry(o) {
409
642
  return {
@@ -421,6 +654,7 @@ var RetryingHttpClient = class {
421
654
  this.base = base;
422
655
  this.r = resolveRetry(options);
423
656
  }
657
+ base;
424
658
  r;
425
659
  async request(opts) {
426
660
  let lastErr;
@@ -480,16 +714,22 @@ function buildResources(http) {
480
714
  return {
481
715
  messages: new MessagesResource(http),
482
716
  comments: new CommentsResource(http),
717
+ connections: new ConnectionsResource(http),
483
718
  webhooks: {
484
719
  subscriptions: new WebhookSubscriptionsResource(http),
485
720
  deliveries: new WebhookDeliveriesResource(http)
486
- }
721
+ },
722
+ whatsapp: new WhatsAppNamespace(http),
723
+ instagram: new InstagramNamespace(http)
487
724
  };
488
725
  }
489
726
  var AtribuClient = class _AtribuClient {
490
727
  messages;
491
728
  comments;
729
+ connections;
492
730
  webhooks;
731
+ whatsapp;
732
+ instagram;
493
733
  /** @internal — exposed for `withRetry` chaining; do not depend on this. */
494
734
  _http;
495
735
  constructor(config) {
@@ -497,7 +737,10 @@ var AtribuClient = class _AtribuClient {
497
737
  const r = buildResources(this._http);
498
738
  this.messages = r.messages;
499
739
  this.comments = r.comments;
740
+ this.connections = r.connections;
500
741
  this.webhooks = r.webhooks;
742
+ this.whatsapp = r.whatsapp;
743
+ this.instagram = r.instagram;
501
744
  }
502
745
  /**
503
746
  * Returns a new AtribuClient that retries on transient errors. The
@@ -525,7 +768,10 @@ var AtribuClient = class _AtribuClient {
525
768
  _http: http,
526
769
  messages: r.messages,
527
770
  comments: r.comments,
528
- webhooks: r.webhooks
771
+ connections: r.connections,
772
+ webhooks: r.webhooks,
773
+ whatsapp: r.whatsapp,
774
+ instagram: r.instagram
529
775
  });
530
776
  return proto;
531
777
  }