@holocronlab/botruntime-chat 0.5.5
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/LICENSE +8 -0
- package/README.md +64 -0
- package/dist/client.d.ts +363 -0
- package/dist/consts.d.ts +1 -0
- package/dist/errors.d.ts +20 -0
- package/dist/event-emitter.d.ts +10 -0
- package/dist/eventsource.d.ts +32 -0
- package/dist/gen/client/errors.d.ts +229 -0
- package/dist/gen/client/index.d.ts +77 -0
- package/dist/gen/client/models.d.ts +212 -0
- package/dist/gen/client/operations/addParticipant.d.ts +55 -0
- package/dist/gen/client/operations/createConversation.d.ts +39 -0
- package/dist/gen/client/operations/createEvent.d.ts +55 -0
- package/dist/gen/client/operations/createMessage.d.ts +294 -0
- package/dist/gen/client/operations/createUser.d.ts +66 -0
- package/dist/gen/client/operations/deleteConversation.d.ts +22 -0
- package/dist/gen/client/operations/deleteMessage.d.ts +22 -0
- package/dist/gen/client/operations/deleteUser.d.ts +21 -0
- package/dist/gen/client/operations/getConversation.d.ts +36 -0
- package/dist/gen/client/operations/getEvent.d.ts +46 -0
- package/dist/gen/client/operations/getMessage.d.ts +167 -0
- package/dist/gen/client/operations/getOrCreateConversation.d.ts +39 -0
- package/dist/gen/client/operations/getOrCreateUser.d.ts +62 -0
- package/dist/gen/client/operations/getParticipant.d.ts +52 -0
- package/dist/gen/client/operations/getUser.d.ts +50 -0
- package/dist/gen/client/operations/listConversations.d.ts +42 -0
- package/dist/gen/client/operations/listMessages.d.ts +171 -0
- package/dist/gen/client/operations/listParticipants.d.ts +55 -0
- package/dist/gen/client/operations/listenConversation.d.ts +22 -0
- package/dist/gen/client/operations/removeParticipant.d.ts +23 -0
- package/dist/gen/client/operations/updateUser.d.ts +62 -0
- package/dist/gen/client/to-axios.d.ts +16 -0
- package/dist/gen/signals/eventCreated.j.d.ts +3 -0
- package/dist/gen/signals/eventCreated.t.d.ts +28 -0
- package/dist/gen/signals/eventCreated.z.d.ts +47 -0
- package/dist/gen/signals/index.d.ts +924 -0
- package/dist/gen/signals/messageCreated.j.d.ts +3 -0
- package/dist/gen/signals/messageCreated.t.d.ts +149 -0
- package/dist/gen/signals/messageCreated.z.d.ts +780 -0
- package/dist/gen/signals/messageDeleted.j.d.ts +3 -0
- package/dist/gen/signals/messageDeleted.t.d.ts +8 -0
- package/dist/gen/signals/messageDeleted.z.d.ts +32 -0
- package/dist/gen/signals/participantAdded.j.d.ts +3 -0
- package/dist/gen/signals/participantAdded.t.d.ts +7 -0
- package/dist/gen/signals/participantAdded.z.d.ts +27 -0
- package/dist/gen/signals/participantRemoved.j.d.ts +3 -0
- package/dist/gen/signals/participantRemoved.t.d.ts +7 -0
- package/dist/gen/signals/participantRemoved.z.d.ts +27 -0
- package/dist/index.cjs +1660 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +138836 -0
- package/dist/index.mjs.map +7 -0
- package/dist/jsonwebtoken.d.ts +3 -0
- package/dist/listing.d.ts +16 -0
- package/dist/signal-listener.d.ts +51 -0
- package/dist/types.d.ts +41 -0
- package/dist/watchdog.d.ts +11 -0
- package/package.json +35 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
declare const codes: {
|
|
2
|
+
readonly HTTP_STATUS_BAD_REQUEST: 400;
|
|
3
|
+
readonly HTTP_STATUS_UNAUTHORIZED: 401;
|
|
4
|
+
readonly HTTP_STATUS_PAYMENT_REQUIRED: 402;
|
|
5
|
+
readonly HTTP_STATUS_FORBIDDEN: 403;
|
|
6
|
+
readonly HTTP_STATUS_NOT_FOUND: 404;
|
|
7
|
+
readonly HTTP_STATUS_METHOD_NOT_ALLOWED: 405;
|
|
8
|
+
readonly HTTP_STATUS_REQUEST_TIMEOUT: 408;
|
|
9
|
+
readonly HTTP_STATUS_CONFLICT: 409;
|
|
10
|
+
readonly HTTP_STATUS_GONE: 410;
|
|
11
|
+
readonly HTTP_STATUS_PAYLOAD_TOO_LARGE: 413;
|
|
12
|
+
readonly HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: 415;
|
|
13
|
+
readonly HTTP_STATUS_DEPENDENCY_FAILED: 424;
|
|
14
|
+
readonly HTTP_STATUS_TOO_MANY_REQUESTS: 429;
|
|
15
|
+
readonly HTTP_STATUS_INTERNAL_SERVER_ERROR: 500;
|
|
16
|
+
readonly HTTP_STATUS_NOT_IMPLEMENTED: 501;
|
|
17
|
+
readonly HTTP_STATUS_BAD_GATEWAY: 502;
|
|
18
|
+
readonly HTTP_STATUS_SERVICE_UNAVAILABLE: 503;
|
|
19
|
+
readonly HTTP_STATUS_GATEWAY_TIMEOUT: 504;
|
|
20
|
+
};
|
|
21
|
+
type ErrorCode = typeof codes[keyof typeof codes];
|
|
22
|
+
declare abstract class BaseApiError<Code extends ErrorCode, Type extends string, Description extends string> extends Error {
|
|
23
|
+
readonly code: Code;
|
|
24
|
+
readonly description: Description;
|
|
25
|
+
readonly type: Type;
|
|
26
|
+
readonly message: string;
|
|
27
|
+
readonly error?: Error | undefined;
|
|
28
|
+
readonly id?: string | undefined;
|
|
29
|
+
readonly metadata?: Record<string, unknown> | undefined;
|
|
30
|
+
readonly isApiError = true;
|
|
31
|
+
constructor(code: Code, description: Description, type: Type, message: string, error?: Error | undefined, id?: string | undefined, metadata?: Record<string, unknown> | undefined);
|
|
32
|
+
format(): string;
|
|
33
|
+
toJSON(): {
|
|
34
|
+
id: string | undefined;
|
|
35
|
+
code: Code;
|
|
36
|
+
type: Type;
|
|
37
|
+
message: string;
|
|
38
|
+
metadata: Record<string, unknown> | undefined;
|
|
39
|
+
};
|
|
40
|
+
static generateId(): string;
|
|
41
|
+
private static getPrefix;
|
|
42
|
+
}
|
|
43
|
+
export declare const isApiError: (thrown: unknown) => thrown is ApiError;
|
|
44
|
+
type UnknownType = 'Unknown';
|
|
45
|
+
/**
|
|
46
|
+
* An unknown error occurred
|
|
47
|
+
*/
|
|
48
|
+
export declare class UnknownError extends BaseApiError<500, UnknownType, 'An unknown error occurred'> {
|
|
49
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
50
|
+
}
|
|
51
|
+
type InternalType = 'Internal';
|
|
52
|
+
/**
|
|
53
|
+
* An internal error occurred
|
|
54
|
+
*/
|
|
55
|
+
export declare class InternalError extends BaseApiError<500, InternalType, 'An internal error occurred'> {
|
|
56
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
57
|
+
}
|
|
58
|
+
type UnauthorizedType = 'Unauthorized';
|
|
59
|
+
/**
|
|
60
|
+
* The request requires to be authenticated.
|
|
61
|
+
*/
|
|
62
|
+
export declare class UnauthorizedError extends BaseApiError<401, UnauthorizedType, 'The request requires to be authenticated.'> {
|
|
63
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
64
|
+
}
|
|
65
|
+
type ForbiddenType = 'Forbidden';
|
|
66
|
+
/**
|
|
67
|
+
* The requested action can\'t be peform by this resource.
|
|
68
|
+
*/
|
|
69
|
+
export declare class ForbiddenError extends BaseApiError<403, ForbiddenType, 'The requested action can\'t be peform by this resource.'> {
|
|
70
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
71
|
+
}
|
|
72
|
+
type PayloadTooLargeType = 'PayloadTooLarge';
|
|
73
|
+
/**
|
|
74
|
+
* The request payload is too large.
|
|
75
|
+
*/
|
|
76
|
+
export declare class PayloadTooLargeError extends BaseApiError<413, PayloadTooLargeType, 'The request payload is too large.'> {
|
|
77
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
78
|
+
}
|
|
79
|
+
type InvalidPayloadType = 'InvalidPayload';
|
|
80
|
+
/**
|
|
81
|
+
* The request payload is invalid.
|
|
82
|
+
*/
|
|
83
|
+
export declare class InvalidPayloadError extends BaseApiError<400, InvalidPayloadType, 'The request payload is invalid.'> {
|
|
84
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
85
|
+
}
|
|
86
|
+
type UnsupportedMediaTypeType = 'UnsupportedMediaType';
|
|
87
|
+
/**
|
|
88
|
+
* The request is invalid because the content-type is not supported.
|
|
89
|
+
*/
|
|
90
|
+
export declare class UnsupportedMediaTypeError extends BaseApiError<415, UnsupportedMediaTypeType, 'The request is invalid because the content-type is not supported.'> {
|
|
91
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
92
|
+
}
|
|
93
|
+
type MethodNotFoundType = 'MethodNotFound';
|
|
94
|
+
/**
|
|
95
|
+
* The requested method does not exist.
|
|
96
|
+
*/
|
|
97
|
+
export declare class MethodNotFoundError extends BaseApiError<405, MethodNotFoundType, 'The requested method does not exist.'> {
|
|
98
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
99
|
+
}
|
|
100
|
+
type ResourceNotFoundType = 'ResourceNotFound';
|
|
101
|
+
/**
|
|
102
|
+
* The requested resource does not exist.
|
|
103
|
+
*/
|
|
104
|
+
export declare class ResourceNotFoundError extends BaseApiError<404, ResourceNotFoundType, 'The requested resource does not exist.'> {
|
|
105
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
106
|
+
}
|
|
107
|
+
type InvalidJsonSchemaType = 'InvalidJsonSchema';
|
|
108
|
+
/**
|
|
109
|
+
* The provided JSON schema is invalid.
|
|
110
|
+
*/
|
|
111
|
+
export declare class InvalidJsonSchemaError extends BaseApiError<400, InvalidJsonSchemaType, 'The provided JSON schema is invalid.'> {
|
|
112
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
113
|
+
}
|
|
114
|
+
type InvalidDataFormatType = 'InvalidDataFormat';
|
|
115
|
+
/**
|
|
116
|
+
* The provided data doesn\'t respect the provided JSON schema.
|
|
117
|
+
*/
|
|
118
|
+
export declare class InvalidDataFormatError extends BaseApiError<400, InvalidDataFormatType, 'The provided data doesn\'t respect the provided JSON schema.'> {
|
|
119
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
120
|
+
}
|
|
121
|
+
type InvalidIdentifierType = 'InvalidIdentifier';
|
|
122
|
+
/**
|
|
123
|
+
* The provided identifier is not valid. An identifier must start with a lowercase letter, be between 2 and 100 characters long and use only alphanumeric characters.
|
|
124
|
+
*/
|
|
125
|
+
export declare class InvalidIdentifierError extends BaseApiError<400, InvalidIdentifierType, 'The provided identifier is not valid. An identifier must start with a lowercase letter, be between 2 and 100 characters long and use only alphanumeric characters.'> {
|
|
126
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
127
|
+
}
|
|
128
|
+
type RelationConflictType = 'RelationConflict';
|
|
129
|
+
/**
|
|
130
|
+
* The resource is related with a different resource that the one referenced in the request. This is usually caused when providing two resource identifiers that aren\'t linked together.
|
|
131
|
+
*/
|
|
132
|
+
export declare class RelationConflictError extends BaseApiError<409, RelationConflictType, 'The resource is related with a different resource that the one referenced in the request. This is usually caused when providing two resource identifiers that aren\'t linked together.'> {
|
|
133
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
134
|
+
}
|
|
135
|
+
type ReferenceConstraintType = 'ReferenceConstraint';
|
|
136
|
+
/**
|
|
137
|
+
* The resource cannot be deleted because it\'s referenced by another resource
|
|
138
|
+
*/
|
|
139
|
+
export declare class ReferenceConstraintError extends BaseApiError<409, ReferenceConstraintType, 'The resource cannot be deleted because it\'s referenced by another resource'> {
|
|
140
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
141
|
+
}
|
|
142
|
+
type ResourceLockedConflictType = 'ResourceLockedConflict';
|
|
143
|
+
/**
|
|
144
|
+
* The resource is current locked and cannot be operated on until the lock is released.
|
|
145
|
+
*/
|
|
146
|
+
export declare class ResourceLockedConflictError extends BaseApiError<409, ResourceLockedConflictType, 'The resource is current locked and cannot be operated on until the lock is released.'> {
|
|
147
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
148
|
+
}
|
|
149
|
+
type ResourceGoneType = 'ResourceGone';
|
|
150
|
+
/**
|
|
151
|
+
* The requested resource is no longer available.
|
|
152
|
+
*/
|
|
153
|
+
export declare class ResourceGoneError extends BaseApiError<410, ResourceGoneType, 'The requested resource is no longer available.'> {
|
|
154
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
155
|
+
}
|
|
156
|
+
type ReferenceNotFoundType = 'ReferenceNotFound';
|
|
157
|
+
/**
|
|
158
|
+
* The provided resource reference is missing. This is usually caused when providing an invalid id inside the payload of a request.
|
|
159
|
+
*/
|
|
160
|
+
export declare class ReferenceNotFoundError extends BaseApiError<400, ReferenceNotFoundType, 'The provided resource reference is missing. This is usually caused when providing an invalid id inside the payload of a request.'> {
|
|
161
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
162
|
+
}
|
|
163
|
+
type InvalidQueryType = 'InvalidQuery';
|
|
164
|
+
/**
|
|
165
|
+
* The provided query is invalid. This is usually caused when providing an invalid parameter for querying a resource.
|
|
166
|
+
*/
|
|
167
|
+
export declare class InvalidQueryError extends BaseApiError<400, InvalidQueryType, 'The provided query is invalid. This is usually caused when providing an invalid parameter for querying a resource.'> {
|
|
168
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
169
|
+
}
|
|
170
|
+
type RuntimeType = 'Runtime';
|
|
171
|
+
/**
|
|
172
|
+
* An error happened during the execution of a runtime (bot or integration).
|
|
173
|
+
*/
|
|
174
|
+
export declare class RuntimeError extends BaseApiError<400, RuntimeType, 'An error happened during the execution of a runtime (bot or integration).'> {
|
|
175
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
176
|
+
}
|
|
177
|
+
type AlreadyExistsType = 'AlreadyExists';
|
|
178
|
+
/**
|
|
179
|
+
* The record attempted to be created already exists.
|
|
180
|
+
*/
|
|
181
|
+
export declare class AlreadyExistsError extends BaseApiError<409, AlreadyExistsType, 'The record attempted to be created already exists.'> {
|
|
182
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
183
|
+
}
|
|
184
|
+
type RateLimitedType = 'RateLimited';
|
|
185
|
+
/**
|
|
186
|
+
* The request has been rate limited.
|
|
187
|
+
*/
|
|
188
|
+
export declare class RateLimitedError extends BaseApiError<429, RateLimitedType, 'The request has been rate limited.'> {
|
|
189
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
190
|
+
}
|
|
191
|
+
type PaymentRequiredType = 'PaymentRequired';
|
|
192
|
+
/**
|
|
193
|
+
* A payment is required to perform this request.
|
|
194
|
+
*/
|
|
195
|
+
export declare class PaymentRequiredError extends BaseApiError<402, PaymentRequiredType, 'A payment is required to perform this request.'> {
|
|
196
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
197
|
+
}
|
|
198
|
+
type QuotaExceededType = 'QuotaExceeded';
|
|
199
|
+
/**
|
|
200
|
+
* The request exceeds the allowed quota. Quotas are a soft limit that can be increased.
|
|
201
|
+
*/
|
|
202
|
+
export declare class QuotaExceededError extends BaseApiError<403, QuotaExceededType, 'The request exceeds the allowed quota. Quotas are a soft limit that can be increased.'> {
|
|
203
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
204
|
+
}
|
|
205
|
+
type LimitExceededType = 'LimitExceeded';
|
|
206
|
+
/**
|
|
207
|
+
* The request exceeds the allowed limit. Limits are a hard limit that cannot be increased.
|
|
208
|
+
*/
|
|
209
|
+
export declare class LimitExceededError extends BaseApiError<413, LimitExceededType, 'The request exceeds the allowed limit. Limits are a hard limit that cannot be increased.'> {
|
|
210
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
211
|
+
}
|
|
212
|
+
type BreakingChangesType = 'BreakingChanges';
|
|
213
|
+
/**
|
|
214
|
+
* Request payload contains breaking changes which is not allowed for this resource without a version increment.
|
|
215
|
+
*/
|
|
216
|
+
export declare class BreakingChangesError extends BaseApiError<400, BreakingChangesType, 'Request payload contains breaking changes which is not allowed for this resource without a version increment.'> {
|
|
217
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
218
|
+
}
|
|
219
|
+
type OperationTimeoutType = 'OperationTimeout';
|
|
220
|
+
/**
|
|
221
|
+
* The operation timed out.
|
|
222
|
+
*/
|
|
223
|
+
export declare class OperationTimeoutError extends BaseApiError<504, OperationTimeoutType, 'The operation timed out.'> {
|
|
224
|
+
constructor(message: string, error?: Error, id?: string, metadata?: Record<string, unknown>);
|
|
225
|
+
}
|
|
226
|
+
export type ErrorType = 'Unknown' | 'Internal' | 'Unauthorized' | 'Forbidden' | 'PayloadTooLarge' | 'InvalidPayload' | 'UnsupportedMediaType' | 'MethodNotFound' | 'ResourceNotFound' | 'InvalidJsonSchema' | 'InvalidDataFormat' | 'InvalidIdentifier' | 'RelationConflict' | 'ReferenceConstraint' | 'ResourceLockedConflict' | 'ResourceGone' | 'ReferenceNotFound' | 'InvalidQuery' | 'Runtime' | 'AlreadyExists' | 'RateLimited' | 'PaymentRequired' | 'QuotaExceeded' | 'LimitExceeded' | 'BreakingChanges' | 'OperationTimeout';
|
|
227
|
+
export type ApiError = UnknownError | InternalError | UnauthorizedError | ForbiddenError | PayloadTooLargeError | InvalidPayloadError | UnsupportedMediaTypeError | MethodNotFoundError | ResourceNotFoundError | InvalidJsonSchemaError | InvalidDataFormatError | InvalidIdentifierError | RelationConflictError | ReferenceConstraintError | ResourceLockedConflictError | ResourceGoneError | ReferenceNotFoundError | InvalidQueryError | RuntimeError | AlreadyExistsError | RateLimitedError | PaymentRequiredError | QuotaExceededError | LimitExceededError | BreakingChangesError | OperationTimeoutError;
|
|
228
|
+
export declare const errorFrom: (err: unknown) => ApiError;
|
|
229
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { toAxiosRequest } from './to-axios';
|
|
3
|
+
import * as getConversation from './operations/getConversation';
|
|
4
|
+
import * as createConversation from './operations/createConversation';
|
|
5
|
+
import * as getOrCreateConversation from './operations/getOrCreateConversation';
|
|
6
|
+
import * as deleteConversation from './operations/deleteConversation';
|
|
7
|
+
import * as listConversations from './operations/listConversations';
|
|
8
|
+
import * as listenConversation from './operations/listenConversation';
|
|
9
|
+
import * as listMessages from './operations/listMessages';
|
|
10
|
+
import * as addParticipant from './operations/addParticipant';
|
|
11
|
+
import * as removeParticipant from './operations/removeParticipant';
|
|
12
|
+
import * as getParticipant from './operations/getParticipant';
|
|
13
|
+
import * as listParticipants from './operations/listParticipants';
|
|
14
|
+
import * as getMessage from './operations/getMessage';
|
|
15
|
+
import * as createMessage from './operations/createMessage';
|
|
16
|
+
import * as deleteMessage from './operations/deleteMessage';
|
|
17
|
+
import * as getUser from './operations/getUser';
|
|
18
|
+
import * as createUser from './operations/createUser';
|
|
19
|
+
import * as getOrCreateUser from './operations/getOrCreateUser';
|
|
20
|
+
import * as updateUser from './operations/updateUser';
|
|
21
|
+
import * as deleteUser from './operations/deleteUser';
|
|
22
|
+
import * as getEvent from './operations/getEvent';
|
|
23
|
+
import * as createEvent from './operations/createEvent';
|
|
24
|
+
export * from './models';
|
|
25
|
+
export * as getConversation from './operations/getConversation';
|
|
26
|
+
export * as createConversation from './operations/createConversation';
|
|
27
|
+
export * as getOrCreateConversation from './operations/getOrCreateConversation';
|
|
28
|
+
export * as deleteConversation from './operations/deleteConversation';
|
|
29
|
+
export * as listConversations from './operations/listConversations';
|
|
30
|
+
export * as listenConversation from './operations/listenConversation';
|
|
31
|
+
export * as listMessages from './operations/listMessages';
|
|
32
|
+
export * as addParticipant from './operations/addParticipant';
|
|
33
|
+
export * as removeParticipant from './operations/removeParticipant';
|
|
34
|
+
export * as getParticipant from './operations/getParticipant';
|
|
35
|
+
export * as listParticipants from './operations/listParticipants';
|
|
36
|
+
export * as getMessage from './operations/getMessage';
|
|
37
|
+
export * as createMessage from './operations/createMessage';
|
|
38
|
+
export * as deleteMessage from './operations/deleteMessage';
|
|
39
|
+
export * as getUser from './operations/getUser';
|
|
40
|
+
export * as createUser from './operations/createUser';
|
|
41
|
+
export * as getOrCreateUser from './operations/getOrCreateUser';
|
|
42
|
+
export * as updateUser from './operations/updateUser';
|
|
43
|
+
export * as deleteUser from './operations/deleteUser';
|
|
44
|
+
export * as getEvent from './operations/getEvent';
|
|
45
|
+
export * as createEvent from './operations/createEvent';
|
|
46
|
+
export declare const apiVersion = "0.7.6";
|
|
47
|
+
export type ClientProps = {
|
|
48
|
+
toAxiosRequest: typeof toAxiosRequest;
|
|
49
|
+
toApiError: typeof toApiError;
|
|
50
|
+
};
|
|
51
|
+
export declare class Client {
|
|
52
|
+
private axiosInstance;
|
|
53
|
+
private props;
|
|
54
|
+
constructor(axiosInstance: AxiosInstance, props?: Partial<ClientProps>);
|
|
55
|
+
readonly getConversation: (input: getConversation.GetConversationInput) => Promise<getConversation.GetConversationResponse>;
|
|
56
|
+
readonly createConversation: (input: createConversation.CreateConversationInput) => Promise<createConversation.CreateConversationResponse>;
|
|
57
|
+
readonly getOrCreateConversation: (input: getOrCreateConversation.GetOrCreateConversationInput) => Promise<getOrCreateConversation.GetOrCreateConversationResponse>;
|
|
58
|
+
readonly deleteConversation: (input: deleteConversation.DeleteConversationInput) => Promise<deleteConversation.DeleteConversationResponse>;
|
|
59
|
+
readonly listConversations: (input: listConversations.ListConversationsInput) => Promise<listConversations.ListConversationsResponse>;
|
|
60
|
+
readonly listenConversation: (input: listenConversation.ListenConversationInput) => Promise<listenConversation.ListenConversationResponse>;
|
|
61
|
+
readonly listMessages: (input: listMessages.ListMessagesInput) => Promise<listMessages.ListMessagesResponse>;
|
|
62
|
+
readonly addParticipant: (input: addParticipant.AddParticipantInput) => Promise<addParticipant.AddParticipantResponse>;
|
|
63
|
+
readonly removeParticipant: (input: removeParticipant.RemoveParticipantInput) => Promise<removeParticipant.RemoveParticipantResponse>;
|
|
64
|
+
readonly getParticipant: (input: getParticipant.GetParticipantInput) => Promise<getParticipant.GetParticipantResponse>;
|
|
65
|
+
readonly listParticipants: (input: listParticipants.ListParticipantsInput) => Promise<listParticipants.ListParticipantsResponse>;
|
|
66
|
+
readonly getMessage: (input: getMessage.GetMessageInput) => Promise<getMessage.GetMessageResponse>;
|
|
67
|
+
readonly createMessage: (input: createMessage.CreateMessageInput) => Promise<createMessage.CreateMessageResponse>;
|
|
68
|
+
readonly deleteMessage: (input: deleteMessage.DeleteMessageInput) => Promise<deleteMessage.DeleteMessageResponse>;
|
|
69
|
+
readonly getUser: (input: getUser.GetUserInput) => Promise<getUser.GetUserResponse>;
|
|
70
|
+
readonly createUser: (input: createUser.CreateUserInput) => Promise<createUser.CreateUserResponse>;
|
|
71
|
+
readonly getOrCreateUser: (input: getOrCreateUser.GetOrCreateUserInput) => Promise<getOrCreateUser.GetOrCreateUserResponse>;
|
|
72
|
+
readonly updateUser: (input: updateUser.UpdateUserInput) => Promise<updateUser.UpdateUserResponse>;
|
|
73
|
+
readonly deleteUser: (input: deleteUser.DeleteUserInput) => Promise<deleteUser.DeleteUserResponse>;
|
|
74
|
+
readonly getEvent: (input: getEvent.GetEventInput) => Promise<getEvent.GetEventResponse>;
|
|
75
|
+
readonly createEvent: (input: createEvent.CreateEventInput) => Promise<createEvent.CreateEventResponse>;
|
|
76
|
+
}
|
|
77
|
+
declare function toApiError(err: unknown): Error;
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 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.
|
|
3
|
+
*/
|
|
4
|
+
export interface User {
|
|
5
|
+
/**
|
|
6
|
+
* Identifier of the [User](#schema_user)
|
|
7
|
+
*/
|
|
8
|
+
id: string;
|
|
9
|
+
/**
|
|
10
|
+
* Name of the [User](#schema_user)
|
|
11
|
+
*/
|
|
12
|
+
name?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Picture url of the [User](#schema_user)
|
|
15
|
+
*/
|
|
16
|
+
pictureUrl?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Custom profile data of the [User](#schema_user) encoded as a string
|
|
19
|
+
*/
|
|
20
|
+
profile?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Creation date of the [User](#schema_user) in ISO 8601 format
|
|
23
|
+
*/
|
|
24
|
+
createdAt: string;
|
|
25
|
+
/**
|
|
26
|
+
* Updating date of the [User](#schema_user) in ISO 8601 format
|
|
27
|
+
*/
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
}
|
|
30
|
+
export interface Conversation {
|
|
31
|
+
/**
|
|
32
|
+
* Identifier of the [Conversation](#schema_conversation)
|
|
33
|
+
*/
|
|
34
|
+
id: string;
|
|
35
|
+
/**
|
|
36
|
+
* Creation date of the [Conversation](#schema_conversation) in ISO 8601 format
|
|
37
|
+
*/
|
|
38
|
+
createdAt: string;
|
|
39
|
+
/**
|
|
40
|
+
* Updating date of the [Conversation](#schema_conversation) in ISO 8601 format
|
|
41
|
+
*/
|
|
42
|
+
updatedAt: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The Message object represents a message in a [Conversation](#schema_conversation) for a specific [User](#schema_user).
|
|
46
|
+
*/
|
|
47
|
+
export interface Message {
|
|
48
|
+
/**
|
|
49
|
+
* Identifier of the [Message](#schema_message)
|
|
50
|
+
*/
|
|
51
|
+
id: string;
|
|
52
|
+
/**
|
|
53
|
+
* Creation date of the [Message](#schema_message) in ISO 8601 format
|
|
54
|
+
*/
|
|
55
|
+
createdAt: string;
|
|
56
|
+
/**
|
|
57
|
+
* Payload is the content type of the message.
|
|
58
|
+
*/
|
|
59
|
+
payload: {
|
|
60
|
+
type: "audio";
|
|
61
|
+
audioUrl: string;
|
|
62
|
+
[k: string]: any;
|
|
63
|
+
} | {
|
|
64
|
+
type: "card";
|
|
65
|
+
title: string;
|
|
66
|
+
subtitle?: string;
|
|
67
|
+
imageUrl?: string;
|
|
68
|
+
actions: {
|
|
69
|
+
action: "postback" | "url" | "say";
|
|
70
|
+
label: string;
|
|
71
|
+
value: string;
|
|
72
|
+
[k: string]: any;
|
|
73
|
+
}[];
|
|
74
|
+
[k: string]: any;
|
|
75
|
+
} | {
|
|
76
|
+
type: "carousel";
|
|
77
|
+
items: {
|
|
78
|
+
type: "card";
|
|
79
|
+
title: string;
|
|
80
|
+
subtitle?: string;
|
|
81
|
+
imageUrl?: string;
|
|
82
|
+
actions: {
|
|
83
|
+
action: "postback" | "url" | "say";
|
|
84
|
+
label: string;
|
|
85
|
+
value: string;
|
|
86
|
+
[k: string]: any;
|
|
87
|
+
}[];
|
|
88
|
+
[k: string]: any;
|
|
89
|
+
}[];
|
|
90
|
+
[k: string]: any;
|
|
91
|
+
} | {
|
|
92
|
+
text: string;
|
|
93
|
+
options: {
|
|
94
|
+
label: string;
|
|
95
|
+
value: string;
|
|
96
|
+
[k: string]: any;
|
|
97
|
+
}[];
|
|
98
|
+
type: "choice";
|
|
99
|
+
[k: string]: any;
|
|
100
|
+
} | {
|
|
101
|
+
text: string;
|
|
102
|
+
options: {
|
|
103
|
+
label: string;
|
|
104
|
+
value: string;
|
|
105
|
+
[k: string]: any;
|
|
106
|
+
}[];
|
|
107
|
+
type: "dropdown";
|
|
108
|
+
[k: string]: any;
|
|
109
|
+
} | {
|
|
110
|
+
type: "file";
|
|
111
|
+
fileUrl: string;
|
|
112
|
+
title?: string;
|
|
113
|
+
[k: string]: any;
|
|
114
|
+
} | {
|
|
115
|
+
type: "image";
|
|
116
|
+
imageUrl: string;
|
|
117
|
+
[k: string]: any;
|
|
118
|
+
} | {
|
|
119
|
+
type: "location";
|
|
120
|
+
latitude: number;
|
|
121
|
+
longitude: number;
|
|
122
|
+
address?: string;
|
|
123
|
+
title?: string;
|
|
124
|
+
[k: string]: any;
|
|
125
|
+
} | {
|
|
126
|
+
type: "text";
|
|
127
|
+
text: string;
|
|
128
|
+
[k: string]: any;
|
|
129
|
+
} | {
|
|
130
|
+
type: "video";
|
|
131
|
+
videoUrl: string;
|
|
132
|
+
[k: string]: any;
|
|
133
|
+
} | {
|
|
134
|
+
type: "markdown";
|
|
135
|
+
markdown: string;
|
|
136
|
+
[k: string]: any;
|
|
137
|
+
} | {
|
|
138
|
+
type: "bloc";
|
|
139
|
+
items: ({
|
|
140
|
+
type: "text";
|
|
141
|
+
text: string;
|
|
142
|
+
[k: string]: any;
|
|
143
|
+
} | {
|
|
144
|
+
type: "markdown";
|
|
145
|
+
markdown: string;
|
|
146
|
+
[k: string]: any;
|
|
147
|
+
} | {
|
|
148
|
+
type: "image";
|
|
149
|
+
imageUrl: string;
|
|
150
|
+
[k: string]: any;
|
|
151
|
+
} | {
|
|
152
|
+
type: "audio";
|
|
153
|
+
audioUrl: string;
|
|
154
|
+
[k: string]: any;
|
|
155
|
+
} | {
|
|
156
|
+
type: "video";
|
|
157
|
+
videoUrl: string;
|
|
158
|
+
[k: string]: any;
|
|
159
|
+
} | {
|
|
160
|
+
type: "file";
|
|
161
|
+
fileUrl: string;
|
|
162
|
+
title?: string;
|
|
163
|
+
[k: string]: any;
|
|
164
|
+
} | {
|
|
165
|
+
type: "location";
|
|
166
|
+
latitude: number;
|
|
167
|
+
longitude: number;
|
|
168
|
+
address?: string;
|
|
169
|
+
title?: string;
|
|
170
|
+
[k: string]: any;
|
|
171
|
+
})[];
|
|
172
|
+
[k: string]: any;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* ID of the [User](#schema_user)
|
|
176
|
+
*/
|
|
177
|
+
userId: string;
|
|
178
|
+
/**
|
|
179
|
+
* ID of the [Conversation](#schema_conversation)
|
|
180
|
+
*/
|
|
181
|
+
conversationId: string;
|
|
182
|
+
/**
|
|
183
|
+
* Metadata of the message
|
|
184
|
+
*/
|
|
185
|
+
metadata?: {
|
|
186
|
+
[k: string]: any;
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
export interface Event {
|
|
190
|
+
/**
|
|
191
|
+
* ID of the custom [Event](#schema_event).
|
|
192
|
+
*/
|
|
193
|
+
id: string;
|
|
194
|
+
/**
|
|
195
|
+
* Creation date of the custom [Event](#schema_event) in ISO 8601 format
|
|
196
|
+
*/
|
|
197
|
+
createdAt: string;
|
|
198
|
+
/**
|
|
199
|
+
* Payload is the content of the custom event.
|
|
200
|
+
*/
|
|
201
|
+
payload: {
|
|
202
|
+
[k: string]: any;
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* ID of the [Conversation](#schema_conversation).
|
|
206
|
+
*/
|
|
207
|
+
conversationId: string;
|
|
208
|
+
/**
|
|
209
|
+
* ID of the [User](#schema_user).
|
|
210
|
+
*/
|
|
211
|
+
userId: string;
|
|
212
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface AddParticipantRequestHeaders {
|
|
2
|
+
"x-user-key": string;
|
|
3
|
+
}
|
|
4
|
+
export interface AddParticipantRequestQuery {
|
|
5
|
+
}
|
|
6
|
+
export interface AddParticipantRequestParams {
|
|
7
|
+
conversationId: string;
|
|
8
|
+
}
|
|
9
|
+
export interface AddParticipantRequestBody {
|
|
10
|
+
/**
|
|
11
|
+
* User id
|
|
12
|
+
*/
|
|
13
|
+
userId: string;
|
|
14
|
+
}
|
|
15
|
+
export type AddParticipantInput = AddParticipantRequestBody & AddParticipantRequestHeaders & AddParticipantRequestQuery & AddParticipantRequestParams;
|
|
16
|
+
export type AddParticipantRequest = {
|
|
17
|
+
headers: AddParticipantRequestHeaders;
|
|
18
|
+
query: AddParticipantRequestQuery;
|
|
19
|
+
params: AddParticipantRequestParams;
|
|
20
|
+
body: AddParticipantRequestBody;
|
|
21
|
+
};
|
|
22
|
+
export declare const parseReq: (input: AddParticipantInput) => AddParticipantRequest & {
|
|
23
|
+
path: string;
|
|
24
|
+
};
|
|
25
|
+
export interface AddParticipantResponse {
|
|
26
|
+
/**
|
|
27
|
+
* 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.
|
|
28
|
+
*/
|
|
29
|
+
participant: {
|
|
30
|
+
/**
|
|
31
|
+
* Identifier of the [User](#schema_user)
|
|
32
|
+
*/
|
|
33
|
+
id: string;
|
|
34
|
+
/**
|
|
35
|
+
* Name of the [User](#schema_user)
|
|
36
|
+
*/
|
|
37
|
+
name?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Picture url of the [User](#schema_user)
|
|
40
|
+
*/
|
|
41
|
+
pictureUrl?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Custom profile data of the [User](#schema_user) encoded as a string
|
|
44
|
+
*/
|
|
45
|
+
profile?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Creation date of the [User](#schema_user) in ISO 8601 format
|
|
48
|
+
*/
|
|
49
|
+
createdAt: string;
|
|
50
|
+
/**
|
|
51
|
+
* Updating date of the [User](#schema_user) in ISO 8601 format
|
|
52
|
+
*/
|
|
53
|
+
updatedAt: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export interface CreateConversationRequestHeaders {
|
|
2
|
+
"x-user-key": string;
|
|
3
|
+
}
|
|
4
|
+
export interface CreateConversationRequestQuery {
|
|
5
|
+
}
|
|
6
|
+
export interface CreateConversationRequestParams {
|
|
7
|
+
}
|
|
8
|
+
export interface CreateConversationRequestBody {
|
|
9
|
+
/**
|
|
10
|
+
* Identifier of the [Conversation](#schema_conversation)
|
|
11
|
+
*/
|
|
12
|
+
id?: string;
|
|
13
|
+
}
|
|
14
|
+
export type CreateConversationInput = CreateConversationRequestBody & CreateConversationRequestHeaders & CreateConversationRequestQuery & CreateConversationRequestParams;
|
|
15
|
+
export type CreateConversationRequest = {
|
|
16
|
+
headers: CreateConversationRequestHeaders;
|
|
17
|
+
query: CreateConversationRequestQuery;
|
|
18
|
+
params: CreateConversationRequestParams;
|
|
19
|
+
body: CreateConversationRequestBody;
|
|
20
|
+
};
|
|
21
|
+
export declare const parseReq: (input: CreateConversationInput) => CreateConversationRequest & {
|
|
22
|
+
path: string;
|
|
23
|
+
};
|
|
24
|
+
export interface CreateConversationResponse {
|
|
25
|
+
conversation: {
|
|
26
|
+
/**
|
|
27
|
+
* Identifier of the [Conversation](#schema_conversation)
|
|
28
|
+
*/
|
|
29
|
+
id: string;
|
|
30
|
+
/**
|
|
31
|
+
* Creation date of the [Conversation](#schema_conversation) in ISO 8601 format
|
|
32
|
+
*/
|
|
33
|
+
createdAt: string;
|
|
34
|
+
/**
|
|
35
|
+
* Updating date of the [Conversation](#schema_conversation) in ISO 8601 format
|
|
36
|
+
*/
|
|
37
|
+
updatedAt: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface CreateEventRequestHeaders {
|
|
2
|
+
"x-user-key": string;
|
|
3
|
+
}
|
|
4
|
+
export interface CreateEventRequestQuery {
|
|
5
|
+
}
|
|
6
|
+
export interface CreateEventRequestParams {
|
|
7
|
+
}
|
|
8
|
+
export interface CreateEventRequestBody {
|
|
9
|
+
/**
|
|
10
|
+
* Payload is the content of the custom event.
|
|
11
|
+
*/
|
|
12
|
+
payload: {
|
|
13
|
+
[k: string]: any;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* ID of the [Conversation](#schema_conversation)
|
|
17
|
+
*/
|
|
18
|
+
conversationId: string;
|
|
19
|
+
}
|
|
20
|
+
export type CreateEventInput = CreateEventRequestBody & CreateEventRequestHeaders & CreateEventRequestQuery & CreateEventRequestParams;
|
|
21
|
+
export type CreateEventRequest = {
|
|
22
|
+
headers: CreateEventRequestHeaders;
|
|
23
|
+
query: CreateEventRequestQuery;
|
|
24
|
+
params: CreateEventRequestParams;
|
|
25
|
+
body: CreateEventRequestBody;
|
|
26
|
+
};
|
|
27
|
+
export declare const parseReq: (input: CreateEventInput) => CreateEventRequest & {
|
|
28
|
+
path: string;
|
|
29
|
+
};
|
|
30
|
+
export interface CreateEventResponse {
|
|
31
|
+
event: {
|
|
32
|
+
/**
|
|
33
|
+
* ID of the custom [Event](#schema_event).
|
|
34
|
+
*/
|
|
35
|
+
id: string;
|
|
36
|
+
/**
|
|
37
|
+
* Creation date of the custom [Event](#schema_event) in ISO 8601 format
|
|
38
|
+
*/
|
|
39
|
+
createdAt: string;
|
|
40
|
+
/**
|
|
41
|
+
* Payload is the content of the custom event.
|
|
42
|
+
*/
|
|
43
|
+
payload: {
|
|
44
|
+
[k: string]: any;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* ID of the [Conversation](#schema_conversation).
|
|
48
|
+
*/
|
|
49
|
+
conversationId: string;
|
|
50
|
+
/**
|
|
51
|
+
* ID of the [User](#schema_user).
|
|
52
|
+
*/
|
|
53
|
+
userId: string;
|
|
54
|
+
};
|
|
55
|
+
}
|