@hirefinn/sdk 0.1.0 → 0.3.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.
Files changed (38) hide show
  1. package/README.md +79 -9
  2. package/dist/cjs/client.d.ts +13 -1
  3. package/dist/cjs/client.js +5 -0
  4. package/dist/cjs/core.d.ts +14 -2
  5. package/dist/cjs/core.js +41 -4
  6. package/dist/cjs/generated/openapi.d.ts +17426 -5875
  7. package/dist/cjs/generated/operations.d.ts +26 -0
  8. package/dist/cjs/generated/operations.js +165 -0
  9. package/dist/cjs/generated/resources.d.ts +887 -0
  10. package/dist/cjs/generated/resources.js +737 -0
  11. package/dist/cjs/index.d.ts +4 -2
  12. package/dist/cjs/index.js +12 -1
  13. package/dist/cjs/resource.d.ts +30 -0
  14. package/dist/cjs/resource.js +23 -0
  15. package/dist/cjs/resources.d.ts +52 -59
  16. package/dist/cjs/resources.js +27 -37
  17. package/dist/cjs/types.d.ts +17 -5
  18. package/dist/cjs/webhooks.d.ts +57 -0
  19. package/dist/cjs/webhooks.js +181 -0
  20. package/dist/esm/client.d.ts +13 -1
  21. package/dist/esm/client.js +6 -1
  22. package/dist/esm/core.d.ts +14 -2
  23. package/dist/esm/core.js +39 -3
  24. package/dist/esm/generated/openapi.d.ts +17426 -5875
  25. package/dist/esm/generated/operations.d.ts +26 -0
  26. package/dist/esm/generated/operations.js +162 -0
  27. package/dist/esm/generated/resources.d.ts +887 -0
  28. package/dist/esm/generated/resources.js +716 -0
  29. package/dist/esm/index.d.ts +4 -2
  30. package/dist/esm/index.js +2 -1
  31. package/dist/esm/resource.d.ts +30 -0
  32. package/dist/esm/resource.js +19 -0
  33. package/dist/esm/resources.d.ts +52 -59
  34. package/dist/esm/resources.js +20 -35
  35. package/dist/esm/types.d.ts +17 -5
  36. package/dist/esm/webhooks.d.ts +57 -0
  37. package/dist/esm/webhooks.js +140 -0
  38. package/package.json +4 -1
