@hirefinn/sdk 0.2.0 → 0.4.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/README.md +63 -13
- package/dist/cjs/client.d.ts +13 -1
- package/dist/cjs/client.js +5 -0
- package/dist/cjs/core.d.ts +16 -3
- package/dist/cjs/core.js +25 -6
- package/dist/cjs/errors.d.ts +1 -1
- package/dist/cjs/errors.js +11 -0
- package/dist/cjs/generated/openapi.d.ts +19867 -5738
- package/dist/cjs/generated/operations.d.ts +26 -0
- package/dist/cjs/generated/operations.js +176 -0
- package/dist/cjs/generated/resources.d.ts +1050 -0
- package/dist/cjs/generated/resources.js +816 -0
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/pagination.d.ts +3 -0
- package/dist/cjs/pagination.js +26 -5
- package/dist/cjs/resource.d.ts +30 -0
- package/dist/cjs/resource.js +23 -0
- package/dist/cjs/resources.d.ts +64 -57
- package/dist/cjs/resources.js +31 -36
- package/dist/cjs/types.d.ts +11 -3
- package/dist/cjs/webhooks.d.ts +11 -1
- package/dist/esm/client.d.ts +13 -1
- package/dist/esm/client.js +6 -1
- package/dist/esm/core.d.ts +16 -3
- package/dist/esm/core.js +24 -5
- package/dist/esm/errors.d.ts +1 -1
- package/dist/esm/errors.js +11 -0
- package/dist/esm/generated/openapi.d.ts +19867 -5738
- package/dist/esm/generated/operations.d.ts +26 -0
- package/dist/esm/generated/operations.js +173 -0
- package/dist/esm/generated/resources.d.ts +1050 -0
- package/dist/esm/generated/resources.js +795 -0
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +2 -2
- package/dist/esm/pagination.d.ts +3 -0
- package/dist/esm/pagination.js +25 -5
- package/dist/esm/resource.d.ts +30 -0
- package/dist/esm/resource.js +19 -0
- package/dist/esm/resources.d.ts +64 -57
- package/dist/esm/resources.js +24 -34
- package/dist/esm/types.d.ts +11 -3
- package/dist/esm/webhooks.d.ts +11 -1
- package/package.json +2 -1
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
export { Finn } from './client.js';
|
|
2
2
|
export { Finn as default } from './client.js';
|
|
3
|
-
export { FinnCore, DEFAULT_BASE_URL, SDK_VERSION, AUTO_IDEMPOTENCY_ROUTES, IDEMPOTENT_WRITE_ROUTES, honoursIdempotencyKey, idempotencyKey, } from './core.js';
|
|
3
|
+
export { FinnCore, DEFAULT_BASE_URL, SDK_VERSION, DEFAULT_FINN_VERSION, AUTO_IDEMPOTENCY_ROUTES, IDEMPOTENT_WRITE_ROUTES, honoursIdempotencyKey, idempotencyKey, DEFAULT_MAX_RETRY_WAIT_MS, } from './core.js';
|
|
4
4
|
export { verifyWebhook, signWebhookPayload, parseSignatureHeader, timingSafeEqual, FinnWebhookVerificationError, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_EVENT_HEADER, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, } from './webhooks.js';
|
|
5
5
|
export type { VerifyWebhookOptions, WebhookEvent } from './webhooks.js';
|
|
6
6
|
export type { FinnOptions, RawRequest } from './core.js';
|
|
7
7
|
export { FinnSdkError, FinnError, FinnConnectionError, FinnTimeoutError, FinnApprovalTimeoutError, codeForStatus, parseRetryAfterSeconds, } from './errors.js';
|
|
8
8
|
export type { FinnErrorCode, FinnFieldError } from './errors.js';
|
|
9
9
|
export { isPendingApproval } from './approval.js';
|
|
10
|
-
export { Paginator, cursorStrategy, offsetStrategy, pageStrategy, beforeStrategy } from './pagination.js';
|
|
10
|
+
export { Paginator, cursorStrategy, offsetStrategy, pageStrategy, beforeStrategy, afterStrategy } from './pagination.js';
|
|
11
11
|
export type { PageStrategy } from './pagination.js';
|
|
12
12
|
export * from './resources.js';
|
|
13
13
|
export type { ApprovalHold, BodyOf, FinnResponse, HoldAction, HoldStatus, HoldableRoute, HttpMethod, Operation, PathParamsOf, PathsFor, PendingApproval, QueryOf, RequestOptions, RequestParams, ResponseOf, ResultOf, Schemas, components, operations, paths, } from './types.js';
|
package/dist/cjs/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.beforeStrategy = exports.pageStrategy = exports.offsetStrategy = exports.cursorStrategy = exports.Paginator = exports.isPendingApproval = exports.parseRetryAfterSeconds = exports.codeForStatus = exports.FinnApprovalTimeoutError = exports.FinnTimeoutError = exports.FinnConnectionError = exports.FinnError = exports.FinnSdkError = exports.DEFAULT_WEBHOOK_TOLERANCE_SECONDS = exports.WEBHOOK_EVENT_HEADER = exports.WEBHOOK_SIGNATURE_HEADER = exports.FinnWebhookVerificationError = exports.timingSafeEqual = exports.parseSignatureHeader = exports.signWebhookPayload = exports.verifyWebhook = exports.idempotencyKey = exports.honoursIdempotencyKey = exports.IDEMPOTENT_WRITE_ROUTES = exports.AUTO_IDEMPOTENCY_ROUTES = exports.SDK_VERSION = exports.DEFAULT_BASE_URL = exports.FinnCore = exports.default = exports.Finn = void 0;
|
|
17
|
+
exports.afterStrategy = exports.beforeStrategy = exports.pageStrategy = exports.offsetStrategy = exports.cursorStrategy = exports.Paginator = exports.isPendingApproval = exports.parseRetryAfterSeconds = exports.codeForStatus = exports.FinnApprovalTimeoutError = exports.FinnTimeoutError = exports.FinnConnectionError = exports.FinnError = exports.FinnSdkError = exports.DEFAULT_WEBHOOK_TOLERANCE_SECONDS = exports.WEBHOOK_EVENT_HEADER = exports.WEBHOOK_SIGNATURE_HEADER = exports.FinnWebhookVerificationError = exports.timingSafeEqual = exports.parseSignatureHeader = exports.signWebhookPayload = exports.verifyWebhook = exports.DEFAULT_MAX_RETRY_WAIT_MS = exports.idempotencyKey = exports.honoursIdempotencyKey = exports.IDEMPOTENT_WRITE_ROUTES = exports.AUTO_IDEMPOTENCY_ROUTES = exports.DEFAULT_FINN_VERSION = exports.SDK_VERSION = exports.DEFAULT_BASE_URL = exports.FinnCore = exports.default = exports.Finn = void 0;
|
|
18
18
|
var client_js_1 = require("./client.js");
|
|
19
19
|
Object.defineProperty(exports, "Finn", { enumerable: true, get: function () { return client_js_1.Finn; } });
|
|
20
20
|
var client_js_2 = require("./client.js");
|
|
@@ -23,10 +23,12 @@ var core_js_1 = require("./core.js");
|
|
|
23
23
|
Object.defineProperty(exports, "FinnCore", { enumerable: true, get: function () { return core_js_1.FinnCore; } });
|
|
24
24
|
Object.defineProperty(exports, "DEFAULT_BASE_URL", { enumerable: true, get: function () { return core_js_1.DEFAULT_BASE_URL; } });
|
|
25
25
|
Object.defineProperty(exports, "SDK_VERSION", { enumerable: true, get: function () { return core_js_1.SDK_VERSION; } });
|
|
26
|
+
Object.defineProperty(exports, "DEFAULT_FINN_VERSION", { enumerable: true, get: function () { return core_js_1.DEFAULT_FINN_VERSION; } });
|
|
26
27
|
Object.defineProperty(exports, "AUTO_IDEMPOTENCY_ROUTES", { enumerable: true, get: function () { return core_js_1.AUTO_IDEMPOTENCY_ROUTES; } });
|
|
27
28
|
Object.defineProperty(exports, "IDEMPOTENT_WRITE_ROUTES", { enumerable: true, get: function () { return core_js_1.IDEMPOTENT_WRITE_ROUTES; } });
|
|
28
29
|
Object.defineProperty(exports, "honoursIdempotencyKey", { enumerable: true, get: function () { return core_js_1.honoursIdempotencyKey; } });
|
|
29
30
|
Object.defineProperty(exports, "idempotencyKey", { enumerable: true, get: function () { return core_js_1.idempotencyKey; } });
|
|
31
|
+
Object.defineProperty(exports, "DEFAULT_MAX_RETRY_WAIT_MS", { enumerable: true, get: function () { return core_js_1.DEFAULT_MAX_RETRY_WAIT_MS; } });
|
|
30
32
|
var webhooks_js_1 = require("./webhooks.js");
|
|
31
33
|
Object.defineProperty(exports, "verifyWebhook", { enumerable: true, get: function () { return webhooks_js_1.verifyWebhook; } });
|
|
32
34
|
Object.defineProperty(exports, "signWebhookPayload", { enumerable: true, get: function () { return webhooks_js_1.signWebhookPayload; } });
|
|
@@ -52,4 +54,5 @@ Object.defineProperty(exports, "cursorStrategy", { enumerable: true, get: functi
|
|
|
52
54
|
Object.defineProperty(exports, "offsetStrategy", { enumerable: true, get: function () { return pagination_js_1.offsetStrategy; } });
|
|
53
55
|
Object.defineProperty(exports, "pageStrategy", { enumerable: true, get: function () { return pagination_js_1.pageStrategy; } });
|
|
54
56
|
Object.defineProperty(exports, "beforeStrategy", { enumerable: true, get: function () { return pagination_js_1.beforeStrategy; } });
|
|
57
|
+
Object.defineProperty(exports, "afterStrategy", { enumerable: true, get: function () { return pagination_js_1.afterStrategy; } });
|
|
55
58
|
__exportStar(require("./resources.js"), exports);
|
package/dist/cjs/pagination.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
* - offset (older voice lists: calls, finns, audiences, ...): `?limit=&offset=` → `{ data, limit, offset, total? }`
|
|
6
6
|
* - page (contacts): `?page=&page_size=` → `{ contacts, page, totalPages }`
|
|
7
7
|
* - before (cases, timeline): `?before=` → `{ cases, next_before }` or `{ items, next }`
|
|
8
|
+
* - after (case events): `?after=&limit=` → `{ events, next_after }`
|
|
8
9
|
*
|
|
9
10
|
* for await (const call of finn.calls.listAll({ status: 'completed' })) { ... }
|
|
10
11
|
* for await (const page of finn.calls.listAll().pages()) { ... }
|
|
@@ -33,4 +34,6 @@ export declare function offsetStrategy<Item>(key?: string): PageStrategy<unknown
|
|
|
33
34
|
export declare function pageStrategy<Item>(key: string): PageStrategy<unknown, Item>;
|
|
34
35
|
/** `?before=` lists answering `{ [key], [nextKey] }`. */
|
|
35
36
|
export declare function beforeStrategy<Item>(key: string, nextKey: string): PageStrategy<unknown, Item>;
|
|
37
|
+
/** `?after=` lists answering `{ [key], [nextKey] }`, where `nextKey` is the last sequence number on the page. */
|
|
38
|
+
export declare function afterStrategy<Item>(key: string, nextKey: string): PageStrategy<unknown, Item>;
|
|
36
39
|
export {};
|
package/dist/cjs/pagination.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* - offset (older voice lists: calls, finns, audiences, ...): `?limit=&offset=` → `{ data, limit, offset, total? }`
|
|
7
7
|
* - page (contacts): `?page=&page_size=` → `{ contacts, page, totalPages }`
|
|
8
8
|
* - before (cases, timeline): `?before=` → `{ cases, next_before }` or `{ items, next }`
|
|
9
|
+
* - after (case events): `?after=&limit=` → `{ events, next_after }`
|
|
9
10
|
*
|
|
10
11
|
* for await (const call of finn.calls.listAll({ status: 'completed' })) { ... }
|
|
11
12
|
* for await (const page of finn.calls.listAll().pages()) { ... }
|
|
@@ -28,6 +29,7 @@ exports.cursorStrategy = cursorStrategy;
|
|
|
28
29
|
exports.offsetStrategy = offsetStrategy;
|
|
29
30
|
exports.pageStrategy = pageStrategy;
|
|
30
31
|
exports.beforeStrategy = beforeStrategy;
|
|
32
|
+
exports.afterStrategy = afterStrategy;
|
|
31
33
|
class Paginator {
|
|
32
34
|
constructor(fetchPage, strategy, query = {}) {
|
|
33
35
|
_Paginator_fetchPage.set(this, void 0);
|
|
@@ -43,8 +45,9 @@ class Paginator {
|
|
|
43
45
|
while (query) {
|
|
44
46
|
const res = await __classPrivateFieldGet(this, _Paginator_fetchPage, "f").call(this, query);
|
|
45
47
|
yield res;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
+
// An empty page ends the list only when the strategy finds no next page: the API filters some lists after
|
|
49
|
+
// paging (hidden cases, chat notes), so a page can come back empty with a cursor that still moves on.
|
|
50
|
+
query = __classPrivateFieldGet(this, _Paginator_strategy, "f").next(res, query, __classPrivateFieldGet(this, _Paginator_strategy, "f").items(res).length);
|
|
48
51
|
}
|
|
49
52
|
}
|
|
50
53
|
async *[(_Paginator_fetchPage = new WeakMap(), _Paginator_strategy = new WeakMap(), _Paginator_query = new WeakMap(), Symbol.asyncIterator)]() {
|
|
@@ -74,7 +77,7 @@ function cursorStrategy(key = 'data') {
|
|
|
74
77
|
next: (res, query) => {
|
|
75
78
|
const r = rec(res);
|
|
76
79
|
const cursor = r.next_cursor;
|
|
77
|
-
if (r.has_more === false || typeof cursor !== 'string' || cursor === '')
|
|
80
|
+
if (r.has_more === false || typeof cursor !== 'string' || cursor === '' || cursor === query.cursor)
|
|
78
81
|
return null;
|
|
79
82
|
return { ...query, cursor };
|
|
80
83
|
},
|
|
@@ -85,6 +88,8 @@ function offsetStrategy(key = 'data') {
|
|
|
85
88
|
return {
|
|
86
89
|
items: (res) => arr(rec(res)[key]),
|
|
87
90
|
next: (res, query, count) => {
|
|
91
|
+
if (count === 0)
|
|
92
|
+
return null;
|
|
88
93
|
const r = rec(res);
|
|
89
94
|
const offset = typeof r.offset === 'number' ? r.offset : Number(query.offset ?? 0);
|
|
90
95
|
const limit = typeof r.limit === 'number' ? r.limit : Number(query.limit ?? count);
|
|
@@ -101,7 +106,9 @@ function offsetStrategy(key = 'data') {
|
|
|
101
106
|
function pageStrategy(key) {
|
|
102
107
|
return {
|
|
103
108
|
items: (res) => arr(rec(res)[key]),
|
|
104
|
-
next: (res, query) => {
|
|
109
|
+
next: (res, query, count) => {
|
|
110
|
+
if (count === 0)
|
|
111
|
+
return null;
|
|
105
112
|
const r = rec(res);
|
|
106
113
|
const page = typeof r.page === 'number' ? r.page : Number(query.page ?? 1);
|
|
107
114
|
if (typeof r.totalPages === 'number' && page >= r.totalPages)
|
|
@@ -116,9 +123,23 @@ function beforeStrategy(key, nextKey) {
|
|
|
116
123
|
items: (res) => arr(rec(res)[key]),
|
|
117
124
|
next: (res, query) => {
|
|
118
125
|
const next = rec(res)[nextKey];
|
|
119
|
-
if (next === null || next === undefined || next === '')
|
|
126
|
+
if (next === null || next === undefined || next === '' || String(next) === String(query.before ?? ''))
|
|
120
127
|
return null;
|
|
121
128
|
return { ...query, before: next };
|
|
122
129
|
},
|
|
123
130
|
};
|
|
124
131
|
}
|
|
132
|
+
/** `?after=` lists answering `{ [key], [nextKey] }`, where `nextKey` is the last sequence number on the page. */
|
|
133
|
+
function afterStrategy(key, nextKey) {
|
|
134
|
+
return {
|
|
135
|
+
items: (res) => arr(rec(res)[key]),
|
|
136
|
+
next: (res, query, count) => {
|
|
137
|
+
const next = rec(res)[nextKey];
|
|
138
|
+
if (typeof next !== 'number' || String(next) === String(query.after ?? ''))
|
|
139
|
+
return null;
|
|
140
|
+
if (query.limit !== undefined && count < Number(query.limit))
|
|
141
|
+
return null;
|
|
142
|
+
return { ...query, after: next };
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The base class of every resource (hand-written in resources.ts and generated in generated/resources.ts), and the
|
|
3
|
+
* type shorthands their method signatures use.
|
|
4
|
+
*/
|
|
5
|
+
import type { FinnCore } from './core.js';
|
|
6
|
+
import { Paginator, type PageStrategy } from './pagination.js';
|
|
7
|
+
import type { BodyOf, HttpMethod, Operation, PathsFor, QueryOf, RequestOptions, ResultOf, paths } from './types.js';
|
|
8
|
+
/** The query of (P, M). */
|
|
9
|
+
export type Q<P extends keyof paths, M extends HttpMethod> = QueryOf<Operation<P, M>>;
|
|
10
|
+
/** The request body of (P, M). */
|
|
11
|
+
export type B<P extends keyof paths, M extends HttpMethod> = BodyOf<Operation<P, M>>;
|
|
12
|
+
/** What a method calling (P, M) resolves to. */
|
|
13
|
+
export type R<P extends keyof paths, M extends HttpMethod> = ResultOf<P & string, M, Operation<P, M>>;
|
|
14
|
+
/** The item type of a `{ data: Item[] }` list answer, or unknown. */
|
|
15
|
+
export type DataItem<T> = T extends {
|
|
16
|
+
data?: (infer I)[] | null;
|
|
17
|
+
} ? I : unknown;
|
|
18
|
+
export type Id = string;
|
|
19
|
+
interface Params {
|
|
20
|
+
path?: Record<string, string | number>;
|
|
21
|
+
query?: unknown;
|
|
22
|
+
body?: unknown;
|
|
23
|
+
}
|
|
24
|
+
export declare abstract class Resource {
|
|
25
|
+
protected readonly core: FinnCore;
|
|
26
|
+
constructor(core: FinnCore);
|
|
27
|
+
protected do<M extends HttpMethod, P extends PathsFor<M>>(method: M, path: P, params?: Params, options?: RequestOptions): Promise<R<P, M>>;
|
|
28
|
+
protected pager<Item>(path: PathsFor<'get'>, strategy: PageStrategy<unknown, Item>, query: unknown, pathParams?: Record<string, string>, options?: RequestOptions): Paginator<Item>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Resource = void 0;
|
|
4
|
+
const pagination_js_1 = require("./pagination.js");
|
|
5
|
+
class Resource {
|
|
6
|
+
constructor(core) {
|
|
7
|
+
this.core = core;
|
|
8
|
+
}
|
|
9
|
+
async do(method, path, params = {}, options) {
|
|
10
|
+
const res = await this.core.rawRequest({
|
|
11
|
+
method,
|
|
12
|
+
path,
|
|
13
|
+
pathParams: params.path,
|
|
14
|
+
query: params.query,
|
|
15
|
+
body: params.body,
|
|
16
|
+
}, options);
|
|
17
|
+
return res.data;
|
|
18
|
+
}
|
|
19
|
+
pager(path, strategy, query, pathParams, options) {
|
|
20
|
+
return new pagination_js_1.Paginator(async (q) => (await this.core.rawRequest({ method: 'get', path, pathParams, query: q }, options)).data, strategy, (query ?? {}));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.Resource = Resource;
|
package/dist/cjs/resources.d.ts
CHANGED
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Hand-written resource classes: the named methods, pagination helpers and approval waits. Each class extends a
|
|
3
|
+
* generated base (src/generated/resources.ts) that adds a method for every other operation under the same tag, so
|
|
4
|
+
* together they cover every operation in the spec. Every method takes an optional last `options` argument
|
|
5
|
+
* (RequestOptions): idempotencyKey, org, version, maxRetries, timeoutMs, signal, headers.
|
|
5
6
|
*/
|
|
6
7
|
import type { FinnCore } from './core.js';
|
|
7
|
-
import {
|
|
8
|
-
import type { ApprovalHold,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type Id = string;
|
|
13
|
-
interface Params {
|
|
14
|
-
path?: Record<string, string | number>;
|
|
15
|
-
query?: unknown;
|
|
16
|
-
body?: unknown;
|
|
17
|
-
}
|
|
18
|
-
declare abstract class Resource {
|
|
19
|
-
protected readonly core: FinnCore;
|
|
20
|
-
constructor(core: FinnCore);
|
|
21
|
-
protected do<M extends HttpMethod, P extends PathsFor<M>>(method: M, path: P, params?: Params, options?: RequestOptions): Promise<R<P, M>>;
|
|
22
|
-
protected pager<Item>(path: PathsFor<'get'>, strategy: ReturnType<typeof cursorStrategy<Item>>, query: unknown, pathParams?: Record<string, string>, options?: RequestOptions): Paginator<Item>;
|
|
23
|
-
}
|
|
24
|
-
export declare class Calls extends Resource {
|
|
8
|
+
import { Resource, type B, type Id, type Q } from './resource.js';
|
|
9
|
+
import type { ApprovalHold, RequestOptions, Schemas } from './types.js';
|
|
10
|
+
import { AgentsGenerated, ApprovalsGenerated, AudiencesGenerated, CallsGenerated, CasesGenerated, ChatGenerated, ContactsGenerated, DeploymentsGenerated, DoNotCallGenerated, FinnsGenerated, PhoneNumbersGenerated, VoicesGenerated, WalletGenerated } from './generated/resources.js';
|
|
11
|
+
export { Crm, Dialer, Organization, Sales, Webhooks } from './generated/resources.js';
|
|
12
|
+
export declare class Calls extends CallsGenerated {
|
|
25
13
|
/** Place an outbound call. Gets an automatic Idempotency-Key. May answer `pending_approval` (see isPendingApproval). */
|
|
26
14
|
create(body: B<'/calls', 'post'>, options?: RequestOptions): Promise<{
|
|
27
15
|
success: true;
|
|
@@ -35,7 +23,7 @@ export declare class Calls extends Resource {
|
|
|
35
23
|
offset: number;
|
|
36
24
|
}>;
|
|
37
25
|
/** Every call matching the filters, page by page. */
|
|
38
|
-
listAll(query?: Q<'/calls', 'get'>, options?: RequestOptions): Paginator<{
|
|
26
|
+
listAll(query?: Q<'/calls', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
39
27
|
call_uuid: string;
|
|
40
28
|
finn_id?: string | null;
|
|
41
29
|
deployment_id?: string | null;
|
|
@@ -55,14 +43,14 @@ export declare class Calls extends Resource {
|
|
|
55
43
|
data: import("./types.js").components["schemas"]["Call"];
|
|
56
44
|
}>;
|
|
57
45
|
}
|
|
58
|
-
export declare class Finns extends
|
|
46
|
+
export declare class Finns extends FinnsGenerated {
|
|
59
47
|
list(query?: Q<'/finns', 'get'>, options?: RequestOptions): Promise<{
|
|
60
48
|
success: true;
|
|
61
49
|
data: import("./types.js").components["schemas"]["Finn"][];
|
|
62
50
|
limit: number;
|
|
63
51
|
offset: number;
|
|
64
52
|
}>;
|
|
65
|
-
listAll(query?: Q<'/finns', 'get'>, options?: RequestOptions): Paginator<{
|
|
53
|
+
listAll(query?: Q<'/finns', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
66
54
|
id: string;
|
|
67
55
|
name: string;
|
|
68
56
|
status: string;
|
|
@@ -116,7 +104,7 @@ export declare class Finns extends Resource {
|
|
|
116
104
|
data: import("./types.js").components["schemas"]["FinnPostCallAnalysis"];
|
|
117
105
|
}>;
|
|
118
106
|
}
|
|
119
|
-
export declare class Voices extends
|
|
107
|
+
export declare class Voices extends VoicesGenerated {
|
|
120
108
|
list(query?: Q<'/voices', 'get'>, options?: RequestOptions): Promise<{
|
|
121
109
|
success: true;
|
|
122
110
|
data: import("./types.js").components["schemas"]["Voice"][];
|
|
@@ -124,7 +112,7 @@ export declare class Voices extends Resource {
|
|
|
124
112
|
limit: number;
|
|
125
113
|
offset: number;
|
|
126
114
|
}>;
|
|
127
|
-
listAll(query?: Q<'/voices', 'get'>, options?: RequestOptions): Paginator<{
|
|
115
|
+
listAll(query?: Q<'/voices', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
128
116
|
voice_id: string;
|
|
129
117
|
name: string | null;
|
|
130
118
|
description: string;
|
|
@@ -140,14 +128,14 @@ export declare class Voices extends Resource {
|
|
|
140
128
|
data: import("./types.js").components["schemas"]["Voice"];
|
|
141
129
|
}>;
|
|
142
130
|
}
|
|
143
|
-
export declare class PhoneNumbers extends
|
|
131
|
+
export declare class PhoneNumbers extends PhoneNumbersGenerated {
|
|
144
132
|
list(query?: Q<'/phone_numbers', 'get'>, options?: RequestOptions): Promise<{
|
|
145
133
|
success: true;
|
|
146
134
|
data: import("./types.js").components["schemas"]["PhoneNumber"][];
|
|
147
135
|
limit: number;
|
|
148
136
|
offset: number;
|
|
149
137
|
}>;
|
|
150
|
-
listAll(query?: Q<'/phone_numbers', 'get'>, options?: RequestOptions): Paginator<{
|
|
138
|
+
listAll(query?: Q<'/phone_numbers', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
151
139
|
id: string;
|
|
152
140
|
phone_number: string;
|
|
153
141
|
status: string;
|
|
@@ -180,14 +168,14 @@ export declare class PhoneNumbers extends Resource {
|
|
|
180
168
|
data: import("./types.js").components["schemas"]["ReleasedPhoneNumber"];
|
|
181
169
|
}>;
|
|
182
170
|
}
|
|
183
|
-
export declare class Audiences extends
|
|
171
|
+
export declare class Audiences extends AudiencesGenerated {
|
|
184
172
|
list(query?: Q<'/audiences', 'get'>, options?: RequestOptions): Promise<{
|
|
185
173
|
success: true;
|
|
186
174
|
data: import("./types.js").components["schemas"]["Audience"][];
|
|
187
175
|
limit: number;
|
|
188
176
|
offset: number;
|
|
189
177
|
}>;
|
|
190
|
-
listAll(query?: Q<'/audiences', 'get'>, options?: RequestOptions): Paginator<{
|
|
178
|
+
listAll(query?: Q<'/audiences', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
191
179
|
id: string;
|
|
192
180
|
name: string;
|
|
193
181
|
contact_count: number;
|
|
@@ -217,7 +205,7 @@ export declare class Audiences extends Resource {
|
|
|
217
205
|
limit: number;
|
|
218
206
|
offset: number;
|
|
219
207
|
}>;
|
|
220
|
-
listAllContacts(audienceId: Id, query?: Q<'/audiences/{audience_id}/contacts', 'get'>, options?: RequestOptions): Paginator<{
|
|
208
|
+
listAllContacts(audienceId: Id, query?: Q<'/audiences/{audience_id}/contacts', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
221
209
|
name?: string;
|
|
222
210
|
phone_number?: string;
|
|
223
211
|
country_code?: string;
|
|
@@ -236,14 +224,14 @@ export declare class Audiences extends Resource {
|
|
|
236
224
|
contacts_removed: number;
|
|
237
225
|
}>;
|
|
238
226
|
}
|
|
239
|
-
export declare class Deployments extends
|
|
227
|
+
export declare class Deployments extends DeploymentsGenerated {
|
|
240
228
|
list(query?: Q<'/deployments', 'get'>, options?: RequestOptions): Promise<{
|
|
241
229
|
success: true;
|
|
242
230
|
data: import("./types.js").components["schemas"]["Deployment"][];
|
|
243
231
|
limit: number;
|
|
244
232
|
offset: number;
|
|
245
233
|
}>;
|
|
246
|
-
listAll(query?: Q<'/deployments', 'get'>, options?: RequestOptions): Paginator<{
|
|
234
|
+
listAll(query?: Q<'/deployments', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
247
235
|
id: string;
|
|
248
236
|
finn_id?: string | null;
|
|
249
237
|
audience_id?: string | null;
|
|
@@ -269,7 +257,7 @@ export declare class Deployments extends Resource {
|
|
|
269
257
|
createInbound(body: B<'/deployments/inbound', 'post'>, options?: RequestOptions): Promise<{
|
|
270
258
|
success: true;
|
|
271
259
|
data: import("./types.js").components["schemas"]["Deployment"];
|
|
272
|
-
}>;
|
|
260
|
+
} | import("./types.js").PendingApproval>;
|
|
273
261
|
retrieve(id: Id, options?: RequestOptions): Promise<{
|
|
274
262
|
success: true;
|
|
275
263
|
data: import("./types.js").components["schemas"]["Deployment"];
|
|
@@ -287,7 +275,7 @@ export declare class Deployments extends Resource {
|
|
|
287
275
|
data: import("./types.js").components["schemas"]["DeploymentAnalytics"];
|
|
288
276
|
}>;
|
|
289
277
|
}
|
|
290
|
-
export declare class Wallet extends
|
|
278
|
+
export declare class Wallet extends WalletGenerated {
|
|
291
279
|
retrieve(options?: RequestOptions): Promise<{
|
|
292
280
|
success: true;
|
|
293
281
|
data: import("./types.js").components["schemas"]["Wallet"];
|
|
@@ -298,7 +286,7 @@ export declare class Wallet extends Resource {
|
|
|
298
286
|
limit: number;
|
|
299
287
|
offset: number;
|
|
300
288
|
}>;
|
|
301
|
-
listAllTransactions(query?: Q<'/wallet/transactions', 'get'>, options?: RequestOptions): Paginator<{
|
|
289
|
+
listAllTransactions(query?: Q<'/wallet/transactions', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
302
290
|
id: string;
|
|
303
291
|
type: string;
|
|
304
292
|
credits_delta: number;
|
|
@@ -307,7 +295,7 @@ export declare class Wallet extends Resource {
|
|
|
307
295
|
created_at: string;
|
|
308
296
|
}, unknown>;
|
|
309
297
|
}
|
|
310
|
-
export declare class DoNotCall extends
|
|
298
|
+
export declare class DoNotCall extends DoNotCallGenerated {
|
|
311
299
|
list(query?: Q<'/do_not_call', 'get'>, options?: RequestOptions): Promise<{
|
|
312
300
|
success: true;
|
|
313
301
|
data: import("./types.js").components["schemas"]["DoNotCallEntry"][];
|
|
@@ -315,7 +303,7 @@ export declare class DoNotCall extends Resource {
|
|
|
315
303
|
limit: number;
|
|
316
304
|
offset: number;
|
|
317
305
|
}>;
|
|
318
|
-
listAll(query?: Q<'/do_not_call', 'get'>, options?: RequestOptions): Paginator<{
|
|
306
|
+
listAll(query?: Q<'/do_not_call', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
319
307
|
phone_key: string;
|
|
320
308
|
phone_number: string;
|
|
321
309
|
sources: ("manual" | "crm_stage" | "rep_dialer" | "call_opt_out" | "chat_opt_out" | "import" | "api" | "operator" | "sales_ai")[];
|
|
@@ -337,7 +325,7 @@ export declare class DoNotCall extends Resource {
|
|
|
337
325
|
removed_sources: string[];
|
|
338
326
|
}>;
|
|
339
327
|
}
|
|
340
|
-
export declare class Contacts extends
|
|
328
|
+
export declare class Contacts extends ContactsGenerated {
|
|
341
329
|
list(query?: Q<'/contacts', 'get'>, options?: RequestOptions): Promise<{
|
|
342
330
|
contacts: import("./types.js").components["schemas"]["Record"][];
|
|
343
331
|
totalCount: number;
|
|
@@ -345,7 +333,7 @@ export declare class Contacts extends Resource {
|
|
|
345
333
|
pageSize: number;
|
|
346
334
|
totalPages: number;
|
|
347
335
|
}>;
|
|
348
|
-
listAll(query?: Q<'/contacts', 'get'>, options?: RequestOptions): Paginator<{
|
|
336
|
+
listAll(query?: Q<'/contacts', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
349
337
|
id: string;
|
|
350
338
|
phone: string;
|
|
351
339
|
phoneKey?: string;
|
|
@@ -401,7 +389,7 @@ export declare class Contacts extends Resource {
|
|
|
401
389
|
[key: string]: number;
|
|
402
390
|
};
|
|
403
391
|
}>;
|
|
404
|
-
timelineAll(id: Id, query?: Q<'/contacts/{id}/timeline', 'get'>, options?: RequestOptions): Paginator<{
|
|
392
|
+
timelineAll(id: Id, query?: Q<'/contacts/{id}/timeline', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
405
393
|
id: string;
|
|
406
394
|
kind: "call" | "chat" | "message" | "operator" | "note" | "form" | "change" | "file" | "view";
|
|
407
395
|
type?: string;
|
|
@@ -426,12 +414,12 @@ export declare class Contacts extends Resource {
|
|
|
426
414
|
fields: import("./types.js").components["schemas"]["FieldDefinition"][];
|
|
427
415
|
}>;
|
|
428
416
|
}
|
|
429
|
-
export declare class Cases extends
|
|
417
|
+
export declare class Cases extends CasesGenerated {
|
|
430
418
|
list(query?: Q<'/cases', 'get'>, options?: RequestOptions): Promise<{
|
|
431
419
|
cases: import("./types.js").components["schemas"]["CaseSummary"][];
|
|
432
420
|
next_before: string | null;
|
|
433
421
|
}>;
|
|
434
|
-
listAll(query?: Q<'/cases', 'get'>, options?: RequestOptions): Paginator<{
|
|
422
|
+
listAll(query?: Q<'/cases', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
435
423
|
id: string;
|
|
436
424
|
agent_id: string;
|
|
437
425
|
agent_name: string;
|
|
@@ -487,10 +475,24 @@ export declare class Cases extends Resource {
|
|
|
487
475
|
} & {
|
|
488
476
|
[key: string]: unknown;
|
|
489
477
|
}>;
|
|
490
|
-
|
|
478
|
+
/** One page of a case's events: pass the previous page's `next_after` as `after` for the next one. */
|
|
479
|
+
listEvents(id: Id, query?: Q<'/cases/{id}/events', 'get'>, options?: RequestOptions): Promise<{
|
|
491
480
|
events: import("./types.js").components["schemas"]["CaseEvent"][];
|
|
492
481
|
next_after: number;
|
|
493
482
|
}>;
|
|
483
|
+
/** Every event of a case, oldest first, page by page (follows `next_after`). */
|
|
484
|
+
listAllEvents(id: Id, query?: Q<'/cases/{id}/events', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
485
|
+
seq: number;
|
|
486
|
+
type: string;
|
|
487
|
+
actor_type: string;
|
|
488
|
+
actor_id?: string;
|
|
489
|
+
step_id?: string;
|
|
490
|
+
thread_id?: string;
|
|
491
|
+
data?: unknown;
|
|
492
|
+
at: string;
|
|
493
|
+
} & {
|
|
494
|
+
[key: string]: unknown;
|
|
495
|
+
}, unknown>;
|
|
494
496
|
/** Start a case on an agent. Gets an automatic Idempotency-Key. May answer `pending_approval` (see isPendingApproval). */
|
|
495
497
|
start(agentId: Id, body?: B<'/agents/{id}/cases', 'post'>, options?: RequestOptions): Promise<{
|
|
496
498
|
case_id: string;
|
|
@@ -510,12 +512,12 @@ export interface WaitForApprovalOptions {
|
|
|
510
512
|
/** Replaces the wait between polls (for tests). */
|
|
511
513
|
sleep?: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
512
514
|
}
|
|
513
|
-
export declare class Approvals extends
|
|
515
|
+
export declare class Approvals extends ApprovalsGenerated {
|
|
514
516
|
list(query?: Q<'/approvals', 'get'>, options?: RequestOptions): Promise<{
|
|
515
|
-
approvals: import("./types.js").components["schemas"]["Approval"][];
|
|
517
|
+
approvals: (import("./types.js").components["schemas"]["Approval"] | import("./types.js").components["schemas"]["ApiHold"])[];
|
|
516
518
|
next_cursor: string | null;
|
|
517
519
|
}>;
|
|
518
|
-
listAll(query?: Q<'/approvals', 'get'>, options?: RequestOptions): Paginator<{
|
|
520
|
+
listAll(query?: Q<'/approvals', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
519
521
|
id: string;
|
|
520
522
|
case_id: string;
|
|
521
523
|
case_title?: string | null;
|
|
@@ -648,13 +650,13 @@ export declare class Approvals extends Resource {
|
|
|
648
650
|
*/
|
|
649
651
|
wait(id: Id, opts?: WaitForApprovalOptions): Promise<ApprovalHold | Schemas['Approval']>;
|
|
650
652
|
}
|
|
651
|
-
export declare class Agents extends
|
|
653
|
+
export declare class Agents extends AgentsGenerated {
|
|
652
654
|
list(query?: Q<'/agents', 'get'>, options?: RequestOptions): Promise<{
|
|
653
655
|
data: import("./types.js").components["schemas"]["AgentSummary"][];
|
|
654
656
|
next_cursor: string | null;
|
|
655
657
|
has_more: boolean;
|
|
656
658
|
}>;
|
|
657
|
-
listAll(query?: Q<'/agents', 'get'>, options?: RequestOptions): Paginator<{
|
|
659
|
+
listAll(query?: Q<'/agents', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<{
|
|
658
660
|
id: string;
|
|
659
661
|
name: string;
|
|
660
662
|
status: "draft" | "live" | "paused" | "archived";
|
|
@@ -785,7 +787,7 @@ export declare class ChatConversations extends Resource {
|
|
|
785
787
|
next_cursor: string | null;
|
|
786
788
|
has_more: boolean;
|
|
787
789
|
}>;
|
|
788
|
-
listAll(query?: Q<'/chat/conversations', 'get'>, options?: RequestOptions): Paginator<ChatItem, unknown>;
|
|
790
|
+
listAll(query?: Q<'/chat/conversations', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<ChatItem, unknown>;
|
|
789
791
|
/** Start a conversation (sends the first message). Gets an automatic Idempotency-Key (the API requires one). May answer `pending_approval`. */
|
|
790
792
|
start(body: B<'/chat/conversations', 'post'>, options?: RequestOptions): Promise<{
|
|
791
793
|
[key: string]: unknown;
|
|
@@ -806,11 +808,17 @@ export declare class ChatConversations extends Resource {
|
|
|
806
808
|
next_cursor: string | null;
|
|
807
809
|
has_more: boolean;
|
|
808
810
|
}>;
|
|
809
|
-
listAllMessages(id: Id, query?: Q<'/chat/conversations/{id}/messages', 'get'>, options?: RequestOptions): Paginator<ChatItem, unknown>;
|
|
811
|
+
listAllMessages(id: Id, query?: Q<'/chat/conversations/{id}/messages', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<ChatItem, unknown>;
|
|
810
812
|
/** Send a message. Gets an automatic Idempotency-Key (the API requires one). May answer `pending_approval`. */
|
|
811
|
-
send(id: Id, body: B<'/chat/conversations/{id}/messages', 'post'>, options?: RequestOptions): Promise<{
|
|
813
|
+
send(id: Id, body: B<'/chat/conversations/{id}/messages', 'post'>, options?: RequestOptions): Promise<({
|
|
814
|
+
message?: {
|
|
815
|
+
[key: string]: unknown;
|
|
816
|
+
};
|
|
817
|
+
ai_paused?: boolean;
|
|
818
|
+
notice?: string;
|
|
819
|
+
} & {
|
|
812
820
|
[key: string]: unknown;
|
|
813
|
-
} | import("./types.js").PendingApproval>;
|
|
821
|
+
}) | import("./types.js").PendingApproval>;
|
|
814
822
|
}
|
|
815
823
|
export declare class ChatContacts extends Resource {
|
|
816
824
|
list(query?: Q<'/chat/contacts', 'get'>, options?: RequestOptions): Promise<{
|
|
@@ -822,15 +830,15 @@ export declare class ChatContacts extends Resource {
|
|
|
822
830
|
} & {
|
|
823
831
|
total?: number | null;
|
|
824
832
|
}>;
|
|
825
|
-
listAll(query?: Q<'/chat/contacts', 'get'>, options?: RequestOptions): Paginator<ChatItem, unknown>;
|
|
833
|
+
listAll(query?: Q<'/chat/contacts', 'get'>, options?: RequestOptions): import("./pagination.js").Paginator<ChatItem, unknown>;
|
|
826
834
|
retrieve(id: Id, options?: RequestOptions): Promise<{
|
|
827
835
|
[key: string]: unknown;
|
|
828
836
|
}>;
|
|
829
837
|
update(id: Id, body: B<'/chat/contacts/{id}', 'patch'>, options?: RequestOptions): Promise<{
|
|
830
838
|
[key: string]: unknown;
|
|
831
|
-
}>;
|
|
839
|
+
} | import("./types.js").PendingApproval>;
|
|
832
840
|
}
|
|
833
|
-
export declare class Chat extends
|
|
841
|
+
export declare class Chat extends ChatGenerated {
|
|
834
842
|
readonly conversations: ChatConversations;
|
|
835
843
|
readonly contacts: ChatContacts;
|
|
836
844
|
constructor(core: FinnCore);
|
|
@@ -842,4 +850,3 @@ export declare class Chat extends Resource {
|
|
|
842
850
|
has_more: boolean;
|
|
843
851
|
}>;
|
|
844
852
|
}
|
|
845
|
-
export {};
|