@lorikeetai/node-sdk 0.6.3 → 0.7.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/CHANGELOG.md +27 -0
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/core.d.ts +1 -1
- package/core.d.ts.map +1 -1
- package/core.js +14 -5
- package/core.js.map +1 -1
- package/core.mjs +14 -5
- package/core.mjs.map +1 -1
- package/error.d.ts +18 -24
- package/error.d.ts.map +1 -1
- package/error.js +1 -31
- package/error.js.map +1 -1
- package/error.mjs +1 -31
- package/error.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/conversation/chat.d.ts +74 -4
- package/resources/conversation/chat.d.ts.map +1 -1
- package/resources/conversation/email.d.ts +74 -4
- package/resources/conversation/email.d.ts.map +1 -1
- package/src/core.ts +15 -5
- package/src/error.ts +24 -40
- package/src/resources/conversation/chat.ts +89 -4
- package/src/resources/conversation/email.ts +89 -4
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/error.js
CHANGED
|
@@ -32,7 +32,7 @@ class APIError extends LorikeetError {
|
|
|
32
32
|
return '(no status code or body)';
|
|
33
33
|
}
|
|
34
34
|
static generate(status, errorResponse, message, headers) {
|
|
35
|
-
if (!status) {
|
|
35
|
+
if (!status || !headers) {
|
|
36
36
|
return new APIConnectionError({ message, cause: (0, core_1.castToError)(errorResponse) });
|
|
37
37
|
}
|
|
38
38
|
const error = errorResponse;
|
|
@@ -67,14 +67,12 @@ exports.APIError = APIError;
|
|
|
67
67
|
class APIUserAbortError extends APIError {
|
|
68
68
|
constructor({ message } = {}) {
|
|
69
69
|
super(undefined, undefined, message || 'Request was aborted.', undefined);
|
|
70
|
-
this.status = undefined;
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
exports.APIUserAbortError = APIUserAbortError;
|
|
74
73
|
class APIConnectionError extends APIError {
|
|
75
74
|
constructor({ message, cause }) {
|
|
76
75
|
super(undefined, undefined, message || 'Connection error.', undefined);
|
|
77
|
-
this.status = undefined;
|
|
78
76
|
// in some environments the 'cause' property is already declared
|
|
79
77
|
// @ts-ignore
|
|
80
78
|
if (cause)
|
|
@@ -89,52 +87,24 @@ class APIConnectionTimeoutError extends APIConnectionError {
|
|
|
89
87
|
}
|
|
90
88
|
exports.APIConnectionTimeoutError = APIConnectionTimeoutError;
|
|
91
89
|
class BadRequestError extends APIError {
|
|
92
|
-
constructor() {
|
|
93
|
-
super(...arguments);
|
|
94
|
-
this.status = 400;
|
|
95
|
-
}
|
|
96
90
|
}
|
|
97
91
|
exports.BadRequestError = BadRequestError;
|
|
98
92
|
class AuthenticationError extends APIError {
|
|
99
|
-
constructor() {
|
|
100
|
-
super(...arguments);
|
|
101
|
-
this.status = 401;
|
|
102
|
-
}
|
|
103
93
|
}
|
|
104
94
|
exports.AuthenticationError = AuthenticationError;
|
|
105
95
|
class PermissionDeniedError extends APIError {
|
|
106
|
-
constructor() {
|
|
107
|
-
super(...arguments);
|
|
108
|
-
this.status = 403;
|
|
109
|
-
}
|
|
110
96
|
}
|
|
111
97
|
exports.PermissionDeniedError = PermissionDeniedError;
|
|
112
98
|
class NotFoundError extends APIError {
|
|
113
|
-
constructor() {
|
|
114
|
-
super(...arguments);
|
|
115
|
-
this.status = 404;
|
|
116
|
-
}
|
|
117
99
|
}
|
|
118
100
|
exports.NotFoundError = NotFoundError;
|
|
119
101
|
class ConflictError extends APIError {
|
|
120
|
-
constructor() {
|
|
121
|
-
super(...arguments);
|
|
122
|
-
this.status = 409;
|
|
123
|
-
}
|
|
124
102
|
}
|
|
125
103
|
exports.ConflictError = ConflictError;
|
|
126
104
|
class UnprocessableEntityError extends APIError {
|
|
127
|
-
constructor() {
|
|
128
|
-
super(...arguments);
|
|
129
|
-
this.status = 422;
|
|
130
|
-
}
|
|
131
105
|
}
|
|
132
106
|
exports.UnprocessableEntityError = UnprocessableEntityError;
|
|
133
107
|
class RateLimitError extends APIError {
|
|
134
|
-
constructor() {
|
|
135
|
-
super(...arguments);
|
|
136
|
-
this.status = 429;
|
|
137
|
-
}
|
|
138
108
|
}
|
|
139
109
|
exports.RateLimitError = RateLimitError;
|
|
140
110
|
class InternalServerError extends APIError {
|
package/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["src/error.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,KAAK;CAAG;AAA3C,sCAA2C;AAE3C,MAAa,
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["src/error.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,oCAA8C;AAE9C,MAAa,aAAc,SAAQ,KAAK;CAAG;AAA3C,sCAA2C;AAE3C,MAAa,QAIX,SAAQ,aAAa;IAQrB,YAAY,MAAe,EAAE,KAAa,EAAE,OAA2B,EAAE,OAAiB;QACxF,KAAK,CAAC,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAEO,MAAM,CAAC,WAAW,CAAC,MAA0B,EAAE,KAAU,EAAE,OAA2B;QAC5F,MAAM,GAAG,GACP,KAAK,EAAE,OAAO,CAAC,CAAC;YACd,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC;gBACjC,KAAK,CAAC,OAAO;gBACf,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC;YACjC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;gBAC/B,CAAC,CAAC,OAAO,CAAC;QAEZ,IAAI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AAQ,QAAsB;CAAG;AAA9D,0CAA8D;AAE9D,MAAa,mBAAoB,SAAQ,QAAsB;CAAG;AAAlE,kDAAkE;AAElE,MAAa,qBAAsB,SAAQ,QAAsB;CAAG;AAApE,sDAAoE;AAEpE,MAAa,aAAc,SAAQ,QAAsB;CAAG;AAA5D,sCAA4D;AAE5D,MAAa,aAAc,SAAQ,QAAsB;CAAG;AAA5D,sCAA4D;AAE5D,MAAa,wBAAyB,SAAQ,QAAsB;CAAG;AAAvE,4DAAuE;AAEvE,MAAa,cAAe,SAAQ,QAAsB;CAAG;AAA7D,wCAA6D;AAE7D,MAAa,mBAAoB,SAAQ,QAAyB;CAAG;AAArE,kDAAqE"}
|
package/error.mjs
CHANGED
|
@@ -28,7 +28,7 @@ export class APIError extends LorikeetError {
|
|
|
28
28
|
return '(no status code or body)';
|
|
29
29
|
}
|
|
30
30
|
static generate(status, errorResponse, message, headers) {
|
|
31
|
-
if (!status) {
|
|
31
|
+
if (!status || !headers) {
|
|
32
32
|
return new APIConnectionError({ message, cause: castToError(errorResponse) });
|
|
33
33
|
}
|
|
34
34
|
const error = errorResponse;
|
|
@@ -62,13 +62,11 @@ export class APIError extends LorikeetError {
|
|
|
62
62
|
export class APIUserAbortError extends APIError {
|
|
63
63
|
constructor({ message } = {}) {
|
|
64
64
|
super(undefined, undefined, message || 'Request was aborted.', undefined);
|
|
65
|
-
this.status = undefined;
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
export class APIConnectionError extends APIError {
|
|
69
68
|
constructor({ message, cause }) {
|
|
70
69
|
super(undefined, undefined, message || 'Connection error.', undefined);
|
|
71
|
-
this.status = undefined;
|
|
72
70
|
// in some environments the 'cause' property is already declared
|
|
73
71
|
// @ts-ignore
|
|
74
72
|
if (cause)
|
|
@@ -81,46 +79,18 @@ export class APIConnectionTimeoutError extends APIConnectionError {
|
|
|
81
79
|
}
|
|
82
80
|
}
|
|
83
81
|
export class BadRequestError extends APIError {
|
|
84
|
-
constructor() {
|
|
85
|
-
super(...arguments);
|
|
86
|
-
this.status = 400;
|
|
87
|
-
}
|
|
88
82
|
}
|
|
89
83
|
export class AuthenticationError extends APIError {
|
|
90
|
-
constructor() {
|
|
91
|
-
super(...arguments);
|
|
92
|
-
this.status = 401;
|
|
93
|
-
}
|
|
94
84
|
}
|
|
95
85
|
export class PermissionDeniedError extends APIError {
|
|
96
|
-
constructor() {
|
|
97
|
-
super(...arguments);
|
|
98
|
-
this.status = 403;
|
|
99
|
-
}
|
|
100
86
|
}
|
|
101
87
|
export class NotFoundError extends APIError {
|
|
102
|
-
constructor() {
|
|
103
|
-
super(...arguments);
|
|
104
|
-
this.status = 404;
|
|
105
|
-
}
|
|
106
88
|
}
|
|
107
89
|
export class ConflictError extends APIError {
|
|
108
|
-
constructor() {
|
|
109
|
-
super(...arguments);
|
|
110
|
-
this.status = 409;
|
|
111
|
-
}
|
|
112
90
|
}
|
|
113
91
|
export class UnprocessableEntityError extends APIError {
|
|
114
|
-
constructor() {
|
|
115
|
-
super(...arguments);
|
|
116
|
-
this.status = 422;
|
|
117
|
-
}
|
|
118
92
|
}
|
|
119
93
|
export class RateLimitError extends APIError {
|
|
120
|
-
constructor() {
|
|
121
|
-
super(...arguments);
|
|
122
|
-
this.status = 429;
|
|
123
|
-
}
|
|
124
94
|
}
|
|
125
95
|
export class InternalServerError extends APIError {
|
|
126
96
|
}
|
package/error.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.mjs","sourceRoot":"","sources":["src/error.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAW;AAE/B,MAAM,OAAO,aAAc,SAAQ,KAAK;CAAG;AAE3C,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"error.mjs","sourceRoot":"","sources":["src/error.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAW;AAE/B,MAAM,OAAO,aAAc,SAAQ,KAAK;CAAG;AAE3C,MA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CAAC;IACvD,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,QAAyC;IAC9E,YAAY,EAAE,OAAO,KAA2B,EAAE;QAChD,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,IAAI,sBAAsB,EAAE,SAAS,CAAC,CAAC;IAC5E,CAAC;CACF;AAED,MAAM,OAAO,kBAAmB,SAAQ,QAAyC;IAC/E,YAAY,EAAE,OAAO,EAAE,KAAK,EAA+D;QACzF,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,IAAI,mBAAmB,EAAE,SAAS,CAAC,CAAC;QACvE,gEAAgE;QAChE,aAAa;QACb,IAAI,KAAK;YAAE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAChC,CAAC;CACF;AAED,MAAM,OAAO,yBAA0B,SAAQ,kBAAkB;IAC/D,YAAY,EAAE,OAAO,KAA2B,EAAE;QAChD,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,CAAC,CAAC;IACtD,CAAC;CACF;AAED,MAAM,OAAO,eAAgB,SAAQ,QAAsB;CAAG;AAE9D,MAAM,OAAO,mBAAoB,SAAQ,QAAsB;CAAG;AAElE,MAAM,OAAO,qBAAsB,SAAQ,QAAsB;CAAG;AAEpE,MAAM,OAAO,aAAc,SAAQ,QAAsB;CAAG;AAE5D,MAAM,OAAO,aAAc,SAAQ,QAAsB;CAAG;AAE5D,MAAM,OAAO,wBAAyB,SAAQ,QAAsB;CAAG;AAEvE,MAAM,OAAO,cAAe,SAAQ,QAAsB;CAAG;AAE7D,MAAM,OAAO,mBAAoB,SAAQ,QAAyB;CAAG"}
|
package/package.json
CHANGED
|
@@ -59,11 +59,15 @@ export interface ChatGenerateResponse {
|
|
|
59
59
|
/**
|
|
60
60
|
* The latest message type - useful for polling
|
|
61
61
|
*/
|
|
62
|
-
latestMessageType: 'CUSTOMER' | '
|
|
62
|
+
latestMessageType: 'CUSTOMER' | 'BOT_RESPONSE' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE';
|
|
63
63
|
/**
|
|
64
64
|
* The full list of messages. This endpoint supports markdown.
|
|
65
65
|
*/
|
|
66
66
|
messages: Array<ChatGenerateResponse.Message>;
|
|
67
|
+
/**
|
|
68
|
+
* The status of the conversation
|
|
69
|
+
*/
|
|
70
|
+
status: 'Unprocessed' | 'Processing' | 'Unhandled' | 'Responded' | 'Error' | 'Escalated' | 'Processed';
|
|
67
71
|
/**
|
|
68
72
|
* The timestamp of when the ticket was last updated in our system.
|
|
69
73
|
*/
|
|
@@ -75,6 +79,10 @@ export declare namespace ChatGenerateResponse {
|
|
|
75
79
|
* The ID of the conversation message
|
|
76
80
|
*/
|
|
77
81
|
id: string;
|
|
82
|
+
/**
|
|
83
|
+
* Attachments that were attached to the message
|
|
84
|
+
*/
|
|
85
|
+
attachments: Array<Message.Attachment>;
|
|
78
86
|
/**
|
|
79
87
|
* The content of the message. Markdown on plain text.
|
|
80
88
|
*/
|
|
@@ -90,7 +98,23 @@ export declare namespace ChatGenerateResponse {
|
|
|
90
98
|
/**
|
|
91
99
|
* The type of the message
|
|
92
100
|
*/
|
|
93
|
-
type: 'CUSTOMER' | '
|
|
101
|
+
type: 'CUSTOMER' | 'BOT_RESPONSE' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE';
|
|
102
|
+
}
|
|
103
|
+
namespace Message {
|
|
104
|
+
interface Attachment {
|
|
105
|
+
/**
|
|
106
|
+
* The name of the attachment
|
|
107
|
+
*/
|
|
108
|
+
name: string;
|
|
109
|
+
/**
|
|
110
|
+
* The type of the attachment
|
|
111
|
+
*/
|
|
112
|
+
type: string;
|
|
113
|
+
/**
|
|
114
|
+
* The URL of the attachment
|
|
115
|
+
*/
|
|
116
|
+
url: string;
|
|
117
|
+
}
|
|
94
118
|
}
|
|
95
119
|
}
|
|
96
120
|
export interface ChatGetResponse {
|
|
@@ -105,11 +129,15 @@ export interface ChatGetResponse {
|
|
|
105
129
|
/**
|
|
106
130
|
* The latest message type - useful for polling
|
|
107
131
|
*/
|
|
108
|
-
latestMessageType: 'CUSTOMER' | '
|
|
132
|
+
latestMessageType: 'CUSTOMER' | 'BOT_RESPONSE' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE';
|
|
109
133
|
/**
|
|
110
134
|
* The full list of messages. This endpoint supports markdown.
|
|
111
135
|
*/
|
|
112
136
|
messages: Array<ChatGetResponse.Message>;
|
|
137
|
+
/**
|
|
138
|
+
* The status of the conversation
|
|
139
|
+
*/
|
|
140
|
+
status: 'Unprocessed' | 'Processing' | 'Unhandled' | 'Responded' | 'Error' | 'Escalated' | 'Processed';
|
|
113
141
|
/**
|
|
114
142
|
* The timestamp of when the ticket was last updated in our system.
|
|
115
143
|
*/
|
|
@@ -121,6 +149,10 @@ export declare namespace ChatGetResponse {
|
|
|
121
149
|
* The ID of the conversation message
|
|
122
150
|
*/
|
|
123
151
|
id: string;
|
|
152
|
+
/**
|
|
153
|
+
* Attachments that were attached to the message
|
|
154
|
+
*/
|
|
155
|
+
attachments: Array<Message.Attachment>;
|
|
124
156
|
/**
|
|
125
157
|
* The content of the message. Markdown on plain text.
|
|
126
158
|
*/
|
|
@@ -136,7 +168,23 @@ export declare namespace ChatGetResponse {
|
|
|
136
168
|
/**
|
|
137
169
|
* The type of the message
|
|
138
170
|
*/
|
|
139
|
-
type: 'CUSTOMER' | '
|
|
171
|
+
type: 'CUSTOMER' | 'BOT_RESPONSE' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE';
|
|
172
|
+
}
|
|
173
|
+
namespace Message {
|
|
174
|
+
interface Attachment {
|
|
175
|
+
/**
|
|
176
|
+
* The name of the attachment
|
|
177
|
+
*/
|
|
178
|
+
name: string;
|
|
179
|
+
/**
|
|
180
|
+
* The type of the attachment
|
|
181
|
+
*/
|
|
182
|
+
type: string;
|
|
183
|
+
/**
|
|
184
|
+
* The URL of the attachment
|
|
185
|
+
*/
|
|
186
|
+
url: string;
|
|
187
|
+
}
|
|
140
188
|
}
|
|
141
189
|
}
|
|
142
190
|
export interface ChatStartResponse {
|
|
@@ -148,8 +196,16 @@ export interface ChatStartResponse {
|
|
|
148
196
|
* The timestamp of the when the conversation was created in our system.
|
|
149
197
|
*/
|
|
150
198
|
createdAt: string;
|
|
199
|
+
/**
|
|
200
|
+
* The status of the conversation
|
|
201
|
+
*/
|
|
202
|
+
status: 'Unprocessed' | 'Processing' | 'Unhandled' | 'Responded' | 'Error' | 'Escalated' | 'Processed';
|
|
151
203
|
}
|
|
152
204
|
export interface ChatGenerateParams {
|
|
205
|
+
/**
|
|
206
|
+
* Attachments to be sent with the message
|
|
207
|
+
*/
|
|
208
|
+
attachments: Array<ChatGenerateParams.Attachment>;
|
|
153
209
|
/**
|
|
154
210
|
* The ID of the conversation
|
|
155
211
|
*/
|
|
@@ -165,6 +221,20 @@ export interface ChatGenerateParams {
|
|
|
165
221
|
customer?: ChatGenerateParams.Customer;
|
|
166
222
|
}
|
|
167
223
|
export declare namespace ChatGenerateParams {
|
|
224
|
+
interface Attachment {
|
|
225
|
+
/**
|
|
226
|
+
* The name of the attachment
|
|
227
|
+
*/
|
|
228
|
+
name: string;
|
|
229
|
+
/**
|
|
230
|
+
* The type of the attachment
|
|
231
|
+
*/
|
|
232
|
+
type: string;
|
|
233
|
+
/**
|
|
234
|
+
* The URL of the attachment
|
|
235
|
+
*/
|
|
236
|
+
url: string;
|
|
237
|
+
}
|
|
168
238
|
/**
|
|
169
239
|
* Any additional customer information, that has changed in the course of the
|
|
170
240
|
* conversation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../../src/resources/conversation/chat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAGnC,qBAAa,IAAK,SAAQ,WAAW;IACnC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,IAAI,EAAE,kB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AC;IAElB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,CAAC,OAAO,WAAW,IAAI,CAAC;IAC5B,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,iBAAiB,IAAI,iBAAiB,EAC3C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,eAAe,IAAI,eAAe,GACxC,CAAC;CACH"}
|
|
@@ -17,11 +17,15 @@ export interface EmailGenerateResponse {
|
|
|
17
17
|
/**
|
|
18
18
|
* The latest message type - useful for polling
|
|
19
19
|
*/
|
|
20
|
-
latestMessageType: 'CUSTOMER' | '
|
|
20
|
+
latestMessageType: 'CUSTOMER' | 'BOT_RESPONSE' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE';
|
|
21
21
|
/**
|
|
22
22
|
* The full list of messages. This endpoint supports markdown.
|
|
23
23
|
*/
|
|
24
24
|
messages: Array<EmailGenerateResponse.Message>;
|
|
25
|
+
/**
|
|
26
|
+
* The status of the conversation
|
|
27
|
+
*/
|
|
28
|
+
status: 'Unprocessed' | 'Processing' | 'Unhandled' | 'Responded' | 'Error' | 'Escalated' | 'Processed';
|
|
25
29
|
/**
|
|
26
30
|
* The timestamp of when the ticket was last updated in our system.
|
|
27
31
|
*/
|
|
@@ -33,6 +37,10 @@ export declare namespace EmailGenerateResponse {
|
|
|
33
37
|
* The ID of the conversation message
|
|
34
38
|
*/
|
|
35
39
|
id: string;
|
|
40
|
+
/**
|
|
41
|
+
* Attachments that were attached to the message
|
|
42
|
+
*/
|
|
43
|
+
attachments: Array<Message.Attachment>;
|
|
36
44
|
/**
|
|
37
45
|
* The content of the message. Markdown on plain text.
|
|
38
46
|
*/
|
|
@@ -48,7 +56,23 @@ export declare namespace EmailGenerateResponse {
|
|
|
48
56
|
/**
|
|
49
57
|
* The type of the message
|
|
50
58
|
*/
|
|
51
|
-
type: 'CUSTOMER' | '
|
|
59
|
+
type: 'CUSTOMER' | 'BOT_RESPONSE' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE';
|
|
60
|
+
}
|
|
61
|
+
namespace Message {
|
|
62
|
+
interface Attachment {
|
|
63
|
+
/**
|
|
64
|
+
* The name of the attachment
|
|
65
|
+
*/
|
|
66
|
+
name: string;
|
|
67
|
+
/**
|
|
68
|
+
* The type of the attachment
|
|
69
|
+
*/
|
|
70
|
+
type: string;
|
|
71
|
+
/**
|
|
72
|
+
* The URL of the attachment
|
|
73
|
+
*/
|
|
74
|
+
url: string;
|
|
75
|
+
}
|
|
52
76
|
}
|
|
53
77
|
}
|
|
54
78
|
export interface EmailGetResponse {
|
|
@@ -63,11 +87,15 @@ export interface EmailGetResponse {
|
|
|
63
87
|
/**
|
|
64
88
|
* The latest message type - useful for polling
|
|
65
89
|
*/
|
|
66
|
-
latestMessageType: 'CUSTOMER' | '
|
|
90
|
+
latestMessageType: 'CUSTOMER' | 'BOT_RESPONSE' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE';
|
|
67
91
|
/**
|
|
68
92
|
* The full list of messages. This endpoint supports markdown.
|
|
69
93
|
*/
|
|
70
94
|
messages: Array<EmailGetResponse.Message>;
|
|
95
|
+
/**
|
|
96
|
+
* The status of the conversation
|
|
97
|
+
*/
|
|
98
|
+
status: 'Unprocessed' | 'Processing' | 'Unhandled' | 'Responded' | 'Error' | 'Escalated' | 'Processed';
|
|
71
99
|
/**
|
|
72
100
|
* The timestamp of when the ticket was last updated in our system.
|
|
73
101
|
*/
|
|
@@ -79,6 +107,10 @@ export declare namespace EmailGetResponse {
|
|
|
79
107
|
* The ID of the conversation message
|
|
80
108
|
*/
|
|
81
109
|
id: string;
|
|
110
|
+
/**
|
|
111
|
+
* Attachments that were attached to the message
|
|
112
|
+
*/
|
|
113
|
+
attachments: Array<Message.Attachment>;
|
|
82
114
|
/**
|
|
83
115
|
* The content of the message. Markdown on plain text.
|
|
84
116
|
*/
|
|
@@ -94,7 +126,23 @@ export declare namespace EmailGetResponse {
|
|
|
94
126
|
/**
|
|
95
127
|
* The type of the message
|
|
96
128
|
*/
|
|
97
|
-
type: 'CUSTOMER' | '
|
|
129
|
+
type: 'CUSTOMER' | 'BOT_RESPONSE' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE';
|
|
130
|
+
}
|
|
131
|
+
namespace Message {
|
|
132
|
+
interface Attachment {
|
|
133
|
+
/**
|
|
134
|
+
* The name of the attachment
|
|
135
|
+
*/
|
|
136
|
+
name: string;
|
|
137
|
+
/**
|
|
138
|
+
* The type of the attachment
|
|
139
|
+
*/
|
|
140
|
+
type: string;
|
|
141
|
+
/**
|
|
142
|
+
* The URL of the attachment
|
|
143
|
+
*/
|
|
144
|
+
url: string;
|
|
145
|
+
}
|
|
98
146
|
}
|
|
99
147
|
}
|
|
100
148
|
export interface EmailStartResponse {
|
|
@@ -106,8 +154,16 @@ export interface EmailStartResponse {
|
|
|
106
154
|
* The timestamp of the when the conversation was created in our system.
|
|
107
155
|
*/
|
|
108
156
|
createdAt: string;
|
|
157
|
+
/**
|
|
158
|
+
* The status of the conversation
|
|
159
|
+
*/
|
|
160
|
+
status: 'Unprocessed' | 'Processing' | 'Unhandled' | 'Responded' | 'Error' | 'Escalated' | 'Processed';
|
|
109
161
|
}
|
|
110
162
|
export interface EmailGenerateParams {
|
|
163
|
+
/**
|
|
164
|
+
* Attachments to be sent with the message
|
|
165
|
+
*/
|
|
166
|
+
attachments: Array<EmailGenerateParams.Attachment>;
|
|
111
167
|
/**
|
|
112
168
|
* The ID of the conversation
|
|
113
169
|
*/
|
|
@@ -123,6 +179,20 @@ export interface EmailGenerateParams {
|
|
|
123
179
|
customer?: EmailGenerateParams.Customer;
|
|
124
180
|
}
|
|
125
181
|
export declare namespace EmailGenerateParams {
|
|
182
|
+
interface Attachment {
|
|
183
|
+
/**
|
|
184
|
+
* The name of the attachment
|
|
185
|
+
*/
|
|
186
|
+
name: string;
|
|
187
|
+
/**
|
|
188
|
+
* The type of the attachment
|
|
189
|
+
*/
|
|
190
|
+
type: string;
|
|
191
|
+
/**
|
|
192
|
+
* The URL of the attachment
|
|
193
|
+
*/
|
|
194
|
+
url: string;
|
|
195
|
+
}
|
|
126
196
|
/**
|
|
127
197
|
* Any additional customer information, that has changed in the course of the
|
|
128
198
|
* conversation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/resources/conversation/email.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,qBAAa,KAAM,SAAQ,WAAW;IACpC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC;IAI1G,GAAG,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC;IAI5F,KAAK,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC;CAGlG;AAED,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,iBAAiB,EAAE,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../../src/resources/conversation/email.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,qBAAa,KAAM,SAAQ,WAAW;IACpC,QAAQ,CAAC,IAAI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qBAAqB,EACnD,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
|
package/src/core.ts
CHANGED
|
@@ -163,7 +163,7 @@ export abstract class APIClient {
|
|
|
163
163
|
maxRetries = 2,
|
|
164
164
|
timeout = 60000, // 1 minute
|
|
165
165
|
httpAgent,
|
|
166
|
-
fetch:
|
|
166
|
+
fetch: overriddenFetch,
|
|
167
167
|
}: {
|
|
168
168
|
baseURL: string;
|
|
169
169
|
maxRetries?: number | undefined;
|
|
@@ -176,7 +176,7 @@ export abstract class APIClient {
|
|
|
176
176
|
this.timeout = validatePositiveInteger('timeout', timeout);
|
|
177
177
|
this.httpAgent = httpAgent;
|
|
178
178
|
|
|
179
|
-
this.fetch =
|
|
179
|
+
this.fetch = overriddenFetch ?? fetch;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
protected authHeaders(opts: FinalRequestOptions): Headers {
|
|
@@ -522,9 +522,19 @@ export abstract class APIClient {
|
|
|
522
522
|
|
|
523
523
|
const timeout = setTimeout(() => controller.abort(), ms);
|
|
524
524
|
|
|
525
|
+
const fetchOptions = {
|
|
526
|
+
signal: controller.signal as any,
|
|
527
|
+
...options,
|
|
528
|
+
};
|
|
529
|
+
if (fetchOptions.method) {
|
|
530
|
+
// Custom methods like 'patch' need to be uppercased
|
|
531
|
+
// See https://github.com/nodejs/undici/issues/2294
|
|
532
|
+
fetchOptions.method = fetchOptions.method.toUpperCase();
|
|
533
|
+
}
|
|
534
|
+
|
|
525
535
|
return (
|
|
526
536
|
// use undefined this binding; fetch errors if bound to something else in browser/cloudflare
|
|
527
|
-
this.fetch.call(undefined, url,
|
|
537
|
+
this.fetch.call(undefined, url, fetchOptions).finally(() => {
|
|
528
538
|
clearTimeout(timeout);
|
|
529
539
|
})
|
|
530
540
|
);
|
|
@@ -970,8 +980,8 @@ export const safeJSON = (text: string) => {
|
|
|
970
980
|
}
|
|
971
981
|
};
|
|
972
982
|
|
|
973
|
-
// https://
|
|
974
|
-
const startsWithSchemeRegexp =
|
|
983
|
+
// https://url.spec.whatwg.org/#url-scheme-string
|
|
984
|
+
const startsWithSchemeRegexp = /^[a-z][a-z0-9+.-]*:/i;
|
|
975
985
|
const isAbsoluteURL = (url: string): boolean => {
|
|
976
986
|
return startsWithSchemeRegexp.test(url);
|
|
977
987
|
};
|
package/src/error.ts
CHANGED
|
@@ -4,17 +4,19 @@ import { castToError, Headers } from './core';
|
|
|
4
4
|
|
|
5
5
|
export class LorikeetError extends Error {}
|
|
6
6
|
|
|
7
|
-
export class APIError
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
export class APIError<
|
|
8
|
+
TStatus extends number | undefined = number | undefined,
|
|
9
|
+
THeaders extends Headers | undefined = Headers | undefined,
|
|
10
|
+
TError extends Object | undefined = Object | undefined,
|
|
11
|
+
> extends LorikeetError {
|
|
12
|
+
/** HTTP status for the response that caused the error */
|
|
13
|
+
readonly status: TStatus;
|
|
14
|
+
/** HTTP headers for the response that caused the error */
|
|
15
|
+
readonly headers: THeaders;
|
|
16
|
+
/** JSON body of the response that caused the error */
|
|
17
|
+
readonly error: TError;
|
|
18
|
+
|
|
19
|
+
constructor(status: TStatus, error: TError, message: string | undefined, headers: THeaders) {
|
|
18
20
|
super(`${APIError.makeMessage(status, error, message)}`);
|
|
19
21
|
this.status = status;
|
|
20
22
|
this.headers = headers;
|
|
@@ -48,7 +50,7 @@ export class APIError extends LorikeetError {
|
|
|
48
50
|
message: string | undefined,
|
|
49
51
|
headers: Headers | undefined,
|
|
50
52
|
): APIError {
|
|
51
|
-
if (!status) {
|
|
53
|
+
if (!status || !headers) {
|
|
52
54
|
return new APIConnectionError({ message, cause: castToError(errorResponse) });
|
|
53
55
|
}
|
|
54
56
|
|
|
@@ -90,17 +92,13 @@ export class APIError extends LorikeetError {
|
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
|
|
93
|
-
export class APIUserAbortError extends APIError {
|
|
94
|
-
override readonly status: undefined = undefined;
|
|
95
|
-
|
|
95
|
+
export class APIUserAbortError extends APIError<undefined, undefined, undefined> {
|
|
96
96
|
constructor({ message }: { message?: string } = {}) {
|
|
97
97
|
super(undefined, undefined, message || 'Request was aborted.', undefined);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
export class APIConnectionError extends APIError {
|
|
102
|
-
override readonly status: undefined = undefined;
|
|
103
|
-
|
|
101
|
+
export class APIConnectionError extends APIError<undefined, undefined, undefined> {
|
|
104
102
|
constructor({ message, cause }: { message?: string | undefined; cause?: Error | undefined }) {
|
|
105
103
|
super(undefined, undefined, message || 'Connection error.', undefined);
|
|
106
104
|
// in some environments the 'cause' property is already declared
|
|
@@ -115,32 +113,18 @@ export class APIConnectionTimeoutError extends APIConnectionError {
|
|
|
115
113
|
}
|
|
116
114
|
}
|
|
117
115
|
|
|
118
|
-
export class BadRequestError extends APIError {
|
|
119
|
-
override readonly status: 400 = 400;
|
|
120
|
-
}
|
|
116
|
+
export class BadRequestError extends APIError<400, Headers> {}
|
|
121
117
|
|
|
122
|
-
export class AuthenticationError extends APIError {
|
|
123
|
-
override readonly status: 401 = 401;
|
|
124
|
-
}
|
|
118
|
+
export class AuthenticationError extends APIError<401, Headers> {}
|
|
125
119
|
|
|
126
|
-
export class PermissionDeniedError extends APIError {
|
|
127
|
-
override readonly status: 403 = 403;
|
|
128
|
-
}
|
|
120
|
+
export class PermissionDeniedError extends APIError<403, Headers> {}
|
|
129
121
|
|
|
130
|
-
export class NotFoundError extends APIError {
|
|
131
|
-
override readonly status: 404 = 404;
|
|
132
|
-
}
|
|
122
|
+
export class NotFoundError extends APIError<404, Headers> {}
|
|
133
123
|
|
|
134
|
-
export class ConflictError extends APIError {
|
|
135
|
-
override readonly status: 409 = 409;
|
|
136
|
-
}
|
|
124
|
+
export class ConflictError extends APIError<409, Headers> {}
|
|
137
125
|
|
|
138
|
-
export class UnprocessableEntityError extends APIError {
|
|
139
|
-
override readonly status: 422 = 422;
|
|
140
|
-
}
|
|
126
|
+
export class UnprocessableEntityError extends APIError<422, Headers> {}
|
|
141
127
|
|
|
142
|
-
export class RateLimitError extends APIError {
|
|
143
|
-
override readonly status: 429 = 429;
|
|
144
|
-
}
|
|
128
|
+
export class RateLimitError extends APIError<429, Headers> {}
|
|
145
129
|
|
|
146
|
-
export class InternalServerError extends APIError {}
|
|
130
|
+
export class InternalServerError extends APIError<number, Headers> {}
|