@audienti/cli 0.1.145 → 0.2.0-exora.2

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.
Files changed (66) hide show
  1. package/README.md +47 -895
  2. package/bin/audienti-mcp.mjs +2 -0
  3. package/cli/account-intake-operations.mjs +28 -0
  4. package/cli/account-intake.mjs +33 -0
  5. package/cli/account-replies.mjs +35 -0
  6. package/cli/account-reply-operations.mjs +30 -0
  7. package/cli/agents.mjs +107 -0
  8. package/cli/approach-operations.mjs +22 -0
  9. package/cli/assignment-operations.mjs +218 -0
  10. package/cli/assignment.mjs +116 -0
  11. package/cli/audience-operations.mjs +16 -0
  12. package/cli/audiences.mjs +26 -0
  13. package/cli/audienti.mjs +124 -0
  14. package/cli/connection-registry-operations.mjs +7 -0
  15. package/cli/content.mjs +29 -0
  16. package/cli/discovery-operations.mjs +27 -0
  17. package/cli/discovery.mjs +14 -0
  18. package/cli/experiment-operations.mjs +25 -0
  19. package/cli/experiments.mjs +26 -0
  20. package/cli/json-file.mjs +13 -0
  21. package/cli/mcp.mjs +47 -0
  22. package/cli/offer-operations.mjs +12 -0
  23. package/cli/offers.mjs +24 -0
  24. package/cli/owner-account-client.mjs +18 -0
  25. package/cli/profiles.mjs +29 -0
  26. package/cli/progress.mjs +12 -0
  27. package/cli/prospecting-settings-operations.mjs +16 -0
  28. package/cli/prospecting-settings.mjs +15 -0
  29. package/cli/recipient-operations.mjs +13 -0
  30. package/cli/recipients.mjs +30 -0
  31. package/cli/sender-account-operations.mjs +24 -0
  32. package/cli/sender-accounts.mjs +23 -0
  33. package/cli/skills-mcp.mjs +24 -0
  34. package/cli/skills.mjs +56 -0
  35. package/cli/suppression-operations.mjs +8 -0
  36. package/cli/suppression.mjs +12 -0
  37. package/cli/tools-operations.mjs +70 -0
  38. package/cli/tools.mjs +72 -0
  39. package/cli/work-execution-operations.mjs +35 -0
  40. package/cli/work-execution.mjs +29 -0
  41. package/cli/work-feedback-operations.mjs +17 -0
  42. package/cli/work-feedback.mjs +18 -0
  43. package/cli/work-operations.mjs +28 -0
  44. package/cli/work.mjs +27 -0
  45. package/cli/workspaces.mjs +158 -0
  46. package/package.json +15 -26
  47. package/skills/audienti/SKILL.md +61 -323
  48. package/skills/audienti/references/helpers.md +149 -0
  49. package/skills/audienti/references/profile-workflows.md +212 -0
  50. package/skills/audienti/references/workflow-receipt.md +49 -0
  51. package/skills/audienti/scripts/contracts.mjs +72 -0
  52. package/skills/audienti/scripts/profile-helpers.mjs +138 -0
  53. package/skills/audienti/scripts/run.mjs +40 -0
  54. package/source-manifest.json +60 -0
  55. package/.mcp.json +0 -13
  56. package/CHANGELOG.md +0 -1018
  57. package/bin/audienti-mcp.js +0 -5
  58. package/bin/audienti.js +0 -6
  59. package/install +0 -83
  60. package/skills/audienti/references/methodology.md +0 -111
  61. package/skills/audienti-gift-research/SKILL.md +0 -47
  62. package/src/agent-skills.js +0 -60
  63. package/src/api-client.js +0 -1639
  64. package/src/cli.js +0 -16992
  65. package/src/config.js +0 -130
  66. package/src/mcp.js +0 -103
