@lorikeetai/node-sdk 0.2.0 → 0.3.1
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/CHANGELOG.md +24 -0
- package/README.md +20 -16
- package/index.d.mts +5 -8
- package/index.d.ts +5 -8
- package/index.d.ts.map +1 -1
- package/index.js +11 -11
- package/index.js.map +1 -1
- package/index.mjs +5 -8
- package/index.mjs.map +1 -1
- package/lib/poll-until.d.ts +16 -0
- package/lib/poll-until.d.ts.map +1 -0
- package/lib/poll-until.js +17 -0
- package/lib/poll-until.js.map +1 -0
- package/lib/poll-until.mjs +13 -0
- package/lib/poll-until.mjs.map +1 -0
- package/package.json +1 -1
- package/resources/conversation/chat.d.ts +65 -8
- package/resources/conversation/chat.d.ts.map +1 -1
- package/resources/conversation/chat.js +7 -0
- package/resources/conversation/chat.js.map +1 -1
- package/resources/conversation/chat.mjs +7 -0
- package/resources/conversation/chat.mjs.map +1 -1
- package/resources/conversation/email.d.ts +4 -0
- package/resources/conversation/email.d.ts.map +1 -1
- package/resources/customer.d.ts +21 -1
- package/resources/customer.d.ts.map +1 -1
- package/resources/customer.js +7 -0
- package/resources/customer.js.map +1 -1
- package/resources/customer.mjs +7 -0
- package/resources/customer.mjs.map +1 -1
- package/resources/index.d.ts +1 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +1 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -2
- package/resources/index.mjs.map +1 -1
- package/src/index.ts +29 -31
- package/src/lib/poll-until.ts +32 -0
- package/src/resources/conversation/chat.ts +86 -8
- package/src/resources/conversation/email.ts +5 -0
- package/src/resources/customer.ts +34 -0
- package/src/resources/index.ts +7 -2
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/token.d.ts +0 -28
- package/resources/token.d.ts.map +0 -1
- package/resources/token.js +0 -16
- package/resources/token.js.map +0 -1
- package/resources/token.mjs +0 -12
- package/resources/token.mjs.map +0 -1
- package/src/resources/token.ts +0 -42
package/resources/customer.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { APIResource } from "../resource.js";
|
|
|
2
2
|
import * as Core from "../core.js";
|
|
3
3
|
export declare class Customer extends APIResource {
|
|
4
4
|
create(body: CustomerCreateParams, options?: Core.RequestOptions): Core.APIPromise<CustomerCreateResponse>;
|
|
5
|
+
token(body: CustomerTokenParams, options?: Core.RequestOptions): Core.APIPromise<string>;
|
|
5
6
|
}
|
|
6
7
|
export interface CustomerCreateResponse {
|
|
7
8
|
/**
|
|
@@ -33,6 +34,7 @@ export interface CustomerCreateResponse {
|
|
|
33
34
|
*/
|
|
34
35
|
displayName?: string;
|
|
35
36
|
}
|
|
37
|
+
export type CustomerTokenResponse = string;
|
|
36
38
|
export interface CustomerCreateParams {
|
|
37
39
|
/**
|
|
38
40
|
* The email of the customer
|
|
@@ -55,7 +57,25 @@ export interface CustomerCreateParams {
|
|
|
55
57
|
*/
|
|
56
58
|
displayName?: string;
|
|
57
59
|
}
|
|
60
|
+
export interface CustomerTokenParams {
|
|
61
|
+
/**
|
|
62
|
+
* The email of the user.
|
|
63
|
+
*/
|
|
64
|
+
email: string;
|
|
65
|
+
/**
|
|
66
|
+
* The first name of the user.
|
|
67
|
+
*/
|
|
68
|
+
firstName: string;
|
|
69
|
+
/**
|
|
70
|
+
* The last name of the user.
|
|
71
|
+
*/
|
|
72
|
+
lastName: string;
|
|
73
|
+
/**
|
|
74
|
+
* The unique identifier of the user in your ticketing system.
|
|
75
|
+
*/
|
|
76
|
+
remoteId: string;
|
|
77
|
+
}
|
|
58
78
|
export declare namespace Customer {
|
|
59
|
-
export { type CustomerCreateResponse as CustomerCreateResponse, type CustomerCreateParams as CustomerCreateParams, };
|
|
79
|
+
export { type CustomerCreateResponse as CustomerCreateResponse, type CustomerTokenResponse as CustomerTokenResponse, type CustomerCreateParams as CustomerCreateParams, type CustomerTokenParams as CustomerTokenParams, };
|
|
60
80
|
}
|
|
61
81
|
//# sourceMappingURL=customer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.d.ts","sourceRoot":"","sources":["../src/resources/customer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAEhC,qBAAa,QAAS,SAAQ,WAAW;IACvC,MAAM,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"customer.d.ts","sourceRoot":"","sources":["../src/resources/customer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAEhC,qBAAa,QAAS,SAAQ,WAAW;IACvC,MAAM,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,sBAAsB,CAAC;IAI1G,KAAK,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;CAOzF;AAED,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,EAAE,EAAE,OAAO,CAAC;IAEZ;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE3C,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,WAAW,QAAQ,CAAC;IAChC,OAAO,EACL,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
package/resources/customer.js
CHANGED
|
@@ -7,6 +7,13 @@ class Customer extends resource_1.APIResource {
|
|
|
7
7
|
create(body, options) {
|
|
8
8
|
return this._client.post('/v1/customer', { body, ...options });
|
|
9
9
|
}
|
|
10
|
+
token(body, options) {
|
|
11
|
+
return this._client.post('/v1/customer/token', {
|
|
12
|
+
body,
|
|
13
|
+
...options,
|
|
14
|
+
headers: { Accept: 'application/json', ...options?.headers },
|
|
15
|
+
});
|
|
16
|
+
}
|
|
10
17
|
}
|
|
11
18
|
exports.Customer = Customer;
|
|
12
19
|
//# sourceMappingURL=customer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.js","sourceRoot":"","sources":["../src/resources/customer.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAG1C,MAAa,QAAS,SAAQ,sBAAW;IACvC,MAAM,CAAC,IAA0B,EAAE,OAA6B;QAC9D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"customer.js","sourceRoot":"","sources":["../src/resources/customer.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAG1C,MAAa,QAAS,SAAQ,sBAAW;IACvC,MAAM,CAAC,IAA0B,EAAE,OAA6B;QAC9D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,IAAyB,EAAE,OAA6B;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC7C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AAZD,4BAYC"}
|
package/resources/customer.mjs
CHANGED
|
@@ -4,5 +4,12 @@ export class Customer extends APIResource {
|
|
|
4
4
|
create(body, options) {
|
|
5
5
|
return this._client.post('/v1/customer', { body, ...options });
|
|
6
6
|
}
|
|
7
|
+
token(body, options) {
|
|
8
|
+
return this._client.post('/v1/customer/token', {
|
|
9
|
+
body,
|
|
10
|
+
...options,
|
|
11
|
+
headers: { Accept: 'application/json', ...options?.headers },
|
|
12
|
+
});
|
|
13
|
+
}
|
|
7
14
|
}
|
|
8
15
|
//# sourceMappingURL=customer.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customer.mjs","sourceRoot":"","sources":["../src/resources/customer.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAGtB,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC,MAAM,CAAC,IAA0B,EAAE,OAA6B;QAC9D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"customer.mjs","sourceRoot":"","sources":["../src/resources/customer.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAGtB,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC,MAAM,CAAC,IAA0B,EAAE,OAA6B;QAC9D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,IAAyB,EAAE,OAA6B;QAC5D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE;YAC7C,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/resources/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { Conversation } from "./conversation/conversation.js";
|
|
2
|
-
export { Customer, type CustomerCreateResponse, type CustomerCreateParams } from "./customer.js";
|
|
2
|
+
export { Customer, type CustomerCreateResponse, type CustomerTokenResponse, type CustomerCreateParams, type CustomerTokenParams, } from "./customer.js";
|
|
3
3
|
export { Ingest, type IngestTestParams } from "./ingest.js";
|
|
4
|
-
export { Token, type TokenCreateResponse, type TokenCreateParams } from "./token.js";
|
|
5
4
|
//# sourceMappingURL=index.d.ts.map
|
package/resources/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EACL,QAAQ,EACR,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,KAAK,gBAAgB,EAAE,MAAM,UAAU,CAAC"}
|
package/resources/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
4
|
+
exports.Ingest = exports.Customer = exports.Conversation = void 0;
|
|
5
5
|
var conversation_1 = require("./conversation/conversation.js");
|
|
6
6
|
Object.defineProperty(exports, "Conversation", { enumerable: true, get: function () { return conversation_1.Conversation; } });
|
|
7
7
|
var customer_1 = require("./customer.js");
|
|
8
8
|
Object.defineProperty(exports, "Customer", { enumerable: true, get: function () { return customer_1.Customer; } });
|
|
9
9
|
var ingest_1 = require("./ingest.js");
|
|
10
10
|
Object.defineProperty(exports, "Ingest", { enumerable: true, get: function () { return ingest_1.Ingest; } });
|
|
11
|
-
var token_1 = require("./token.js");
|
|
12
|
-
Object.defineProperty(exports, "Token", { enumerable: true, get: function () { return token_1.Token; } });
|
|
13
11
|
//# sourceMappingURL=index.js.map
|
package/resources/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,+DAA2D;AAAlD,4GAAA,YAAY,OAAA;AACrB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,+DAA2D;AAAlD,4GAAA,YAAY,OAAA;AACrB,0CAMoB;AALlB,oGAAA,QAAQ,OAAA;AAMV,sCAAyD;AAAhD,gGAAA,MAAM,OAAA"}
|
package/resources/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
export { Conversation } from "./conversation/conversation.mjs";
|
|
3
|
-
export { Customer } from "./customer.mjs";
|
|
3
|
+
export { Customer, } from "./customer.mjs";
|
|
4
4
|
export { Ingest } from "./ingest.mjs";
|
|
5
|
-
export { Token } from "./token.mjs";
|
|
6
5
|
//# sourceMappingURL=index.mjs.map
|
package/resources/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,YAAY,EAAE;OAChB,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,YAAY,EAAE;OAChB,EACL,QAAQ,GAKT;OACM,EAAE,MAAM,EAAyB"}
|
package/src/index.ts
CHANGED
|
@@ -5,10 +5,16 @@ import * as Core from './core';
|
|
|
5
5
|
import * as Errors from './error';
|
|
6
6
|
import * as Uploads from './uploads';
|
|
7
7
|
import * as API from './resources/index';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
Customer,
|
|
10
|
+
CustomerCreateParams,
|
|
11
|
+
CustomerCreateResponse,
|
|
12
|
+
CustomerTokenParams,
|
|
13
|
+
CustomerTokenResponse,
|
|
14
|
+
} from './resources/customer';
|
|
9
15
|
import { Ingest, IngestTestParams } from './resources/ingest';
|
|
10
|
-
import { Token, TokenCreateParams, TokenCreateResponse } from './resources/token';
|
|
11
16
|
import { Conversation } from './resources/conversation/conversation';
|
|
17
|
+
import { generateSignature } from './lib/generate-signature';
|
|
12
18
|
|
|
13
19
|
export interface ClientOptions {
|
|
14
20
|
/**
|
|
@@ -139,7 +145,6 @@ export class Lorikeet extends Core.APIClient {
|
|
|
139
145
|
}
|
|
140
146
|
|
|
141
147
|
conversation: API.Conversation = new API.Conversation(this);
|
|
142
|
-
token: API.Token = new API.Token(this);
|
|
143
148
|
customer: API.Customer = new API.Customer(this);
|
|
144
149
|
ingest: API.Ingest = new API.Ingest(this);
|
|
145
150
|
|
|
@@ -193,49 +198,42 @@ export class Lorikeet extends Core.APIClient {
|
|
|
193
198
|
static fileFromPath = Uploads.fileFromPath;
|
|
194
199
|
}
|
|
195
200
|
|
|
196
|
-
export {
|
|
197
|
-
LorikeetError,
|
|
198
|
-
APIError,
|
|
199
|
-
APIConnectionError,
|
|
200
|
-
APIConnectionTimeoutError,
|
|
201
|
-
APIUserAbortError,
|
|
202
|
-
NotFoundError,
|
|
203
|
-
ConflictError,
|
|
204
|
-
RateLimitError,
|
|
205
|
-
BadRequestError,
|
|
206
|
-
AuthenticationError,
|
|
207
|
-
InternalServerError,
|
|
208
|
-
PermissionDeniedError,
|
|
209
|
-
UnprocessableEntityError,
|
|
210
|
-
} from './error';
|
|
211
|
-
|
|
212
|
-
export import toFile = Uploads.toFile;
|
|
213
|
-
export import fileFromPath = Uploads.fileFromPath;
|
|
214
|
-
import { generateSignature } from './lib/generate-signature';
|
|
215
|
-
|
|
216
201
|
Lorikeet.Conversation = Conversation;
|
|
217
|
-
Lorikeet.Token = Token;
|
|
218
202
|
Lorikeet.Customer = Customer;
|
|
219
203
|
Lorikeet.Ingest = Ingest;
|
|
220
|
-
|
|
221
204
|
export declare namespace Lorikeet {
|
|
222
205
|
export type RequestOptions = Core.RequestOptions;
|
|
223
206
|
|
|
224
207
|
export { Conversation as Conversation };
|
|
225
208
|
|
|
226
|
-
export {
|
|
227
|
-
Token as Token,
|
|
228
|
-
type TokenCreateResponse as TokenCreateResponse,
|
|
229
|
-
type TokenCreateParams as TokenCreateParams,
|
|
230
|
-
};
|
|
231
|
-
|
|
232
209
|
export {
|
|
233
210
|
Customer as Customer,
|
|
234
211
|
type CustomerCreateResponse as CustomerCreateResponse,
|
|
212
|
+
type CustomerTokenResponse as CustomerTokenResponse,
|
|
235
213
|
type CustomerCreateParams as CustomerCreateParams,
|
|
214
|
+
type CustomerTokenParams as CustomerTokenParams,
|
|
236
215
|
};
|
|
237
216
|
|
|
238
217
|
export { Ingest as Ingest, type IngestTestParams as IngestTestParams };
|
|
239
218
|
}
|
|
240
219
|
|
|
220
|
+
export { toFile, fileFromPath } from "./uploads";
|
|
221
|
+
export {
|
|
222
|
+
LorikeetError,
|
|
223
|
+
APIError,
|
|
224
|
+
APIConnectionError,
|
|
225
|
+
APIConnectionTimeoutError,
|
|
226
|
+
APIUserAbortError,
|
|
227
|
+
NotFoundError,
|
|
228
|
+
ConflictError,
|
|
229
|
+
RateLimitError,
|
|
230
|
+
BadRequestError,
|
|
231
|
+
AuthenticationError,
|
|
232
|
+
InternalServerError,
|
|
233
|
+
PermissionDeniedError,
|
|
234
|
+
UnprocessableEntityError,
|
|
235
|
+
} from "./error";
|
|
236
|
+
|
|
237
|
+
export { generateSignature } from "./lib/generate-signature";
|
|
238
|
+
|
|
241
239
|
export default Lorikeet;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
interface PollUntilOptions<TData> {
|
|
2
|
+
/** The maximum time to wait for the condition to be met. */
|
|
3
|
+
timeout?: number;
|
|
4
|
+
|
|
5
|
+
/** The interval between each poll. */
|
|
6
|
+
interval?: number;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param result The result of the polling function.
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
condition: (result: TData) => boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Utility function to poll an endpoint. */
|
|
17
|
+
export const pollUntil = async <T>(
|
|
18
|
+
fn: () => Promise<T>,
|
|
19
|
+
{ condition = (result) => !!result, interval = 100, timeout = 5000 }: PollUntilOptions<T>,
|
|
20
|
+
): Promise<T> => {
|
|
21
|
+
const startTime = Date.now();
|
|
22
|
+
|
|
23
|
+
while (Date.now() - startTime < timeout) {
|
|
24
|
+
const result = await fn();
|
|
25
|
+
if (condition(result)) {
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
await new Promise((resolve) => setTimeout(resolve, interval));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
throw new Error(`Polling timed out`);
|
|
32
|
+
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../resource';
|
|
4
4
|
import * as Core from '../../core';
|
|
5
|
+
import { pollUntil } from "../../lib/poll-until";
|
|
5
6
|
|
|
6
7
|
export class Chat extends APIResource {
|
|
7
8
|
generate(body: ChatGenerateParams, options?: Core.RequestOptions): Core.APIPromise<ChatGenerateResponse> {
|
|
@@ -15,6 +16,16 @@ export class Chat extends APIResource {
|
|
|
15
16
|
start(body: ChatStartParams, options?: Core.RequestOptions): Core.APIPromise<ChatStartResponse> {
|
|
16
17
|
return this._client.post('/v1/conversation/chat/create', { body, ...options });
|
|
17
18
|
}
|
|
19
|
+
|
|
20
|
+
poll(query: ChatGetParams, options?: Core.RequestOptions): Core.APIPromise<ChatGetResponse> {
|
|
21
|
+
const start = new Date().toISOString();
|
|
22
|
+
return pollUntil<ChatGetResponse>(
|
|
23
|
+
() => this._client.get('/v1/conversation/chat/message', { query, ...options }),
|
|
24
|
+
{
|
|
25
|
+
condition: (conversation) => conversation.createdAt > start,
|
|
26
|
+
},
|
|
27
|
+
) as Core.APIPromise<ChatGetResponse>;
|
|
28
|
+
}
|
|
18
29
|
}
|
|
19
30
|
|
|
20
31
|
export interface ChatGenerateResponse {
|
|
@@ -24,15 +35,46 @@ export interface ChatGenerateResponse {
|
|
|
24
35
|
conversationId: unknown;
|
|
25
36
|
|
|
26
37
|
/**
|
|
27
|
-
* The timestamp of when the message was created in our system.
|
|
38
|
+
* The timestamp of when the last message was created in our system.
|
|
28
39
|
*/
|
|
29
40
|
createdAt: string;
|
|
30
41
|
|
|
31
42
|
/**
|
|
32
|
-
* The message
|
|
33
|
-
* processed.
|
|
43
|
+
* The created message. This endpoint supports markdown.
|
|
34
44
|
*/
|
|
35
|
-
message:
|
|
45
|
+
message: ChatGenerateResponse.Message;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The timestamp of when the ticket was last updated in our system.
|
|
49
|
+
*/
|
|
50
|
+
updatedAt: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export namespace ChatGenerateResponse {
|
|
54
|
+
/**
|
|
55
|
+
* The created message. This endpoint supports markdown.
|
|
56
|
+
*/
|
|
57
|
+
export interface Message {
|
|
58
|
+
/**
|
|
59
|
+
* The ID of the conversation message
|
|
60
|
+
*/
|
|
61
|
+
id: string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The content of the message. Markdown on plain text.
|
|
65
|
+
*/
|
|
66
|
+
content: string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The raw content of the message. Usually HTML.
|
|
70
|
+
*/
|
|
71
|
+
rawContent: string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The type of the message
|
|
75
|
+
*/
|
|
76
|
+
type: 'CUSTOMER' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE' | 'BOT_RESPONSE';
|
|
77
|
+
}
|
|
36
78
|
}
|
|
37
79
|
|
|
38
80
|
export interface ChatGetResponse {
|
|
@@ -42,15 +84,46 @@ export interface ChatGetResponse {
|
|
|
42
84
|
conversationId: unknown;
|
|
43
85
|
|
|
44
86
|
/**
|
|
45
|
-
* The timestamp of when the message was created in our system.
|
|
87
|
+
* The timestamp of when the last message was created in our system.
|
|
46
88
|
*/
|
|
47
89
|
createdAt: string;
|
|
48
90
|
|
|
49
91
|
/**
|
|
50
|
-
* The message
|
|
51
|
-
* processed.
|
|
92
|
+
* The created message. This endpoint supports markdown.
|
|
52
93
|
*/
|
|
53
|
-
message:
|
|
94
|
+
message: ChatGetResponse.Message;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The timestamp of when the ticket was last updated in our system.
|
|
98
|
+
*/
|
|
99
|
+
updatedAt: string;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export namespace ChatGetResponse {
|
|
103
|
+
/**
|
|
104
|
+
* The created message. This endpoint supports markdown.
|
|
105
|
+
*/
|
|
106
|
+
export interface Message {
|
|
107
|
+
/**
|
|
108
|
+
* The ID of the conversation message
|
|
109
|
+
*/
|
|
110
|
+
id: string;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* The content of the message. Markdown on plain text.
|
|
114
|
+
*/
|
|
115
|
+
content: string;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The raw content of the message. Usually HTML.
|
|
119
|
+
*/
|
|
120
|
+
rawContent: string;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The type of the message
|
|
124
|
+
*/
|
|
125
|
+
type: 'CUSTOMER' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE' | 'BOT_RESPONSE';
|
|
126
|
+
}
|
|
54
127
|
}
|
|
55
128
|
|
|
56
129
|
export interface ChatStartResponse {
|
|
@@ -90,6 +163,11 @@ export interface ChatStartParams {
|
|
|
90
163
|
*/
|
|
91
164
|
customerId: unknown;
|
|
92
165
|
|
|
166
|
+
/**
|
|
167
|
+
* The public key associated with this agent
|
|
168
|
+
*/
|
|
169
|
+
publicKey: string;
|
|
170
|
+
|
|
93
171
|
/**
|
|
94
172
|
* The timestamp of the when the conversation was created in our system.
|
|
95
173
|
*/
|
|
@@ -7,6 +7,14 @@ export class Customer extends APIResource {
|
|
|
7
7
|
create(body: CustomerCreateParams, options?: Core.RequestOptions): Core.APIPromise<CustomerCreateResponse> {
|
|
8
8
|
return this._client.post('/v1/customer', { body, ...options });
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
token(body: CustomerTokenParams, options?: Core.RequestOptions): Core.APIPromise<string> {
|
|
12
|
+
return this._client.post('/v1/customer/token', {
|
|
13
|
+
body,
|
|
14
|
+
...options,
|
|
15
|
+
headers: { Accept: 'application/json', ...options?.headers },
|
|
16
|
+
});
|
|
17
|
+
}
|
|
10
18
|
}
|
|
11
19
|
|
|
12
20
|
export interface CustomerCreateResponse {
|
|
@@ -46,6 +54,8 @@ export interface CustomerCreateResponse {
|
|
|
46
54
|
displayName?: string;
|
|
47
55
|
}
|
|
48
56
|
|
|
57
|
+
export type CustomerTokenResponse = string;
|
|
58
|
+
|
|
49
59
|
export interface CustomerCreateParams {
|
|
50
60
|
/**
|
|
51
61
|
* The email of the customer
|
|
@@ -73,9 +83,33 @@ export interface CustomerCreateParams {
|
|
|
73
83
|
displayName?: string;
|
|
74
84
|
}
|
|
75
85
|
|
|
86
|
+
export interface CustomerTokenParams {
|
|
87
|
+
/**
|
|
88
|
+
* The email of the user.
|
|
89
|
+
*/
|
|
90
|
+
email: string;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The first name of the user.
|
|
94
|
+
*/
|
|
95
|
+
firstName: string;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The last name of the user.
|
|
99
|
+
*/
|
|
100
|
+
lastName: string;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The unique identifier of the user in your ticketing system.
|
|
104
|
+
*/
|
|
105
|
+
remoteId: string;
|
|
106
|
+
}
|
|
107
|
+
|
|
76
108
|
export declare namespace Customer {
|
|
77
109
|
export {
|
|
78
110
|
type CustomerCreateResponse as CustomerCreateResponse,
|
|
111
|
+
type CustomerTokenResponse as CustomerTokenResponse,
|
|
79
112
|
type CustomerCreateParams as CustomerCreateParams,
|
|
113
|
+
type CustomerTokenParams as CustomerTokenParams,
|
|
80
114
|
};
|
|
81
115
|
}
|
package/src/resources/index.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
export { Conversation } from './conversation/conversation';
|
|
4
|
-
export {
|
|
4
|
+
export {
|
|
5
|
+
Customer,
|
|
6
|
+
type CustomerCreateResponse,
|
|
7
|
+
type CustomerTokenResponse,
|
|
8
|
+
type CustomerCreateParams,
|
|
9
|
+
type CustomerTokenParams,
|
|
10
|
+
} from './customer';
|
|
5
11
|
export { Ingest, type IngestTestParams } from './ingest';
|
|
6
|
-
export { Token, type TokenCreateResponse, type TokenCreateParams } from './token';
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.3.1'; // x-release-please-version
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.3.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.3.1'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|
package/resources/token.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { APIResource } from "../resource.js";
|
|
2
|
-
import * as Core from "../core.js";
|
|
3
|
-
export declare class Token extends APIResource {
|
|
4
|
-
create(body: TokenCreateParams, options?: Core.RequestOptions): Core.APIPromise<string>;
|
|
5
|
-
}
|
|
6
|
-
export type TokenCreateResponse = string;
|
|
7
|
-
export interface TokenCreateParams {
|
|
8
|
-
/**
|
|
9
|
-
* The email of the user.
|
|
10
|
-
*/
|
|
11
|
-
email: string;
|
|
12
|
-
/**
|
|
13
|
-
* The first name of the user.
|
|
14
|
-
*/
|
|
15
|
-
firstName: string;
|
|
16
|
-
/**
|
|
17
|
-
* The last name of the user.
|
|
18
|
-
*/
|
|
19
|
-
lastName: string;
|
|
20
|
-
/**
|
|
21
|
-
* The unique identifier of the user in your system.
|
|
22
|
-
*/
|
|
23
|
-
remoteId: string;
|
|
24
|
-
}
|
|
25
|
-
export declare namespace Token {
|
|
26
|
-
export { type TokenCreateResponse as TokenCreateResponse, type TokenCreateParams as TokenCreateParams };
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=token.d.ts.map
|
package/resources/token.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../src/resources/token.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,IAAI,MAAM,SAAS,CAAC;AAEhC,qBAAa,KAAM,SAAQ,WAAW;IACpC,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;CAOxF;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEzC,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,KAAK,iBAAiB,IAAI,iBAAiB,EAAE,CAAC;CACzG"}
|
package/resources/token.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Token = void 0;
|
|
5
|
-
const resource_1 = require("../resource.js");
|
|
6
|
-
class Token extends resource_1.APIResource {
|
|
7
|
-
create(body, options) {
|
|
8
|
-
return this._client.post('/ingest/token', {
|
|
9
|
-
body,
|
|
10
|
-
...options,
|
|
11
|
-
headers: { Accept: 'application/json', ...options?.headers },
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.Token = Token;
|
|
16
|
-
//# sourceMappingURL=token.js.map
|
package/resources/token.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../src/resources/token.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,6CAA0C;AAG1C,MAAa,KAAM,SAAQ,sBAAW;IACpC,MAAM,CAAC,IAAuB,EAAE,OAA6B;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE;YACxC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AARD,sBAQC"}
|
package/resources/token.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
import { APIResource } from "../resource.mjs";
|
|
3
|
-
export class Token extends APIResource {
|
|
4
|
-
create(body, options) {
|
|
5
|
-
return this._client.post('/ingest/token', {
|
|
6
|
-
body,
|
|
7
|
-
...options,
|
|
8
|
-
headers: { Accept: 'application/json', ...options?.headers },
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=token.mjs.map
|
package/resources/token.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token.mjs","sourceRoot":"","sources":["../src/resources/token.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAGtB,MAAM,OAAO,KAAM,SAAQ,WAAW;IACpC,MAAM,CAAC,IAAuB,EAAE,OAA6B;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE;YACxC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/src/resources/token.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { APIResource } from '../resource';
|
|
4
|
-
import * as Core from '../core';
|
|
5
|
-
|
|
6
|
-
export class Token extends APIResource {
|
|
7
|
-
create(body: TokenCreateParams, options?: Core.RequestOptions): Core.APIPromise<string> {
|
|
8
|
-
return this._client.post('/ingest/token', {
|
|
9
|
-
body,
|
|
10
|
-
...options,
|
|
11
|
-
headers: { Accept: 'application/json', ...options?.headers },
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type TokenCreateResponse = string;
|
|
17
|
-
|
|
18
|
-
export interface TokenCreateParams {
|
|
19
|
-
/**
|
|
20
|
-
* The email of the user.
|
|
21
|
-
*/
|
|
22
|
-
email: string;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The first name of the user.
|
|
26
|
-
*/
|
|
27
|
-
firstName: string;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The last name of the user.
|
|
31
|
-
*/
|
|
32
|
-
lastName: string;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* The unique identifier of the user in your system.
|
|
36
|
-
*/
|
|
37
|
-
remoteId: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export declare namespace Token {
|
|
41
|
-
export { type TokenCreateResponse as TokenCreateResponse, type TokenCreateParams as TokenCreateParams };
|
|
42
|
-
}
|