@@ -0,0 +1,716 @@
1
+ /**
2
+ * Resource methods for every operation src/resources.ts does not hand-write. Hand-written classes extend the
3
+ * `*Generated` bases; the other classes are used as they are.
4
+ * Generated by scripts/generate.mjs from spec/openapi.json. Do not edit by hand: run `npm run generate`.
5
+ * Spec: Finn API v1 (OpenAPI 3.1.0)
6
+ */
7
+ import { cursorStrategy } from '../pagination.js';
8
+ import { Resource } from '../resource.js';
9
+ /**
10
+ * Generated methods for the Calls tag; `Calls` in src/resources.ts adds the hand-written ones.
11
+ */
12
+ export class CallsGenerated extends Resource {
13
+ }
14
+ /**
15
+ * Generated methods for the Finns tag; `Finns` in src/resources.ts adds the hand-written ones.
16
+ */
17
+ export class FinnsGenerated extends Resource {
18
+ /**
19
+ * Draft a Finn with AI.
20
+ * `POST /finns/generate`, operationId `generateFinn`.
21
+ */
22
+ generate(body, options) {
23
+ return this.do('post', '/finns/generate', { body }, options);
24
+ }
25
+ /**
26
+ * Read a Finn's call flow.
27
+ * `GET /finns/{finn_id}/flow`, operationId `getFinnFlow`.
28
+ */
29
+ getFlow(finnId, options) {
30
+ return this.do('get', '/finns/{finn_id}/flow', { path: { finn_id: finnId } }, options);
31
+ }
32
+ /**
33
+ * Turn a Finn's call flow on.
34
+ * `POST /finns/{finn_id}/flow/enable`, operationId `enableFinnFlow`.
35
+ */
36
+ enableFlow(finnId, options) {
37
+ return this.do('post', '/finns/{finn_id}/flow/enable', { path: { finn_id: finnId } }, options);
38
+ }
39
+ /**
40
+ * Turn a Finn's call flow off.
41
+ * `POST /finns/{finn_id}/flow/disable`, operationId `disableFinnFlow`.
42
+ */
43
+ disableFlow(finnId, options) {
44
+ return this.do('post', '/finns/{finn_id}/flow/disable', { path: { finn_id: finnId } }, options);
45
+ }
46
+ /**
47
+ * Read a Finn's settings.
48
+ * `GET /finns/{finn_id}/settings`, operationId `getFinnSettings`.
49
+ */
50
+ getSettings(finnId, options) {
51
+ return this.do('get', '/finns/{finn_id}/settings', { path: { finn_id: finnId } }, options);
52
+ }
53
+ /**
54
+ * Read a Finn's variables.
55
+ * `GET /finns/{finn_id}/variables`, operationId `getFinnVariables`.
56
+ */
57
+ getVariables(finnId, options) {
58
+ return this.do('get', '/finns/{finn_id}/variables', { path: { finn_id: finnId } }, options);
59
+ }
60
+ /**
61
+ * Edit a Finn's variables.
62
+ * `PATCH /finns/{finn_id}/variables`, operationId `updateFinnVariables`.
63
+ */
64
+ updateVariables(finnId, body, options) {
65
+ return this.do('patch', '/finns/{finn_id}/variables', { path: { finn_id: finnId }, body }, options);
66
+ }
67
+ /**
68
+ * Edit a Finn's agent handbook.
69
+ * `PATCH /finns/{finn_id}/handbook`, operationId `updateFinnHandbook`.
70
+ */
71
+ updateHandbook(finnId, body, options) {
72
+ return this.do('patch', '/finns/{finn_id}/handbook', { path: { finn_id: finnId }, body }, options);
73
+ }
74
+ /**
75
+ * Edit a Finn's speech settings.
76
+ * `PATCH /finns/{finn_id}/speech_settings`, operationId `updateFinnSpeechSettings`.
77
+ */
78
+ updateSpeechSettings(finnId, body, options) {
79
+ return this.do('patch', '/finns/{finn_id}/speech_settings', { path: { finn_id: finnId }, body }, options);
80
+ }
81
+ /**
82
+ * Edit a draft Finn.
83
+ * `PATCH /finns/{finn_id}/draft`, operationId `updateFinnDraft`.
84
+ */
85
+ updateDraft(finnId, body, options) {
86
+ return this.do('patch', '/finns/{finn_id}/draft', { path: { finn_id: finnId }, body }, options);
87
+ }
88
+ /**
89
+ * Copy a Finn.
90
+ * `POST /finns/{finn_id}/duplicate`, operationId `duplicateFinn`.
91
+ */
92
+ duplicate(finnId, body, options) {
93
+ return this.do('post', '/finns/{finn_id}/duplicate', { path: { finn_id: finnId }, body }, options);
94
+ }
95
+ /**
96
+ * Read a Finn's share link.
97
+ * `GET /finns/{finn_id}/share_link`, operationId `getFinnShareLink`.
98
+ */
99
+ getShareLink(finnId, options) {
100
+ return this.do('get', '/finns/{finn_id}/share_link', { path: { finn_id: finnId } }, options);
101
+ }
102
+ /**
103
+ * Get or make a Finn's share link.
104
+ * `POST /finns/{finn_id}/share_link`, operationId `createFinnShareLink`.
105
+ */
106
+ createShareLink(finnId, options) {
107
+ return this.do('post', '/finns/{finn_id}/share_link', { path: { finn_id: finnId } }, options);
108
+ }
109
+ /**
110
+ * A Finn's call stats.
111
+ * `GET /finns/{finn_id}/stats`, operationId `getFinnStats`.
112
+ */
113
+ getStats(finnId, query, options) {
114
+ return this.do('get', '/finns/{finn_id}/stats', { path: { finn_id: finnId }, query }, options);
115
+ }
116
+ /**
117
+ * Summarize a Finn's call outcomes.
118
+ * `GET /finns/{finn_id}/outcomes`, operationId `getFinnOutcomes`.
119
+ */
120
+ getOutcomes(finnId, query, options) {
121
+ return this.do('get', '/finns/{finn_id}/outcomes', { path: { finn_id: finnId }, query }, options);
122
+ }
123
+ }
124
+ /**
125
+ * Generated methods for the Voices tag; `Voices` in src/resources.ts adds the hand-written ones.
126
+ */
127
+ export class VoicesGenerated extends Resource {
128
+ }
129
+ /**
130
+ * Generated methods for the Phone numbers tag; `PhoneNumbers` in src/resources.ts adds the hand-written ones.
131
+ */
132
+ export class PhoneNumbersGenerated extends Resource {
133
+ }
134
+ /**
135
+ * Generated methods for the Audiences tag; `Audiences` in src/resources.ts adds the hand-written ones.
136
+ */
137
+ export class AudiencesGenerated extends Resource {
138
+ }
139
+ /**
140
+ * Generated methods for the Deployments tag; `Deployments` in src/resources.ts adds the hand-written ones.
141
+ */
142
+ export class DeploymentsGenerated extends Resource {
143
+ }
144
+ /**
145
+ * Generated methods for the Wallet tag; `Wallet` in src/resources.ts adds the hand-written ones.
146
+ */
147
+ export class WalletGenerated extends Resource {
148
+ }
149
+ /**
150
+ * Generated methods for the Do not call tag; `DoNotCall` in src/resources.ts adds the hand-written ones.
151
+ */
152
+ export class DoNotCallGenerated extends Resource {
153
+ }
154
+ /**
155
+ * Generated methods for the Records tag; `Contacts` in src/resources.ts adds the hand-written ones.
156
+ */
157
+ export class ContactsGenerated extends Resource {
158
+ }
159
+ /**
160
+ * Generated methods for the Cases tag; `Cases` in src/resources.ts adds the hand-written ones.
161
+ */
162
+ export class CasesGenerated extends Resource {
163
+ }
164
+ /**
165
+ * Generated methods for the Approvals tag; `Approvals` in src/resources.ts adds the hand-written ones.
166
+ */
167
+ export class ApprovalsGenerated extends Resource {
168
+ }
169
+ /**
170
+ * Generated methods for the Agents tag; `Agents` in src/resources.ts adds the hand-written ones.
171
+ */
172
+ export class AgentsGenerated extends Resource {
173
+ }
174
+ /**
175
+ * Generated methods for the Chat tag; `Chat` in src/resources.ts adds the hand-written ones.
176
+ */
177
+ export class ChatGenerated extends Resource {
178
+ }
179
+ /**
180
+ * CRM: records, stages, forms, documents, follow-ups, views and imports (`/crm`). Reached as `finn.crm`.
181
+ */
182
+ export class Crm extends Resource {
183
+ /**
184
+ * Get the CRM setup.
185
+ * `GET /crm/setup`, operationId `getCrmSetup`, scope `crm:read`.
186
+ */
187
+ getSetup(options) {
188
+ return this.do('get', '/crm/setup', {}, options);
189
+ }
190
+ /**
191
+ * Get the filter schema.
192
+ * `GET /crm/filter_schema`, operationId `getCrmFilterSchema`, scope `crm:read`.
193
+ */
194
+ getFilterSchema(options) {
195
+ return this.do('get', '/crm/filter_schema', {}, options);
196
+ }
197
+ /**
198
+ * Search records.
199
+ * `POST /crm/records/search`, operationId `searchCrmRecords`, scope `crm:read`.
200
+ */
201
+ searchRecords(body, options) {
202
+ return this.do('post', '/crm/records/search', { body }, options);
203
+ }
204
+ /**
205
+ * Query records.
206
+ * `POST /crm/records/query`, operationId `queryCrmRecords`, scope `crm:read`.
207
+ */
208
+ queryRecords(body, query, options) {
209
+ return this.do('post', '/crm/records/query', { query, body }, options);
210
+ }
211
+ /**
212
+ * Count records.
213
+ * `POST /crm/records/query/count`, operationId `countCrmRecords`, scope `crm:read`.
214
+ */
215
+ countRecords(body, options) {
216
+ return this.do('post', '/crm/records/query/count', { body }, options);
217
+ }
218
+ /**
219
+ * Count records by stage.
220
+ * `POST /crm/records/query/stage_counts`, operationId `countCrmRecordsByStage`, scope `crm:read`.
221
+ */
222
+ countRecordsByStage(body, options) {
223
+ return this.do('post', '/crm/records/query/stage_counts', { body }, options);
224
+ }
225
+ /**
226
+ * Get a record.
227
+ * `GET /crm/records/{id}`, operationId `getCrmRecord`, scope `crm:read`.
228
+ */
229
+ getRecord(id, options) {
230
+ return this.do('get', '/crm/records/{id}', { path: { id } }, options);
231
+ }
232
+ /**
233
+ * Update a record's fields.
234
+ * `PATCH /crm/records/{id}`, operationId `updateCrmRecord`, scope `crm:write`.
235
+ */
236
+ updateRecord(id, body, options) {
237
+ return this.do('patch', '/crm/records/{id}', { path: { id }, body }, options);
238
+ }
239
+ /**
240
+ * Get a record's timeline.
241
+ * `GET /crm/records/{id}/timeline`, operationId `getCrmRecordTimeline`, scope `crm:read`.
242
+ */
243
+ getRecordTimeline(id, query, options) {
244
+ return this.do('get', '/crm/records/{id}/timeline', { path: { id }, query }, options);
245
+ }
246
+ /**
247
+ * Get a stage gate.
248
+ * `GET /crm/records/{id}/stage_gate`, operationId `getCrmStageGate`, scope `crm:read`.
249
+ */
250
+ getStageGate(id, query, options) {
251
+ return this.do('get', '/crm/records/{id}/stage_gate', { path: { id }, query }, options);
252
+ }
253
+ /**
254
+ * List a record's documents.
255
+ * `GET /crm/records/{id}/documents`, operationId `listCrmRecordDocuments`, scope `crm:read`.
256
+ */
257
+ listRecordDocuments(id, options) {
258
+ return this.do('get', '/crm/records/{id}/documents', { path: { id } }, options);
259
+ }
260
+ /**
261
+ * List a record's files.
262
+ * `GET /crm/records/{id}/files`, operationId `listCrmRecordFiles`, scope `crm:read`.
263
+ */
264
+ listRecordFiles(id, options) {
265
+ return this.do('get', '/crm/records/{id}/files', { path: { id } }, options);
266
+ }
267
+ /**
268
+ * Attach a file.
269
+ * `POST /crm/records/{id}/files`, operationId `attachCrmFile`, scope `crm:docs:write`.
270
+ */
271
+ attachFile(id, body, options) {
272
+ return this.do('post', '/crm/records/{id}/files', { path: { id }, body }, options);
273
+ }
274
+ /**
275
+ * Get a record's forms checklist.
276
+ * `GET /crm/records/{id}/forms_checklist`, operationId `getCrmFormsChecklist`, scope `crm:read`.
277
+ */
278
+ getFormsChecklist(id, options) {
279
+ return this.do('get', '/crm/records/{id}/forms_checklist', { path: { id } }, options);
280
+ }
281
+ /**
282
+ * List a record's form submissions.
283
+ * `GET /crm/records/{id}/submissions`, operationId `listCrmFormSubmissions`, scope `crm:read`.
284
+ */
285
+ listFormSubmissions(id, options) {
286
+ return this.do('get', '/crm/records/{id}/submissions', { path: { id } }, options);
287
+ }
288
+ /**
289
+ * List a record's form drafts.
290
+ * `GET /crm/records/{id}/form_drafts`, operationId `listCrmFormDrafts`, scope `crm:read`.
291
+ */
292
+ listFormDrafts(id, options) {
293
+ return this.do('get', '/crm/records/{id}/form_drafts', { path: { id } }, options);
294
+ }
295
+ /**
296
+ * List forms.
297
+ * `GET /crm/forms`, operationId `listCrmForms`, scope `crm:read`.
298
+ */
299
+ listForms(options) {
300
+ return this.do('get', '/crm/forms', {}, options);
301
+ }
302
+ /**
303
+ * List follow-ups.
304
+ * `GET /crm/follow_ups`, operationId `listCrmFollowUps`, scope `crm:read`.
305
+ */
306
+ listFollowUps(query, options) {
307
+ return this.do('get', '/crm/follow_ups', { query }, options);
308
+ }
309
+ /** Every item of `listFollowUps`, page by page (follows `next_cursor`). */
310
+ listAllFollowUps(query, options) {
311
+ return this.pager('/crm/follow_ups', cursorStrategy('data'), query, undefined, options);
312
+ }
313
+ /**
314
+ * Get follow-up counts.
315
+ * `GET /crm/follow_ups/stats`, operationId `getCrmFollowUpStats`, scope `crm:read`.
316
+ */
317
+ getFollowUpStats(query, options) {
318
+ return this.do('get', '/crm/follow_ups/stats', { query }, options);
319
+ }
320
+ /**
321
+ * Get my work.
322
+ * `GET /crm/my_work`, operationId `getCrmMyWork`, scope `crm:read`.
323
+ */
324
+ getMyWork(options) {
325
+ return this.do('get', '/crm/my_work', {}, options);
326
+ }
327
+ /**
328
+ * List saved views.
329
+ * `GET /crm/views`, operationId `listCrmViews`, scope `crm:read`.
330
+ */
331
+ listViews(options) {
332
+ return this.do('get', '/crm/views', {}, options);
333
+ }
334
+ /**
335
+ * Save a view.
336
+ * `POST /crm/views`, operationId `saveCrmView`, scope `crm:write`.
337
+ */
338
+ saveView(body, options) {
339
+ return this.do('post', '/crm/views', { body }, options);
340
+ }
341
+ /**
342
+ * Get the pipeline summary.
343
+ * `GET /crm/summary`, operationId `getCrmSummary`, scope `crm:read`.
344
+ */
345
+ getSummary(options) {
346
+ return this.do('get', '/crm/summary', {}, options);
347
+ }
348
+ /**
349
+ * Get counts per stage.
350
+ * `GET /crm/stage_counts`, operationId `getCrmStageCounts`, scope `crm:read`.
351
+ */
352
+ getStageCounts(options) {
353
+ return this.do('get', '/crm/stage_counts', {}, options);
354
+ }
355
+ /**
356
+ * Get speed to lead.
357
+ * `GET /crm/speed`, operationId `getCrmSpeed`, scope `crm:read`.
358
+ */
359
+ getSpeed(query, options) {
360
+ return this.do('get', '/crm/speed', { query }, options);
361
+ }
362
+ /**
363
+ * Find duplicates.
364
+ * `GET /crm/duplicates`, operationId `listCrmDuplicates`, scope `crm:read`.
365
+ */
366
+ listDuplicates(options) {
367
+ return this.do('get', '/crm/duplicates', {}, options);
368
+ }
369
+ /**
370
+ * Ask the CRM.
371
+ * `POST /crm/ask`, operationId `askCrm`, scope `crm:read`.
372
+ */
373
+ ask(body, options) {
374
+ return this.do('post', '/crm/ask', { body }, options);
375
+ }
376
+ /**
377
+ * Add a note.
378
+ * `POST /crm/records/{id}/notes`, operationId `addCrmNote`, scope `crm:write`.
379
+ */
380
+ addNote(id, body, options) {
381
+ return this.do('post', '/crm/records/{id}/notes', { path: { id }, body }, options);
382
+ }
383
+ /**
384
+ * Create a follow-up.
385
+ * `POST /crm/records/{id}/follow_ups`, operationId `createCrmFollowUp`, scope `crm:write`.
386
+ */
387
+ createFollowUp(id, body, options) {
388
+ return this.do('post', '/crm/records/{id}/follow_ups', { path: { id }, body }, options);
389
+ }
390
+ /**
391
+ * Update a follow-up.
392
+ * `PATCH /crm/follow_ups/{id}`, operationId `updateCrmFollowUp`, scope `crm:write`.
393
+ */
394
+ updateFollowUp(id, body, options) {
395
+ return this.do('patch', '/crm/follow_ups/{id}', { path: { id }, body }, options);
396
+ }
397
+ /**
398
+ * Create a record.
399
+ * `POST /crm/records`, operationId `createCrmRecord`, scope `crm:write`.
400
+ */
401
+ createRecord(body, options) {
402
+ return this.do('post', '/crm/records', { body }, options);
403
+ }
404
+ /**
405
+ * Tick a stage check.
406
+ * `PUT /crm/records/{id}/stage_checks/{stage}/{check}`, operationId `setCrmStageCheck`, scope `crm:write`.
407
+ */
408
+ setStageCheck(id, stage, check, body, options) {
409
+ return this.do('put', '/crm/records/{id}/stage_checks/{stage}/{check}', { path: { id, stage, check }, body }, options);
410
+ }
411
+ /**
412
+ * Assign a reference number.
413
+ * `POST /crm/records/{id}/ref_no`, operationId `assignCrmReferenceNo`, scope `crm:write`.
414
+ */
415
+ assignReferenceNo(id, options) {
416
+ return this.do('post', '/crm/records/{id}/ref_no', { path: { id } }, options);
417
+ }
418
+ /**
419
+ * Set a document status.
420
+ * `POST /crm/records/{id}/documents/{type}/status`, operationId `setCrmDocumentStatus`, scope `crm:write`.
421
+ */
422
+ setDocumentStatus(id, type, body, options) {
423
+ return this.do('post', '/crm/records/{id}/documents/{type}/status', { path: { id, type }, body }, options);
424
+ }
425
+ /**
426
+ * Save a form draft.
427
+ * `PUT /crm/records/{id}/forms/{form_id}/draft`, operationId `saveCrmFormDraft`, scope `crm:write`.
428
+ */
429
+ saveFormDraft(id, formId, body, options) {
430
+ return this.do('put', '/crm/records/{id}/forms/{form_id}/draft', { path: { id, form_id: formId }, body }, options);
431
+ }
432
+ /**
433
+ * Draft a document.
434
+ * `POST /crm/records/{id}/doc_drafts`, operationId `draftCrmDocument`, scope `crm:write`.
435
+ */
436
+ draftDocument(id, body, options) {
437
+ return this.do('post', '/crm/records/{id}/doc_drafts', { path: { id }, body }, options);
438
+ }
439
+ /**
440
+ * Move a record to another stage.
441
+ * `POST /crm/records/{id}/stage_moves`, operationId `moveCrmRecordStage`, scope `crm:stage`.
442
+ * May answer `pending_approval` (see isPendingApproval).
443
+ */
444
+ moveRecordStage(id, body, options) {
445
+ return this.do('post', '/crm/records/{id}/stage_moves', { path: { id }, body }, options);
446
+ }
447
+ /**
448
+ * Submit a form.
449
+ * `POST /crm/records/{id}/forms/{form_id}/submissions`, operationId `submitCrmForm`, scope `crm:stage`.
450
+ * May answer `pending_approval` (see isPendingApproval).
451
+ */
452
+ submitForm(id, formId, body, options) {
453
+ return this.do('post', '/crm/records/{id}/forms/{form_id}/submissions', { path: { id, form_id: formId }, body }, options);
454
+ }
455
+ /**
456
+ * Share a form link.
457
+ * `POST /crm/records/{id}/forms/{form_id}/links`, operationId `createCrmFormLink`, scope `crm:share`.
458
+ * May answer `pending_approval` (see isPendingApproval).
459
+ */
460
+ createFormLink(id, formId, body, options) {
461
+ return this.do('post', '/crm/records/{id}/forms/{form_id}/links', { path: { id, form_id: formId }, body }, options);
462
+ }
463
+ /**
464
+ * Share an upload link.
465
+ * `POST /crm/records/{id}/upload_links`, operationId `createCrmUploadLink`, scope `crm:share`.
466
+ * May answer `pending_approval` (see isPendingApproval).
467
+ */
468
+ createUploadLink(id, body, options) {
469
+ return this.do('post', '/crm/records/{id}/upload_links', { path: { id }, body }, options);
470
+ }
471
+ /**
472
+ * Map import columns.
473
+ * `POST /crm/imports/columns`, operationId `guessCrmImportColumns`, scope `crm:import`.
474
+ */
475
+ guessImportColumns(body, options) {
476
+ return this.do('post', '/crm/imports/columns', { body }, options);
477
+ }
478
+ /**
479
+ * Import records.
480
+ * `POST /crm/imports`, operationId `importCrmRecords`, scope `crm:import`.
481
+ * May answer `pending_approval` (see isPendingApproval).
482
+ */
483
+ importRecords(body, options) {
484
+ return this.do('post', '/crm/imports', { body }, options);
485
+ }
486
+ }
487
+ /**
488
+ * Dialer sessions, analytics, follow-ups and lead briefs (`/dialer`). Reached as `finn.dialer`.
489
+ */
490
+ export class Dialer extends Resource {
491
+ /**
492
+ * List dialer sessions.
493
+ * `GET /dialer/sessions`, operationId `listDialerSessions`, scope `dialer:read`.
494
+ */
495
+ listSessions(query, options) {
496
+ return this.do('get', '/dialer/sessions', { query }, options);
497
+ }
498
+ /** Every item of `listSessions`, page by page (follows `next_cursor`). */
499
+ listAllSessions(query, options) {
500
+ return this.pager('/dialer/sessions', cursorStrategy('data'), query, undefined, options);
501
+ }
502
+ /**
503
+ * Get a dialer session.
504
+ * `GET /dialer/sessions/{id}`, operationId `getDialerSession`, scope `dialer:read`.
505
+ */
506
+ getSession(id, options) {
507
+ return this.do('get', '/dialer/sessions/{id}', { path: { id } }, options);
508
+ }
509
+ /**
510
+ * Dialer analytics.
511
+ * `GET /dialer/analytics`, operationId `getDialerAnalytics`, scope `dialer:read`.
512
+ */
513
+ getAnalytics(query, options) {
514
+ return this.do('get', '/dialer/analytics', { query }, options);
515
+ }
516
+ /**
517
+ * List dialer follow-ups.
518
+ * `GET /dialer/follow-ups`, operationId `listDialerFollowUps`, scope `dialer:read`.
519
+ */
520
+ listFollowUps(options) {
521
+ return this.do('get', '/dialer/follow-ups', {}, options);
522
+ }
523
+ /**
524
+ * Get a lead's cached brief.
525
+ * `GET /dialer/leads/{id}/brief`, operationId `getDialerLeadBrief`, scope `dialer:read`.
526
+ */
527
+ getLeadBrief(id, query, options) {
528
+ return this.do('get', '/dialer/leads/{id}/brief', { path: { id }, query }, options);
529
+ }
530
+ }
531
+ /**
532
+ * Webhook endpoints, their deliveries, and the event types (`/webhook_endpoints`, `/events`). Reached as `finn.webhooks`.
533
+ */
534
+ export class Webhooks extends Resource {
535
+ /**
536
+ * List webhook endpoints.
537
+ * `GET /webhook_endpoints`, operationId `listWebhookEndpoints`, scope `admin:webhooks`.
538
+ */
539
+ listEndpoints(query, options) {
540
+ return this.do('get', '/webhook_endpoints', { query }, options);
541
+ }
542
+ /** Every item of `listEndpoints`, page by page (follows `next_cursor`). */
543
+ listAllEndpoints(query, options) {
544
+ return this.pager('/webhook_endpoints', cursorStrategy('data'), query, undefined, options);
545
+ }
546
+ /**
547
+ * Create a webhook endpoint.
548
+ * `POST /webhook_endpoints`, operationId `createWebhookEndpoint`, scope `admin:webhooks`.
549
+ */
550
+ createEndpoint(body, options) {
551
+ return this.do('post', '/webhook_endpoints', { body }, options);
552
+ }
553
+ /**
554
+ * Get a webhook endpoint.
555
+ * `GET /webhook_endpoints/{id}`, operationId `getWebhookEndpoint`, scope `admin:webhooks`.
556
+ */
557
+ getEndpoint(id, options) {
558
+ return this.do('get', '/webhook_endpoints/{id}', { path: { id } }, options);
559
+ }
560
+ /**
561
+ * Update, enable or disable a webhook endpoint.
562
+ * `PATCH /webhook_endpoints/{id}`, operationId `updateWebhookEndpoint`, scope `admin:webhooks`.
563
+ */
564
+ updateEndpoint(id, body, options) {
565
+ return this.do('patch', '/webhook_endpoints/{id}', { path: { id }, body }, options);
566
+ }
567
+ /**
568
+ * Delete a webhook endpoint.
569
+ * `DELETE /webhook_endpoints/{id}`, operationId `deleteWebhookEndpoint`, scope `admin:webhooks`.
570
+ */
571
+ deleteEndpoint(id, options) {
572
+ return this.do('delete', '/webhook_endpoints/{id}', { path: { id } }, options);
573
+ }
574
+ /**
575
+ * List an endpoint's deliveries.
576
+ * `GET /webhook_endpoints/{id}/deliveries`, operationId `listWebhookDeliveries`, scope `admin:webhooks`.
577
+ */
578
+ listDeliveries(id, query, options) {
579
+ return this.do('get', '/webhook_endpoints/{id}/deliveries', { path: { id }, query }, options);
580
+ }
581
+ /** Every item of `listDeliveries`, page by page (follows `next_cursor`). */
582
+ listAllDeliveries(id, query, options) {
583
+ return this.pager('/webhook_endpoints/{id}/deliveries', cursorStrategy('data'), query, { id }, options);
584
+ }
585
+ /**
586
+ * List webhook events.
587
+ * `GET /events`, operationId `listEventTypes`, scope `admin:webhooks`.
588
+ */
589
+ listEventTypes(options) {
590
+ return this.do('get', '/events', {}, options);
591
+ }
592
+ }
593
+ /**
594
+ * The organization, its members, integrations and API keys (read only). Reached as `finn.organization`.
595
+ */
596
+ export class Organization extends Resource {
597
+ /**
598
+ * Get the organization.
599
+ * `GET /organization`, operationId `getOrganization`, scope `admin:read`.
600
+ */
601
+ get(options) {
602
+ return this.do('get', '/organization', {}, options);
603
+ }
604
+ /**
605
+ * List members.
606
+ * `GET /organization/members`, operationId `listOrganizationMembers`, scope `admin:read`.
607
+ */
608
+ listMembers(query, options) {
609
+ return this.do('get', '/organization/members', { query }, options);
610
+ }
611
+ /** Every item of `listMembers`, page by page (follows `next_cursor`). */
612
+ listAllMembers(query, options) {
613
+ return this.pager('/organization/members', cursorStrategy('data'), query, undefined, options);
614
+ }
615
+ /**
616
+ * List integrations.
617
+ * `GET /organization/integrations`, operationId `listOrganizationIntegrations`, scope `admin:read`.
618
+ */
619
+ listIntegrations(query, options) {
620
+ return this.do('get', '/organization/integrations', { query }, options);
621
+ }
622
+ /** Every item of `listIntegrations`, page by page (follows `next_cursor`). */
623
+ listAllIntegrations(query, options) {
624
+ return this.pager('/organization/integrations', cursorStrategy('data'), query, undefined, options);
625
+ }
626
+ /**
627
+ * List API keys.
628
+ * `GET /organization/api_keys`, operationId `listOrganizationApiKeys`, scope `admin:read`.
629
+ */
630
+ listApiKeys(query, options) {
631
+ return this.do('get', '/organization/api_keys', { query }, options);
632
+ }
633
+ /** Every item of `listApiKeys`, page by page (follows `next_cursor`). */
634
+ listAllApiKeys(query, options) {
635
+ return this.pager('/organization/api_keys', cursorStrategy('data'), query, undefined, options);
636
+ }
637
+ }
638
+ /**
639
+ * Sales plays, prospects, drafts and threads (`/sales`). Reached as `finn.sales`.
640
+ *
641
+ * @experimental The Sales API is switched off for every organization, so these calls answer an error until it is switched on for yours. Names and shapes may change without a major version.
642
+ */
643
+ export class Sales extends Resource {
644
+ /**
645
+ * List Sales AI plays.
646
+ * `GET /sales/plays`, operationId `listSalesPlays`, scope `sales:read`.
647
+ * @experimental The Sales API is switched off for every organization, so these calls answer an error until it is switched on for yours. Names and shapes may change without a major version.
648
+ */
649
+ listPlays(options) {
650
+ return this.do('get', '/sales/plays', {}, options);
651
+ }
652
+ /**
653
+ * List a play's runs.
654
+ * `GET /sales/plays/{slug}/runs`, operationId `listSalesPlayRuns`, scope `sales:read`.
655
+ * @experimental The Sales API is switched off for every organization, so these calls answer an error until it is switched on for yours. Names and shapes may change without a major version.
656
+ */
657
+ listPlayRuns(slug, query, options) {
658
+ return this.do('get', '/sales/plays/{slug}/runs', { path: { slug }, query }, options);
659
+ }
660
+ /**
661
+ * List a play's prospects.
662
+ * `GET /sales/plays/{slug}/prospects`, operationId `listSalesProspects`, scope `sales:read`.
663
+ * @experimental The Sales API is switched off for every organization, so these calls answer an error until it is switched on for yours. Names and shapes may change without a major version.
664
+ */
665
+ listProspects(slug, query, options) {
666
+ return this.do('get', '/sales/plays/{slug}/prospects', { path: { slug }, query }, options);
667
+ }
668
+ /**
669
+ * Run a play.
670
+ * `POST /sales/plays/{slug}/run`, operationId `runSalesPlay`, scope `sales:write`.
671
+ * @experimental The Sales API is switched off for every organization, so these calls answer an error until it is switched on for yours. Names and shapes may change without a major version.
672
+ */
673
+ runPlay(slug, options) {
674
+ return this.do('post', '/sales/plays/{slug}/run', { path: { slug } }, options);
675
+ }
676
+ /**
677
+ * List drafts.
678
+ * `GET /sales/drafts`, operationId `listSalesDrafts`, scope `sales:read`.
679
+ * @experimental The Sales API is switched off for every organization, so these calls answer an error until it is switched on for yours. Names and shapes may change without a major version.
680
+ */
681
+ listDrafts(query, options) {
682
+ return this.do('get', '/sales/drafts', { query }, options);
683
+ }
684
+ /**
685
+ * Edit a draft.
686
+ * `PATCH /sales/drafts/{id}`, operationId `updateSalesDraft`, scope `sales:write`.
687
+ * @experimental The Sales API is switched off for every organization, so these calls answer an error until it is switched on for yours. Names and shapes may change without a major version.
688
+ */
689
+ updateDraft(id, body, options) {
690
+ return this.do('patch', '/sales/drafts/{id}', { path: { id }, body }, options);
691
+ }
692
+ /**
693
+ * Skip a draft.
694
+ * `POST /sales/drafts/{id}/skip`, operationId `skipSalesDraft`, scope `sales:write`.
695
+ * @experimental The Sales API is switched off for every organization, so these calls answer an error until it is switched on for yours. Names and shapes may change without a major version.
696
+ */
697
+ skipDraft(id, body, options) {
698
+ return this.do('post', '/sales/drafts/{id}/skip', { path: { id }, body }, options);
699
+ }
700
+ /**
701
+ * List threads.
702
+ * `GET /sales/threads`, operationId `listSalesThreads`, scope `sales:read`.
703
+ * @experimental The Sales API is switched off for every organization, so these calls answer an error until it is switched on for yours. Names and shapes may change without a major version.
704
+ */
705
+ listThreads(query, options) {
706
+ return this.do('get', '/sales/threads', { query }, options);
707
+ }
708
+ /**
709
+ * Get a thread.
710
+ * `GET /sales/threads/{id}`, operationId `getSalesThread`, scope `sales:read`.
711
+ * @experimental The Sales API is switched off for every organization, so these calls answer an error until it is switched on for yours. Names and shapes may change without a major version.
712
+ */
713
+ getThread(id, options) {
714
+ return this.do('get', '/sales/threads/{id}', { path: { id } }, options);
715
+ }
716
+ }