package/src/api-client.js DELETED
@@ -1,1639 +0,0 @@
1
- export const DEFAULT_HOST = "https://app.audienti.com";
2
-
3
- export class ApiError extends Error {
4
- constructor(message, { status, body, cause } = {}) {
5
- super(message);
6
- this.name = "ApiError";
7
- this.status = status;
8
- this.body = body;
9
- this.cause = cause;
10
- }
11
- }
12
-
13
- export function normalizeHost(host = DEFAULT_HOST) {
14
- const trimmed = String(host || DEFAULT_HOST).trim();
15
- const withProtocol = /^https?:\/\//i.test(trimmed) ? trimmed : `https://${trimmed}`;
16
- const url = new URL(withProtocol);
17
- url.pathname = url.pathname.replace(/\/+$/, "");
18
- url.search = "";
19
- url.hash = "";
20
-
21
- return url.toString().replace(/\/$/, "");
22
- }
23
-
24
- export class AudientiClient {
25
- constructor({ host = DEFAULT_HOST, token, fetchImpl = globalThis.fetch } = {}) {
26
- if (!fetchImpl) {
27
- throw new Error("This Node runtime does not provide fetch.");
28
- }
29
-
30
- this.host = normalizeHost(host);
31
- this.token = token;
32
- this.fetchImpl = fetchImpl;
33
- }
34
-
35
- me() {
36
- return this.requestJson("/api/v1/me.json");
37
- }
38
-
39
- accounts() {
40
- return this.requestJson("/api/v1/accounts.json");
41
- }
42
-
43
- socialTools() {
44
- return this.requestJson("/api/v1/social_tools.json");
45
- }
46
-
47
- socialTool(name) {
48
- return this.requestJson(`/api/v1/social_tools/${encodeURIComponent(name)}.json`);
49
- }
50
-
51
- createAccount(body) {
52
- return this.requestJson("/api/v1/accounts.json", { method: "POST", body });
53
- }
54
-
55
- account(accountId) {
56
- return this.requestJson(accountPath(accountId, []));
57
- }
58
-
59
- linkedinLookup(kind, query = {}) {
60
- return this.requestJson(apiPath(["linkedin_lookups", kind], query));
61
- }
62
-
63
- mcp(message) {
64
- return this.requestJson("/mcp", {
65
- method: "POST",
66
- body: message
67
- });
68
- }
69
-
70
- browserRepairPatch(attemptId, { path, content }, token) {
71
- return this.requestJson(`/api/v1/browser_repair_attempts/${encodeURIComponent(attemptId)}/patch.json`, {
72
- method: "POST", body: { path, content }, token
73
- });
74
- }
75
-
76
- browserRepairHostedTest(attemptId, token) {
77
- return this.requestJson(`/api/v1/browser_repair_attempts/${encodeURIComponent(attemptId)}/hosted_test.json`, {method: "POST", body: {}, token});
78
- }
79
-
80
- browserRepairNoChange(attemptId, reason, token) {
81
- return this.requestJson(`/api/v1/browser_repair_attempts/${encodeURIComponent(attemptId)}/no_change.json`, {
82
- method: "POST", body: {reason}, token
83
- });
84
- }
85
-
86
- browserRepairComputer(attemptId, tool, body = {}, token) {
87
- return this.requestJson(apiPath(["browser_repair_attempts", attemptId, "computer", tool]), {
88
- method: "POST", body, token
89
- });
90
- }
91
-
92
- users(accountId) {
93
- return this.requestJson(accountPath(accountId, ["users"]));
94
- }
95
-
96
- userAutomation(accountId, userId, query = {}) {
97
- return this.requestJson(accountPath(accountId, ["users", userId, "automation"], query));
98
- }
99
-
100
- updateUserAutomation(accountId, userId, body, query = {}) {
101
- return this.requestJson(accountPath(accountId, ["users", userId, "automation"], query), {
102
- method: "PATCH",
103
- body
104
- });
105
- }
106
-
107
- socialCookies(accountId, query = {}) {
108
- return this.requestJson(accountPath(accountId, ["social_cookies"], query));
109
- }
110
-
111
- socialCookie(accountId, socialCookieId) {
112
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId]));
113
- }
114
-
115
- socialCookieActivity(accountId, socialCookieId, query = {}) {
116
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId, "activity"], query));
117
- }
118
-
119
- createSocialCookie(accountId, body) {
120
- return this.requestJson(accountPath(accountId, ["social_cookies"]), { method: "POST", body });
121
- }
122
-
123
- updateSocialCookie(accountId, socialCookieId, body) {
124
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId]), { method: "PATCH", body });
125
- }
126
-
127
- deleteSocialCookie(accountId, socialCookieId) {
128
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId]), { method: "DELETE" });
129
- }
130
-
131
- pauseSocialCookie(accountId, socialCookieId) {
132
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId, "pause"]), { method: "POST" });
133
- }
134
-
135
- resumeSocialCookie(accountId, socialCookieId) {
136
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId, "resume"]), { method: "POST" });
137
- }
138
-
139
- resumeSocialCookieAutopilot(accountId, socialCookieId) {
140
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId, "resume_autopilot"]), { method: "POST" });
141
- }
142
-
143
- recheckSocialCookieAccountType(accountId, socialCookieId) {
144
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId, "recheck_account_type"]), { method: "POST" });
145
- }
146
-
147
- reconnectSocialCookie(accountId, socialCookieId) {
148
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId, "reconnect"]), { method: "POST" });
149
- }
150
-
151
- submitSocialCookieOtp(accountId, socialCookieId, body) {
152
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId, "submit_otp"]), { method: "POST", body });
153
- }
154
-
155
- updateSocialCookieRights(accountId, socialCookieId, body) {
156
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId, "rights"]), { method: "PATCH", body });
157
- }
158
-
159
- updateSocialCookieSettings(accountId, socialCookieId, body) {
160
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId, "settings"]), { method: "PATCH", body });
161
- }
162
-
163
- syncSocialCookieMessages(accountId, socialCookieId, body = {}) {
164
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId, "sync_messages"]), {
165
- method: "POST",
166
- body
167
- });
168
- }
169
-
170
- userActivity(accountId, userId, query = {}) {
171
- return this.requestJson(accountPath(accountId, ["operations", "users", userId, "activity"], query));
172
- }
173
-
174
- offers(accountId) {
175
- return this.requestJson(accountPath(accountId, ["offers"]));
176
- }
177
-
178
- offer(accountId, offerId) {
179
- return this.requestJson(accountPath(accountId, ["offers", offerId]));
180
- }
181
-
182
- createOffer(accountId, body) {
183
- return this.requestJson(accountPath(accountId, ["offers"]), {
184
- method: "POST",
185
- body
186
- });
187
- }
188
-
189
- updateOffer(accountId, offerId, body) {
190
- return this.requestJson(accountPath(accountId, ["offers", offerId]), {
191
- method: "PATCH",
192
- body
193
- });
194
- }
195
-
196
- deleteOffer(accountId, offerId) {
197
- return this.requestJson(accountPath(accountId, ["offers", offerId]), {
198
- method: "DELETE"
199
- });
200
- }
201
-
202
- regenerateOfferResearch(accountId, offerId, body = {}) {
203
- return this.requestJson(accountPath(accountId, ["offers", offerId, "regenerate_research"]), {
204
- method: "POST",
205
- body
206
- });
207
- }
208
-
209
- updateOfferWriteup(accountId, offerId, body) {
210
- return this.requestJson(accountPath(accountId, ["offers", offerId, "writeup"]), {
211
- method: "PATCH",
212
- body
213
- });
214
- }
215
-
216
- addOfferArtifacts(accountId, offerId, body) {
217
- return this.requestJson(accountPath(accountId, ["offers", offerId, "artifacts"]), {
218
- method: "POST",
219
- body
220
- });
221
- }
222
-
223
- removeOfferArtifact(accountId, offerId, artifactId) {
224
- return this.requestJson(accountPath(accountId, ["offers", offerId, "artifacts", artifactId]), {
225
- method: "DELETE"
226
- });
227
- }
228
-
229
- createOfferGift(accountId, offerId, body) {
230
- return this.requestJson(accountPath(accountId, ["offers", offerId, "gifts"]), {
231
- method: "POST",
232
- body
233
- });
234
- }
235
-
236
- updateOfferGift(accountId, offerId, giftId, body) {
237
- return this.requestJson(accountPath(accountId, ["offers", offerId, "gifts", giftId]), {
238
- method: "PATCH",
239
- body
240
- });
241
- }
242
-
243
- updateOfferInsight(accountId, offerId, insightId, body) {
244
- return this.requestJson(accountPath(accountId, ["offers", offerId, "insights", insightId]), {
245
- method: "PATCH",
246
- body
247
- });
248
- }
249
-
250
- icps(accountId, query = {}) {
251
- return this.requestJson(accountPath(accountId, ["icps"], query));
252
- }
253
-
254
- icp(accountId, icpId) {
255
- return this.requestJson(accountPath(accountId, ["icps", icpId]));
256
- }
257
-
258
- createIcp(accountId, body) {
259
- return this.requestJson(accountPath(accountId, ["icps"]), {
260
- method: "POST",
261
- body
262
- });
263
- }
264
-
265
- updateIcp(accountId, icpId, body) {
266
- return this.requestJson(accountPath(accountId, ["icps", icpId]), {
267
- method: "PATCH",
268
- body
269
- });
270
- }
271
-
272
- archiveIcp(accountId, icpId) {
273
- return this.requestJson(accountPath(accountId, ["icps", icpId, "archive"]), {
274
- method: "POST",
275
- body: {}
276
- });
277
- }
278
-
279
- restoreIcp(accountId, icpId) {
280
- return this.requestJson(accountPath(accountId, ["icps", icpId, "restore"]), {
281
- method: "POST",
282
- body: {}
283
- });
284
- }
285
-
286
- addIcpTag(accountId, icpId, body) {
287
- return this.requestJson(accountPath(accountId, ["icps", icpId, "add_tag"]), {
288
- method: "POST",
289
- body
290
- });
291
- }
292
-
293
- removeIcpTag(accountId, icpId, body) {
294
- return this.requestJson(accountPath(accountId, ["icps", icpId, "remove_tag"]), {
295
- method: "DELETE",
296
- body
297
- });
298
- }
299
-
300
- bulkAddIcpTag(accountId, body) {
301
- return this.requestJson(accountPath(accountId, ["icps", "bulk_add_tag"]), {
302
- method: "POST",
303
- body
304
- });
305
- }
306
-
307
- cloneIcp(accountId, icpId) {
308
- return this.requestJson(accountPath(accountId, ["icps", icpId, "clone"]), {
309
- method: "POST",
310
- body: {}
311
- });
312
- }
313
-
314
- deleteIcp(accountId, icpId) {
315
- return this.requestJson(accountPath(accountId, ["icps", icpId]), {
316
- method: "DELETE"
317
- });
318
- }
319
-
320
- icpProspects(accountId, icpId, query = {}) {
321
- return this.requestJson(accountPath(accountId, ["icps", icpId, "prospects"], query));
322
- }
323
-
324
- companies(accountId, query = {}) {
325
- return this.requestJson(accountPath(accountId, ["companies"], query));
326
- }
327
-
328
- dncEntries(accountId, query = {}) {
329
- return this.requestJson(accountPath(accountId, ["dnc"], query));
330
- }
331
-
332
- createDncEntry(accountId, body) {
333
- return this.requestJson(accountPath(accountId, ["dnc"]), {
334
- method: "POST",
335
- body
336
- });
337
- }
338
-
339
- importDncEntries(accountId, body) {
340
- return this.requestJson(accountPath(accountId, ["dnc", "import"]), {
341
- method: "POST",
342
- body
343
- });
344
- }
345
-
346
- deleteDncEntry(accountId, entryId) {
347
- return this.requestJson(accountPath(accountId, ["dnc", entryId]), {
348
- method: "DELETE"
349
- });
350
- }
351
-
352
- companyRules(accountId) {
353
- return this.requestJson(accountPath(accountId, ["company_rules"]));
354
- }
355
-
356
- companyRule(accountId, ruleId) {
357
- return this.requestJson(accountPath(accountId, ["company_rules", ruleId]));
358
- }
359
-
360
- createCompanyRule(accountId, body) {
361
- return this.requestJson(accountPath(accountId, ["company_rules"]), {
362
- method: "POST",
363
- body
364
- });
365
- }
366
-
367
- updateCompanyRule(accountId, ruleId, body) {
368
- return this.requestJson(accountPath(accountId, ["company_rules", ruleId]), {
369
- method: "PATCH",
370
- body
371
- });
372
- }
373
-
374
- deleteCompanyRule(accountId, ruleId) {
375
- return this.requestJson(accountPath(accountId, ["company_rules", ruleId]), {
376
- method: "DELETE"
377
- });
378
- }
379
-
380
- applyCompanyRule(accountId, ruleId) {
381
- return this.requestJson(accountPath(accountId, ["company_rules", ruleId, "apply"]), {
382
- method: "POST"
383
- });
384
- }
385
-
386
- applyAllCompanyRules(accountId) {
387
- return this.requestJson(accountPath(accountId, ["company_rules", "apply_all"]), {
388
- method: "POST"
389
- });
390
- }
391
-
392
- hubspotIntegration(accountId, query = {}) {
393
- return this.requestJson(accountPath(accountId, ["hubspot_integration"], query));
394
- }
395
-
396
- connectHubspot(accountId, body) {
397
- return this.requestJson(accountPath(accountId, ["hubspot_integration"]), {
398
- method: "POST",
399
- body
400
- });
401
- }
402
-
403
- disconnectHubspot(accountId) {
404
- return this.requestJson(accountPath(accountId, ["hubspot_integration"]), {
405
- method: "DELETE"
406
- });
407
- }
408
-
409
- retryHubspotEvent(accountId, body) {
410
- return this.requestJson(accountPath(accountId, ["hubspot_integration", "retry_event"]), {
411
- method: "POST",
412
- body
413
- });
414
- }
415
-
416
- syncHubspot(accountId) {
417
- return this.requestJson(accountPath(accountId, ["hubspot_integration", "sync_all"]), {
418
- method: "POST"
419
- });
420
- }
421
-
422
- createHubspotListSync(accountId, body) {
423
- return this.requestJson(accountPath(accountId, ["hubspot_integration", "list_syncs"]), {
424
- method: "POST",
425
- body
426
- });
427
- }
428
-
429
- updateHubspotListSync(accountId, listSyncId, body) {
430
- return this.requestJson(accountPath(accountId, ["hubspot_integration", "list_syncs", listSyncId]), {
431
- method: "PATCH",
432
- body
433
- });
434
- }
435
-
436
- deleteHubspotListSync(accountId, listSyncId) {
437
- return this.requestJson(accountPath(accountId, ["hubspot_integration", "list_syncs", listSyncId]), {
438
- method: "DELETE"
439
- });
440
- }
441
-
442
- syncHubspotListSync(accountId, listSyncId) {
443
- return this.requestJson(accountPath(accountId, ["hubspot_integration", "list_syncs", listSyncId, "sync_now"]), {
444
- method: "POST"
445
- });
446
- }
447
-
448
- prospectWebhookEndpoints(accountId) {
449
- return this.requestJson(accountPath(accountId, ["prospect_webhook_endpoints"]));
450
- }
451
-
452
- createProspectWebhookEndpoint(accountId, body) {
453
- return this.requestJson(accountPath(accountId, ["prospect_webhook_endpoints"]), {
454
- method: "POST",
455
- body
456
- });
457
- }
458
-
459
- updateProspectWebhookEndpoint(accountId, endpointId, body) {
460
- return this.requestJson(accountPath(accountId, ["prospect_webhook_endpoints", endpointId]), {
461
- method: "PATCH",
462
- body
463
- });
464
- }
465
-
466
- rotateProspectWebhookEndpoint(accountId, endpointId) {
467
- return this.requestJson(accountPath(accountId, ["prospect_webhook_endpoints", endpointId, "rotate"]), {
468
- method: "POST"
469
- });
470
- }
471
-
472
- deleteProspectWebhookEndpoint(accountId, endpointId) {
473
- return this.requestJson(accountPath(accountId, ["prospect_webhook_endpoints", endpointId]), {
474
- method: "DELETE"
475
- });
476
- }
477
-
478
- accountPayment(accountId) {
479
- return this.requestJson(accountPath(accountId, ["admission"]));
480
- }
481
-
482
- redeemSignupCode(accountId, code) {
483
- return this.requestJson(accountPath(accountId, ["admission"]), {
484
- method: "POST",
485
- body: { code }
486
- });
487
- }
488
-
489
- brandProfile(accountId) {
490
- return this.requestJson(accountPath(accountId, ["brand_profile"]));
491
- }
492
-
493
- updateBrandProfile(accountId, body) {
494
- return this.requestJson(accountPath(accountId, ["brand_profile"]), {
495
- method: "PATCH",
496
- body
497
- });
498
- }
499
-
500
- replyAlerts() {
501
- return this.requestJson(apiPath(["me", "reply_alerts"]));
502
- }
503
-
504
- updateReplyAlerts(body) {
505
- return this.requestJson(apiPath(["me", "reply_alerts"]), {
506
- method: "PATCH",
507
- body
508
- });
509
- }
510
-
511
- jumpTo(accountId, query) {
512
- return this.requestJson(accountPath(accountId, ["jump_to"], { q: query }));
513
- }
514
-
515
- tags(accountId) {
516
- return this.requestJson(accountPath(accountId, ["tags"]));
517
- }
518
-
519
- tasks(accountId, query = {}) {
520
- return this.requestJson(accountPath(accountId, ["tasks"], query));
521
- }
522
-
523
- createTask(accountId, body) {
524
- return this.requestJson(accountPath(accountId, ["tasks"]), {
525
- method: "POST",
526
- body
527
- });
528
- }
529
-
530
- completeTask(accountId, taskId) {
531
- return this.requestJson(accountPath(accountId, ["tasks", taskId, "complete"]), {
532
- method: "PATCH"
533
- });
534
- }
535
-
536
- updateTask(accountId, taskId, body) {
537
- return this.requestJson(accountPath(accountId, ["tasks", taskId]), {
538
- method: "PATCH",
539
- body
540
- });
541
- }
542
-
543
- bulkUpdateTasks(accountId, body) {
544
- return this.requestJson(accountPath(accountId, ["tasks", "bulk_update"]), {
545
- method: "PATCH",
546
- body
547
- });
548
- }
549
-
550
- lists(accountId) {
551
- return this.requestJson(accountPath(accountId, ["lists"]));
552
- }
553
-
554
- createList(accountId, body) {
555
- return this.requestJson(accountPath(accountId, ["lists"]), {
556
- method: "POST",
557
- body
558
- });
559
- }
560
-
561
- list(accountId, listId) {
562
- return this.requestJson(accountPath(accountId, ["lists", listId]));
563
- }
564
-
565
- updateList(accountId, listId, body) {
566
- return this.requestJson(accountPath(accountId, ["lists", listId]), {
567
- method: "PATCH",
568
- body
569
- });
570
- }
571
-
572
- addListTag(accountId, listId, body) {
573
- return this.requestJson(accountPath(accountId, ["lists", listId, "add_tag"]), {
574
- method: "POST",
575
- body
576
- });
577
- }
578
-
579
- removeListTag(accountId, listId, body) {
580
- return this.requestJson(accountPath(accountId, ["lists", listId, "remove_tag"]), {
581
- method: "DELETE",
582
- body
583
- });
584
- }
585
-
586
- deleteList(accountId, listId) {
587
- return this.requestJson(accountPath(accountId, ["lists", listId]), {
588
- method: "DELETE"
589
- });
590
- }
591
-
592
- bulkAddListTag(accountId, body) {
593
- return this.requestJson(accountPath(accountId, ["lists", "bulk_add_tag"]), {
594
- method: "POST",
595
- body
596
- });
597
- }
598
-
599
- mergeLists(accountId, body) {
600
- return this.requestJson(accountPath(accountId, ["lists", "merge_selected"]), {
601
- method: "POST",
602
- body
603
- });
604
- }
605
-
606
- exportList(accountId, listId, query = {}) {
607
- return this.requestJson(accountPath(accountId, ["lists", listId, "export"], query));
608
- }
609
-
610
- listProspects(accountId, listId, query = {}) {
611
- return this.requestJson(accountPath(accountId, ["lists", listId, "prospects"], query));
612
- }
613
-
614
- addListProspects(accountId, listId, body) {
615
- return this.requestJson(accountPath(accountId, ["lists", listId, "prospects"]), {
616
- method: "POST",
617
- body
618
- });
619
- }
620
-
621
- removeListProspects(accountId, listId, body) {
622
- return this.requestJson(accountPath(accountId, ["lists", listId, "prospects"]), {
623
- method: "DELETE",
624
- body
625
- });
626
- }
627
-
628
- listRoutingRules(accountId, listId) {
629
- return this.requestJson(accountPath(accountId, ["lists", listId, "routing_rules"]));
630
- }
631
-
632
- createListRoutingRule(accountId, listId, body) {
633
- return this.requestJson(accountPath(accountId, ["lists", listId, "routing_rules"]), {
634
- method: "POST",
635
- body
636
- });
637
- }
638
-
639
- updateListRoutingRule(accountId, listId, ruleId, body) {
640
- return this.requestJson(accountPath(accountId, ["lists", listId, "routing_rules", ruleId]), {
641
- method: "PATCH",
642
- body
643
- });
644
- }
645
-
646
- removeListRoutingRule(accountId, listId, ruleId) {
647
- return this.requestJson(accountPath(accountId, ["lists", listId, "routing_rules", ruleId]), {
648
- method: "DELETE"
649
- });
650
- }
651
-
652
- moveListRoutingRule(accountId, listId, ruleId, body) {
653
- return this.requestJson(accountPath(accountId, ["lists", listId, "routing_rules", ruleId, "move"]), {
654
- method: "PATCH",
655
- body
656
- });
657
- }
658
-
659
- toggleListRoutingRule(accountId, listId, ruleId) {
660
- return this.requestJson(accountPath(accountId, ["lists", listId, "routing_rules", ruleId, "toggle"]), {
661
- method: "PATCH"
662
- });
663
- }
664
-
665
- applyListRoutingRules(accountId, listId) {
666
- return this.requestJson(accountPath(accountId, ["lists", listId, "routing_rules", "apply"]), {
667
- method: "POST",
668
- body: {}
669
- });
670
- }
671
-
672
- motions(accountId) {
673
- return this.requestJson(accountPath(accountId, ["motions"]));
674
- }
675
-
676
- motion(accountId, motionId) {
677
- return this.requestJson(accountPath(accountId, ["motions", motionId]));
678
- }
679
-
680
- motionSignals(accountId, motionId) {
681
- return this.requestJson(accountPath(accountId, ["motions", motionId, "signals"]));
682
- }
683
-
684
- createMotion(accountId, body) {
685
- return this.requestJson(accountPath(accountId, ["motions"]), {
686
- method: "POST",
687
- body
688
- });
689
- }
690
-
691
- updateMotion(accountId, motionId, body) {
692
- return this.requestJson(accountPath(accountId, ["motions", motionId]), {
693
- method: "PATCH",
694
- body
695
- });
696
- }
697
-
698
- motionAbmCompanies(accountId, motionId) {
699
- return this.requestJson(accountPath(accountId, ["motions", motionId, "abm_companies"]));
700
- }
701
-
702
- addMotionAbmCompanies(accountId, motionId, body) {
703
- return this.requestJson(accountPath(accountId, ["motions", motionId, "abm_companies"]), {
704
- method: "POST",
705
- body
706
- });
707
- }
708
-
709
- motionProfileSignals(accountId, motionId) {
710
- return this.requestJson(accountPath(accountId, ["motions", motionId, "profile_signals"]));
711
- }
712
-
713
- addMotionProfileSignal(accountId, motionId, body) {
714
- return this.requestJson(accountPath(accountId, ["motions", motionId, "profile_signals"]), {
715
- method: "POST",
716
- body
717
- });
718
- }
719
-
720
- removeMotionProfileSignal(accountId, motionId, signalId) {
721
- return this.requestJson(accountPath(accountId, ["motions", motionId, "profile_signals", signalId]), {
722
- method: "DELETE"
723
- });
724
- }
725
-
726
- removeMotionAbmCompany(accountId, motionId, rowId) {
727
- return this.requestJson(accountPath(accountId, ["motions", motionId, "abm_companies", rowId]), {
728
- method: "DELETE"
729
- });
730
- }
731
-
732
- contentPrograms(accountId, query = {}) {
733
- return this.requestJson(accountPath(accountId, ["content_ops", "programs"], query));
734
- }
735
-
736
- contentPlan(accountId, programId, query = {}) {
737
- return this.requestJson(accountPath(accountId, ["content_ops", "programs", programId, "plan"], query));
738
- }
739
-
740
- contentPlans(accountId, query = {}) {
741
- return this.requestJson(accountPath(accountId, ["content_ops", "plans"], query));
742
- }
743
-
744
- contentPlanReport(accountId, reportId, query = {}) {
745
- return this.requestJson(accountPath(accountId, ["content_ops", "plans", reportId], query));
746
- }
747
-
748
- contentPlanUpdate(accountId, reportId, day, body = {}) {
749
- return this.requestJson(accountPath(accountId, ["content_ops", "plans", reportId, "items", day]), { method: "PATCH", body });
750
- }
751
-
752
- contentPlanApprove(accountId, reportId, day, body = {}) {
753
- return this.requestJson(accountPath(accountId, ["content_ops", "plans", reportId, "items", day, "approve"]), { method: "POST", body });
754
- }
755
-
756
- contentPlanResearch(accountId, reportId, day, body = {}) {
757
- return this.requestJson(accountPath(accountId, ["content_ops", "plans", reportId, "items", day, "research"]), { method: "POST", body });
758
- }
759
-
760
- contentPlanDraft(accountId, reportId, day, body = {}) {
761
- return this.requestJson(accountPath(accountId, ["content_ops", "plans", reportId, "items", day, "draft"]), { method: "POST", body });
762
- }
763
-
764
- contentPlanVisuals(accountId, reportId, day, body = {}) {
765
- return this.requestJson(accountPath(accountId, ["content_ops", "plans", reportId, "items", day, "visuals"]), { method: "POST", body });
766
- }
767
-
768
- contentPostReply(accountId, workItemId, taskId, body = {}) {
769
- return this.requestJson(accountPath(accountId, ["content_ops", "tracked_posts", workItemId, "comments", taskId, "reply"]), { method: "POST", body });
770
- }
771
-
772
- contentWorkItem(accountId, workItemId) {
773
- return this.requestJson(accountPath(accountId, ["content_ops", "work_items", workItemId]));
774
- }
775
-
776
- contentTrackedPosts(accountId, query = {}) {
777
- return this.requestJson(accountPath(accountId, ["content_ops", "tracked_posts"], query));
778
- }
779
-
780
- contentTrackPost(accountId, body) {
781
- return this.requestJson(accountPath(accountId, ["content_ops", "tracked_posts"]), { method: "POST", body });
782
- }
783
-
784
- contentTrackedPost(accountId, workItemId) {
785
- return this.requestJson(accountPath(accountId, ["content_ops", "tracked_posts", workItemId]));
786
- }
787
-
788
- contentFeedback(accountId, workItemId, body) {
789
- return this.requestJson(accountPath(accountId, ["content_ops", "work_items", workItemId, "feedback"]), { method: "POST", body });
790
- }
791
-
792
- contentApprove(accountId, workItemId) {
793
- return this.requestJson(accountPath(accountId, ["content_ops", "work_items", workItemId, "approve"]), { method: "POST" });
794
- }
795
-
796
- contentSchedule(accountId, workItemId, body) {
797
- return this.requestJson(accountPath(accountId, ["content_ops", "work_items", workItemId, "schedule"]), { method: "POST", body });
798
- }
799
-
800
- contentPublish(accountId, workItemId, body) {
801
- return this.requestJson(accountPath(accountId, ["content_ops", "work_items", workItemId, "publish"]), { method: "POST", body });
802
- }
803
-
804
- contentComments(accountId, query = {}) {
805
- return this.requestJson(accountPath(accountId, ["content_ops", "comment_tasks"], query));
806
- }
807
-
808
- contentReply(accountId, commentTaskId, body) {
809
- return this.requestJson(accountPath(accountId, ["content_ops", "comment_tasks", commentTaskId, "send_reply"]), { method: "POST", body });
810
- }
811
-
812
- contentDismiss(accountId, commentTaskId) {
813
- return this.requestJson(accountPath(accountId, ["content_ops", "comment_tasks", commentTaskId, "dismiss"]), { method: "POST" });
814
- }
815
-
816
- addMotionTag(accountId, motionId, body) {
817
- return this.requestJson(accountPath(accountId, ["motions", motionId, "add_tag"]), {
818
- method: "POST",
819
- body
820
- });
821
- }
822
-
823
- removeMotionTag(accountId, motionId, body) {
824
- return this.requestJson(accountPath(accountId, ["motions", motionId, "remove_tag"]), {
825
- method: "DELETE",
826
- body
827
- });
828
- }
829
-
830
- deleteMotion(accountId, motionId) {
831
- return this.requestJson(accountPath(accountId, ["motions", motionId]), {
832
- method: "DELETE"
833
- });
834
- }
835
-
836
- cloneMotion(accountId, motionId, body) {
837
- return this.requestJson(accountPath(accountId, ["motions", motionId, "clone"]), {
838
- method: "POST",
839
- body
840
- });
841
- }
842
-
843
- moveMotionProspects(accountId, motionId, body) {
844
- return this.requestJson(accountPath(accountId, ["motions", motionId, "move_prospects"]), {
845
- method: "POST",
846
- body
847
- });
848
- }
849
-
850
- motionRuns(accountId, motionId, params = {}) {
851
- return this.requestJson(accountPath(accountId, ["motions", motionId, "runs"], params));
852
- }
853
-
854
- motionStatus(accountId, motionId) {
855
- return this.requestJson(accountPath(accountId, ["motions", motionId, "status"]));
856
- }
857
-
858
- runMotionDiscovery(accountId, motionId, body = {}) {
859
- return this.requestJson(accountPath(accountId, ["motions", motionId, "run_discovery"]), {
860
- method: "POST",
861
- body
862
- });
863
- }
864
-
865
- bulkAddMotionTag(accountId, body) {
866
- return this.requestJson(accountPath(accountId, ["motions", "bulk_add_tag"]), {
867
- method: "POST",
868
- body
869
- });
870
- }
871
-
872
- bulkRemoveMotionTag(accountId, body) {
873
- return this.requestJson(accountPath(accountId, ["motions", "bulk_remove_tag"]), {
874
- method: "POST",
875
- body
876
- });
877
- }
878
-
879
- bulkUpdateMotionPrincipal(accountId, body) {
880
- return this.requestJson(accountPath(accountId, ["motions", "bulk_update_principal"]), {
881
- method: "POST",
882
- body
883
- });
884
- }
885
-
886
- bulkUpdateMotionStatus(accountId, body) {
887
- return this.requestJson(accountPath(accountId, ["motions", "bulk_update_status"]), {
888
- method: "POST",
889
- body
890
- });
891
- }
892
-
893
- retireMotionStrategy(accountId, motionId, strategyId) {
894
- return this.requestJson(accountPath(accountId, ["motions", motionId, "strategies", strategyId, "retire"]), {
895
- method: "POST"
896
- });
897
- }
898
-
899
- refreshMotionLaunchCheck(accountId, motionId) {
900
- return this.requestJson(accountPath(accountId, ["motions", motionId, "refresh_launch_check"]), {
901
- method: "POST"
902
- });
903
- }
904
-
905
- refreshMotionLaunchChecks(accountId) {
906
- return this.requestJson(accountPath(accountId, ["motions", "refresh_launch_checks"]), {
907
- method: "POST"
908
- });
909
- }
910
-
911
- updateMotionPremise(accountId, motionId, body) {
912
- return this.requestJson(accountPath(accountId, ["motions", motionId, "update_premise"]), {
913
- method: "PATCH",
914
- body
915
- });
916
- }
917
-
918
- createQuickStart(accountId, body) {
919
- return this.requestJson(accountPath(accountId, ["quick_start"]), {
920
- method: "POST",
921
- body
922
- });
923
- }
924
-
925
- quickStart(accountId, draftId) {
926
- return this.requestJson(accountPath(accountId, ["quick_start", draftId]));
927
- }
928
-
929
- updateQuickStart(accountId, draftId, body) {
930
- return this.requestJson(accountPath(accountId, ["quick_start", draftId]), {
931
- method: "PATCH",
932
- body
933
- });
934
- }
935
-
936
- setupState(accountId, query = {}) {
937
- return this.requestJson(accountPath(accountId, ["quick_start", "setup_state"], query));
938
- }
939
-
940
- confirmQuickStart(accountId, draftId, body = {}) {
941
- return this.requestJson(accountPath(accountId, ["quick_start", draftId, "confirm"]), {
942
- method: "POST",
943
- body
944
- });
945
- }
946
-
947
- motionProspects(accountId, motionId, query = {}) {
948
- return this.requestJson(accountPath(accountId, ["motions", motionId, "prospects"], query));
949
- }
950
-
951
- addMotionProspects(accountId, motionId, body) {
952
- return this.requestJson(accountPath(accountId, ["motions", motionId, "prospects"]), {
953
- method: "POST",
954
- body
955
- });
956
- }
957
-
958
- prospects(accountId, query = {}) {
959
- return this.requestJson(accountPath(accountId, ["prospects"], query));
960
- }
961
-
962
- prospect(accountId, prospectId) {
963
- return this.requestJson(accountPath(accountId, ["prospects", prospectId]));
964
- }
965
-
966
- moveProspectAccount(accountId, prospectId, body) {
967
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "move_account"]), {
968
- method: "POST",
969
- body
970
- });
971
- }
972
-
973
- replanProspect(accountId, prospectId, body = {}) {
974
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "replan"]), {
975
- method: "POST",
976
- body
977
- });
978
- }
979
-
980
- reenrichProspect(accountId, prospectId, body = {}) {
981
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "reenrich"]), {
982
- method: "POST",
983
- body
984
- });
985
- }
986
-
987
- refreshProspectQueue(accountId, prospectId, body = {}) {
988
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "refresh_queue"]), {
989
- method: "POST",
990
- body
991
- });
992
- }
993
-
994
- setProspectDestination(accountId, body) {
995
- return this.requestJson(accountPath(accountId, ["prospect_destinations"]), {
996
- method: "POST",
997
- body
998
- });
999
- }
1000
-
1001
- assignProspects(accountId, body) {
1002
- return this.requestJson(accountPath(accountId, ["prospects", "assign"]), {
1003
- method: "POST",
1004
- body
1005
- });
1006
- }
1007
-
1008
- prospectTimeline(accountId, prospectId, query = {}) {
1009
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "timeline"], query));
1010
- }
1011
-
1012
- prospectMessageTypes(accountId, prospectId) {
1013
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "message_types"]));
1014
- }
1015
-
1016
- writeProspectMessage(accountId, prospectId, body) {
1017
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "write_message"]), {
1018
- method: "POST",
1019
- body
1020
- });
1021
- }
1022
-
1023
- rejectProspect(accountId, prospectId) {
1024
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "reject"]), {
1025
- method: "POST"
1026
- });
1027
- }
1028
-
1029
- nurtureProspect(accountId, prospectId, body = {}) {
1030
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "nurture"]), {
1031
- method: "POST",
1032
- body
1033
- });
1034
- }
1035
-
1036
- restoreProspect(accountId, prospectId) {
1037
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "restore"]), {
1038
- method: "POST"
1039
- });
1040
- }
1041
-
1042
- lockProspect(accountId, prospectId, body = {}) {
1043
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "lock"]), {
1044
- method: "POST",
1045
- body
1046
- });
1047
- }
1048
-
1049
- unlockProspect(accountId, prospectId) {
1050
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "unlock"]), {
1051
- method: "POST"
1052
- });
1053
- }
1054
-
1055
- deferProspect(accountId, prospectId) {
1056
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "defer"]), {
1057
- method: "POST"
1058
- });
1059
- }
1060
-
1061
- delayProspect(accountId, prospectId, body = {}) {
1062
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "delay"]), {
1063
- method: "POST",
1064
- body
1065
- });
1066
- }
1067
-
1068
- monitorProspect(accountId, prospectId, body = {}) {
1069
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "monitor"]), {
1070
- method: "POST",
1071
- body
1072
- });
1073
- }
1074
-
1075
- unmonitorProspect(accountId, prospectId) {
1076
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "unmonitor"]), {
1077
- method: "POST"
1078
- });
1079
- }
1080
-
1081
- renameProspect(accountId, prospectId, body = {}) {
1082
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "display_name"]), {
1083
- method: "PATCH",
1084
- body
1085
- });
1086
- }
1087
-
1088
- importProspectPost(accountId, prospectId, body = {}) {
1089
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "import_post"]), {
1090
- method: "POST",
1091
- body
1092
- });
1093
- }
1094
-
1095
- syncProspect(accountId, prospectId, body = {}) {
1096
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "sync"]), {
1097
- method: "POST",
1098
- body
1099
- });
1100
- }
1101
-
1102
- cancelProspectScheduledEvent(accountId, prospectId, body = {}) {
1103
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "cancel_scheduled_event"]), {
1104
- method: "POST",
1105
- body
1106
- });
1107
- }
1108
-
1109
- writeProspectQueueDraft(accountId, prospectId, body = {}) {
1110
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "write"]), {
1111
- method: "POST",
1112
- body
1113
- });
1114
- }
1115
-
1116
- rewriteProspectQueueDraft(accountId, prospectId, body = {}) {
1117
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "rewrite"]), {
1118
- method: "POST",
1119
- body
1120
- });
1121
- }
1122
-
1123
- engageProspect(accountId, prospectId, body = {}) {
1124
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "engage"]), {
1125
- method: "POST",
1126
- body
1127
- });
1128
- }
1129
-
1130
- rejectSelectedProspects(accountId, body = {}) {
1131
- return this.requestJson(accountPath(accountId, ["prospects", "reject_selected"]), {
1132
- method: "POST",
1133
- body
1134
- });
1135
- }
1136
-
1137
- intakeProspect(accountId, body = {}) {
1138
- return this.requestJson(accountPath(accountId, ["prospects", "intake"]), {
1139
- method: "POST",
1140
- body
1141
- });
1142
- }
1143
-
1144
- retryEvent(accountId, eventId) {
1145
- return this.requestJson(accountPath(accountId, ["events", eventId, "retry"]), {
1146
- method: "POST"
1147
- });
1148
- }
1149
-
1150
- resolveUncertainComment(accountId, eventId, body) {
1151
- return this.requestJson(accountPath(accountId, ["events", eventId, "resolve_uncertain_comment"]), {
1152
- method: "POST",
1153
- body
1154
- });
1155
- }
1156
-
1157
- deferCommentRetry(accountId, eventId) {
1158
- return this.requestJson(accountPath(accountId, ["events", eventId, "defer_comment_retry"]), {
1159
- method: "POST"
1160
- });
1161
- }
1162
-
1163
- resolveUncertainCommentStatus(accountId, eventId, resolutionId) {
1164
- return this.requestJson(accountPath(accountId, ["events", eventId, "resolve_uncertain_comment", "status"], { resolution_id: resolutionId }));
1165
- }
1166
-
1167
- deleteProfile(accountId, profileId) {
1168
- return this.requestJson(accountPath(accountId, ["profiles", profileId]), {
1169
- method: "DELETE"
1170
- });
1171
- }
1172
-
1173
- stopPursuingCompany(accountId, companyId) {
1174
- return this.requestJson(accountPath(accountId, ["companies", companyId, "stop_pursuing"]), {
1175
- method: "POST"
1176
- });
1177
- }
1178
-
1179
- contentDefer(accountId, workItemId, body = {}) {
1180
- return this.requestJson(accountPath(accountId, ["content_ops", "work_items", workItemId, "defer"]), {
1181
- method: "POST",
1182
- body
1183
- });
1184
- }
1185
-
1186
- updateInboxOpsFilters(accountId, body = {}) {
1187
- return this.requestJson(accountPath(accountId, ["inbox_ops", "filters"]), {
1188
- method: "PATCH",
1189
- body
1190
- });
1191
- }
1192
-
1193
- inboxOpsReply(accountId, rowId, body = {}) {
1194
- return this.requestJson(accountPath(accountId, ["inbox_ops", rowId, "reply"]), {
1195
- method: "POST",
1196
- body
1197
- });
1198
- }
1199
-
1200
- inboxOpsWriteReply(accountId, rowId) {
1201
- return this.requestJson(accountPath(accountId, ["inbox_ops", rowId, "reply", "write"]), {
1202
- method: "POST"
1203
- });
1204
- }
1205
-
1206
- inboxOpsAdopt(accountId, rowId, body = {}) {
1207
- return this.requestJson(accountPath(accountId, ["inbox_ops", rowId, "adopt"]), {
1208
- method: "POST",
1209
- body
1210
- });
1211
- }
1212
-
1213
- reconciliationAddToMotion(accountId, sourceKey, body = {}) {
1214
- return this.requestJson(accountPath(accountId, ["reconciliations", sourceKey, "add_to_motion"]), {
1215
- method: "POST",
1216
- body
1217
- });
1218
- }
1219
-
1220
- reconciliationIgnore(accountId, sourceKey) {
1221
- return this.requestJson(accountPath(accountId, ["reconciliations", sourceKey, "ignore"]), {
1222
- method: "POST"
1223
- });
1224
- }
1225
-
1226
- prospectSequencePreview(accountId, prospectId, body = {}) {
1227
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "sequence_preview"]), {
1228
- method: "POST",
1229
- body
1230
- });
1231
- }
1232
-
1233
- prospectSequenceExport(accountId, prospectId, body = {}) {
1234
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "sequence_export"]), {
1235
- method: "POST",
1236
- body
1237
- });
1238
- }
1239
-
1240
- createProspectSequenceExportJob(accountId, prospectId, body = {}) {
1241
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "sequence_export_jobs"]), {
1242
- method: "POST",
1243
- body
1244
- });
1245
- }
1246
-
1247
- prospectSequenceExportJob(accountId, prospectId, jobId) {
1248
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "sequence_export_jobs", jobId]));
1249
- }
1250
-
1251
- addProspectNote(accountId, prospectId, body) {
1252
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "add_note"]), {
1253
- method: "POST",
1254
- body
1255
- });
1256
- }
1257
-
1258
- addProspectProfile(accountId, prospectId, body) {
1259
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "profiles"]), {
1260
- method: "POST",
1261
- body
1262
- });
1263
- }
1264
-
1265
- reportBadProspectProfile(accountId, prospectId, body) {
1266
- return this.requestJson(accountPath(accountId, ["prospects", prospectId, "report_bad_profile"]), {
1267
- method: "POST",
1268
- body
1269
- });
1270
- }
1271
-
1272
- prospectImport(accountId, body) {
1273
- return this.requestJson(accountPath(accountId, ["prospect_imports"]), {
1274
- method: "POST",
1275
- body
1276
- });
1277
- }
1278
-
1279
- prospectImportBatch(accountId, body) {
1280
- return this.requestJson(accountPath(accountId, ["prospect_imports", "batch"]), {
1281
- method: "POST",
1282
- body
1283
- });
1284
- }
1285
-
1286
- prospectImportStatus(accountId, importId) {
1287
- return this.requestJson(accountPath(accountId, ["prospect_imports", importId]));
1288
- }
1289
-
1290
- linkedinReviewReports(accountId, query = {}) {
1291
- return this.requestJson(accountPath(accountId, ["tools", "linkedin-review", "reports"], query));
1292
- }
1293
-
1294
- linkedinReview(accountId, body) {
1295
- return this.requestJson(accountPath(accountId, ["tools", "linkedin-review", "reports"]), {
1296
- method: "POST",
1297
- body
1298
- });
1299
- }
1300
-
1301
- linkedinReviewStatus(accountId, reportId) {
1302
- return this.requestJson(accountPath(accountId, ["tools", "linkedin-review", "reports", reportId]));
1303
- }
1304
-
1305
- linkedinStrategyReviews(accountId, query = {}) {
1306
- return this.requestJson(accountPath(accountId, ["tools", "linkedin-strategy-review", "reports"], query));
1307
- }
1308
-
1309
- createLinkedinStrategyReview(accountId, body) {
1310
- return this.requestJson(accountPath(accountId, ["tools", "linkedin-strategy-review", "reports"]), {
1311
- method: "POST",
1312
- body
1313
- });
1314
- }
1315
-
1316
- linkedinStrategyReview(accountId, reportId) {
1317
- return this.requestJson(accountPath(accountId, ["tools", "linkedin-strategy-review", "reports", reportId]));
1318
- }
1319
-
1320
- deleteLinkedinStrategyReview(accountId, reportId) {
1321
- return this.requestJson(accountPath(accountId, ["tools", "linkedin-strategy-review", "reports", reportId]), {
1322
- method: "DELETE"
1323
- });
1324
- }
1325
-
1326
- // Standalone account tool runs (#2554).
1327
- quoteToolRun(accountId, body) {
1328
- return this.requestJson(accountPath(accountId, ["tools", "run_quotes"]), { method: "POST", body });
1329
- }
1330
-
1331
- toolRunCreditAction(accountId, runId, body) {
1332
- return this.requestJson(accountPath(accountId, ["tools", "runs", runId, "credit_actions"]), { method: "POST", body });
1333
- }
1334
-
1335
- toolCreditUsage(accountId, reference) {
1336
- return this.requestJson(accountPath(accountId, ["tools", "credit_usages", reference]));
1337
- }
1338
-
1339
- createToolRun(accountId, body) {
1340
- return this.requestJson(accountPath(accountId, ["tools", "runs"]), { method: "POST", body });
1341
- }
1342
-
1343
- toolRuns(accountId, query = {}) {
1344
- return this.requestJson(accountPath(accountId, ["tools", "runs"], query));
1345
- }
1346
-
1347
- toolRun(accountId, runId) {
1348
- return this.requestJson(accountPath(accountId, ["tools", "runs", runId]));
1349
- }
1350
-
1351
- toolRunResults(accountId, runId, query = {}) {
1352
- return this.requestJson(accountPath(accountId, ["tools", "runs", runId, "results"], query));
1353
- }
1354
-
1355
- // CSV text by default; export_format=json returns an object.
1356
- toolRunExport(accountId, runId, query = {}) {
1357
- return this.requestJson(accountPath(accountId, ["tools", "runs", runId, "export"], query));
1358
- }
1359
-
1360
- creditRefundReview(accountId, usageId) {
1361
- return this.requestJson(accountPath(accountId, ["credit_usages", usageId, "refund"]));
1362
- }
1363
-
1364
- approveCreditRefund(accountId, usageId, body) {
1365
- return this.requestJson(accountPath(accountId, ["credit_usages", usageId, "refund"]), { method: "POST", body });
1366
- }
1367
-
1368
- creditUsages(accountId, query = {}) {
1369
- return this.requestJson(accountPath(accountId, ["credit_usages"], query));
1370
- }
1371
-
1372
- creditUsage(accountId, usageId) {
1373
- return this.requestJson(accountPath(accountId, ["credit_usages", usageId]));
1374
- }
1375
-
1376
- creditApprovals(accountId) {
1377
- return this.requestJson(accountPath(accountId, ["credit_approvals"]));
1378
- }
1379
-
1380
- acceptCreditPrice(accountId, priceId) {
1381
- return this.requestJson(accountPath(accountId, ["credit_approvals", "prices", priceId]), { method: "POST", body: {} });
1382
- }
1383
-
1384
- approveCreditPayer(accountId, operationId, body) {
1385
- return this.requestJson(accountPath(accountId, ["credit_approvals", "payers", operationId]), { method: "POST", body });
1386
- }
1387
-
1388
- // Saved network of one connected account (owner-only).
1389
- socialCookieNetwork(accountId, socialCookieId, query = {}) {
1390
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId, "network"], query));
1391
- }
1392
-
1393
- socialCookieNetworkExport(accountId, socialCookieId, query = {}) {
1394
- return this.requestJson(accountPath(accountId, ["social_cookies", socialCookieId, "network", "export"], query));
1395
- }
1396
-
1397
- humanizeText(accountId, body) {
1398
- return this.requestJson(accountPath(accountId, ["tools", "humanize"]), {
1399
- method: "POST",
1400
- body: { humanization: body }
1401
- });
1402
- }
1403
-
1404
- operatorQueue(accountId, query = {}) {
1405
- return this.requestJson(accountPath(accountId, ["operator"], query));
1406
- }
1407
-
1408
- networkOpsAction(accountId, rowId, action, body) {
1409
- return this.requestJson(accountPath(accountId, ["network_ops", rowId, action]), {
1410
- method: "POST",
1411
- ...(body === undefined ? {} : { body })
1412
- });
1413
- }
1414
-
1415
- inboxOpsFilters(accountId) {
1416
- return this.requestJson(accountPath(accountId, ["inbox_ops", "filters"]));
1417
- }
1418
-
1419
- updateInboxOpsRule(accountId, rowId, body) {
1420
- return this.requestJson(accountPath(accountId, ["inbox_ops", rowId, "rule"]), {
1421
- method: "PATCH",
1422
- body
1423
- });
1424
- }
1425
-
1426
- inboxOpsActions(accountId, body) {
1427
- return this.requestJson(accountPath(accountId, ["inbox_ops", "actions"]), {
1428
- method: "POST",
1429
- body
1430
- });
1431
- }
1432
-
1433
- setInboxOpsRule(accountId, body) {
1434
- return this.requestJson(accountPath(accountId, ["inbox_ops", "rules"]), {
1435
- method: "PATCH",
1436
- body
1437
- });
1438
- }
1439
-
1440
- removeInboxOpsRule(accountId, body) {
1441
- return this.requestJson(accountPath(accountId, ["inbox_ops", "rules"]), {
1442
- method: "DELETE",
1443
- body
1444
- });
1445
- }
1446
-
1447
- operatorNext(accountId, query = {}) {
1448
- return this.requestJson(accountPath(accountId, ["operator", "next"], query));
1449
- }
1450
-
1451
- operatorRow(accountId, rowId, query = {}) {
1452
- return this.requestJson(accountPath(accountId, ["operator", "row"], { ...query, row_id: rowId }));
1453
- }
1454
-
1455
- operatorAnswer(accountId, body) {
1456
- return this.requestJson(accountPath(accountId, ["operator", "answer"]), { method: "POST", body });
1457
- }
1458
-
1459
- requeueOperatorFailedDrafts(accountId, body = {}) {
1460
- return this.requestJson(accountPath(accountId, ["operator", "failed_drafts", "requeue"]), {
1461
- method: "POST",
1462
- body
1463
- });
1464
- }
1465
-
1466
- operatorOutcome(accountId, body) {
1467
- return this.requestJson(accountPath(accountId, ["operator", "outcome"]), {
1468
- method: "POST",
1469
- body
1470
- });
1471
- }
1472
-
1473
- analyticsProspects(accountId, query = {}) {
1474
- return this.requestJson(accountPath(accountId, ["analytics", "prospects"], query));
1475
- }
1476
-
1477
- analyticsUsers(accountId, query = {}) {
1478
- return this.requestJson(accountPath(accountId, ["analytics", "users"], query));
1479
- }
1480
-
1481
- analyticsVisibility(accountId, query = {}) {
1482
- return this.requestJson(accountPath(accountId, ["analytics", "visibility"], query));
1483
- }
1484
-
1485
- analyticsContent(accountId, query = {}) {
1486
- return this.requestJson(accountPath(accountId, ["analytics", "content"], query));
1487
- }
1488
-
1489
- analyticsDashboard(accountId, query = {}) {
1490
- return this.requestJson(accountPath(accountId, ["analytics", "dashboard"], query));
1491
- }
1492
-
1493
- analyticsMotions(accountId) {
1494
- return this.requestJson(accountPath(accountId, ["analytics", "motions"]));
1495
- }
1496
-
1497
- analyticsIcps(accountId) {
1498
- return this.requestJson(accountPath(accountId, ["analytics", "icps"]));
1499
- }
1500
-
1501
- analyticsMetrics(accountId, query = {}) {
1502
- return this.requestJson(accountPath(accountId, ["analytics", "metrics"], query));
1503
- }
1504
-
1505
- analyticsStages(accountId, query = {}) {
1506
- return this.requestJson(accountPath(accountId, ["analytics", "stages"], query));
1507
- }
1508
-
1509
- createAnalyticsCohortList(accountId, body = {}) {
1510
- return this.requestJson(accountPath(accountId, ["analytics", "cohort_lists"]), {
1511
- method: "POST",
1512
- body
1513
- });
1514
- }
1515
-
1516
- async requestJson(path, { method = "GET", body, token } = {}) {
1517
- const url = new URL(path, `${this.host}/`);
1518
- let response;
1519
-
1520
- try {
1521
- response = await this.fetchImpl(url, {
1522
- method,
1523
- headers: this.headers(body, token === undefined ? this.token : token),
1524
- body: body === undefined ? undefined : JSON.stringify(body)
1525
- });
1526
- } catch (error) {
1527
- throw new ApiError(networkErrorMessage(url, error), { cause: error });
1528
- }
1529
-
1530
- const responseBody = await parseBody(response);
1531
-
1532
- if (!response.ok) {
1533
- throw new ApiError(errorMessage(response.status, responseBody), {
1534
- status: response.status,
1535
- body: responseBody
1536
- });
1537
- }
1538
-
1539
- return responseBody;
1540
- }
1541
-
1542
- headers(body, token = this.token) {
1543
- const headers = {
1544
- Accept: "application/json",
1545
- "X-Audienti-Client": "cli"
1546
- };
1547
-
1548
- if (token) {
1549
- headers.Authorization = `Bearer ${token}`;
1550
- }
1551
-
1552
- if (body !== undefined) {
1553
- headers["Content-Type"] = "application/json";
1554
- }
1555
-
1556
- return headers;
1557
- }
1558
- }
1559
-
1560
- function accountPath(accountId, segments, query = {}) {
1561
- return apiPath(["accounts", accountId, ...segments], query);
1562
- }
1563
-
1564
- function apiPath(segments, query = {}) {
1565
- const encodedSegments = [
1566
- "api",
1567
- "v1",
1568
- ...segments
1569
- ].map((segment) => encodeURIComponent(segment));
1570
- const searchParams = new URLSearchParams();
1571
-
1572
- for (const [key, value] of Object.entries(query)) {
1573
- if (value !== undefined && value !== null && String(value).trim() !== "") {
1574
- searchParams.set(key, String(value));
1575
- }
1576
- }
1577
-
1578
- const path = `/${encodedSegments.join("/")}.json`;
1579
- const search = searchParams.toString();
1580
- return search ? `${path}?${search}` : path;
1581
- }
1582
-
1583
- async function parseBody(response) {
1584
- const text = await response.text();
1585
- if (!text) return null;
1586
-
1587
- try {
1588
- return JSON.parse(text);
1589
- } catch {
1590
- return text;
1591
- }
1592
- }
1593
-
1594
- function errorMessage(status, body) {
1595
- if (status === 401) {
1596
- return "Authentication failed. Run `audienti auth token <token>` with a valid API token.";
1597
- }
1598
-
1599
- if (status === 402) {
1600
- if (body?.code === "payment_needed") {
1601
- return "This account has not paid or used a signup code yet. Run `audienti payment show`.";
1602
- }
1603
- return body?.error || "Audienti stopped this account for a payment reason.";
1604
- }
1605
-
1606
- if (status === 403) {
1607
- return "The API token is not allowed to access that Audienti resource.";
1608
- }
1609
-
1610
- if (status === 404) {
1611
- return "The requested Audienti resource was not found.";
1612
- }
1613
-
1614
- if (status === 409) {
1615
- return body?.error || "Audienti rejected the request because the resource changed. Re-fetch and try again.";
1616
- }
1617
-
1618
- if (status === 422) {
1619
- const reasons = [body?.errors, body?.details].find(Array.isArray);
1620
- const details = reasons?.length > 0 ? reasons.join(", ") : body?.message || body?.error;
1621
- return details ? `Audienti rejected the request: ${details}` : "Audienti rejected the request.";
1622
- }
1623
-
1624
- if ((status === 429 || status === 503) && body?.error) {
1625
- return body.error;
1626
- }
1627
-
1628
- return `Audienti API request failed with HTTP ${status}.`;
1629
- }
1630
-
1631
- function networkErrorMessage(url, error) {
1632
- const detail = error?.message ? ` (${error.message})` : "";
1633
- return [
1634
- `Unable to reach Audienti API at ${url.origin}.`,
1635
- "Check that the app is running and the configured host is correct.",
1636
- "For workspace-local CLI auth, start the workspace app server first or pass `--host <url>` to `auth token`.",
1637
- detail
1638
- ].join(" ").trim();
1639
- }