@lorikeetai/node-sdk 0.3.1 → 0.5.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 +40 -0
- package/README.md +9 -0
- package/index.d.mts +7 -4
- package/index.d.ts +7 -4
- package/index.d.ts.map +1 -1
- package/index.js +5 -2
- package/index.js.map +1 -1
- package/index.mjs +5 -2
- package/index.mjs.map +1 -1
- package/lib/poll-until.d.ts +6 -2
- package/lib/poll-until.d.ts.map +1 -1
- package/lib/poll-until.js +4 -1
- package/lib/poll-until.js.map +1 -1
- package/lib/poll-until.mjs +4 -1
- package/lib/poll-until.mjs.map +1 -1
- package/package.json +2 -1
- package/resources/conversation/chat.d.ts +68 -17
- package/resources/conversation/chat.d.ts.map +1 -1
- package/resources/conversation/chat.js +46 -2
- package/resources/conversation/chat.js.map +1 -1
- package/resources/conversation/chat.mjs +46 -2
- package/resources/conversation/chat.mjs.map +1 -1
- package/resources/conversation/conversation.d.ts +2 -2
- package/resources/conversation/conversation.d.ts.map +1 -1
- package/resources/conversation/conversation.js.map +1 -1
- package/resources/conversation/conversation.mjs +1 -1
- package/resources/conversation/conversation.mjs.map +1 -1
- package/resources/conversation/email.d.ts +113 -3
- package/resources/conversation/email.d.ts.map +1 -1
- package/resources/conversation/email.js +6 -0
- package/resources/conversation/email.js.map +1 -1
- package/resources/conversation/email.mjs +6 -0
- package/resources/conversation/email.mjs.map +1 -1
- package/resources/conversation/index.d.ts +1 -1
- package/resources/conversation/index.d.ts.map +1 -1
- package/resources/conversation/index.js.map +1 -1
- package/resources/conversation/index.mjs +1 -1
- package/resources/conversation/index.mjs.map +1 -1
- package/resources/customer.d.ts +67 -8
- package/resources/customer.d.ts.map +1 -1
- package/resources/customer.js +3 -0
- package/resources/customer.js.map +1 -1
- package/resources/customer.mjs +3 -0
- package/resources/customer.mjs.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/workflow.d.ts +7 -0
- package/resources/workflow.d.ts.map +1 -0
- package/resources/workflow.js +18 -0
- package/resources/workflow.js.map +1 -0
- package/resources/workflow.mjs +14 -0
- package/resources/workflow.mjs.map +1 -0
- package/src/index.ts +9 -2
- package/src/lib/poll-until.ts +11 -5
- package/src/resources/conversation/chat.ts +80 -19
- package/src/resources/conversation/conversation.ts +13 -1
- package/src/resources/conversation/email.ts +149 -3
- package/src/resources/conversation/index.ts +9 -1
- package/src/resources/customer.ts +82 -7
- package/src/resources/index.ts +2 -0
- package/src/resources/workflow.ts +17 -0
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/index.ts
CHANGED
|
@@ -9,10 +9,12 @@ import {
|
|
|
9
9
|
Customer,
|
|
10
10
|
CustomerCreateParams,
|
|
11
11
|
CustomerCreateResponse,
|
|
12
|
+
CustomerGetResponse,
|
|
12
13
|
CustomerTokenParams,
|
|
13
14
|
CustomerTokenResponse,
|
|
14
15
|
} from './resources/customer';
|
|
15
16
|
import { Ingest, IngestTestParams } from './resources/ingest';
|
|
17
|
+
import { Workflow } from './resources/workflow';
|
|
16
18
|
import { Conversation } from './resources/conversation/conversation';
|
|
17
19
|
import { generateSignature } from './lib/generate-signature';
|
|
18
20
|
|
|
@@ -146,6 +148,7 @@ export class Lorikeet extends Core.APIClient {
|
|
|
146
148
|
|
|
147
149
|
conversation: API.Conversation = new API.Conversation(this);
|
|
148
150
|
customer: API.Customer = new API.Customer(this);
|
|
151
|
+
workflow: API.Workflow = new API.Workflow(this);
|
|
149
152
|
ingest: API.Ingest = new API.Ingest(this);
|
|
150
153
|
|
|
151
154
|
protected override defaultQuery(): Core.DefaultQuery | undefined {
|
|
@@ -200,6 +203,7 @@ export class Lorikeet extends Core.APIClient {
|
|
|
200
203
|
|
|
201
204
|
Lorikeet.Conversation = Conversation;
|
|
202
205
|
Lorikeet.Customer = Customer;
|
|
206
|
+
Lorikeet.Workflow = Workflow;
|
|
203
207
|
Lorikeet.Ingest = Ingest;
|
|
204
208
|
export declare namespace Lorikeet {
|
|
205
209
|
export type RequestOptions = Core.RequestOptions;
|
|
@@ -209,15 +213,18 @@ export declare namespace Lorikeet {
|
|
|
209
213
|
export {
|
|
210
214
|
Customer as Customer,
|
|
211
215
|
type CustomerCreateResponse as CustomerCreateResponse,
|
|
216
|
+
type CustomerGetResponse as CustomerGetResponse,
|
|
212
217
|
type CustomerTokenResponse as CustomerTokenResponse,
|
|
213
218
|
type CustomerCreateParams as CustomerCreateParams,
|
|
214
219
|
type CustomerTokenParams as CustomerTokenParams,
|
|
215
220
|
};
|
|
216
221
|
|
|
222
|
+
export { Workflow as Workflow };
|
|
223
|
+
|
|
217
224
|
export { Ingest as Ingest, type IngestTestParams as IngestTestParams };
|
|
218
225
|
}
|
|
219
226
|
|
|
220
|
-
export { toFile, fileFromPath } from
|
|
227
|
+
export { toFile, fileFromPath } from './uploads';
|
|
221
228
|
export {
|
|
222
229
|
LorikeetError,
|
|
223
230
|
APIError,
|
|
@@ -232,7 +239,7 @@ export {
|
|
|
232
239
|
InternalServerError,
|
|
233
240
|
PermissionDeniedError,
|
|
234
241
|
UnprocessableEntityError,
|
|
235
|
-
} from
|
|
242
|
+
} from './error';
|
|
236
243
|
|
|
237
244
|
export { generateSignature } from "./lib/generate-signature";
|
|
238
245
|
|
package/src/lib/poll-until.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
interface PollUntilOptions<TData> {
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* The maximum time to wait for the condition to be met (ms).
|
|
4
|
+
*/
|
|
3
5
|
timeout?: number;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
/**
|
|
7
|
+
* The interval between each poll (ms).
|
|
8
|
+
*/
|
|
6
9
|
interval?: number;
|
|
7
|
-
|
|
8
10
|
/**
|
|
9
11
|
*
|
|
10
12
|
* @param result The result of the polling function.
|
|
@@ -16,10 +18,14 @@ interface PollUntilOptions<TData> {
|
|
|
16
18
|
/** Utility function to poll an endpoint. */
|
|
17
19
|
export const pollUntil = async <T>(
|
|
18
20
|
fn: () => Promise<T>,
|
|
19
|
-
{ condition = (result) => !!result, interval =
|
|
21
|
+
{ condition = (result) => !!result, interval = 3000, timeout = 30000 }: PollUntilOptions<T>,
|
|
20
22
|
): Promise<T> => {
|
|
21
23
|
const startTime = Date.now();
|
|
22
24
|
|
|
25
|
+
if (interval < 1000) {
|
|
26
|
+
throw new Error(`Polling interval must be at least 1000ms`);
|
|
27
|
+
}
|
|
28
|
+
|
|
23
29
|
while (Date.now() - startTime < timeout) {
|
|
24
30
|
const result = await fn();
|
|
25
31
|
if (condition(result)) {
|
|
@@ -5,24 +5,71 @@ import * as Core from '../../core';
|
|
|
5
5
|
import { pollUntil } from "../../lib/poll-until";
|
|
6
6
|
|
|
7
7
|
export class Chat extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* __chat.generate__
|
|
10
|
+
*
|
|
11
|
+
* Generate a chat message for a conversation. This endpoint will return immediately, polling will be required to get the response.
|
|
12
|
+
*
|
|
13
|
+
* The `latestMessageType` field in the response can be used to determine if the response is ready.
|
|
14
|
+
*
|
|
15
|
+
* If the `latestMessageType` is `BOT_RESPONSE`, the response is ready.
|
|
16
|
+
* For a more ergonomic way to poll, use the `message` method.
|
|
17
|
+
*
|
|
18
|
+
* ** WARNING ** This endpoint is not idempotent. If you call it multiple times, you will generate multiple messages.
|
|
19
|
+
*
|
|
20
|
+
* @see {@link Chat.message}
|
|
21
|
+
*/
|
|
8
22
|
generate(body: ChatGenerateParams, options?: Core.RequestOptions): Core.APIPromise<ChatGenerateResponse> {
|
|
9
23
|
return this._client.post('/v1/conversation/chat/message', { body, ...options });
|
|
10
24
|
}
|
|
11
25
|
|
|
26
|
+
/**
|
|
27
|
+
* __chat.get__
|
|
28
|
+
*
|
|
29
|
+
* Returns a chat message for a conversation. This endpoint will return the latest state of the conversation.
|
|
30
|
+
*/
|
|
12
31
|
get(query: ChatGetParams, options?: Core.RequestOptions): Core.APIPromise<ChatGetResponse> {
|
|
13
32
|
return this._client.get('/v1/conversation/chat/message', { query, ...options });
|
|
14
33
|
}
|
|
15
34
|
|
|
35
|
+
/**
|
|
36
|
+
* __chat.start__
|
|
37
|
+
*
|
|
38
|
+
* Start a chat conversation. This endpoint will return immediately.
|
|
39
|
+
*
|
|
40
|
+
* The `conversationId` field in the response can be used to generate messages.
|
|
41
|
+
*
|
|
42
|
+
* ** WARNING ** This endpoint is not idempotent. If you call it multiple times, you will generate multiple conversations.
|
|
43
|
+
*/
|
|
16
44
|
start(body: ChatStartParams, options?: Core.RequestOptions): Core.APIPromise<ChatStartResponse> {
|
|
17
45
|
return this._client.post('/v1/conversation/chat/create', { body, ...options });
|
|
18
46
|
}
|
|
19
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Returns a chat message for a conversation. This endpoint will poll until a response is ready.
|
|
50
|
+
*
|
|
51
|
+
* When it return the response is the latest message type that is of type `BOT_RESPONSE`.
|
|
52
|
+
*
|
|
53
|
+
* @see {@link Chat.poll}
|
|
54
|
+
*/
|
|
55
|
+
message(body: ChatGenerateParams, options?: Core.RequestOptions): Core.APIPromise<ChatGetResponse> {
|
|
56
|
+
return this.generate(body, options).then((response) =>
|
|
57
|
+
this.poll({ conversationId: response.conversationId }, options),
|
|
58
|
+
) as Core.APIPromise<ChatGetResponse>;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* __chat.get__
|
|
63
|
+
*
|
|
64
|
+
* Polls until it returns a BOT chat message for a conversation.
|
|
65
|
+
*/
|
|
20
66
|
poll(query: ChatGetParams, options?: Core.RequestOptions): Core.APIPromise<ChatGetResponse> {
|
|
21
|
-
const start = new Date().toISOString();
|
|
22
67
|
return pollUntil<ChatGetResponse>(
|
|
23
68
|
() => this._client.get('/v1/conversation/chat/message', { query, ...options }),
|
|
24
69
|
{
|
|
25
|
-
|
|
70
|
+
timeout: 180_000,
|
|
71
|
+
interval: 5_000,
|
|
72
|
+
condition: (conversation) => conversation.latestMessageType === 'BOT_RESPONSE',
|
|
26
73
|
},
|
|
27
74
|
) as Core.APIPromise<ChatGetResponse>;
|
|
28
75
|
}
|
|
@@ -32,17 +79,22 @@ export interface ChatGenerateResponse {
|
|
|
32
79
|
/**
|
|
33
80
|
* The ID of the conversation
|
|
34
81
|
*/
|
|
35
|
-
conversationId:
|
|
82
|
+
conversationId: string;
|
|
36
83
|
|
|
37
84
|
/**
|
|
38
|
-
* The timestamp of when the
|
|
85
|
+
* The timestamp of the when the conversation was created in our system.
|
|
39
86
|
*/
|
|
40
87
|
createdAt: string;
|
|
41
88
|
|
|
42
89
|
/**
|
|
43
|
-
* The
|
|
90
|
+
* The latest message type - useful for polling
|
|
91
|
+
*/
|
|
92
|
+
latestMessageType: 'CUSTOMER' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE' | 'BOT_RESPONSE';
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The full list of messages. This endpoint supports markdown.
|
|
44
96
|
*/
|
|
45
|
-
|
|
97
|
+
messages: Array<ChatGenerateResponse.Message>;
|
|
46
98
|
|
|
47
99
|
/**
|
|
48
100
|
* The timestamp of when the ticket was last updated in our system.
|
|
@@ -51,9 +103,6 @@ export interface ChatGenerateResponse {
|
|
|
51
103
|
}
|
|
52
104
|
|
|
53
105
|
export namespace ChatGenerateResponse {
|
|
54
|
-
/**
|
|
55
|
-
* The created message. This endpoint supports markdown.
|
|
56
|
-
*/
|
|
57
106
|
export interface Message {
|
|
58
107
|
/**
|
|
59
108
|
* The ID of the conversation message
|
|
@@ -65,6 +114,11 @@ export namespace ChatGenerateResponse {
|
|
|
65
114
|
*/
|
|
66
115
|
content: string;
|
|
67
116
|
|
|
117
|
+
/**
|
|
118
|
+
* The timestamp of the message.
|
|
119
|
+
*/
|
|
120
|
+
createdAt: string;
|
|
121
|
+
|
|
68
122
|
/**
|
|
69
123
|
* The raw content of the message. Usually HTML.
|
|
70
124
|
*/
|
|
@@ -81,17 +135,22 @@ export interface ChatGetResponse {
|
|
|
81
135
|
/**
|
|
82
136
|
* The ID of the conversation
|
|
83
137
|
*/
|
|
84
|
-
conversationId:
|
|
138
|
+
conversationId: string;
|
|
85
139
|
|
|
86
140
|
/**
|
|
87
|
-
* The timestamp of when the
|
|
141
|
+
* The timestamp of the when the conversation was created in our system.
|
|
88
142
|
*/
|
|
89
143
|
createdAt: string;
|
|
90
144
|
|
|
91
145
|
/**
|
|
92
|
-
* The
|
|
146
|
+
* The latest message type - useful for polling
|
|
93
147
|
*/
|
|
94
|
-
|
|
148
|
+
latestMessageType: 'CUSTOMER' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE' | 'BOT_RESPONSE';
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The full list of messages. This endpoint supports markdown.
|
|
152
|
+
*/
|
|
153
|
+
messages: Array<ChatGetResponse.Message>;
|
|
95
154
|
|
|
96
155
|
/**
|
|
97
156
|
* The timestamp of when the ticket was last updated in our system.
|
|
@@ -100,9 +159,6 @@ export interface ChatGetResponse {
|
|
|
100
159
|
}
|
|
101
160
|
|
|
102
161
|
export namespace ChatGetResponse {
|
|
103
|
-
/**
|
|
104
|
-
* The created message. This endpoint supports markdown.
|
|
105
|
-
*/
|
|
106
162
|
export interface Message {
|
|
107
163
|
/**
|
|
108
164
|
* The ID of the conversation message
|
|
@@ -114,6 +170,11 @@ export namespace ChatGetResponse {
|
|
|
114
170
|
*/
|
|
115
171
|
content: string;
|
|
116
172
|
|
|
173
|
+
/**
|
|
174
|
+
* The timestamp of the message.
|
|
175
|
+
*/
|
|
176
|
+
createdAt: string;
|
|
177
|
+
|
|
117
178
|
/**
|
|
118
179
|
* The raw content of the message. Usually HTML.
|
|
119
180
|
*/
|
|
@@ -130,7 +191,7 @@ export interface ChatStartResponse {
|
|
|
130
191
|
/**
|
|
131
192
|
* The ID of the conversation
|
|
132
193
|
*/
|
|
133
|
-
conversationId:
|
|
194
|
+
conversationId: string;
|
|
134
195
|
|
|
135
196
|
/**
|
|
136
197
|
* The timestamp of the when the conversation was created in our system.
|
|
@@ -142,7 +203,7 @@ export interface ChatGenerateParams {
|
|
|
142
203
|
/**
|
|
143
204
|
* The ID of the conversation
|
|
144
205
|
*/
|
|
145
|
-
conversationId:
|
|
206
|
+
conversationId: string;
|
|
146
207
|
|
|
147
208
|
/**
|
|
148
209
|
* The message to be sent to the user. This endpoint supports markdown.
|
|
@@ -161,7 +222,7 @@ export interface ChatStartParams {
|
|
|
161
222
|
/**
|
|
162
223
|
* The ID of the customer. If omitted, a new customer will be created.
|
|
163
224
|
*/
|
|
164
|
-
customerId:
|
|
225
|
+
customerId: string;
|
|
165
226
|
|
|
166
227
|
/**
|
|
167
228
|
* The public key associated with this agent
|
|
@@ -12,7 +12,15 @@ import {
|
|
|
12
12
|
ChatStartResponse,
|
|
13
13
|
} from './chat';
|
|
14
14
|
import * as EmailAPI from './email';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
Email,
|
|
17
|
+
EmailGenerateParams,
|
|
18
|
+
EmailGenerateResponse,
|
|
19
|
+
EmailGetParams,
|
|
20
|
+
EmailGetResponse,
|
|
21
|
+
EmailStartParams,
|
|
22
|
+
EmailStartResponse,
|
|
23
|
+
} from './email';
|
|
16
24
|
|
|
17
25
|
export class Conversation extends APIResource {
|
|
18
26
|
email: EmailAPI.Email = new EmailAPI.Email(this._client);
|
|
@@ -25,7 +33,11 @@ Conversation.Chat = Chat;
|
|
|
25
33
|
export declare namespace Conversation {
|
|
26
34
|
export {
|
|
27
35
|
Email as Email,
|
|
36
|
+
type EmailGenerateResponse as EmailGenerateResponse,
|
|
37
|
+
type EmailGetResponse as EmailGetResponse,
|
|
28
38
|
type EmailStartResponse as EmailStartResponse,
|
|
39
|
+
type EmailGenerateParams as EmailGenerateParams,
|
|
40
|
+
type EmailGetParams as EmailGetParams,
|
|
29
41
|
type EmailStartParams as EmailStartParams,
|
|
30
42
|
};
|
|
31
43
|
|
|
@@ -4,16 +4,136 @@ import { APIResource } from '../../resource';
|
|
|
4
4
|
import * as Core from '../../core';
|
|
5
5
|
|
|
6
6
|
export class Email extends APIResource {
|
|
7
|
+
generate(body: EmailGenerateParams, options?: Core.RequestOptions): Core.APIPromise<EmailGenerateResponse> {
|
|
8
|
+
return this._client.post('/v1/conversation/email/message', { body, ...options });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
get(query: EmailGetParams, options?: Core.RequestOptions): Core.APIPromise<EmailGetResponse> {
|
|
12
|
+
return this._client.get('/v1/conversation/email/message', { query, ...options });
|
|
13
|
+
}
|
|
14
|
+
|
|
7
15
|
start(body: EmailStartParams, options?: Core.RequestOptions): Core.APIPromise<EmailStartResponse> {
|
|
8
16
|
return this._client.post('/v1/conversation/email/create', { body, ...options });
|
|
9
17
|
}
|
|
10
18
|
}
|
|
11
19
|
|
|
20
|
+
export interface EmailGenerateResponse {
|
|
21
|
+
/**
|
|
22
|
+
* The ID of the conversation
|
|
23
|
+
*/
|
|
24
|
+
conversationId: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The timestamp of the when the conversation was created in our system.
|
|
28
|
+
*/
|
|
29
|
+
createdAt: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The latest message type - useful for polling
|
|
33
|
+
*/
|
|
34
|
+
latestMessageType: 'CUSTOMER' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE' | 'BOT_RESPONSE';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The full list of messages. This endpoint supports markdown.
|
|
38
|
+
*/
|
|
39
|
+
messages: Array<EmailGenerateResponse.Message>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The timestamp of when the ticket was last updated in our system.
|
|
43
|
+
*/
|
|
44
|
+
updatedAt: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export namespace EmailGenerateResponse {
|
|
48
|
+
export interface Message {
|
|
49
|
+
/**
|
|
50
|
+
* The ID of the conversation message
|
|
51
|
+
*/
|
|
52
|
+
id: string;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The content of the message. Markdown on plain text.
|
|
56
|
+
*/
|
|
57
|
+
content: string;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The timestamp of the message.
|
|
61
|
+
*/
|
|
62
|
+
createdAt: string;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The raw content of the message. Usually HTML.
|
|
66
|
+
*/
|
|
67
|
+
rawContent: string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The type of the message
|
|
71
|
+
*/
|
|
72
|
+
type: 'CUSTOMER' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE' | 'BOT_RESPONSE';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface EmailGetResponse {
|
|
77
|
+
/**
|
|
78
|
+
* The ID of the conversation
|
|
79
|
+
*/
|
|
80
|
+
conversationId: string;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The timestamp of the when the conversation was created in our system.
|
|
84
|
+
*/
|
|
85
|
+
createdAt: string;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* The latest message type - useful for polling
|
|
89
|
+
*/
|
|
90
|
+
latestMessageType: 'CUSTOMER' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE' | 'BOT_RESPONSE';
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* The full list of messages. This endpoint supports markdown.
|
|
94
|
+
*/
|
|
95
|
+
messages: Array<EmailGetResponse.Message>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* The timestamp of when the ticket was last updated in our system.
|
|
99
|
+
*/
|
|
100
|
+
updatedAt: string;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export namespace EmailGetResponse {
|
|
104
|
+
export interface Message {
|
|
105
|
+
/**
|
|
106
|
+
* The ID of the conversation message
|
|
107
|
+
*/
|
|
108
|
+
id: string;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* The content of the message. Markdown on plain text.
|
|
112
|
+
*/
|
|
113
|
+
content: string;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The timestamp of the message.
|
|
117
|
+
*/
|
|
118
|
+
createdAt: string;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* The raw content of the message. Usually HTML.
|
|
122
|
+
*/
|
|
123
|
+
rawContent: string;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The type of the message
|
|
127
|
+
*/
|
|
128
|
+
type: 'CUSTOMER' | 'PENDING_RESPONSE' | 'DRAFT_RESPONSE' | 'BOT_RESPONSE';
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
12
132
|
export interface EmailStartResponse {
|
|
13
133
|
/**
|
|
14
134
|
* The ID of the conversation
|
|
15
135
|
*/
|
|
16
|
-
conversationId:
|
|
136
|
+
conversationId: string;
|
|
17
137
|
|
|
18
138
|
/**
|
|
19
139
|
* The timestamp of the when the conversation was created in our system.
|
|
@@ -21,11 +141,30 @@ export interface EmailStartResponse {
|
|
|
21
141
|
createdAt: string;
|
|
22
142
|
}
|
|
23
143
|
|
|
144
|
+
export interface EmailGenerateParams {
|
|
145
|
+
/**
|
|
146
|
+
* The ID of the conversation
|
|
147
|
+
*/
|
|
148
|
+
conversationId: string;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* The message to be sent to the user. This endpoint supports markdown.
|
|
152
|
+
*/
|
|
153
|
+
message: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface EmailGetParams {
|
|
157
|
+
/**
|
|
158
|
+
* The ID of the conversation you need to poll.
|
|
159
|
+
*/
|
|
160
|
+
conversationId: string;
|
|
161
|
+
}
|
|
162
|
+
|
|
24
163
|
export interface EmailStartParams {
|
|
25
164
|
/**
|
|
26
165
|
* The ID of the customer. If omitted, a new customer will be created.
|
|
27
166
|
*/
|
|
28
|
-
customerId:
|
|
167
|
+
customerId: string;
|
|
29
168
|
|
|
30
169
|
/**
|
|
31
170
|
* The public key associated with this agent
|
|
@@ -39,5 +178,12 @@ export interface EmailStartParams {
|
|
|
39
178
|
}
|
|
40
179
|
|
|
41
180
|
export declare namespace Email {
|
|
42
|
-
export {
|
|
181
|
+
export {
|
|
182
|
+
type EmailGenerateResponse as EmailGenerateResponse,
|
|
183
|
+
type EmailGetResponse as EmailGetResponse,
|
|
184
|
+
type EmailStartResponse as EmailStartResponse,
|
|
185
|
+
type EmailGenerateParams as EmailGenerateParams,
|
|
186
|
+
type EmailGetParams as EmailGetParams,
|
|
187
|
+
type EmailStartParams as EmailStartParams,
|
|
188
|
+
};
|
|
43
189
|
}
|
|
@@ -10,4 +10,12 @@ export {
|
|
|
10
10
|
type ChatStartParams,
|
|
11
11
|
} from './chat';
|
|
12
12
|
export { Conversation } from './conversation';
|
|
13
|
-
export {
|
|
13
|
+
export {
|
|
14
|
+
Email,
|
|
15
|
+
type EmailGenerateResponse,
|
|
16
|
+
type EmailGetResponse,
|
|
17
|
+
type EmailStartResponse,
|
|
18
|
+
type EmailGenerateParams,
|
|
19
|
+
type EmailGetParams,
|
|
20
|
+
type EmailStartParams,
|
|
21
|
+
} from './email';
|
|
@@ -8,6 +8,10 @@ export class Customer extends APIResource {
|
|
|
8
8
|
return this._client.post('/v1/customer', { body, ...options });
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
get(id: string, options?: Core.RequestOptions): Core.APIPromise<CustomerGetResponse> {
|
|
12
|
+
return this._client.get(`/v1/customer/${id}`, options);
|
|
13
|
+
}
|
|
14
|
+
|
|
11
15
|
token(body: CustomerTokenParams, options?: Core.RequestOptions): Core.APIPromise<string> {
|
|
12
16
|
return this._client.post('/v1/customer/token', {
|
|
13
17
|
body,
|
|
@@ -43,10 +47,61 @@ export interface CustomerCreateResponse {
|
|
|
43
47
|
*/
|
|
44
48
|
lastName: string;
|
|
45
49
|
|
|
50
|
+
/**
|
|
51
|
+
* The id of the customer in the ticketing system. For the SDK this needs to be
|
|
52
|
+
* stable and unique
|
|
53
|
+
*/
|
|
54
|
+
remoteId: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The id of the customer in your own primary database or a unique identifier, for
|
|
58
|
+
* example a cookie
|
|
59
|
+
*/
|
|
60
|
+
subscriberCustomerId: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The display name of the customer
|
|
64
|
+
*/
|
|
65
|
+
displayName?: string;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface CustomerGetResponse {
|
|
46
69
|
/**
|
|
47
70
|
* The id of the customer in the subscriber system
|
|
48
71
|
*/
|
|
49
|
-
|
|
72
|
+
id: unknown;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The timestamp of the when the customer was created in our system
|
|
76
|
+
*/
|
|
77
|
+
createdAt: string;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The email of the customer
|
|
81
|
+
*/
|
|
82
|
+
email: string;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The first name of the customer
|
|
86
|
+
*/
|
|
87
|
+
firstName: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The last name of the customer
|
|
91
|
+
*/
|
|
92
|
+
lastName: string;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The id of the customer in the ticketing system. For the SDK this needs to be
|
|
96
|
+
* stable and unique
|
|
97
|
+
*/
|
|
98
|
+
remoteId: string;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The id of the customer in your own primary database or a unique identifier, for
|
|
102
|
+
* example a cookie
|
|
103
|
+
*/
|
|
104
|
+
subscriberCustomerId: string;
|
|
50
105
|
|
|
51
106
|
/**
|
|
52
107
|
* The display name of the customer
|
|
@@ -73,9 +128,16 @@ export interface CustomerCreateParams {
|
|
|
73
128
|
lastName: string;
|
|
74
129
|
|
|
75
130
|
/**
|
|
76
|
-
* The id of the customer in the
|
|
131
|
+
* The id of the customer in the ticketing system. For the SDK this needs to be
|
|
132
|
+
* stable and unique
|
|
77
133
|
*/
|
|
78
|
-
remoteId:
|
|
134
|
+
remoteId: string;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The id of the customer in your own primary database or a unique identifier, for
|
|
138
|
+
* example a cookie
|
|
139
|
+
*/
|
|
140
|
+
subscriberCustomerId: string;
|
|
79
141
|
|
|
80
142
|
/**
|
|
81
143
|
* The display name of the customer
|
|
@@ -85,29 +147,42 @@ export interface CustomerCreateParams {
|
|
|
85
147
|
|
|
86
148
|
export interface CustomerTokenParams {
|
|
87
149
|
/**
|
|
88
|
-
* The email of the
|
|
150
|
+
* The email of the customer
|
|
89
151
|
*/
|
|
90
152
|
email: string;
|
|
91
153
|
|
|
92
154
|
/**
|
|
93
|
-
* The first name of the
|
|
155
|
+
* The first name of the customer
|
|
94
156
|
*/
|
|
95
157
|
firstName: string;
|
|
96
158
|
|
|
97
159
|
/**
|
|
98
|
-
* The last name of the
|
|
160
|
+
* The last name of the customer
|
|
99
161
|
*/
|
|
100
162
|
lastName: string;
|
|
101
163
|
|
|
102
164
|
/**
|
|
103
|
-
* The
|
|
165
|
+
* The id of the customer in the ticketing system. For the SDK this needs to be
|
|
166
|
+
* stable and unique
|
|
104
167
|
*/
|
|
105
168
|
remoteId: string;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The id of the customer in your own primary database or a unique identifier, for
|
|
172
|
+
* example a cookie
|
|
173
|
+
*/
|
|
174
|
+
subscriberCustomerId: string;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* The display name of the customer
|
|
178
|
+
*/
|
|
179
|
+
displayName?: string;
|
|
106
180
|
}
|
|
107
181
|
|
|
108
182
|
export declare namespace Customer {
|
|
109
183
|
export {
|
|
110
184
|
type CustomerCreateResponse as CustomerCreateResponse,
|
|
185
|
+
type CustomerGetResponse as CustomerGetResponse,
|
|
111
186
|
type CustomerTokenResponse as CustomerTokenResponse,
|
|
112
187
|
type CustomerCreateParams as CustomerCreateParams,
|
|
113
188
|
type CustomerTokenParams as CustomerTokenParams,
|
package/src/resources/index.ts
CHANGED
|
@@ -4,8 +4,10 @@ export { Conversation } from './conversation/conversation';
|
|
|
4
4
|
export {
|
|
5
5
|
Customer,
|
|
6
6
|
type CustomerCreateResponse,
|
|
7
|
+
type CustomerGetResponse,
|
|
7
8
|
type CustomerTokenResponse,
|
|
8
9
|
type CustomerCreateParams,
|
|
9
10
|
type CustomerTokenParams,
|
|
10
11
|
} from './customer';
|
|
11
12
|
export { Ingest, type IngestTestParams } from './ingest';
|
|
13
|
+
export { Workflow } from './workflow';
|
|
@@ -0,0 +1,17 @@
|
|
|
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 Workflow extends APIResource {
|
|
7
|
+
update(options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
8
|
+
return this._client.post('/v1/workflow', { ...options, headers: { Accept: '*/*', ...options?.headers } });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
get(id: string, options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
12
|
+
return this._client.get(`/v1/workflow/${id}`, {
|
|
13
|
+
...options,
|
|
14
|
+
headers: { Accept: '*/*', ...options?.headers },
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.5.0'; // 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.5.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED