@botpress/webchat-client 0.1.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/.eslintrc.cjs +11 -0
- package/.turbo/turbo-build.log +28 -0
- package/dist/index.d.ts +2685 -0
- package/dist/webchat-client.js +5 -0
- package/dist/webchat-client2.js +84 -0
- package/dist/webchat-client3.js +116 -0
- package/dist/webchat-client4.js +8 -0
- package/dist/webchat-client5.js +272 -0
- package/dist/webchat-client6.js +23 -0
- package/dist/webchat-client7.js +11 -0
- package/dist/webchat-client8.js +105 -0
- package/dist/webchat-client9.js +218 -0
- package/openapi-ts.config.ts +8 -0
- package/package.json +41 -0
- package/src/client/client.ts +193 -0
- package/src/client/config.ts +15 -0
- package/src/client/eventEmitter.ts +36 -0
- package/src/client/index.ts +2 -0
- package/src/client/types/index.ts +0 -0
- package/src/client/types/signals/custom.ts +8 -0
- package/src/client/types/signals/index.ts +16 -0
- package/src/client/types/signals/messageCreated.ts +201 -0
- package/src/client/types/signals/messageUpdated.ts +201 -0
- package/src/client/types/signals/typingStarted.ts +6 -0
- package/src/client/types/signals/typingStopped.ts +4 -0
- package/src/client/types/signals/webchatConfig.ts +8 -0
- package/src/client/types/signals/webchatVisibility.ts +6 -0
- package/src/index.ts +2 -0
- package/tsconfig.json +12 -0
- package/vite.config.ts +19 -0
package/dist/index.d.ts
ADDED
@@ -0,0 +1,2685 @@
|
|
1
|
+
/**
|
2
|
+
* Add a [Participant](#schema_user) to a [Conversation](#schema_conversation).
|
3
|
+
*/
|
4
|
+
declare const addParticipant: <ThrowOnError extends boolean = false>(options: Options<AddParticipantData, ThrowOnError>) => RequestResult<{
|
5
|
+
participant: User;
|
6
|
+
}, {
|
7
|
+
participant: User;
|
8
|
+
}, ThrowOnError>;
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Participant data
|
12
|
+
*/
|
13
|
+
export declare type AddParticipantBody = {
|
14
|
+
/**
|
15
|
+
* User id
|
16
|
+
*/
|
17
|
+
userId: string;
|
18
|
+
};
|
19
|
+
|
20
|
+
export declare type AddParticipantData = {
|
21
|
+
/**
|
22
|
+
* Participant data
|
23
|
+
*/
|
24
|
+
body?: AddParticipantBody;
|
25
|
+
headers: {
|
26
|
+
/**
|
27
|
+
* Authentication Key
|
28
|
+
*/
|
29
|
+
'x-user-key': string;
|
30
|
+
};
|
31
|
+
path: {
|
32
|
+
/**
|
33
|
+
* Conversation id
|
34
|
+
*/
|
35
|
+
id: string;
|
36
|
+
};
|
37
|
+
query?: never;
|
38
|
+
url: '/conversations/{id}/participants';
|
39
|
+
};
|
40
|
+
|
41
|
+
export declare type AddParticipantError = AddParticipantErrors[keyof AddParticipantErrors];
|
42
|
+
|
43
|
+
export declare type AddParticipantErrors = {
|
44
|
+
/**
|
45
|
+
* Returns the [Participant](#schema_user) object
|
46
|
+
*/
|
47
|
+
default: {
|
48
|
+
participant: User;
|
49
|
+
};
|
50
|
+
};
|
51
|
+
|
52
|
+
export declare type AddParticipantResponse = AddParticipantResponses[keyof AddParticipantResponses];
|
53
|
+
|
54
|
+
export declare type AddParticipantResponses = {
|
55
|
+
/**
|
56
|
+
* Returns the [Participant](#schema_user) object
|
57
|
+
*/
|
58
|
+
200: {
|
59
|
+
participant: User;
|
60
|
+
};
|
61
|
+
};
|
62
|
+
|
63
|
+
declare type ArrayStyle = 'form' | 'spaceDelimited' | 'pipeDelimited';
|
64
|
+
|
65
|
+
declare interface Auth {
|
66
|
+
/**
|
67
|
+
* Which part of the request do we use to send the auth?
|
68
|
+
*
|
69
|
+
* @default 'header'
|
70
|
+
*/
|
71
|
+
in?: 'header' | 'query' | 'cookie';
|
72
|
+
/**
|
73
|
+
* Header or query parameter name.
|
74
|
+
*
|
75
|
+
* @default 'Authorization'
|
76
|
+
*/
|
77
|
+
name?: string;
|
78
|
+
scheme?: 'basic' | 'bearer';
|
79
|
+
type: 'apiKey' | 'http';
|
80
|
+
}
|
81
|
+
|
82
|
+
declare type AuthToken = string | undefined;
|
83
|
+
|
84
|
+
declare type BodySerializer = (body: any) => any;
|
85
|
+
|
86
|
+
declare type BuildUrlFn = <TData extends {
|
87
|
+
body?: unknown;
|
88
|
+
path?: Record<string, unknown>;
|
89
|
+
query?: Record<string, unknown>;
|
90
|
+
url: string;
|
91
|
+
}>(options: Pick<TData, 'url'> & Options_2<TData>) => string;
|
92
|
+
|
93
|
+
declare type CallbackFn<T> = (args: T) => void;
|
94
|
+
|
95
|
+
declare interface Client$1<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never> {
|
96
|
+
/**
|
97
|
+
* Returns the final request URL.
|
98
|
+
*/
|
99
|
+
buildUrl: BuildUrlFn;
|
100
|
+
connect: MethodFn;
|
101
|
+
delete: MethodFn;
|
102
|
+
get: MethodFn;
|
103
|
+
getConfig: () => Config;
|
104
|
+
head: MethodFn;
|
105
|
+
options: MethodFn;
|
106
|
+
patch: MethodFn;
|
107
|
+
post: MethodFn;
|
108
|
+
put: MethodFn;
|
109
|
+
request: RequestFn;
|
110
|
+
setConfig: (config: Config) => Config;
|
111
|
+
trace: MethodFn;
|
112
|
+
}
|
113
|
+
|
114
|
+
export declare type Client = {
|
115
|
+
createConversation: () => Promise<ClientTypes_2.CreateConversationResponse>;
|
116
|
+
getConversation: (params: ConversationIdParam) => Promise<ClientTypes_2.GetConversationResponse>;
|
117
|
+
deleteConversation: (params: ConversationIdParam) => Promise<ClientTypes_2.DeleteConversationResponse>;
|
118
|
+
listConversations: (params: NextTokenParam) => Promise<ClientTypes_2.ListConversationsResponse>;
|
119
|
+
listConversationMessages: (params: ConversationIdParam & NextTokenParam) => Promise<ClientTypes_2.ListConversationMessagesResponse>;
|
120
|
+
addParticipant: (params: ConversationIdParam & UserIdParam) => Promise<ClientTypes_2.AddParticipantResponse>;
|
121
|
+
removeParticipant: (params: ConversationIdParam & UserIdParam) => Promise<ClientTypes_2.RemoveParticipantResponse>;
|
122
|
+
getParticipant: (params: ConversationIdParam & UserIdParam) => Promise<ClientTypes_2.GetParticipantResponse>;
|
123
|
+
listParticipants: (params: ConversationIdParam & NextTokenParam) => Promise<ClientTypes_2.ListParticipantsResponse>;
|
124
|
+
createMessage: (params: ClientTypes_2.CreateMessageBody) => Promise<ClientTypes_2.CreateMessageResponse>;
|
125
|
+
updateMessage: (params: MessageIdParam & ClientTypes_2.UpdateMessageBody) => Promise<ClientTypes_2.UpdateMessageResponse>;
|
126
|
+
getMessage: (params: MessageIdParam) => Promise<ClientTypes_2.GetMessageResponse>;
|
127
|
+
deleteMessage: (params: MessageIdParam) => Promise<ClientTypes_2.DeleteMessageResponse>;
|
128
|
+
createFile: (params: ClientTypes_2.CreateFileBody) => Promise<ClientTypes_2.CreateFileResponse>;
|
129
|
+
createUser: (params: ClientTypes_2.CreateUserBody) => Promise<ClientTypes_2.CreateUserResponse>;
|
130
|
+
getUser: (params: UserIdParam) => Promise<ClientTypes_2.GetUserResponse>;
|
131
|
+
updateUser: (params: ClientTypes_2.CreateUserBody) => Promise<ClientTypes_2.UpdateUserResponse>;
|
132
|
+
deleteUser: (params: UserIdParam) => Promise<ClientTypes_2.DeleteUserResponse>;
|
133
|
+
createEvent: (params: ClientTypes_2.CreateEventBody) => Promise<ClientTypes_2.CreateEventResponse>;
|
134
|
+
getEvent: (params: EventIdParam) => Promise<ClientTypes_2.GetEventResponse>;
|
135
|
+
listenConversation: (params: ConversationIdParam) => EventEmitter<Record<Event_3['type'], Event_3['data']>>['on'];
|
136
|
+
};
|
137
|
+
|
138
|
+
declare type Client_2 = Client$1<RequestFn, Config, MethodFn, BuildUrlFn> & {
|
139
|
+
interceptors: Middleware<Request, Response, unknown, RequestOptions>;
|
140
|
+
};
|
141
|
+
|
142
|
+
export declare type ClientOptions = {
|
143
|
+
baseUrl: 'https://webchat.botpress.cloud/' | (string & {});
|
144
|
+
};
|
145
|
+
|
146
|
+
declare interface ClientOptions_2 {
|
147
|
+
baseUrl?: string;
|
148
|
+
throwOnError?: boolean;
|
149
|
+
}
|
150
|
+
|
151
|
+
declare namespace ClientTypes_2 {
|
152
|
+
export {
|
153
|
+
User,
|
154
|
+
Conversation,
|
155
|
+
Message,
|
156
|
+
Event_2 as Event,
|
157
|
+
File_2 as File,
|
158
|
+
CreateConversationBody,
|
159
|
+
AddParticipantBody,
|
160
|
+
CreateMessageBody,
|
161
|
+
UpdateMessageBody,
|
162
|
+
SelectMessageBody,
|
163
|
+
CreateUserBody,
|
164
|
+
UpdateUserBody,
|
165
|
+
CreateEventBody,
|
166
|
+
CreateFileBody,
|
167
|
+
DeleteConversationData,
|
168
|
+
DeleteConversationErrors,
|
169
|
+
DeleteConversationError,
|
170
|
+
DeleteConversationResponses,
|
171
|
+
DeleteConversationResponse,
|
172
|
+
GetConversationData,
|
173
|
+
GetConversationErrors,
|
174
|
+
GetConversationError,
|
175
|
+
GetConversationResponses,
|
176
|
+
GetConversationResponse,
|
177
|
+
ListConversationsData,
|
178
|
+
ListConversationsErrors,
|
179
|
+
ListConversationsError,
|
180
|
+
ListConversationsResponses,
|
181
|
+
ListConversationsResponse,
|
182
|
+
CreateConversationData,
|
183
|
+
CreateConversationErrors,
|
184
|
+
CreateConversationError,
|
185
|
+
CreateConversationResponses,
|
186
|
+
CreateConversationResponse,
|
187
|
+
ListenConversationData,
|
188
|
+
ListenConversationErrors,
|
189
|
+
ListenConversationError,
|
190
|
+
ListenConversationResponses,
|
191
|
+
ListenConversationResponse,
|
192
|
+
ListConversationMessagesData,
|
193
|
+
ListConversationMessagesErrors,
|
194
|
+
ListConversationMessagesError,
|
195
|
+
ListConversationMessagesResponses,
|
196
|
+
ListConversationMessagesResponse,
|
197
|
+
ListParticipantsData,
|
198
|
+
ListParticipantsErrors,
|
199
|
+
ListParticipantsError,
|
200
|
+
ListParticipantsResponses,
|
201
|
+
ListParticipantsResponse,
|
202
|
+
AddParticipantData,
|
203
|
+
AddParticipantErrors,
|
204
|
+
AddParticipantError,
|
205
|
+
AddParticipantResponses,
|
206
|
+
AddParticipantResponse,
|
207
|
+
RemoveParticipantData,
|
208
|
+
RemoveParticipantErrors,
|
209
|
+
RemoveParticipantError,
|
210
|
+
RemoveParticipantResponses,
|
211
|
+
RemoveParticipantResponse,
|
212
|
+
GetParticipantData,
|
213
|
+
GetParticipantErrors,
|
214
|
+
GetParticipantError,
|
215
|
+
GetParticipantResponses,
|
216
|
+
GetParticipantResponse,
|
217
|
+
DeleteMessageData,
|
218
|
+
DeleteMessageErrors,
|
219
|
+
DeleteMessageError,
|
220
|
+
DeleteMessageResponses,
|
221
|
+
DeleteMessageResponse,
|
222
|
+
GetMessageData,
|
223
|
+
GetMessageErrors,
|
224
|
+
GetMessageError,
|
225
|
+
GetMessageResponses,
|
226
|
+
GetMessageResponse,
|
227
|
+
UpdateMessageData,
|
228
|
+
UpdateMessageErrors,
|
229
|
+
UpdateMessageError,
|
230
|
+
UpdateMessageResponses,
|
231
|
+
UpdateMessageResponse,
|
232
|
+
CreateMessageData,
|
233
|
+
CreateMessageErrors,
|
234
|
+
CreateMessageError,
|
235
|
+
CreateMessageResponses,
|
236
|
+
CreateMessageResponse,
|
237
|
+
SelectMessageData,
|
238
|
+
SelectMessageErrors,
|
239
|
+
SelectMessageError,
|
240
|
+
SelectMessageResponses,
|
241
|
+
SelectMessageResponse,
|
242
|
+
DeleteUserData,
|
243
|
+
DeleteUserErrors,
|
244
|
+
DeleteUserError,
|
245
|
+
DeleteUserResponses,
|
246
|
+
DeleteUserResponse,
|
247
|
+
GetUserData,
|
248
|
+
GetUserErrors,
|
249
|
+
GetUserError,
|
250
|
+
GetUserResponses,
|
251
|
+
GetUserResponse,
|
252
|
+
UpdateUserData,
|
253
|
+
UpdateUserErrors,
|
254
|
+
UpdateUserError,
|
255
|
+
UpdateUserResponses,
|
256
|
+
UpdateUserResponse,
|
257
|
+
CreateUserData,
|
258
|
+
CreateUserErrors,
|
259
|
+
CreateUserError,
|
260
|
+
CreateUserResponses,
|
261
|
+
CreateUserResponse,
|
262
|
+
GetEventData,
|
263
|
+
GetEventErrors,
|
264
|
+
GetEventError,
|
265
|
+
GetEventResponses,
|
266
|
+
GetEventResponse,
|
267
|
+
CreateEventData,
|
268
|
+
CreateEventErrors,
|
269
|
+
CreateEventError,
|
270
|
+
CreateEventResponses,
|
271
|
+
CreateEventResponse,
|
272
|
+
CreateFileData,
|
273
|
+
CreateFileErrors,
|
274
|
+
CreateFileError,
|
275
|
+
CreateFileResponses,
|
276
|
+
CreateFileResponse,
|
277
|
+
ClientOptions,
|
278
|
+
Options,
|
279
|
+
deleteConversation,
|
280
|
+
getConversation,
|
281
|
+
listConversations,
|
282
|
+
createConversation,
|
283
|
+
listenConversation,
|
284
|
+
listConversationMessages,
|
285
|
+
listParticipants,
|
286
|
+
addParticipant,
|
287
|
+
removeParticipant,
|
288
|
+
getParticipant,
|
289
|
+
deleteMessage,
|
290
|
+
getMessage,
|
291
|
+
updateMessage,
|
292
|
+
createMessage,
|
293
|
+
selectMessage,
|
294
|
+
deleteUser,
|
295
|
+
getUser,
|
296
|
+
updateUser,
|
297
|
+
createUser_2 as createUser,
|
298
|
+
getEvent,
|
299
|
+
createEvent,
|
300
|
+
createFile
|
301
|
+
}
|
302
|
+
}
|
303
|
+
|
304
|
+
declare interface Config$1 {
|
305
|
+
/**
|
306
|
+
* Auth token or a function returning auth token. The resolved value will be
|
307
|
+
* added to the request payload as defined by its `security` array.
|
308
|
+
*/
|
309
|
+
auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
|
310
|
+
/**
|
311
|
+
* A function for serializing request body parameter. By default,
|
312
|
+
* {@link JSON.stringify()} will be used.
|
313
|
+
*/
|
314
|
+
bodySerializer?: BodySerializer | null;
|
315
|
+
/**
|
316
|
+
* An object containing any HTTP headers that you want to pre-populate your
|
317
|
+
* `Headers` object with.
|
318
|
+
*
|
319
|
+
* {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
|
320
|
+
*/
|
321
|
+
headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
|
322
|
+
/**
|
323
|
+
* The request method.
|
324
|
+
*
|
325
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
|
326
|
+
*/
|
327
|
+
method?: 'CONNECT' | 'DELETE' | 'GET' | 'HEAD' | 'OPTIONS' | 'PATCH' | 'POST' | 'PUT' | 'TRACE';
|
328
|
+
/**
|
329
|
+
* A function for serializing request query parameters. By default, arrays
|
330
|
+
* will be exploded in form style, objects will be exploded in deepObject
|
331
|
+
* style, and reserved characters are percent-encoded.
|
332
|
+
*
|
333
|
+
* This method will have no effect if the native `paramsSerializer()` Axios
|
334
|
+
* API function is used.
|
335
|
+
*
|
336
|
+
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
|
337
|
+
*/
|
338
|
+
querySerializer?: QuerySerializer | QuerySerializerOptions;
|
339
|
+
/**
|
340
|
+
* A function transforming response data before it's returned. This is useful
|
341
|
+
* for post-processing data, e.g. converting ISO strings into Date objects.
|
342
|
+
*/
|
343
|
+
responseTransformer?: (data: unknown) => Promise<unknown>;
|
344
|
+
/**
|
345
|
+
* A function validating response data. This is useful if you want to ensure
|
346
|
+
* the response conforms to the desired shape, so it can be safely passed to
|
347
|
+
* the transformers and returned to the user.
|
348
|
+
*/
|
349
|
+
responseValidator?: (data: unknown) => Promise<unknown>;
|
350
|
+
}
|
351
|
+
|
352
|
+
declare interface Config<T extends ClientOptions_2 = ClientOptions_2> extends Omit<RequestInit, 'body' | 'headers' | 'method'>, Config$1 {
|
353
|
+
/**
|
354
|
+
* Base URL for all requests made by this client.
|
355
|
+
*/
|
356
|
+
baseUrl?: T['baseUrl'];
|
357
|
+
/**
|
358
|
+
* Fetch API implementation. You can use this option to provide a custom
|
359
|
+
* fetch instance.
|
360
|
+
*
|
361
|
+
* @default globalThis.fetch
|
362
|
+
*/
|
363
|
+
fetch?: (request: Request) => ReturnType<typeof fetch>;
|
364
|
+
/**
|
365
|
+
* Please don't use the Fetch client for Next.js applications. The `next`
|
366
|
+
* options won't have any effect.
|
367
|
+
*
|
368
|
+
* Install {@link https://www.npmjs.com/package/@hey-api/client-next `@hey-api/client-next`} instead.
|
369
|
+
*/
|
370
|
+
next?: never;
|
371
|
+
/**
|
372
|
+
* Return the response data parsed in a specified format. By default, `auto`
|
373
|
+
* will infer the appropriate method from the `Content-Type` response header.
|
374
|
+
* You can override this behavior with any of the {@link Body} methods.
|
375
|
+
* Select `stream` if you don't want to parse response data at all.
|
376
|
+
*
|
377
|
+
* @default 'auto'
|
378
|
+
*/
|
379
|
+
parseAs?: Exclude<keyof Body, 'body' | 'bodyUsed'> | 'auto' | 'stream';
|
380
|
+
/**
|
381
|
+
* Throw an error instead of returning it in the response?
|
382
|
+
*
|
383
|
+
* @default false
|
384
|
+
*/
|
385
|
+
throwOnError?: T['throwOnError'];
|
386
|
+
}
|
387
|
+
|
388
|
+
export declare type Conversation = {
|
389
|
+
/**
|
390
|
+
* Id of the [Conversation](#schema_conversation)
|
391
|
+
*/
|
392
|
+
id: string;
|
393
|
+
/**
|
394
|
+
* Creation date of the [Conversation](#schema_conversation) in ISO 8601 format
|
395
|
+
*/
|
396
|
+
createdAt: string;
|
397
|
+
/**
|
398
|
+
* Updating date of the [Conversation](#schema_conversation) in ISO 8601 format
|
399
|
+
*/
|
400
|
+
updatedAt: string;
|
401
|
+
};
|
402
|
+
|
403
|
+
declare type ConversationIdParam = {
|
404
|
+
conversationId: string;
|
405
|
+
};
|
406
|
+
|
407
|
+
export declare const createClient: ({ userKey, clientId, apiUrl, }: {
|
408
|
+
userKey: string;
|
409
|
+
clientId: string;
|
410
|
+
apiUrl?: string;
|
411
|
+
}) => Client;
|
412
|
+
|
413
|
+
/**
|
414
|
+
* Creates a new [Conversation](#schema_conversation)
|
415
|
+
*/
|
416
|
+
declare const createConversation: <ThrowOnError extends boolean = false>(options: Options<CreateConversationData, ThrowOnError>) => RequestResult<{
|
417
|
+
conversation: Conversation;
|
418
|
+
}, {
|
419
|
+
conversation: Conversation;
|
420
|
+
}, ThrowOnError>;
|
421
|
+
|
422
|
+
/**
|
423
|
+
* Conversation properties
|
424
|
+
*/
|
425
|
+
export declare type CreateConversationBody = {
|
426
|
+
_?: string;
|
427
|
+
};
|
428
|
+
|
429
|
+
export declare type CreateConversationData = {
|
430
|
+
/**
|
431
|
+
* Conversation data
|
432
|
+
*/
|
433
|
+
body?: CreateConversationBody;
|
434
|
+
headers: {
|
435
|
+
/**
|
436
|
+
* Authentication Key
|
437
|
+
*/
|
438
|
+
'x-user-key': string;
|
439
|
+
};
|
440
|
+
path?: never;
|
441
|
+
query?: never;
|
442
|
+
url: '/conversations';
|
443
|
+
};
|
444
|
+
|
445
|
+
export declare type CreateConversationError = CreateConversationErrors[keyof CreateConversationErrors];
|
446
|
+
|
447
|
+
export declare type CreateConversationErrors = {
|
448
|
+
/**
|
449
|
+
* Returns a [Conversation](#schema_conversation)
|
450
|
+
*/
|
451
|
+
default: {
|
452
|
+
conversation: Conversation;
|
453
|
+
};
|
454
|
+
};
|
455
|
+
|
456
|
+
export declare type CreateConversationResponse = CreateConversationResponses[keyof CreateConversationResponses];
|
457
|
+
|
458
|
+
export declare type CreateConversationResponses = {
|
459
|
+
/**
|
460
|
+
* Returns a [Conversation](#schema_conversation)
|
461
|
+
*/
|
462
|
+
201: {
|
463
|
+
conversation: Conversation;
|
464
|
+
};
|
465
|
+
};
|
466
|
+
|
467
|
+
/**
|
468
|
+
* Creates a new [Event](#schema_event)
|
469
|
+
*/
|
470
|
+
declare const createEvent: <ThrowOnError extends boolean = false>(options: Options<CreateEventData, ThrowOnError>) => RequestResult<{
|
471
|
+
event: Event_2;
|
472
|
+
}, {
|
473
|
+
event: Event_2;
|
474
|
+
}, ThrowOnError>;
|
475
|
+
|
476
|
+
/**
|
477
|
+
* Event data
|
478
|
+
*/
|
479
|
+
export declare type CreateEventBody = {
|
480
|
+
/**
|
481
|
+
* Payload is the content type of the event.
|
482
|
+
*/
|
483
|
+
payload: {
|
484
|
+
type: 'custom';
|
485
|
+
data: {};
|
486
|
+
} | {
|
487
|
+
type: 'conversation_started';
|
488
|
+
data: {};
|
489
|
+
};
|
490
|
+
/**
|
491
|
+
* ID of the [Conversation](#schema_conversation)
|
492
|
+
*/
|
493
|
+
conversationId: string;
|
494
|
+
/**
|
495
|
+
* Whether to bind the event to the conversation. Defaults to true
|
496
|
+
*/
|
497
|
+
bindConversation?: boolean;
|
498
|
+
/**
|
499
|
+
* Whether to bind the event to the user. Defaults to true
|
500
|
+
*/
|
501
|
+
bindUser?: boolean;
|
502
|
+
};
|
503
|
+
|
504
|
+
export declare type CreateEventData = {
|
505
|
+
/**
|
506
|
+
* Event data
|
507
|
+
*/
|
508
|
+
body?: CreateEventBody;
|
509
|
+
headers: {
|
510
|
+
/**
|
511
|
+
* Authentication Key
|
512
|
+
*/
|
513
|
+
'x-user-key': string;
|
514
|
+
};
|
515
|
+
path?: never;
|
516
|
+
query?: never;
|
517
|
+
url: '/events';
|
518
|
+
};
|
519
|
+
|
520
|
+
export declare type CreateEventError = CreateEventErrors[keyof CreateEventErrors];
|
521
|
+
|
522
|
+
export declare type CreateEventErrors = {
|
523
|
+
/**
|
524
|
+
* Returns a [Event](#schema_event).
|
525
|
+
*/
|
526
|
+
default: {
|
527
|
+
event: Event_2;
|
528
|
+
};
|
529
|
+
};
|
530
|
+
|
531
|
+
export declare type CreateEventResponse = CreateEventResponses[keyof CreateEventResponses];
|
532
|
+
|
533
|
+
export declare type CreateEventResponses = {
|
534
|
+
/**
|
535
|
+
* Returns a [Event](#schema_event).
|
536
|
+
*/
|
537
|
+
201: {
|
538
|
+
event: Event_2;
|
539
|
+
};
|
540
|
+
};
|
541
|
+
|
542
|
+
/**
|
543
|
+
* Creates a new file and returns it's upload URL.
|
544
|
+
*/
|
545
|
+
declare const createFile: <ThrowOnError extends boolean = false>(options: Options<CreateFileData, ThrowOnError>) => RequestResult<{
|
546
|
+
file: File_2;
|
547
|
+
}, {
|
548
|
+
file: File_2;
|
549
|
+
}, ThrowOnError>;
|
550
|
+
|
551
|
+
/**
|
552
|
+
* File data
|
553
|
+
*/
|
554
|
+
export declare type CreateFileBody = {
|
555
|
+
/**
|
556
|
+
* Unique key for the file. Must be unique across the bot (and the integration, when applicable).
|
557
|
+
*/
|
558
|
+
key: string;
|
559
|
+
/**
|
560
|
+
* File size in bytes. This will count against your File Storage quota. If the index parameter is set to true, this will also count against your Vector DB Storage quota.
|
561
|
+
*/
|
562
|
+
size: number;
|
563
|
+
/**
|
564
|
+
* File access policies. Add "public_content" to allow public access to the file content. Add "integrations" to allow read, search and list operations for any integration installed in the bot.
|
565
|
+
*/
|
566
|
+
accessPolicies?: Array<'integrations' | 'public_content'>;
|
567
|
+
/**
|
568
|
+
* Whether the file should be indexed. If true, the file content will be searchable in the Vector DB. This will count against your Vector DB Storage quota.
|
569
|
+
*/
|
570
|
+
index?: boolean;
|
571
|
+
/**
|
572
|
+
* File content type. If omitted, the content type will be inferred from the file extension (if any) specified in key. If a content type cannot be inferred, the default is "application/octet-stream".
|
573
|
+
*/
|
574
|
+
contentType?: string;
|
575
|
+
/**
|
576
|
+
* File tags. These are used for search and filtering operations.
|
577
|
+
*/
|
578
|
+
tags?: {
|
579
|
+
[key: string]: string;
|
580
|
+
};
|
581
|
+
/**
|
582
|
+
* The timestamp (in ISO 8601 format) when the file will be automatically deleted from the file API.
|
583
|
+
*/
|
584
|
+
expiresAt?: string;
|
585
|
+
};
|
586
|
+
|
587
|
+
export declare type CreateFileData = {
|
588
|
+
/**
|
589
|
+
* File data
|
590
|
+
*/
|
591
|
+
body?: CreateFileBody;
|
592
|
+
headers: {
|
593
|
+
/**
|
594
|
+
* Authentication Key
|
595
|
+
*/
|
596
|
+
'x-user-key': string;
|
597
|
+
};
|
598
|
+
path?: never;
|
599
|
+
query?: never;
|
600
|
+
url: '/files';
|
601
|
+
};
|
602
|
+
|
603
|
+
export declare type CreateFileError = CreateFileErrors[keyof CreateFileErrors];
|
604
|
+
|
605
|
+
export declare type CreateFileErrors = {
|
606
|
+
/**
|
607
|
+
* Returns a file
|
608
|
+
*/
|
609
|
+
default: {
|
610
|
+
file: File_2;
|
611
|
+
};
|
612
|
+
};
|
613
|
+
|
614
|
+
export declare type CreateFileResponse = CreateFileResponses[keyof CreateFileResponses];
|
615
|
+
|
616
|
+
export declare type CreateFileResponses = {
|
617
|
+
/**
|
618
|
+
* Returns a file
|
619
|
+
*/
|
620
|
+
201: {
|
621
|
+
file: File_2;
|
622
|
+
};
|
623
|
+
};
|
624
|
+
|
625
|
+
/**
|
626
|
+
* Creates a new [Message](#schema_message)
|
627
|
+
*/
|
628
|
+
declare const createMessage: <ThrowOnError extends boolean = false>(options: Options<CreateMessageData, ThrowOnError>) => RequestResult<{
|
629
|
+
message: Message;
|
630
|
+
}, {
|
631
|
+
message: Message;
|
632
|
+
}, ThrowOnError>;
|
633
|
+
|
634
|
+
/**
|
635
|
+
* Message data
|
636
|
+
*/
|
637
|
+
export declare type CreateMessageBody = {
|
638
|
+
/**
|
639
|
+
* Payload is the content of the message.
|
640
|
+
*/
|
641
|
+
payload: {
|
642
|
+
audioUrl: string;
|
643
|
+
type: 'audio';
|
644
|
+
} | {
|
645
|
+
title: string;
|
646
|
+
subtitle?: string;
|
647
|
+
imageUrl?: string;
|
648
|
+
actions: Array<{
|
649
|
+
action: 'postback' | 'url' | 'say';
|
650
|
+
label: string;
|
651
|
+
value: string;
|
652
|
+
}>;
|
653
|
+
type: 'card';
|
654
|
+
} | {
|
655
|
+
items: Array<{
|
656
|
+
title: string;
|
657
|
+
subtitle?: string;
|
658
|
+
imageUrl?: string;
|
659
|
+
actions: Array<{
|
660
|
+
action: 'postback' | 'url' | 'say';
|
661
|
+
label: string;
|
662
|
+
value: string;
|
663
|
+
}>;
|
664
|
+
}>;
|
665
|
+
type: 'carousel';
|
666
|
+
} | {
|
667
|
+
text: string;
|
668
|
+
options: Array<{
|
669
|
+
label: string;
|
670
|
+
value: string;
|
671
|
+
}>;
|
672
|
+
disableFreeText?: boolean;
|
673
|
+
type: 'choice';
|
674
|
+
} | {
|
675
|
+
text: string;
|
676
|
+
options: Array<{
|
677
|
+
label: string;
|
678
|
+
value: string;
|
679
|
+
}>;
|
680
|
+
disableFreeText?: boolean;
|
681
|
+
type: 'dropdown';
|
682
|
+
} | {
|
683
|
+
fileUrl: string;
|
684
|
+
title?: string;
|
685
|
+
type: 'file';
|
686
|
+
} | {
|
687
|
+
imageUrl: string;
|
688
|
+
type: 'image';
|
689
|
+
} | {
|
690
|
+
latitude: number;
|
691
|
+
longitude: number;
|
692
|
+
address?: string;
|
693
|
+
title?: string;
|
694
|
+
type: 'location';
|
695
|
+
} | {
|
696
|
+
text: string;
|
697
|
+
value?: string;
|
698
|
+
type: 'text';
|
699
|
+
} | {
|
700
|
+
videoUrl: string;
|
701
|
+
type: 'video';
|
702
|
+
} | {
|
703
|
+
items: Array<{
|
704
|
+
type: 'text';
|
705
|
+
payload: {
|
706
|
+
text: string;
|
707
|
+
value?: string;
|
708
|
+
};
|
709
|
+
} | {
|
710
|
+
type: 'markdown';
|
711
|
+
payload: {
|
712
|
+
markdown: string;
|
713
|
+
};
|
714
|
+
} | {
|
715
|
+
type: 'image';
|
716
|
+
payload: {
|
717
|
+
imageUrl: string;
|
718
|
+
};
|
719
|
+
} | {
|
720
|
+
type: 'audio';
|
721
|
+
payload: {
|
722
|
+
audioUrl: string;
|
723
|
+
};
|
724
|
+
} | {
|
725
|
+
type: 'video';
|
726
|
+
payload: {
|
727
|
+
videoUrl: string;
|
728
|
+
};
|
729
|
+
} | {
|
730
|
+
type: 'file';
|
731
|
+
payload: {
|
732
|
+
fileUrl: string;
|
733
|
+
title?: string;
|
734
|
+
};
|
735
|
+
} | {
|
736
|
+
type: 'location';
|
737
|
+
payload: {
|
738
|
+
latitude: number;
|
739
|
+
longitude: number;
|
740
|
+
address?: string;
|
741
|
+
title?: string;
|
742
|
+
};
|
743
|
+
}>;
|
744
|
+
type: 'bloc';
|
745
|
+
} | {
|
746
|
+
markdown: string;
|
747
|
+
type: 'markdown';
|
748
|
+
} | {
|
749
|
+
url: string;
|
750
|
+
name: string;
|
751
|
+
data?: unknown;
|
752
|
+
type: 'custom';
|
753
|
+
} | {
|
754
|
+
reaction: string;
|
755
|
+
type: 'reaction';
|
756
|
+
};
|
757
|
+
/**
|
758
|
+
* ID of the [Conversation](#schema_conversation)
|
759
|
+
*/
|
760
|
+
conversationId: string;
|
761
|
+
/**
|
762
|
+
* Metadata of the message
|
763
|
+
*/
|
764
|
+
metadata?: {};
|
765
|
+
/**
|
766
|
+
* ID of the message this message is replying to
|
767
|
+
*/
|
768
|
+
replyTo?: string;
|
769
|
+
};
|
770
|
+
|
771
|
+
export declare type CreateMessageData = {
|
772
|
+
/**
|
773
|
+
* Message data
|
774
|
+
*/
|
775
|
+
body?: CreateMessageBody;
|
776
|
+
headers: {
|
777
|
+
/**
|
778
|
+
* Authentication Key
|
779
|
+
*/
|
780
|
+
'x-user-key': string;
|
781
|
+
};
|
782
|
+
path?: never;
|
783
|
+
query?: never;
|
784
|
+
url: '/messages';
|
785
|
+
};
|
786
|
+
|
787
|
+
export declare type CreateMessageError = CreateMessageErrors[keyof CreateMessageErrors];
|
788
|
+
|
789
|
+
export declare type CreateMessageErrors = {
|
790
|
+
/**
|
791
|
+
* Returns a [Message](#schema_message).
|
792
|
+
*/
|
793
|
+
default: {
|
794
|
+
message: Message;
|
795
|
+
};
|
796
|
+
};
|
797
|
+
|
798
|
+
export declare type CreateMessageResponse = CreateMessageResponses[keyof CreateMessageResponses];
|
799
|
+
|
800
|
+
export declare type CreateMessageResponses = {
|
801
|
+
/**
|
802
|
+
* Returns a [Message](#schema_message).
|
803
|
+
*/
|
804
|
+
201: {
|
805
|
+
message: Message;
|
806
|
+
};
|
807
|
+
};
|
808
|
+
|
809
|
+
export declare const createUser: ({ clientId, apiUrl }: {
|
810
|
+
clientId: string;
|
811
|
+
apiUrl?: string;
|
812
|
+
}) => Promise<{
|
813
|
+
user: ClientTypes_2.User;
|
814
|
+
key: string;
|
815
|
+
}>;
|
816
|
+
|
817
|
+
/**
|
818
|
+
* Creates a new [User](#schema_user)
|
819
|
+
*/
|
820
|
+
declare const createUser_2: <ThrowOnError extends boolean = false>(options?: Options<CreateUserData, ThrowOnError>) => RequestResult<{
|
821
|
+
user: User;
|
822
|
+
key: string;
|
823
|
+
}, {
|
824
|
+
user: User;
|
825
|
+
key: string;
|
826
|
+
}, ThrowOnError>;
|
827
|
+
|
828
|
+
/**
|
829
|
+
* User data
|
830
|
+
*/
|
831
|
+
export declare type CreateUserBody = {
|
832
|
+
/**
|
833
|
+
* Name of the [User](#schema_user) (not a unique identifier)
|
834
|
+
*/
|
835
|
+
name?: string;
|
836
|
+
/**
|
837
|
+
* Picture url of the [User](#schema_user)
|
838
|
+
*/
|
839
|
+
pictureUrl?: string;
|
840
|
+
/**
|
841
|
+
* User data
|
842
|
+
*/
|
843
|
+
userData?: {};
|
844
|
+
};
|
845
|
+
|
846
|
+
export declare type CreateUserData = {
|
847
|
+
/**
|
848
|
+
* User data
|
849
|
+
*/
|
850
|
+
body?: CreateUserBody;
|
851
|
+
path?: never;
|
852
|
+
query?: never;
|
853
|
+
url: '/users';
|
854
|
+
};
|
855
|
+
|
856
|
+
export declare type CreateUserError = CreateUserErrors[keyof CreateUserErrors];
|
857
|
+
|
858
|
+
export declare type CreateUserErrors = {
|
859
|
+
/**
|
860
|
+
* Returns a [User](#schema_user)
|
861
|
+
*/
|
862
|
+
default: {
|
863
|
+
user: User;
|
864
|
+
key: string;
|
865
|
+
};
|
866
|
+
};
|
867
|
+
|
868
|
+
export declare type CreateUserResponse = CreateUserResponses[keyof CreateUserResponses];
|
869
|
+
|
870
|
+
export declare type CreateUserResponses = {
|
871
|
+
/**
|
872
|
+
* Returns a [User](#schema_user)
|
873
|
+
*/
|
874
|
+
201: {
|
875
|
+
user: User;
|
876
|
+
key: string;
|
877
|
+
};
|
878
|
+
};
|
879
|
+
|
880
|
+
declare type Custom = {
|
881
|
+
type: 'custom';
|
882
|
+
data: {
|
883
|
+
event: {
|
884
|
+
[k: string]: any;
|
885
|
+
};
|
886
|
+
};
|
887
|
+
};
|
888
|
+
|
889
|
+
/**
|
890
|
+
* Permanently deletes a [Conversation](#schema_conversation). It cannot be undone. Also immediately deletes corresponding [Messages](#schema_message).
|
891
|
+
*/
|
892
|
+
declare const deleteConversation: <ThrowOnError extends boolean = false>(options: Options<DeleteConversationData, ThrowOnError>) => RequestResult<{
|
893
|
+
[key: string]: never;
|
894
|
+
}, {
|
895
|
+
[key: string]: never;
|
896
|
+
}, ThrowOnError>;
|
897
|
+
|
898
|
+
export declare type DeleteConversationData = {
|
899
|
+
body?: never;
|
900
|
+
headers: {
|
901
|
+
/**
|
902
|
+
* Authentication Key
|
903
|
+
*/
|
904
|
+
'x-user-key': string;
|
905
|
+
};
|
906
|
+
path: {
|
907
|
+
/**
|
908
|
+
* Conversation id
|
909
|
+
*/
|
910
|
+
id: string;
|
911
|
+
};
|
912
|
+
query?: never;
|
913
|
+
url: '/conversations/{id}';
|
914
|
+
};
|
915
|
+
|
916
|
+
export declare type DeleteConversationError = DeleteConversationErrors[keyof DeleteConversationErrors];
|
917
|
+
|
918
|
+
export declare type DeleteConversationErrors = {
|
919
|
+
/**
|
920
|
+
* Returns the [Conversation](#schema_conversation) object that was deleted
|
921
|
+
*/
|
922
|
+
default: {
|
923
|
+
[key: string]: never;
|
924
|
+
};
|
925
|
+
};
|
926
|
+
|
927
|
+
export declare type DeleteConversationResponse = DeleteConversationResponses[keyof DeleteConversationResponses];
|
928
|
+
|
929
|
+
export declare type DeleteConversationResponses = {
|
930
|
+
/**
|
931
|
+
* Returns the [Conversation](#schema_conversation) object that was deleted
|
932
|
+
*/
|
933
|
+
200: {
|
934
|
+
[key: string]: never;
|
935
|
+
};
|
936
|
+
};
|
937
|
+
|
938
|
+
/**
|
939
|
+
* Permanently deletes a [Message](#schema_message). It cannot be undone.
|
940
|
+
*/
|
941
|
+
declare const deleteMessage: <ThrowOnError extends boolean = false>(options: Options<DeleteMessageData, ThrowOnError>) => RequestResult<{
|
942
|
+
[key: string]: never;
|
943
|
+
}, {
|
944
|
+
[key: string]: never;
|
945
|
+
}, ThrowOnError>;
|
946
|
+
|
947
|
+
export declare type DeleteMessageData = {
|
948
|
+
body?: never;
|
949
|
+
headers: {
|
950
|
+
/**
|
951
|
+
* Authentication Key
|
952
|
+
*/
|
953
|
+
'x-user-key': string;
|
954
|
+
};
|
955
|
+
path: {
|
956
|
+
/**
|
957
|
+
* Message id
|
958
|
+
*/
|
959
|
+
id: string;
|
960
|
+
};
|
961
|
+
query?: never;
|
962
|
+
url: '/messages/{id}';
|
963
|
+
};
|
964
|
+
|
965
|
+
export declare type DeleteMessageError = DeleteMessageErrors[keyof DeleteMessageErrors];
|
966
|
+
|
967
|
+
export declare type DeleteMessageErrors = {
|
968
|
+
/**
|
969
|
+
* Returns the [Message](#schema_message) object that was deleted
|
970
|
+
*/
|
971
|
+
default: {
|
972
|
+
[key: string]: never;
|
973
|
+
};
|
974
|
+
};
|
975
|
+
|
976
|
+
export declare type DeleteMessageResponse = DeleteMessageResponses[keyof DeleteMessageResponses];
|
977
|
+
|
978
|
+
export declare type DeleteMessageResponses = {
|
979
|
+
/**
|
980
|
+
* Returns the [Message](#schema_message) object that was deleted
|
981
|
+
*/
|
982
|
+
200: {
|
983
|
+
[key: string]: never;
|
984
|
+
};
|
985
|
+
};
|
986
|
+
|
987
|
+
/**
|
988
|
+
* Permanently deletes a [User](#schema_user). It cannot be undone.
|
989
|
+
*/
|
990
|
+
declare const deleteUser: <ThrowOnError extends boolean = false>(options: Options<DeleteUserData, ThrowOnError>) => RequestResult<{
|
991
|
+
[key: string]: never;
|
992
|
+
}, {
|
993
|
+
[key: string]: never;
|
994
|
+
}, ThrowOnError>;
|
995
|
+
|
996
|
+
export declare type DeleteUserData = {
|
997
|
+
body?: never;
|
998
|
+
headers: {
|
999
|
+
/**
|
1000
|
+
* Authentication Key
|
1001
|
+
*/
|
1002
|
+
'x-user-key': string;
|
1003
|
+
};
|
1004
|
+
path?: never;
|
1005
|
+
query?: never;
|
1006
|
+
url: '/users/me';
|
1007
|
+
};
|
1008
|
+
|
1009
|
+
export declare type DeleteUserError = DeleteUserErrors[keyof DeleteUserErrors];
|
1010
|
+
|
1011
|
+
export declare type DeleteUserErrors = {
|
1012
|
+
/**
|
1013
|
+
* Returns the [User](#schema_user) object that was deleted
|
1014
|
+
*/
|
1015
|
+
default: {
|
1016
|
+
[key: string]: never;
|
1017
|
+
};
|
1018
|
+
};
|
1019
|
+
|
1020
|
+
export declare type DeleteUserResponse = DeleteUserResponses[keyof DeleteUserResponses];
|
1021
|
+
|
1022
|
+
export declare type DeleteUserResponses = {
|
1023
|
+
/**
|
1024
|
+
* Returns the [User](#schema_user) object that was deleted
|
1025
|
+
*/
|
1026
|
+
200: {
|
1027
|
+
[key: string]: never;
|
1028
|
+
};
|
1029
|
+
};
|
1030
|
+
|
1031
|
+
declare type ErrInterceptor<Err, Res, Req, Options> = (error: Err, response: Res, request: Req, options: Options) => Err | Promise<Err>;
|
1032
|
+
|
1033
|
+
declare type Event_2 = {
|
1034
|
+
/**
|
1035
|
+
* ID of the [Event](#schema_event).
|
1036
|
+
*/
|
1037
|
+
id: string;
|
1038
|
+
/**
|
1039
|
+
* Creation date of the [Event](#schema_event) in ISO 8601 format
|
1040
|
+
*/
|
1041
|
+
createdAt: string;
|
1042
|
+
/**
|
1043
|
+
* Payload is the content of the event.
|
1044
|
+
*/
|
1045
|
+
payload: {
|
1046
|
+
type: 'custom';
|
1047
|
+
data: {};
|
1048
|
+
} | {
|
1049
|
+
type: 'conversation_started';
|
1050
|
+
data: {};
|
1051
|
+
};
|
1052
|
+
/**
|
1053
|
+
* ID of the [Conversation](#schema_conversation).
|
1054
|
+
*/
|
1055
|
+
conversationId: string;
|
1056
|
+
/**
|
1057
|
+
* ID of the [User](#schema_user).
|
1058
|
+
*/
|
1059
|
+
userId: string;
|
1060
|
+
};
|
1061
|
+
export { Event_2 as Event }
|
1062
|
+
|
1063
|
+
declare type Event_3 = Signal | {
|
1064
|
+
type: 'error';
|
1065
|
+
data: any;
|
1066
|
+
} | {
|
1067
|
+
type: 'open';
|
1068
|
+
data: any;
|
1069
|
+
};
|
1070
|
+
|
1071
|
+
declare class EventEmitter<T extends Record<string, any>> {
|
1072
|
+
private readonly eventMap;
|
1073
|
+
constructor();
|
1074
|
+
on<U extends keyof T>(event: U, callback: CallbackFn<T[U]>): () => void;
|
1075
|
+
emit<U extends keyof T>(event: U, arg?: T[U]): void;
|
1076
|
+
}
|
1077
|
+
|
1078
|
+
declare type EventIdParam = {
|
1079
|
+
eventId: string;
|
1080
|
+
};
|
1081
|
+
|
1082
|
+
declare type File_2 = {
|
1083
|
+
id: string;
|
1084
|
+
botId: string;
|
1085
|
+
key: string;
|
1086
|
+
size: number | null;
|
1087
|
+
contentType: string;
|
1088
|
+
tags: {
|
1089
|
+
[key: string]: string;
|
1090
|
+
};
|
1091
|
+
createdAt: string;
|
1092
|
+
updatedAt: string;
|
1093
|
+
accessPolicies: Array<'integrations' | 'public_content'>;
|
1094
|
+
index: boolean;
|
1095
|
+
url: string;
|
1096
|
+
status: 'upload_pending' | 'upload_failed' | 'upload_completed' | 'indexing_pending' | 'indexing_failed' | 'indexing_completed';
|
1097
|
+
failedStatusReason?: string;
|
1098
|
+
uploadUrl: string;
|
1099
|
+
};
|
1100
|
+
export { File_2 as File }
|
1101
|
+
|
1102
|
+
/**
|
1103
|
+
* Retrieves the [Conversation](#schema_conversation) object for a valid identifier.
|
1104
|
+
*/
|
1105
|
+
declare const getConversation: <ThrowOnError extends boolean = false>(options: Options<GetConversationData, ThrowOnError>) => RequestResult<{
|
1106
|
+
conversation: Conversation;
|
1107
|
+
}, {
|
1108
|
+
conversation: Conversation;
|
1109
|
+
}, ThrowOnError>;
|
1110
|
+
|
1111
|
+
export declare type GetConversationData = {
|
1112
|
+
body?: never;
|
1113
|
+
headers: {
|
1114
|
+
/**
|
1115
|
+
* Authentication Key
|
1116
|
+
*/
|
1117
|
+
'x-user-key': string;
|
1118
|
+
};
|
1119
|
+
path: {
|
1120
|
+
/**
|
1121
|
+
* Conversation id
|
1122
|
+
*/
|
1123
|
+
id: string;
|
1124
|
+
};
|
1125
|
+
query?: never;
|
1126
|
+
url: '/conversations/{id}';
|
1127
|
+
};
|
1128
|
+
|
1129
|
+
export declare type GetConversationError = GetConversationErrors[keyof GetConversationErrors];
|
1130
|
+
|
1131
|
+
export declare type GetConversationErrors = {
|
1132
|
+
/**
|
1133
|
+
* Returns a [Conversation](#schema_conversation) object if a valid identifier was provided
|
1134
|
+
*/
|
1135
|
+
default: {
|
1136
|
+
conversation: Conversation;
|
1137
|
+
};
|
1138
|
+
};
|
1139
|
+
|
1140
|
+
export declare type GetConversationResponse = GetConversationResponses[keyof GetConversationResponses];
|
1141
|
+
|
1142
|
+
export declare type GetConversationResponses = {
|
1143
|
+
/**
|
1144
|
+
* Returns a [Conversation](#schema_conversation) object if a valid identifier was provided
|
1145
|
+
*/
|
1146
|
+
200: {
|
1147
|
+
conversation: Conversation;
|
1148
|
+
};
|
1149
|
+
};
|
1150
|
+
|
1151
|
+
/**
|
1152
|
+
* Retrieves the [Event](#schema_event) object for a valid identifier.
|
1153
|
+
*/
|
1154
|
+
declare const getEvent: <ThrowOnError extends boolean = false>(options: Options<GetEventData, ThrowOnError>) => RequestResult<{
|
1155
|
+
event: Event_2;
|
1156
|
+
}, {
|
1157
|
+
event: Event_2;
|
1158
|
+
}, ThrowOnError>;
|
1159
|
+
|
1160
|
+
export declare type GetEventData = {
|
1161
|
+
body?: never;
|
1162
|
+
headers: {
|
1163
|
+
/**
|
1164
|
+
* Authentication Key
|
1165
|
+
*/
|
1166
|
+
'x-user-key': string;
|
1167
|
+
};
|
1168
|
+
path: {
|
1169
|
+
/**
|
1170
|
+
* Id of the Event
|
1171
|
+
*/
|
1172
|
+
id: string;
|
1173
|
+
};
|
1174
|
+
query?: never;
|
1175
|
+
url: '/events/{id}';
|
1176
|
+
};
|
1177
|
+
|
1178
|
+
export declare type GetEventError = GetEventErrors[keyof GetEventErrors];
|
1179
|
+
|
1180
|
+
export declare type GetEventErrors = {
|
1181
|
+
/**
|
1182
|
+
* Returns an [Event](#schema_event) object if a valid identifier was provided
|
1183
|
+
*/
|
1184
|
+
default: {
|
1185
|
+
event: Event_2;
|
1186
|
+
};
|
1187
|
+
};
|
1188
|
+
|
1189
|
+
export declare type GetEventResponse = GetEventResponses[keyof GetEventResponses];
|
1190
|
+
|
1191
|
+
export declare type GetEventResponses = {
|
1192
|
+
/**
|
1193
|
+
* Returns an [Event](#schema_event) object if a valid identifier was provided
|
1194
|
+
*/
|
1195
|
+
200: {
|
1196
|
+
event: Event_2;
|
1197
|
+
};
|
1198
|
+
};
|
1199
|
+
|
1200
|
+
/**
|
1201
|
+
* Retrieves the [Message](#schema_message) object for a valid identifier.
|
1202
|
+
*/
|
1203
|
+
declare const getMessage: <ThrowOnError extends boolean = false>(options: Options<GetMessageData, ThrowOnError>) => RequestResult<{
|
1204
|
+
message: Message;
|
1205
|
+
}, {
|
1206
|
+
message: Message;
|
1207
|
+
}, ThrowOnError>;
|
1208
|
+
|
1209
|
+
export declare type GetMessageData = {
|
1210
|
+
body?: never;
|
1211
|
+
headers: {
|
1212
|
+
/**
|
1213
|
+
* Authentication Key
|
1214
|
+
*/
|
1215
|
+
'x-user-key': string;
|
1216
|
+
};
|
1217
|
+
path: {
|
1218
|
+
/**
|
1219
|
+
* Id of the Message
|
1220
|
+
*/
|
1221
|
+
id: string;
|
1222
|
+
};
|
1223
|
+
query?: never;
|
1224
|
+
url: '/messages/{id}';
|
1225
|
+
};
|
1226
|
+
|
1227
|
+
export declare type GetMessageError = GetMessageErrors[keyof GetMessageErrors];
|
1228
|
+
|
1229
|
+
export declare type GetMessageErrors = {
|
1230
|
+
/**
|
1231
|
+
* Returns a [Message](#schema_message) object if a valid identifier was provided
|
1232
|
+
*/
|
1233
|
+
default: {
|
1234
|
+
message: Message;
|
1235
|
+
};
|
1236
|
+
};
|
1237
|
+
|
1238
|
+
export declare type GetMessageResponse = GetMessageResponses[keyof GetMessageResponses];
|
1239
|
+
|
1240
|
+
export declare type GetMessageResponses = {
|
1241
|
+
/**
|
1242
|
+
* Returns a [Message](#schema_message) object if a valid identifier was provided
|
1243
|
+
*/
|
1244
|
+
200: {
|
1245
|
+
message: Message;
|
1246
|
+
};
|
1247
|
+
};
|
1248
|
+
|
1249
|
+
/**
|
1250
|
+
* Retrieves a [Participant](#schema_user) from a [Conversation](#schema_conversation).
|
1251
|
+
*/
|
1252
|
+
declare const getParticipant: <ThrowOnError extends boolean = false>(options: Options<GetParticipantData, ThrowOnError>) => RequestResult<{
|
1253
|
+
participant: User;
|
1254
|
+
}, {
|
1255
|
+
participant: User;
|
1256
|
+
}, ThrowOnError>;
|
1257
|
+
|
1258
|
+
export declare type GetParticipantData = {
|
1259
|
+
body?: never;
|
1260
|
+
headers: {
|
1261
|
+
/**
|
1262
|
+
* Authentication Key
|
1263
|
+
*/
|
1264
|
+
'x-user-key': string;
|
1265
|
+
};
|
1266
|
+
path: {
|
1267
|
+
/**
|
1268
|
+
* Conversation id
|
1269
|
+
*/
|
1270
|
+
id: string;
|
1271
|
+
/**
|
1272
|
+
* User id
|
1273
|
+
*/
|
1274
|
+
userId: string;
|
1275
|
+
};
|
1276
|
+
query?: never;
|
1277
|
+
url: '/conversations/{id}/participants/{userId}';
|
1278
|
+
};
|
1279
|
+
|
1280
|
+
export declare type GetParticipantError = GetParticipantErrors[keyof GetParticipantErrors];
|
1281
|
+
|
1282
|
+
export declare type GetParticipantErrors = {
|
1283
|
+
/**
|
1284
|
+
* Returns the [Participant](#schema_user) object
|
1285
|
+
*/
|
1286
|
+
default: {
|
1287
|
+
participant: User;
|
1288
|
+
};
|
1289
|
+
};
|
1290
|
+
|
1291
|
+
export declare type GetParticipantResponse = GetParticipantResponses[keyof GetParticipantResponses];
|
1292
|
+
|
1293
|
+
export declare type GetParticipantResponses = {
|
1294
|
+
/**
|
1295
|
+
* Returns the [Participant](#schema_user) object
|
1296
|
+
*/
|
1297
|
+
200: {
|
1298
|
+
participant: User;
|
1299
|
+
};
|
1300
|
+
};
|
1301
|
+
|
1302
|
+
/**
|
1303
|
+
* Retrieves the [User](#schema_user) object for a valid identifier.
|
1304
|
+
*/
|
1305
|
+
declare const getUser: <ThrowOnError extends boolean = false>(options: Options<GetUserData, ThrowOnError>) => RequestResult<{
|
1306
|
+
user: User;
|
1307
|
+
}, {
|
1308
|
+
user: User;
|
1309
|
+
}, ThrowOnError>;
|
1310
|
+
|
1311
|
+
export declare type GetUserData = {
|
1312
|
+
body?: never;
|
1313
|
+
headers: {
|
1314
|
+
/**
|
1315
|
+
* Authentication Key
|
1316
|
+
*/
|
1317
|
+
'x-user-key': string;
|
1318
|
+
};
|
1319
|
+
path?: never;
|
1320
|
+
query?: never;
|
1321
|
+
url: '/users/me';
|
1322
|
+
};
|
1323
|
+
|
1324
|
+
export declare type GetUserError = GetUserErrors[keyof GetUserErrors];
|
1325
|
+
|
1326
|
+
export declare type GetUserErrors = {
|
1327
|
+
/**
|
1328
|
+
* Returns a [User](#schema_user) object if a valid identifier was provided
|
1329
|
+
*/
|
1330
|
+
default: {
|
1331
|
+
user: User;
|
1332
|
+
};
|
1333
|
+
};
|
1334
|
+
|
1335
|
+
export declare type GetUserResponse = GetUserResponses[keyof GetUserResponses];
|
1336
|
+
|
1337
|
+
export declare type GetUserResponses = {
|
1338
|
+
/**
|
1339
|
+
* Returns a [User](#schema_user) object if a valid identifier was provided
|
1340
|
+
*/
|
1341
|
+
200: {
|
1342
|
+
user: User;
|
1343
|
+
};
|
1344
|
+
};
|
1345
|
+
|
1346
|
+
declare class Interceptors<Interceptor> {
|
1347
|
+
_fns: Interceptor[];
|
1348
|
+
constructor();
|
1349
|
+
clear(): void;
|
1350
|
+
exists(fn: Interceptor): boolean;
|
1351
|
+
eject(fn: Interceptor): void;
|
1352
|
+
use(fn: Interceptor): void;
|
1353
|
+
}
|
1354
|
+
|
1355
|
+
/**
|
1356
|
+
* Retrieves the conversation's [Messages](#schema_message)
|
1357
|
+
*/
|
1358
|
+
declare const listConversationMessages: <ThrowOnError extends boolean = false>(options: Options<ListConversationMessagesData, ThrowOnError>) => RequestResult<{
|
1359
|
+
messages: Array<Message>;
|
1360
|
+
meta: {
|
1361
|
+
nextToken?: string;
|
1362
|
+
};
|
1363
|
+
}, {
|
1364
|
+
messages: Array<Message>;
|
1365
|
+
meta: {
|
1366
|
+
nextToken?: string;
|
1367
|
+
};
|
1368
|
+
}, ThrowOnError>;
|
1369
|
+
|
1370
|
+
export declare type ListConversationMessagesData = {
|
1371
|
+
body?: never;
|
1372
|
+
headers: {
|
1373
|
+
/**
|
1374
|
+
* Authentication Key
|
1375
|
+
*/
|
1376
|
+
'x-user-key': string;
|
1377
|
+
};
|
1378
|
+
path: {
|
1379
|
+
/**
|
1380
|
+
* Conversation id
|
1381
|
+
*/
|
1382
|
+
id: string;
|
1383
|
+
};
|
1384
|
+
query?: {
|
1385
|
+
/**
|
1386
|
+
* Provide the `meta.nextToken` value provided in the last API response to retrieve the next page of results
|
1387
|
+
*/
|
1388
|
+
nextToken?: string;
|
1389
|
+
};
|
1390
|
+
url: '/conversations/{id}/messages';
|
1391
|
+
};
|
1392
|
+
|
1393
|
+
export declare type ListConversationMessagesError = ListConversationMessagesErrors[keyof ListConversationMessagesErrors];
|
1394
|
+
|
1395
|
+
export declare type ListConversationMessagesErrors = {
|
1396
|
+
/**
|
1397
|
+
* Returns a list of [Message](#schema_message) objects
|
1398
|
+
*/
|
1399
|
+
default: {
|
1400
|
+
messages: Array<Message>;
|
1401
|
+
meta: {
|
1402
|
+
/**
|
1403
|
+
* The token to use to retrieve the next page of results, passed as a query string parameter (value should be URL-encoded) to this API endpoint.
|
1404
|
+
*/
|
1405
|
+
nextToken?: string;
|
1406
|
+
};
|
1407
|
+
};
|
1408
|
+
};
|
1409
|
+
|
1410
|
+
export declare type ListConversationMessagesResponse = ListConversationMessagesResponses[keyof ListConversationMessagesResponses];
|
1411
|
+
|
1412
|
+
export declare type ListConversationMessagesResponses = {
|
1413
|
+
/**
|
1414
|
+
* Returns a list of [Message](#schema_message) objects
|
1415
|
+
*/
|
1416
|
+
200: {
|
1417
|
+
messages: Array<Message>;
|
1418
|
+
meta: {
|
1419
|
+
/**
|
1420
|
+
* The token to use to retrieve the next page of results, passed as a query string parameter (value should be URL-encoded) to this API endpoint.
|
1421
|
+
*/
|
1422
|
+
nextToken?: string;
|
1423
|
+
};
|
1424
|
+
};
|
1425
|
+
};
|
1426
|
+
|
1427
|
+
/**
|
1428
|
+
* Returns a list of [Conversation](#schema_conversation) objects
|
1429
|
+
*/
|
1430
|
+
declare const listConversations: <ThrowOnError extends boolean = false>(options: Options<ListConversationsData, ThrowOnError>) => RequestResult<{
|
1431
|
+
conversations: Array<{
|
1432
|
+
id: string;
|
1433
|
+
createdAt: string;
|
1434
|
+
updatedAt: string;
|
1435
|
+
}>;
|
1436
|
+
meta: {
|
1437
|
+
nextToken?: string;
|
1438
|
+
};
|
1439
|
+
}, {
|
1440
|
+
conversations: Array<{
|
1441
|
+
id: string;
|
1442
|
+
createdAt: string;
|
1443
|
+
updatedAt: string;
|
1444
|
+
}>;
|
1445
|
+
meta: {
|
1446
|
+
nextToken?: string;
|
1447
|
+
};
|
1448
|
+
}, ThrowOnError>;
|
1449
|
+
|
1450
|
+
export declare type ListConversationsData = {
|
1451
|
+
body?: never;
|
1452
|
+
headers: {
|
1453
|
+
/**
|
1454
|
+
* Authentication Key
|
1455
|
+
*/
|
1456
|
+
'x-user-key': string;
|
1457
|
+
};
|
1458
|
+
path?: never;
|
1459
|
+
query?: {
|
1460
|
+
/**
|
1461
|
+
* Provide the `meta.nextToken` value provided in the last API response to retrieve the next page of results
|
1462
|
+
*/
|
1463
|
+
nextToken?: string;
|
1464
|
+
};
|
1465
|
+
url: '/conversations';
|
1466
|
+
};
|
1467
|
+
|
1468
|
+
export declare type ListConversationsError = ListConversationsErrors[keyof ListConversationsErrors];
|
1469
|
+
|
1470
|
+
export declare type ListConversationsErrors = {
|
1471
|
+
/**
|
1472
|
+
* Returns a list of [Conversation](#schema_conversation) objects
|
1473
|
+
*/
|
1474
|
+
default: {
|
1475
|
+
conversations: Array<{
|
1476
|
+
/**
|
1477
|
+
* Id of the [Conversation](#schema_conversation)
|
1478
|
+
*/
|
1479
|
+
id: string;
|
1480
|
+
/**
|
1481
|
+
* Creation date of the [Conversation](#schema_conversation) in ISO 8601 format
|
1482
|
+
*/
|
1483
|
+
createdAt: string;
|
1484
|
+
/**
|
1485
|
+
* Updating date of the [Conversation](#schema_conversation) in ISO 8601 format
|
1486
|
+
*/
|
1487
|
+
updatedAt: string;
|
1488
|
+
}>;
|
1489
|
+
meta: {
|
1490
|
+
/**
|
1491
|
+
* The token to use to retrieve the next page of results, passed as a query string parameter (value should be URL-encoded) to this API endpoint.
|
1492
|
+
*/
|
1493
|
+
nextToken?: string;
|
1494
|
+
};
|
1495
|
+
};
|
1496
|
+
};
|
1497
|
+
|
1498
|
+
export declare type ListConversationsResponse = ListConversationsResponses[keyof ListConversationsResponses];
|
1499
|
+
|
1500
|
+
export declare type ListConversationsResponses = {
|
1501
|
+
/**
|
1502
|
+
* Returns a list of [Conversation](#schema_conversation) objects
|
1503
|
+
*/
|
1504
|
+
200: {
|
1505
|
+
conversations: Array<{
|
1506
|
+
/**
|
1507
|
+
* Id of the [Conversation](#schema_conversation)
|
1508
|
+
*/
|
1509
|
+
id: string;
|
1510
|
+
/**
|
1511
|
+
* Creation date of the [Conversation](#schema_conversation) in ISO 8601 format
|
1512
|
+
*/
|
1513
|
+
createdAt: string;
|
1514
|
+
/**
|
1515
|
+
* Updating date of the [Conversation](#schema_conversation) in ISO 8601 format
|
1516
|
+
*/
|
1517
|
+
updatedAt: string;
|
1518
|
+
}>;
|
1519
|
+
meta: {
|
1520
|
+
/**
|
1521
|
+
* The token to use to retrieve the next page of results, passed as a query string parameter (value should be URL-encoded) to this API endpoint.
|
1522
|
+
*/
|
1523
|
+
nextToken?: string;
|
1524
|
+
};
|
1525
|
+
};
|
1526
|
+
};
|
1527
|
+
|
1528
|
+
/**
|
1529
|
+
* Creates a SSE stream to receive messages and events from a conversation
|
1530
|
+
*/
|
1531
|
+
declare const listenConversation: <ThrowOnError extends boolean = false>(options: Options<ListenConversationData, ThrowOnError>) => RequestResult<{
|
1532
|
+
[key: string]: never;
|
1533
|
+
}, {
|
1534
|
+
[key: string]: never;
|
1535
|
+
}, ThrowOnError>;
|
1536
|
+
|
1537
|
+
export declare type ListenConversationData = {
|
1538
|
+
body?: never;
|
1539
|
+
headers: {
|
1540
|
+
/**
|
1541
|
+
* Authentication Key
|
1542
|
+
*/
|
1543
|
+
'x-user-key': string;
|
1544
|
+
};
|
1545
|
+
path: {
|
1546
|
+
/**
|
1547
|
+
* Conversation id
|
1548
|
+
*/
|
1549
|
+
id: string;
|
1550
|
+
};
|
1551
|
+
query?: never;
|
1552
|
+
url: '/conversations/{id}/listen';
|
1553
|
+
};
|
1554
|
+
|
1555
|
+
export declare type ListenConversationError = ListenConversationErrors[keyof ListenConversationErrors];
|
1556
|
+
|
1557
|
+
export declare type ListenConversationErrors = {
|
1558
|
+
/**
|
1559
|
+
* Returns nothing but a stream
|
1560
|
+
*/
|
1561
|
+
default: {
|
1562
|
+
[key: string]: never;
|
1563
|
+
};
|
1564
|
+
};
|
1565
|
+
|
1566
|
+
export declare type ListenConversationResponse = ListenConversationResponses[keyof ListenConversationResponses];
|
1567
|
+
|
1568
|
+
export declare type ListenConversationResponses = {
|
1569
|
+
/**
|
1570
|
+
* Returns nothing but a stream
|
1571
|
+
*/
|
1572
|
+
200: {
|
1573
|
+
[key: string]: never;
|
1574
|
+
};
|
1575
|
+
};
|
1576
|
+
|
1577
|
+
/**
|
1578
|
+
* Retrieves a list of [Participants](#schema_user) for a given [Conversation](#schema_conversation).
|
1579
|
+
*/
|
1580
|
+
declare const listParticipants: <ThrowOnError extends boolean = false>(options: Options<ListParticipantsData, ThrowOnError>) => RequestResult<{
|
1581
|
+
participants: Array<User>;
|
1582
|
+
meta: {
|
1583
|
+
nextToken?: string;
|
1584
|
+
};
|
1585
|
+
}, {
|
1586
|
+
participants: Array<User>;
|
1587
|
+
meta: {
|
1588
|
+
nextToken?: string;
|
1589
|
+
};
|
1590
|
+
}, ThrowOnError>;
|
1591
|
+
|
1592
|
+
export declare type ListParticipantsData = {
|
1593
|
+
body?: never;
|
1594
|
+
headers: {
|
1595
|
+
/**
|
1596
|
+
* Authentication Key
|
1597
|
+
*/
|
1598
|
+
'x-user-key': string;
|
1599
|
+
};
|
1600
|
+
path: {
|
1601
|
+
/**
|
1602
|
+
* Conversation id
|
1603
|
+
*/
|
1604
|
+
id: string;
|
1605
|
+
};
|
1606
|
+
query?: {
|
1607
|
+
/**
|
1608
|
+
* Provide the `meta.nextToken` value provided in the last API response to retrieve the next page of results
|
1609
|
+
*/
|
1610
|
+
nextToken?: string;
|
1611
|
+
};
|
1612
|
+
url: '/conversations/{id}/participants';
|
1613
|
+
};
|
1614
|
+
|
1615
|
+
export declare type ListParticipantsError = ListParticipantsErrors[keyof ListParticipantsErrors];
|
1616
|
+
|
1617
|
+
export declare type ListParticipantsErrors = {
|
1618
|
+
/**
|
1619
|
+
* Returns a list of [Participants](#schema_user) objects
|
1620
|
+
*/
|
1621
|
+
default: {
|
1622
|
+
participants: Array<User>;
|
1623
|
+
meta: {
|
1624
|
+
/**
|
1625
|
+
* The token to use to retrieve the next page of results, passed as a query string parameter (value should be URL-encoded) to this API endpoint.
|
1626
|
+
*/
|
1627
|
+
nextToken?: string;
|
1628
|
+
};
|
1629
|
+
};
|
1630
|
+
};
|
1631
|
+
|
1632
|
+
export declare type ListParticipantsResponse = ListParticipantsResponses[keyof ListParticipantsResponses];
|
1633
|
+
|
1634
|
+
export declare type ListParticipantsResponses = {
|
1635
|
+
/**
|
1636
|
+
* Returns a list of [Participants](#schema_user) objects
|
1637
|
+
*/
|
1638
|
+
200: {
|
1639
|
+
participants: Array<User>;
|
1640
|
+
meta: {
|
1641
|
+
/**
|
1642
|
+
* The token to use to retrieve the next page of results, passed as a query string parameter (value should be URL-encoded) to this API endpoint.
|
1643
|
+
*/
|
1644
|
+
nextToken?: string;
|
1645
|
+
};
|
1646
|
+
};
|
1647
|
+
};
|
1648
|
+
|
1649
|
+
/**
|
1650
|
+
* The Message object represents a message in a [Conversation](#schema_conversation) for a specific [User](#schema_user).
|
1651
|
+
*/
|
1652
|
+
export declare type Message = {
|
1653
|
+
/**
|
1654
|
+
* Id of the [Message](#schema_message)
|
1655
|
+
*/
|
1656
|
+
id: string;
|
1657
|
+
/**
|
1658
|
+
* Creation date of the [Message](#schema_message) in ISO 8601 format
|
1659
|
+
*/
|
1660
|
+
createdAt: string;
|
1661
|
+
/**
|
1662
|
+
* Payload is the content of the message.
|
1663
|
+
*/
|
1664
|
+
payload: {
|
1665
|
+
audioUrl: string;
|
1666
|
+
type: 'audio';
|
1667
|
+
} | {
|
1668
|
+
title: string;
|
1669
|
+
subtitle?: string;
|
1670
|
+
imageUrl?: string;
|
1671
|
+
actions: Array<{
|
1672
|
+
action: 'postback' | 'url' | 'say';
|
1673
|
+
label: string;
|
1674
|
+
value: string;
|
1675
|
+
}>;
|
1676
|
+
type: 'card';
|
1677
|
+
} | {
|
1678
|
+
items: Array<{
|
1679
|
+
title: string;
|
1680
|
+
subtitle?: string;
|
1681
|
+
imageUrl?: string;
|
1682
|
+
actions: Array<{
|
1683
|
+
action: 'postback' | 'url' | 'say';
|
1684
|
+
label: string;
|
1685
|
+
value: string;
|
1686
|
+
}>;
|
1687
|
+
}>;
|
1688
|
+
type: 'carousel';
|
1689
|
+
} | {
|
1690
|
+
text: string;
|
1691
|
+
options: Array<{
|
1692
|
+
label: string;
|
1693
|
+
value: string;
|
1694
|
+
}>;
|
1695
|
+
disableFreeText?: boolean;
|
1696
|
+
type: 'choice';
|
1697
|
+
} | {
|
1698
|
+
text: string;
|
1699
|
+
options: Array<{
|
1700
|
+
label: string;
|
1701
|
+
value: string;
|
1702
|
+
}>;
|
1703
|
+
disableFreeText?: boolean;
|
1704
|
+
type: 'dropdown';
|
1705
|
+
} | {
|
1706
|
+
fileUrl: string;
|
1707
|
+
title?: string;
|
1708
|
+
type: 'file';
|
1709
|
+
} | {
|
1710
|
+
imageUrl: string;
|
1711
|
+
type: 'image';
|
1712
|
+
} | {
|
1713
|
+
latitude: number;
|
1714
|
+
longitude: number;
|
1715
|
+
address?: string;
|
1716
|
+
title?: string;
|
1717
|
+
type: 'location';
|
1718
|
+
} | {
|
1719
|
+
text: string;
|
1720
|
+
value?: string;
|
1721
|
+
type: 'text';
|
1722
|
+
} | {
|
1723
|
+
videoUrl: string;
|
1724
|
+
type: 'video';
|
1725
|
+
} | {
|
1726
|
+
items: Array<{
|
1727
|
+
type: 'text';
|
1728
|
+
payload: {
|
1729
|
+
text: string;
|
1730
|
+
value?: string;
|
1731
|
+
};
|
1732
|
+
} | {
|
1733
|
+
type: 'markdown';
|
1734
|
+
payload: {
|
1735
|
+
markdown: string;
|
1736
|
+
};
|
1737
|
+
} | {
|
1738
|
+
type: 'image';
|
1739
|
+
payload: {
|
1740
|
+
imageUrl: string;
|
1741
|
+
};
|
1742
|
+
} | {
|
1743
|
+
type: 'audio';
|
1744
|
+
payload: {
|
1745
|
+
audioUrl: string;
|
1746
|
+
};
|
1747
|
+
} | {
|
1748
|
+
type: 'video';
|
1749
|
+
payload: {
|
1750
|
+
videoUrl: string;
|
1751
|
+
};
|
1752
|
+
} | {
|
1753
|
+
type: 'file';
|
1754
|
+
payload: {
|
1755
|
+
fileUrl: string;
|
1756
|
+
title?: string;
|
1757
|
+
};
|
1758
|
+
} | {
|
1759
|
+
type: 'location';
|
1760
|
+
payload: {
|
1761
|
+
latitude: number;
|
1762
|
+
longitude: number;
|
1763
|
+
address?: string;
|
1764
|
+
title?: string;
|
1765
|
+
};
|
1766
|
+
}>;
|
1767
|
+
type: 'bloc';
|
1768
|
+
} | {
|
1769
|
+
markdown: string;
|
1770
|
+
type: 'markdown';
|
1771
|
+
} | {
|
1772
|
+
url: string;
|
1773
|
+
name: string;
|
1774
|
+
data?: unknown;
|
1775
|
+
type: 'custom';
|
1776
|
+
} | {
|
1777
|
+
reaction: string;
|
1778
|
+
type: 'reaction';
|
1779
|
+
};
|
1780
|
+
/**
|
1781
|
+
* ID of the [User](#schema_user)
|
1782
|
+
*/
|
1783
|
+
userId: string;
|
1784
|
+
/**
|
1785
|
+
* ID of the [Conversation](#schema_conversation)
|
1786
|
+
*/
|
1787
|
+
conversationId: string;
|
1788
|
+
/**
|
1789
|
+
* Metadata of the message
|
1790
|
+
*/
|
1791
|
+
metadata?: {};
|
1792
|
+
/**
|
1793
|
+
* ID of the message this message is replying to
|
1794
|
+
*/
|
1795
|
+
replyTo?: string;
|
1796
|
+
/**
|
1797
|
+
* ID of the user who selected this message. Undefined if not selected.
|
1798
|
+
*/
|
1799
|
+
selectedBy?: string;
|
1800
|
+
};
|
1801
|
+
|
1802
|
+
declare type MessageCreated = {
|
1803
|
+
type: 'message_created';
|
1804
|
+
/**
|
1805
|
+
* The Message object represents a message in a [Conversation](#schema_conversation) for a specific [User](#schema_user).
|
1806
|
+
*/
|
1807
|
+
data: {
|
1808
|
+
/**
|
1809
|
+
* Id of the [Message](#schema_message)
|
1810
|
+
*/
|
1811
|
+
id: string;
|
1812
|
+
/**
|
1813
|
+
* Creation date of the [Message](#schema_message) in ISO 8601 format
|
1814
|
+
*/
|
1815
|
+
createdAt: string;
|
1816
|
+
/**
|
1817
|
+
* Payload is the content of the message.
|
1818
|
+
*/
|
1819
|
+
payload: {
|
1820
|
+
audioUrl: string;
|
1821
|
+
type: 'audio';
|
1822
|
+
[k: string]: any;
|
1823
|
+
} | {
|
1824
|
+
title: string;
|
1825
|
+
subtitle?: string;
|
1826
|
+
imageUrl?: string;
|
1827
|
+
actions: {
|
1828
|
+
action: 'postback' | 'url' | 'say';
|
1829
|
+
label: string;
|
1830
|
+
value: string;
|
1831
|
+
[k: string]: any;
|
1832
|
+
}[];
|
1833
|
+
type: 'card';
|
1834
|
+
[k: string]: any;
|
1835
|
+
} | {
|
1836
|
+
items: {
|
1837
|
+
title: string;
|
1838
|
+
subtitle?: string;
|
1839
|
+
imageUrl?: string;
|
1840
|
+
actions: {
|
1841
|
+
action: 'postback' | 'url' | 'say';
|
1842
|
+
label: string;
|
1843
|
+
value: string;
|
1844
|
+
[k: string]: any;
|
1845
|
+
}[];
|
1846
|
+
[k: string]: any;
|
1847
|
+
}[];
|
1848
|
+
type: 'carousel';
|
1849
|
+
[k: string]: any;
|
1850
|
+
} | {
|
1851
|
+
text: string;
|
1852
|
+
options: {
|
1853
|
+
label: string;
|
1854
|
+
value: string;
|
1855
|
+
[k: string]: any;
|
1856
|
+
}[];
|
1857
|
+
type: 'choice';
|
1858
|
+
disableFreeText?: boolean;
|
1859
|
+
[k: string]: any;
|
1860
|
+
} | {
|
1861
|
+
text: string;
|
1862
|
+
options: {
|
1863
|
+
label: string;
|
1864
|
+
value: string;
|
1865
|
+
[k: string]: any;
|
1866
|
+
}[];
|
1867
|
+
type: 'dropdown';
|
1868
|
+
[k: string]: any;
|
1869
|
+
} | {
|
1870
|
+
fileUrl: string;
|
1871
|
+
title?: string;
|
1872
|
+
type: 'file';
|
1873
|
+
[k: string]: any;
|
1874
|
+
} | {
|
1875
|
+
imageUrl: string;
|
1876
|
+
type: 'image';
|
1877
|
+
[k: string]: any;
|
1878
|
+
} | {
|
1879
|
+
latitude: number;
|
1880
|
+
longitude: number;
|
1881
|
+
address?: string;
|
1882
|
+
title?: string;
|
1883
|
+
type: 'location';
|
1884
|
+
[k: string]: any;
|
1885
|
+
} | {
|
1886
|
+
text: string;
|
1887
|
+
type: 'text';
|
1888
|
+
value?: string;
|
1889
|
+
[k: string]: any;
|
1890
|
+
} | {
|
1891
|
+
videoUrl: string;
|
1892
|
+
type: 'video';
|
1893
|
+
[k: string]: any;
|
1894
|
+
} | {
|
1895
|
+
items: ({
|
1896
|
+
type: 'text';
|
1897
|
+
payload: {
|
1898
|
+
text: string;
|
1899
|
+
[k: string]: any;
|
1900
|
+
};
|
1901
|
+
[k: string]: any;
|
1902
|
+
} | {
|
1903
|
+
type: 'markdown';
|
1904
|
+
payload: {
|
1905
|
+
markdown: string;
|
1906
|
+
[k: string]: any;
|
1907
|
+
};
|
1908
|
+
[k: string]: any;
|
1909
|
+
} | {
|
1910
|
+
type: 'image';
|
1911
|
+
payload: {
|
1912
|
+
imageUrl: string;
|
1913
|
+
[k: string]: any;
|
1914
|
+
};
|
1915
|
+
[k: string]: any;
|
1916
|
+
} | {
|
1917
|
+
type: 'audio';
|
1918
|
+
payload: {
|
1919
|
+
audioUrl: string;
|
1920
|
+
[k: string]: any;
|
1921
|
+
};
|
1922
|
+
[k: string]: any;
|
1923
|
+
} | {
|
1924
|
+
type: 'video';
|
1925
|
+
payload: {
|
1926
|
+
videoUrl: string;
|
1927
|
+
[k: string]: any;
|
1928
|
+
};
|
1929
|
+
[k: string]: any;
|
1930
|
+
} | {
|
1931
|
+
type: 'file';
|
1932
|
+
payload: {
|
1933
|
+
fileUrl: string;
|
1934
|
+
title?: string;
|
1935
|
+
[k: string]: any;
|
1936
|
+
};
|
1937
|
+
[k: string]: any;
|
1938
|
+
} | {
|
1939
|
+
type: 'location';
|
1940
|
+
payload: {
|
1941
|
+
latitude: number;
|
1942
|
+
longitude: number;
|
1943
|
+
address?: string;
|
1944
|
+
title?: string;
|
1945
|
+
[k: string]: any;
|
1946
|
+
};
|
1947
|
+
[k: string]: any;
|
1948
|
+
})[];
|
1949
|
+
type: 'bloc';
|
1950
|
+
[k: string]: any;
|
1951
|
+
} | {
|
1952
|
+
markdown: string;
|
1953
|
+
type: 'markdown';
|
1954
|
+
[k: string]: any;
|
1955
|
+
} | {
|
1956
|
+
type: 'custom';
|
1957
|
+
url: string;
|
1958
|
+
name: string;
|
1959
|
+
data?: any;
|
1960
|
+
[k: string]: any;
|
1961
|
+
};
|
1962
|
+
/**
|
1963
|
+
* ID of the [User](#schema_user)
|
1964
|
+
*/
|
1965
|
+
userId: string;
|
1966
|
+
/**
|
1967
|
+
* ID of the [Conversation](#schema_conversation)
|
1968
|
+
*/
|
1969
|
+
conversationId: string;
|
1970
|
+
/**
|
1971
|
+
* Metadata of the message
|
1972
|
+
*/
|
1973
|
+
metadata?: {
|
1974
|
+
[k: string]: any;
|
1975
|
+
};
|
1976
|
+
/**
|
1977
|
+
* ID of the message this message is replying to
|
1978
|
+
*/
|
1979
|
+
replyTo?: string;
|
1980
|
+
};
|
1981
|
+
};
|
1982
|
+
|
1983
|
+
declare type MessageIdParam = {
|
1984
|
+
messageId: string;
|
1985
|
+
};
|
1986
|
+
|
1987
|
+
declare type MessageUpdated = {
|
1988
|
+
type: 'message_updated';
|
1989
|
+
/**
|
1990
|
+
* The Message object represents a message in a [Conversation](#schema_conversation) for a specific [User](#schema_user).
|
1991
|
+
*/
|
1992
|
+
data: {
|
1993
|
+
/**
|
1994
|
+
* Id of the [Message](#schema_message)
|
1995
|
+
*/
|
1996
|
+
id: string;
|
1997
|
+
/**
|
1998
|
+
* Creation date of the [Message](#schema_message) in ISO 8601 format
|
1999
|
+
*/
|
2000
|
+
createdAt: string;
|
2001
|
+
/**
|
2002
|
+
* Payload is the content of the message.
|
2003
|
+
*/
|
2004
|
+
payload: {
|
2005
|
+
audioUrl: string;
|
2006
|
+
type: 'audio';
|
2007
|
+
[k: string]: any;
|
2008
|
+
} | {
|
2009
|
+
title: string;
|
2010
|
+
subtitle?: string;
|
2011
|
+
imageUrl?: string;
|
2012
|
+
actions: {
|
2013
|
+
action: 'postback' | 'url' | 'say';
|
2014
|
+
label: string;
|
2015
|
+
value: string;
|
2016
|
+
[k: string]: any;
|
2017
|
+
}[];
|
2018
|
+
type: 'card';
|
2019
|
+
[k: string]: any;
|
2020
|
+
} | {
|
2021
|
+
items: {
|
2022
|
+
title: string;
|
2023
|
+
subtitle?: string;
|
2024
|
+
imageUrl?: string;
|
2025
|
+
actions: {
|
2026
|
+
action: 'postback' | 'url' | 'say';
|
2027
|
+
label: string;
|
2028
|
+
value: string;
|
2029
|
+
[k: string]: any;
|
2030
|
+
}[];
|
2031
|
+
[k: string]: any;
|
2032
|
+
}[];
|
2033
|
+
type: 'carousel';
|
2034
|
+
[k: string]: any;
|
2035
|
+
} | {
|
2036
|
+
text: string;
|
2037
|
+
options: {
|
2038
|
+
label: string;
|
2039
|
+
value: string;
|
2040
|
+
[k: string]: any;
|
2041
|
+
}[];
|
2042
|
+
type: 'choice';
|
2043
|
+
disableFreeText?: boolean;
|
2044
|
+
[k: string]: any;
|
2045
|
+
} | {
|
2046
|
+
text: string;
|
2047
|
+
options: {
|
2048
|
+
label: string;
|
2049
|
+
value: string;
|
2050
|
+
[k: string]: any;
|
2051
|
+
}[];
|
2052
|
+
type: 'dropdown';
|
2053
|
+
[k: string]: any;
|
2054
|
+
} | {
|
2055
|
+
fileUrl: string;
|
2056
|
+
title?: string;
|
2057
|
+
type: 'file';
|
2058
|
+
[k: string]: any;
|
2059
|
+
} | {
|
2060
|
+
imageUrl: string;
|
2061
|
+
type: 'image';
|
2062
|
+
[k: string]: any;
|
2063
|
+
} | {
|
2064
|
+
latitude: number;
|
2065
|
+
longitude: number;
|
2066
|
+
address?: string;
|
2067
|
+
title?: string;
|
2068
|
+
type: 'location';
|
2069
|
+
[k: string]: any;
|
2070
|
+
} | {
|
2071
|
+
text: string;
|
2072
|
+
type: 'text';
|
2073
|
+
value?: string;
|
2074
|
+
[k: string]: any;
|
2075
|
+
} | {
|
2076
|
+
videoUrl: string;
|
2077
|
+
type: 'video';
|
2078
|
+
[k: string]: any;
|
2079
|
+
} | {
|
2080
|
+
items: ({
|
2081
|
+
type: 'text';
|
2082
|
+
payload: {
|
2083
|
+
text: string;
|
2084
|
+
[k: string]: any;
|
2085
|
+
};
|
2086
|
+
[k: string]: any;
|
2087
|
+
} | {
|
2088
|
+
type: 'markdown';
|
2089
|
+
payload: {
|
2090
|
+
markdown: string;
|
2091
|
+
[k: string]: any;
|
2092
|
+
};
|
2093
|
+
[k: string]: any;
|
2094
|
+
} | {
|
2095
|
+
type: 'image';
|
2096
|
+
payload: {
|
2097
|
+
imageUrl: string;
|
2098
|
+
[k: string]: any;
|
2099
|
+
};
|
2100
|
+
[k: string]: any;
|
2101
|
+
} | {
|
2102
|
+
type: 'audio';
|
2103
|
+
payload: {
|
2104
|
+
audioUrl: string;
|
2105
|
+
[k: string]: any;
|
2106
|
+
};
|
2107
|
+
[k: string]: any;
|
2108
|
+
} | {
|
2109
|
+
type: 'video';
|
2110
|
+
payload: {
|
2111
|
+
videoUrl: string;
|
2112
|
+
[k: string]: any;
|
2113
|
+
};
|
2114
|
+
[k: string]: any;
|
2115
|
+
} | {
|
2116
|
+
type: 'file';
|
2117
|
+
payload: {
|
2118
|
+
fileUrl: string;
|
2119
|
+
title?: string;
|
2120
|
+
[k: string]: any;
|
2121
|
+
};
|
2122
|
+
[k: string]: any;
|
2123
|
+
} | {
|
2124
|
+
type: 'location';
|
2125
|
+
payload: {
|
2126
|
+
latitude: number;
|
2127
|
+
longitude: number;
|
2128
|
+
address?: string;
|
2129
|
+
title?: string;
|
2130
|
+
[k: string]: any;
|
2131
|
+
};
|
2132
|
+
[k: string]: any;
|
2133
|
+
})[];
|
2134
|
+
type: 'bloc';
|
2135
|
+
[k: string]: any;
|
2136
|
+
} | {
|
2137
|
+
markdown: string;
|
2138
|
+
type: 'markdown';
|
2139
|
+
[k: string]: any;
|
2140
|
+
} | {
|
2141
|
+
type: 'custom';
|
2142
|
+
url: string;
|
2143
|
+
name: string;
|
2144
|
+
data?: any;
|
2145
|
+
[k: string]: any;
|
2146
|
+
};
|
2147
|
+
/**
|
2148
|
+
* ID of the [User](#schema_user)
|
2149
|
+
*/
|
2150
|
+
userId: string;
|
2151
|
+
/**
|
2152
|
+
* ID of the [Conversation](#schema_conversation)
|
2153
|
+
*/
|
2154
|
+
conversationId: string;
|
2155
|
+
/**
|
2156
|
+
* Metadata of the message
|
2157
|
+
*/
|
2158
|
+
metadata?: {
|
2159
|
+
[k: string]: any;
|
2160
|
+
};
|
2161
|
+
/**
|
2162
|
+
* ID of the message this message is replying to
|
2163
|
+
*/
|
2164
|
+
replyTo?: string;
|
2165
|
+
};
|
2166
|
+
};
|
2167
|
+
|
2168
|
+
declare type MethodFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'>) => RequestResult<TData, TError, ThrowOnError>;
|
2169
|
+
|
2170
|
+
declare interface Middleware<Req, Res, Err, Options> {
|
2171
|
+
error: Pick<Interceptors<ErrInterceptor<Err, Res, Req, Options>>, 'eject' | 'use'>;
|
2172
|
+
request: Pick<Interceptors<ReqInterceptor<Req, Options>>, 'eject' | 'use'>;
|
2173
|
+
response: Pick<Interceptors<ResInterceptor<Res, Req, Options>>, 'eject' | 'use'>;
|
2174
|
+
}
|
2175
|
+
|
2176
|
+
declare type NextTokenParam = {
|
2177
|
+
nextToken?: string;
|
2178
|
+
};
|
2179
|
+
|
2180
|
+
declare type ObjectStyle = 'form' | 'deepObject';
|
2181
|
+
|
2182
|
+
declare type OmitKeys<T, K> = Pick<T, Exclude<keyof T, K>>;
|
2183
|
+
|
2184
|
+
declare type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options_2<TData, ThrowOnError> & {
|
2185
|
+
/**
|
2186
|
+
* You can provide a client instance returned by `createClient()` instead of
|
2187
|
+
* individual options. This might be also useful if you want to implement a
|
2188
|
+
* custom client.
|
2189
|
+
*/
|
2190
|
+
client?: Client_2;
|
2191
|
+
/**
|
2192
|
+
* You can pass arbitrary values through the `meta` object. This can be
|
2193
|
+
* used to access values that aren't defined as part of the SDK function.
|
2194
|
+
*/
|
2195
|
+
meta?: Record<string, unknown>;
|
2196
|
+
};
|
2197
|
+
|
2198
|
+
declare type Options_2<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = OmitKeys<RequestOptions<ThrowOnError>, 'body' | 'path' | 'query' | 'url'> & Omit<TData, 'url'>;
|
2199
|
+
|
2200
|
+
declare type QuerySerializer = (query: Record<string, unknown>) => string;
|
2201
|
+
|
2202
|
+
declare interface QuerySerializerOptions {
|
2203
|
+
allowReserved?: boolean;
|
2204
|
+
array?: SerializerOptions<ArrayStyle>;
|
2205
|
+
object?: SerializerOptions<ObjectStyle>;
|
2206
|
+
}
|
2207
|
+
|
2208
|
+
/**
|
2209
|
+
* Remove a [Participant](#schema_user) from a [Conversation](#schema_conversation).
|
2210
|
+
*/
|
2211
|
+
declare const removeParticipant: <ThrowOnError extends boolean = false>(options: Options<RemoveParticipantData, ThrowOnError>) => RequestResult<{
|
2212
|
+
[key: string]: never;
|
2213
|
+
}, {
|
2214
|
+
[key: string]: never;
|
2215
|
+
}, ThrowOnError>;
|
2216
|
+
|
2217
|
+
export declare type RemoveParticipantData = {
|
2218
|
+
body?: never;
|
2219
|
+
headers: {
|
2220
|
+
/**
|
2221
|
+
* Authentication Key
|
2222
|
+
*/
|
2223
|
+
'x-user-key': string;
|
2224
|
+
};
|
2225
|
+
path: {
|
2226
|
+
/**
|
2227
|
+
* Conversation id
|
2228
|
+
*/
|
2229
|
+
id: string;
|
2230
|
+
/**
|
2231
|
+
* User id
|
2232
|
+
*/
|
2233
|
+
userId: string;
|
2234
|
+
};
|
2235
|
+
query?: never;
|
2236
|
+
url: '/conversations/{id}/participants/{userId}';
|
2237
|
+
};
|
2238
|
+
|
2239
|
+
export declare type RemoveParticipantError = RemoveParticipantErrors[keyof RemoveParticipantErrors];
|
2240
|
+
|
2241
|
+
export declare type RemoveParticipantErrors = {
|
2242
|
+
/**
|
2243
|
+
* Returns an empty object
|
2244
|
+
*/
|
2245
|
+
default: {
|
2246
|
+
[key: string]: never;
|
2247
|
+
};
|
2248
|
+
};
|
2249
|
+
|
2250
|
+
export declare type RemoveParticipantResponse = RemoveParticipantResponses[keyof RemoveParticipantResponses];
|
2251
|
+
|
2252
|
+
export declare type RemoveParticipantResponses = {
|
2253
|
+
/**
|
2254
|
+
* Returns an empty object
|
2255
|
+
*/
|
2256
|
+
200: {
|
2257
|
+
[key: string]: never;
|
2258
|
+
};
|
2259
|
+
};
|
2260
|
+
|
2261
|
+
declare type ReqInterceptor<Req, Options> = (request: Req, options: Options) => Req | Promise<Req>;
|
2262
|
+
|
2263
|
+
declare type RequestFn = <TData = unknown, TError = unknown, ThrowOnError extends boolean = false>(options: Omit<RequestOptions<ThrowOnError>, 'method'> & Pick<Required<RequestOptions<ThrowOnError>>, 'method'>) => RequestResult<TData, TError, ThrowOnError>;
|
2264
|
+
|
2265
|
+
declare interface RequestOptions<ThrowOnError extends boolean = boolean, Url extends string = string> extends Config<{
|
2266
|
+
throwOnError: ThrowOnError;
|
2267
|
+
}> {
|
2268
|
+
/**
|
2269
|
+
* Any body that you want to add to your request.
|
2270
|
+
*
|
2271
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
|
2272
|
+
*/
|
2273
|
+
body?: unknown;
|
2274
|
+
path?: Record<string, unknown>;
|
2275
|
+
query?: Record<string, unknown>;
|
2276
|
+
/**
|
2277
|
+
* Security mechanism(s) to use for the request.
|
2278
|
+
*/
|
2279
|
+
security?: ReadonlyArray<Auth>;
|
2280
|
+
url: Url;
|
2281
|
+
}
|
2282
|
+
|
2283
|
+
declare type RequestResult<TData = unknown, TError = unknown, ThrowOnError extends boolean = boolean> = ThrowOnError extends true ? Promise<{
|
2284
|
+
data: TData;
|
2285
|
+
request: Request;
|
2286
|
+
response: Response;
|
2287
|
+
}> : Promise<({
|
2288
|
+
data: TData;
|
2289
|
+
error: undefined;
|
2290
|
+
} | {
|
2291
|
+
data: undefined;
|
2292
|
+
error: TError;
|
2293
|
+
}) & {
|
2294
|
+
request: Request;
|
2295
|
+
response: Response;
|
2296
|
+
}>;
|
2297
|
+
|
2298
|
+
declare type ResInterceptor<Res, Req, Options> = (response: Res, request: Req, options: Options) => Res | Promise<Res>;
|
2299
|
+
|
2300
|
+
/**
|
2301
|
+
* Updates a [Message](#schema_message) sent by any user to mark it as already selected. A message can only be selected once.
|
2302
|
+
*/
|
2303
|
+
declare const selectMessage: <ThrowOnError extends boolean = false>(options: Options<SelectMessageData, ThrowOnError>) => RequestResult<{
|
2304
|
+
[key: string]: never;
|
2305
|
+
}, {
|
2306
|
+
[key: string]: never;
|
2307
|
+
}, ThrowOnError>;
|
2308
|
+
|
2309
|
+
/**
|
2310
|
+
* Empty object
|
2311
|
+
*/
|
2312
|
+
export declare type SelectMessageBody = {
|
2313
|
+
[key: string]: never;
|
2314
|
+
};
|
2315
|
+
|
2316
|
+
export declare type SelectMessageData = {
|
2317
|
+
/**
|
2318
|
+
* Empty object
|
2319
|
+
*/
|
2320
|
+
body?: SelectMessageBody;
|
2321
|
+
headers: {
|
2322
|
+
/**
|
2323
|
+
* Authentication Key
|
2324
|
+
*/
|
2325
|
+
'x-user-key': string;
|
2326
|
+
};
|
2327
|
+
path: {
|
2328
|
+
/**
|
2329
|
+
* Message id
|
2330
|
+
*/
|
2331
|
+
id: string;
|
2332
|
+
};
|
2333
|
+
query?: never;
|
2334
|
+
url: '/messages/{id}/select';
|
2335
|
+
};
|
2336
|
+
|
2337
|
+
export declare type SelectMessageError = SelectMessageErrors[keyof SelectMessageErrors];
|
2338
|
+
|
2339
|
+
export declare type SelectMessageErrors = {
|
2340
|
+
/**
|
2341
|
+
* Empty object
|
2342
|
+
*/
|
2343
|
+
default: {
|
2344
|
+
[key: string]: never;
|
2345
|
+
};
|
2346
|
+
};
|
2347
|
+
|
2348
|
+
export declare type SelectMessageResponse = SelectMessageResponses[keyof SelectMessageResponses];
|
2349
|
+
|
2350
|
+
export declare type SelectMessageResponses = {
|
2351
|
+
/**
|
2352
|
+
* Empty object
|
2353
|
+
*/
|
2354
|
+
200: {
|
2355
|
+
[key: string]: never;
|
2356
|
+
};
|
2357
|
+
};
|
2358
|
+
|
2359
|
+
declare interface SerializerOptions<T> {
|
2360
|
+
/**
|
2361
|
+
* @default true
|
2362
|
+
*/
|
2363
|
+
explode: boolean;
|
2364
|
+
style: T;
|
2365
|
+
}
|
2366
|
+
|
2367
|
+
declare type Signal = MessageCreated | MessageUpdated | WebchatVisibility | WebchatConfig | Custom | TypingStarted | TypingStopped;
|
2368
|
+
|
2369
|
+
declare interface TDataShape {
|
2370
|
+
body?: unknown;
|
2371
|
+
headers?: unknown;
|
2372
|
+
path?: unknown;
|
2373
|
+
query?: unknown;
|
2374
|
+
url: string;
|
2375
|
+
}
|
2376
|
+
|
2377
|
+
declare type TypingStarted = {
|
2378
|
+
type: 'typing_started';
|
2379
|
+
data: {
|
2380
|
+
timeout?: number;
|
2381
|
+
};
|
2382
|
+
};
|
2383
|
+
|
2384
|
+
declare type TypingStopped = {
|
2385
|
+
type: 'typing_stopped';
|
2386
|
+
data: {};
|
2387
|
+
};
|
2388
|
+
|
2389
|
+
/**
|
2390
|
+
* Updates a [Message](#schema_message). The bot won't be aware of the changes.
|
2391
|
+
*/
|
2392
|
+
declare const updateMessage: <ThrowOnError extends boolean = false>(options: Options<UpdateMessageData, ThrowOnError>) => RequestResult<{
|
2393
|
+
message: Message;
|
2394
|
+
}, {
|
2395
|
+
message: Message;
|
2396
|
+
}, ThrowOnError>;
|
2397
|
+
|
2398
|
+
/**
|
2399
|
+
* Message data
|
2400
|
+
*/
|
2401
|
+
export declare type UpdateMessageBody = {
|
2402
|
+
/**
|
2403
|
+
* Payload is the content of the message.
|
2404
|
+
*/
|
2405
|
+
payload?: {
|
2406
|
+
audioUrl: string;
|
2407
|
+
type: 'audio';
|
2408
|
+
} | {
|
2409
|
+
title: string;
|
2410
|
+
subtitle?: string;
|
2411
|
+
imageUrl?: string;
|
2412
|
+
actions: Array<{
|
2413
|
+
action: 'postback' | 'url' | 'say';
|
2414
|
+
label: string;
|
2415
|
+
value: string;
|
2416
|
+
}>;
|
2417
|
+
type: 'card';
|
2418
|
+
} | {
|
2419
|
+
items: Array<{
|
2420
|
+
title: string;
|
2421
|
+
subtitle?: string;
|
2422
|
+
imageUrl?: string;
|
2423
|
+
actions: Array<{
|
2424
|
+
action: 'postback' | 'url' | 'say';
|
2425
|
+
label: string;
|
2426
|
+
value: string;
|
2427
|
+
}>;
|
2428
|
+
}>;
|
2429
|
+
type: 'carousel';
|
2430
|
+
} | {
|
2431
|
+
text: string;
|
2432
|
+
options: Array<{
|
2433
|
+
label: string;
|
2434
|
+
value: string;
|
2435
|
+
}>;
|
2436
|
+
disableFreeText?: boolean;
|
2437
|
+
type: 'choice';
|
2438
|
+
} | {
|
2439
|
+
text: string;
|
2440
|
+
options: Array<{
|
2441
|
+
label: string;
|
2442
|
+
value: string;
|
2443
|
+
}>;
|
2444
|
+
disableFreeText?: boolean;
|
2445
|
+
type: 'dropdown';
|
2446
|
+
} | {
|
2447
|
+
fileUrl: string;
|
2448
|
+
title?: string;
|
2449
|
+
type: 'file';
|
2450
|
+
} | {
|
2451
|
+
imageUrl: string;
|
2452
|
+
type: 'image';
|
2453
|
+
} | {
|
2454
|
+
latitude: number;
|
2455
|
+
longitude: number;
|
2456
|
+
address?: string;
|
2457
|
+
title?: string;
|
2458
|
+
type: 'location';
|
2459
|
+
} | {
|
2460
|
+
text: string;
|
2461
|
+
value?: string;
|
2462
|
+
type: 'text';
|
2463
|
+
} | {
|
2464
|
+
videoUrl: string;
|
2465
|
+
type: 'video';
|
2466
|
+
} | {
|
2467
|
+
items: Array<{
|
2468
|
+
type: 'text';
|
2469
|
+
payload: {
|
2470
|
+
text: string;
|
2471
|
+
value?: string;
|
2472
|
+
};
|
2473
|
+
} | {
|
2474
|
+
type: 'markdown';
|
2475
|
+
payload: {
|
2476
|
+
markdown: string;
|
2477
|
+
};
|
2478
|
+
} | {
|
2479
|
+
type: 'image';
|
2480
|
+
payload: {
|
2481
|
+
imageUrl: string;
|
2482
|
+
};
|
2483
|
+
} | {
|
2484
|
+
type: 'audio';
|
2485
|
+
payload: {
|
2486
|
+
audioUrl: string;
|
2487
|
+
};
|
2488
|
+
} | {
|
2489
|
+
type: 'video';
|
2490
|
+
payload: {
|
2491
|
+
videoUrl: string;
|
2492
|
+
};
|
2493
|
+
} | {
|
2494
|
+
type: 'file';
|
2495
|
+
payload: {
|
2496
|
+
fileUrl: string;
|
2497
|
+
title?: string;
|
2498
|
+
};
|
2499
|
+
} | {
|
2500
|
+
type: 'location';
|
2501
|
+
payload: {
|
2502
|
+
latitude: number;
|
2503
|
+
longitude: number;
|
2504
|
+
address?: string;
|
2505
|
+
title?: string;
|
2506
|
+
};
|
2507
|
+
}>;
|
2508
|
+
type: 'bloc';
|
2509
|
+
} | {
|
2510
|
+
markdown: string;
|
2511
|
+
type: 'markdown';
|
2512
|
+
} | {
|
2513
|
+
url: string;
|
2514
|
+
name: string;
|
2515
|
+
data?: unknown;
|
2516
|
+
type: 'custom';
|
2517
|
+
} | {
|
2518
|
+
reaction: string;
|
2519
|
+
type: 'reaction';
|
2520
|
+
};
|
2521
|
+
/**
|
2522
|
+
* Metadata of the message
|
2523
|
+
*/
|
2524
|
+
metadata?: {};
|
2525
|
+
};
|
2526
|
+
|
2527
|
+
export declare type UpdateMessageData = {
|
2528
|
+
/**
|
2529
|
+
* Message data
|
2530
|
+
*/
|
2531
|
+
body?: UpdateMessageBody;
|
2532
|
+
headers: {
|
2533
|
+
/**
|
2534
|
+
* Authentication Key
|
2535
|
+
*/
|
2536
|
+
'x-user-key': string;
|
2537
|
+
};
|
2538
|
+
path: {
|
2539
|
+
/**
|
2540
|
+
* Message id
|
2541
|
+
*/
|
2542
|
+
id: string;
|
2543
|
+
};
|
2544
|
+
query?: never;
|
2545
|
+
url: '/messages/{id}';
|
2546
|
+
};
|
2547
|
+
|
2548
|
+
export declare type UpdateMessageError = UpdateMessageErrors[keyof UpdateMessageErrors];
|
2549
|
+
|
2550
|
+
export declare type UpdateMessageErrors = {
|
2551
|
+
/**
|
2552
|
+
* Returns a [Message](#schema_message).
|
2553
|
+
*/
|
2554
|
+
default: {
|
2555
|
+
message: Message;
|
2556
|
+
};
|
2557
|
+
};
|
2558
|
+
|
2559
|
+
export declare type UpdateMessageResponse = UpdateMessageResponses[keyof UpdateMessageResponses];
|
2560
|
+
|
2561
|
+
export declare type UpdateMessageResponses = {
|
2562
|
+
/**
|
2563
|
+
* Returns a [Message](#schema_message).
|
2564
|
+
*/
|
2565
|
+
200: {
|
2566
|
+
message: Message;
|
2567
|
+
};
|
2568
|
+
};
|
2569
|
+
|
2570
|
+
/**
|
2571
|
+
* Update [User](#schema_user)
|
2572
|
+
*/
|
2573
|
+
declare const updateUser: <ThrowOnError extends boolean = false>(options: Options<UpdateUserData, ThrowOnError>) => RequestResult<{
|
2574
|
+
user: User;
|
2575
|
+
}, {
|
2576
|
+
user: User;
|
2577
|
+
}, ThrowOnError>;
|
2578
|
+
|
2579
|
+
/**
|
2580
|
+
* User data
|
2581
|
+
*/
|
2582
|
+
export declare type UpdateUserBody = {
|
2583
|
+
/**
|
2584
|
+
* Name of the [User](#schema_user) (not a unique identifier)
|
2585
|
+
*/
|
2586
|
+
name?: string;
|
2587
|
+
/**
|
2588
|
+
* Picture url of the [User](#schema_user)
|
2589
|
+
*/
|
2590
|
+
pictureUrl?: string;
|
2591
|
+
/**
|
2592
|
+
* User data
|
2593
|
+
*/
|
2594
|
+
userData?: {} | null;
|
2595
|
+
};
|
2596
|
+
|
2597
|
+
export declare type UpdateUserData = {
|
2598
|
+
/**
|
2599
|
+
* User data
|
2600
|
+
*/
|
2601
|
+
body?: UpdateUserBody;
|
2602
|
+
headers: {
|
2603
|
+
/**
|
2604
|
+
* Authentication Key
|
2605
|
+
*/
|
2606
|
+
'x-user-key': string;
|
2607
|
+
};
|
2608
|
+
path?: never;
|
2609
|
+
query?: never;
|
2610
|
+
url: '/users/me';
|
2611
|
+
};
|
2612
|
+
|
2613
|
+
export declare type UpdateUserError = UpdateUserErrors[keyof UpdateUserErrors];
|
2614
|
+
|
2615
|
+
export declare type UpdateUserErrors = {
|
2616
|
+
/**
|
2617
|
+
* Returns a [User](#schema_user)
|
2618
|
+
*/
|
2619
|
+
default: {
|
2620
|
+
user: User;
|
2621
|
+
};
|
2622
|
+
};
|
2623
|
+
|
2624
|
+
export declare type UpdateUserResponse = UpdateUserResponses[keyof UpdateUserResponses];
|
2625
|
+
|
2626
|
+
export declare type UpdateUserResponses = {
|
2627
|
+
/**
|
2628
|
+
* Returns a [User](#schema_user)
|
2629
|
+
*/
|
2630
|
+
200: {
|
2631
|
+
user: User;
|
2632
|
+
};
|
2633
|
+
};
|
2634
|
+
|
2635
|
+
/**
|
2636
|
+
* The user object represents someone interacting with the bot within a specific integration. The same person interacting with a bot in slack and messenger will be represented with two different users.
|
2637
|
+
*/
|
2638
|
+
export declare type User = {
|
2639
|
+
/**
|
2640
|
+
* Name of the [User](#schema_user)
|
2641
|
+
*/
|
2642
|
+
name?: string;
|
2643
|
+
/**
|
2644
|
+
* Picture url of the [User](#schema_user)
|
2645
|
+
*/
|
2646
|
+
pictureUrl?: string;
|
2647
|
+
/**
|
2648
|
+
* User data
|
2649
|
+
*/
|
2650
|
+
data?: {};
|
2651
|
+
/**
|
2652
|
+
* Id of the [User](#schema_user)
|
2653
|
+
*/
|
2654
|
+
id: string;
|
2655
|
+
/**
|
2656
|
+
* Creation date of the [User](#schema_user) in ISO 8601 format
|
2657
|
+
*/
|
2658
|
+
createdAt: string;
|
2659
|
+
/**
|
2660
|
+
* Updating date of the [User](#schema_user) in ISO 8601 format
|
2661
|
+
*/
|
2662
|
+
updatedAt: string;
|
2663
|
+
};
|
2664
|
+
|
2665
|
+
declare type UserIdParam = {
|
2666
|
+
userId: string;
|
2667
|
+
};
|
2668
|
+
|
2669
|
+
declare type WebchatConfig = {
|
2670
|
+
type: 'webchat_config';
|
2671
|
+
data: {
|
2672
|
+
config: {
|
2673
|
+
[k: string]: any;
|
2674
|
+
};
|
2675
|
+
};
|
2676
|
+
};
|
2677
|
+
|
2678
|
+
declare type WebchatVisibility = {
|
2679
|
+
type: 'webchat_visibility';
|
2680
|
+
data: {
|
2681
|
+
visibility: 'show' | 'hide' | 'toggle';
|
2682
|
+
};
|
2683
|
+
};
|
2684
|
+
|
2685
|
+
export { }
|