@easbot/gateway-sdk 0.3.29 → 0.3.32

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/dist/index.d.cts CHANGED
@@ -1,123 +1,75 @@
1
1
  type ClientOptions$1 = {
2
- baseUrl: 'http://localhost:8080' | (string & {});
3
- };
4
- type HealthResponse = {
5
- status: string;
6
- timestamp: number;
7
- version: string;
8
- };
9
- type StatusResponse = {
10
- status: string;
11
- connections: number;
12
- sessions: number;
13
- messageSubscriptions: number;
14
- agentSubscriptions: number;
15
- uptime: number;
16
- version: string;
17
- agents?: {
18
- total: number;
19
- healthy: number;
20
- unhealthy: number;
21
- };
22
- channels?: Array<{
23
- id: string;
24
- platform: string;
25
- name: string;
26
- version: string;
27
- }>;
28
- };
29
- type ChannelListResponse = {
30
- channels: Array<{
31
- id: string;
32
- platform: string;
33
- name: string;
34
- version?: string;
35
- }>;
36
- total: number;
37
- };
38
- type ContactListResponse = {
39
- contacts: Array<ContactInfo>;
40
- total: number;
41
- hasMore: boolean;
42
- };
43
- type ContactInfo = {
44
- uid: string;
45
- platform: string;
46
- stableId: string;
47
- profile: {
48
- displayName?: string;
49
- username?: string;
50
- };
51
- lastSeenAt: number;
52
- createdAt: number;
53
- };
54
- type SessionListResponse = {
55
- sessions: Array<SessionInfo>;
56
- total: number;
57
- hasMore: boolean;
58
- };
59
- type SessionInfo = {
60
- id: string;
61
- platform?: string;
62
- channelId?: string;
63
- userId?: string;
64
- chatId?: string;
65
- chatType?: string;
66
- chatTitle?: string;
67
- state: string;
68
- createdAt: number;
69
- lastActiveAt: number;
70
- };
71
- type CreateSessionResponse = {
72
- id: string;
73
- createdAt: number;
74
- };
75
- type SendMessageResponse = {
76
- messageId: string;
77
- sessionId: string;
78
- createdAt: number;
79
- metadata?: {
80
- channel?: string;
81
- channelSource?: string;
82
- channelInfo?: {
83
- platform?: string;
84
- channelId?: string;
85
- chatId?: string;
86
- userId?: string;
87
- };
88
- };
2
+ baseUrl: `${string}://${string}` | (string & {});
89
3
  };
90
- type HealthCheckData = {
4
+ type GatewayHealthData = {
91
5
  body?: never;
92
6
  path?: never;
93
7
  query?: never;
94
8
  url: '/health';
95
9
  };
96
- type HealthCheckResponses = {
97
- 200: HealthResponse;
10
+ type GatewayHealthResponses = {
11
+ 200: {
12
+ status: string;
13
+ timestamp: number;
14
+ version: string;
15
+ };
98
16
  };
99
- type HealthCheckResponse = HealthCheckResponses[keyof HealthCheckResponses];
100
- type GetStatusData = {
17
+ type GatewayHealthResponse = GatewayHealthResponses[keyof GatewayHealthResponses];
18
+ type GatewayStatusData = {
101
19
  body?: never;
102
20
  path?: never;
103
21
  query?: never;
104
22
  url: '/status';
105
23
  };
106
- type GetStatusResponses = {
107
- 200: StatusResponse;
24
+ type GatewayStatusResponses = {
25
+ 200: {
26
+ status: string;
27
+ connections: number;
28
+ sessions: number;
29
+ messageSubscriptions: number;
30
+ agentSubscriptions: number;
31
+ uptime: number;
32
+ version: string;
33
+ agents?: {
34
+ total: number;
35
+ healthy: number;
36
+ unhealthy: number;
37
+ };
38
+ channels?: Array<{
39
+ id: string;
40
+ platform: string;
41
+ name: string;
42
+ version: string;
43
+ }>;
44
+ };
108
45
  };
109
- type GetStatusResponse = GetStatusResponses[keyof GetStatusResponses];
110
- type ListChannelsData = {
46
+ type GatewayStatusResponse = GatewayStatusResponses[keyof GatewayStatusResponses];
47
+ type GatewayChannelsListData = {
111
48
  body?: never;
112
49
  path?: never;
113
50
  query?: never;
114
51
  url: '/channels';
115
52
  };
116
- type ListChannelsResponses = {
117
- 200: ChannelListResponse;
53
+ type GatewayChannelsListErrors = {
54
+ 503: {
55
+ error: string;
56
+ code?: string;
57
+ };
118
58
  };
119
- type ListChannelsResponse = ListChannelsResponses[keyof ListChannelsResponses];
120
- type ListContactsData = {
59
+ type GatewayChannelsListError = GatewayChannelsListErrors[keyof GatewayChannelsListErrors];
60
+ type GatewayChannelsListResponses = {
61
+ 200: {
62
+ channels: Array<{
63
+ id: string;
64
+ platform: string;
65
+ name: string;
66
+ version: string;
67
+ }>;
68
+ total: number;
69
+ };
70
+ };
71
+ type GatewayChannelsListResponse = GatewayChannelsListResponses[keyof GatewayChannelsListResponses];
72
+ type GatewayContactsListData = {
121
73
  body?: never;
122
74
  path?: never;
123
75
  query: {
@@ -127,11 +79,36 @@ type ListContactsData = {
127
79
  };
128
80
  url: '/contacts';
129
81
  };
130
- type ListContactsResponses = {
131
- 200: ContactListResponse;
82
+ type GatewayContactsListErrors = {
83
+ 500: {
84
+ error: string;
85
+ code?: string;
86
+ };
87
+ 503: {
88
+ error: string;
89
+ code?: string;
90
+ };
132
91
  };
133
- type ListContactsResponse = ListContactsResponses[keyof ListContactsResponses];
134
- type GetContactData = {
92
+ type GatewayContactsListError = GatewayContactsListErrors[keyof GatewayContactsListErrors];
93
+ type GatewayContactsListResponses = {
94
+ 200: {
95
+ contacts: Array<{
96
+ uid: string;
97
+ platform: string;
98
+ stableId?: string;
99
+ profile?: {
100
+ [key: string]: unknown;
101
+ };
102
+ lastSeenAt?: number;
103
+ createdAt?: number;
104
+ aliases?: Array<string>;
105
+ }>;
106
+ total: number;
107
+ hasMore: boolean;
108
+ };
109
+ };
110
+ type GatewayContactsListResponse = GatewayContactsListResponses[keyof GatewayContactsListResponses];
111
+ type GatewayContactsGetData = {
135
112
  body?: never;
136
113
  path: {
137
114
  uid: string;
@@ -139,98 +116,181 @@ type GetContactData = {
139
116
  query?: never;
140
117
  url: '/contacts/{uid}';
141
118
  };
142
- type GetContactErrors = {
143
- 404: unknown;
119
+ type GatewayContactsGetErrors = {
120
+ 404: {
121
+ error: string;
122
+ code?: string;
123
+ };
124
+ 500: {
125
+ error: string;
126
+ code?: string;
127
+ };
128
+ 503: {
129
+ error: string;
130
+ code?: string;
131
+ };
144
132
  };
145
- type GetContactResponses = {
146
- 200: ContactInfo & {
147
- aliases?: {
133
+ type GatewayContactsGetError = GatewayContactsGetErrors[keyof GatewayContactsGetErrors];
134
+ type GatewayContactsGetResponses = {
135
+ 200: {
136
+ uid: string;
137
+ platform: string;
138
+ stableId?: string;
139
+ profile?: {
148
140
  [key: string]: unknown;
149
141
  };
142
+ lastSeenAt?: number;
143
+ createdAt?: number;
144
+ aliases?: Array<string>;
150
145
  };
151
146
  };
152
- type GetContactResponse = GetContactResponses[keyof GetContactResponses];
153
- type ListSessionsData = {
147
+ type GatewayContactsGetResponse = GatewayContactsGetResponses[keyof GatewayContactsGetResponses];
148
+ type GatewaySessionsListData = {
154
149
  body?: never;
155
150
  path?: never;
156
151
  query?: {
157
- limit?: number;
158
- offset?: number;
159
152
  platform?: string;
160
153
  channelId?: string;
161
154
  userId?: string;
162
155
  chatId?: string;
156
+ limit?: number;
157
+ offset?: number;
163
158
  };
164
159
  url: '/sessions';
165
160
  };
166
- type ListSessionsResponses = {
167
- 200: SessionListResponse;
161
+ type GatewaySessionsListResponses = {
162
+ 200: {
163
+ sessions: Array<{
164
+ id: string;
165
+ platform?: string;
166
+ channelId?: string;
167
+ userId?: string;
168
+ chatId?: string;
169
+ chatType?: string;
170
+ chatTitle?: string;
171
+ state: string;
172
+ createdAt: number;
173
+ lastActiveAt: number;
174
+ }>;
175
+ total: number;
176
+ hasMore: boolean;
177
+ };
168
178
  };
169
- type ListSessionsResponse = ListSessionsResponses[keyof ListSessionsResponses];
170
- type GetSessionData = {
179
+ type GatewaySessionsListResponse = GatewaySessionsListResponses[keyof GatewaySessionsListResponses];
180
+ type GatewaySessionsGetData = {
171
181
  body?: never;
172
182
  path: {
173
- id: string;
183
+ sessionId: string;
174
184
  };
175
185
  query?: never;
176
- url: '/sessions/{id}';
186
+ url: '/sessions/{sessionId}';
177
187
  };
178
- type GetSessionErrors = {
179
- 404: unknown;
188
+ type GatewaySessionsGetErrors = {
189
+ 404: {
190
+ error: string;
191
+ code?: string;
192
+ };
180
193
  };
181
- type GetSessionResponses = {
182
- 200: SessionInfo & {
194
+ type GatewaySessionsGetError = GatewaySessionsGetErrors[keyof GatewaySessionsGetErrors];
195
+ type GatewaySessionsGetResponses = {
196
+ 200: {
197
+ id: string;
198
+ platform?: string;
199
+ channelId?: string;
200
+ userId?: string;
201
+ chatId?: string;
202
+ chatType?: string;
203
+ chatTitle?: string;
204
+ backendSessionId?: string;
205
+ state: string;
183
206
  subscriberCount?: number;
207
+ createdAt: number;
208
+ lastActiveAt: number;
184
209
  };
185
210
  };
186
- type GetSessionResponse = GetSessionResponses[keyof GetSessionResponses];
187
- type CreateSessionData = {
188
- body?: {
189
- title?: string;
190
- channel?: {
191
- platform?: string;
192
- channelId?: string;
193
- userId?: string;
194
- chatId?: string;
195
- };
196
- };
211
+ type GatewaySessionsGetResponse = GatewaySessionsGetResponses[keyof GatewaySessionsGetResponses];
212
+ type GatewaySessionCreateData = {
213
+ body: unknown;
197
214
  path?: never;
198
215
  query?: never;
199
216
  url: '/session';
200
217
  };
201
- type CreateSessionResponses = {
202
- 200: CreateSessionResponse;
218
+ type GatewaySessionCreateErrors = {
219
+ 400: {
220
+ error: string;
221
+ code?: string;
222
+ };
223
+ 500: {
224
+ error: string;
225
+ code?: string;
226
+ };
203
227
  };
204
- type CreateSessionResponse2 = CreateSessionResponses[keyof CreateSessionResponses];
205
- type SendMessageData = {
206
- body: {
207
- content: Array<{
208
- type: string;
209
- text?: string;
210
- image?: string;
211
- data?: string;
212
- }>;
213
- channel?: string;
214
- userId?: string;
215
- chatId?: string;
216
- messageType?: string;
217
- processorId?: string;
218
- agent?: string;
219
- replyToMessageId?: string;
228
+ type GatewaySessionCreateError = GatewaySessionCreateErrors[keyof GatewaySessionCreateErrors];
229
+ type GatewaySessionCreateResponses = {
230
+ 200: {
231
+ id: string;
232
+ createdAt: number;
220
233
  };
234
+ };
235
+ type GatewaySessionCreateResponse = GatewaySessionCreateResponses[keyof GatewaySessionCreateResponses];
236
+ type GatewaySessionPromptData = {
237
+ body: unknown;
221
238
  path: {
222
- id: string;
239
+ sessionId: string;
223
240
  };
224
241
  query?: never;
225
- url: '/session/{id}/prompt';
242
+ url: '/session/{sessionId}/prompt';
226
243
  };
227
- type SendMessageErrors = {
228
- 404: unknown;
244
+ type GatewaySessionPromptErrors = {
245
+ 400: {
246
+ error: string;
247
+ code?: string;
248
+ };
249
+ 500: {
250
+ error: string;
251
+ code?: string;
252
+ };
229
253
  };
230
- type SendMessageResponses = {
231
- 200: SendMessageResponse;
254
+ type GatewaySessionPromptError = GatewaySessionPromptErrors[keyof GatewaySessionPromptErrors];
255
+ type GatewaySessionPromptResponses = {
256
+ 202: {
257
+ messageId: string;
258
+ sessionId: string;
259
+ createdAt: number;
260
+ metadata: {
261
+ channel: string;
262
+ channelSource?: string;
263
+ channelInfo?: {
264
+ [key: string]: unknown;
265
+ };
266
+ };
267
+ };
232
268
  };
233
- type SendMessageResponse2 = SendMessageResponses[keyof SendMessageResponses];
269
+ type GatewaySessionPromptResponse = GatewaySessionPromptResponses[keyof GatewaySessionPromptResponses];
270
+ type GatewaySubscriptionsListData = {
271
+ body?: never;
272
+ path?: never;
273
+ query?: {
274
+ sessionId?: string;
275
+ subscriberId?: string;
276
+ };
277
+ url: '/subscriptions';
278
+ };
279
+ type GatewaySubscriptionsListResponses = {
280
+ 200: {
281
+ subscriptions: Array<{
282
+ type: string;
283
+ sessionId: string;
284
+ subscriberCount: number;
285
+ subscribers: Array<{
286
+ id: string;
287
+ subscriptionId: string;
288
+ }>;
289
+ }>;
290
+ total: number;
291
+ };
292
+ };
293
+ type GatewaySubscriptionsListResponse = GatewaySubscriptionsListResponses[keyof GatewaySubscriptionsListResponses];
234
294
 
235
295
  type AuthToken = string | undefined;
236
296
  interface Auth {
@@ -407,59 +467,69 @@ declare class HeyApiRegistry<T> {
407
467
  get(key?: string): T;
408
468
  set(value: T, key?: string): void;
409
469
  }
410
- declare class EasbotGatewayClient extends HeyApiClient {
411
- static readonly __registry: HeyApiRegistry<EasbotGatewayClient>;
412
- constructor(args?: {
413
- client?: Client;
414
- key?: string;
415
- });
416
- healthCheck<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): RequestResult<HealthCheckResponses, unknown, ThrowOnError>;
417
- getStatus<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): RequestResult<GetStatusResponses, unknown, ThrowOnError>;
418
- listChannels<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): RequestResult<ListChannelsResponses, unknown, ThrowOnError>;
419
- listContacts<ThrowOnError extends boolean = false>(parameters: {
470
+ declare class Channels extends HeyApiClient {
471
+ list<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): RequestResult<GatewayChannelsListResponses, GatewayChannelsListErrors, ThrowOnError>;
472
+ }
473
+ declare class Contacts extends HeyApiClient {
474
+ list<ThrowOnError extends boolean = false>(parameters: {
420
475
  platform: string;
421
476
  limit?: number;
422
477
  offset?: number;
423
- }, options?: Options<never, ThrowOnError>): RequestResult<ListContactsResponses, unknown, ThrowOnError>;
424
- getContact<ThrowOnError extends boolean = false>(parameters: {
478
+ }, options?: Options<never, ThrowOnError>): RequestResult<GatewayContactsListResponses, GatewayContactsListErrors, ThrowOnError>;
479
+ get<ThrowOnError extends boolean = false>(parameters: {
425
480
  uid: string;
426
- }, options?: Options<never, ThrowOnError>): RequestResult<GetContactResponses, GetContactErrors, ThrowOnError>;
427
- listSessions<ThrowOnError extends boolean = false>(parameters?: {
428
- limit?: number;
429
- offset?: number;
481
+ }, options?: Options<never, ThrowOnError>): RequestResult<GatewayContactsGetResponses, GatewayContactsGetErrors, ThrowOnError>;
482
+ }
483
+ declare class Sessions extends HeyApiClient {
484
+ list<ThrowOnError extends boolean = false>(parameters?: {
430
485
  platform?: string;
431
486
  channelId?: string;
432
487
  userId?: string;
433
488
  chatId?: string;
434
- }, options?: Options<never, ThrowOnError>): RequestResult<ListSessionsResponses, unknown, ThrowOnError>;
435
- getSession<ThrowOnError extends boolean = false>(parameters: {
436
- id: string;
437
- }, options?: Options<never, ThrowOnError>): RequestResult<GetSessionResponses, GetSessionErrors, ThrowOnError>;
438
- createSession<ThrowOnError extends boolean = false>(parameters?: {
439
- title?: string;
440
- channel?: {
441
- platform?: string;
442
- channelId?: string;
443
- userId?: string;
444
- chatId?: string;
445
- };
446
- }, options?: Options<never, ThrowOnError>): RequestResult<CreateSessionResponses, unknown, ThrowOnError>;
447
- sendMessage<ThrowOnError extends boolean = false>(parameters: {
448
- id: string;
449
- content: Array<{
450
- type: string;
451
- text?: string;
452
- image?: string;
453
- data?: string;
454
- }>;
455
- channel?: string;
456
- userId?: string;
457
- chatId?: string;
458
- messageType?: string;
459
- processorId?: string;
460
- agent?: string;
461
- replyToMessageId?: string;
462
- }, options?: Options<never, ThrowOnError>): RequestResult<SendMessageResponses, SendMessageErrors, ThrowOnError>;
489
+ limit?: number;
490
+ offset?: number;
491
+ }, options?: Options<never, ThrowOnError>): RequestResult<GatewaySessionsListResponses, unknown, ThrowOnError>;
492
+ get<ThrowOnError extends boolean = false>(parameters: {
493
+ sessionId: string;
494
+ }, options?: Options<never, ThrowOnError>): RequestResult<GatewaySessionsGetResponses, GatewaySessionsGetErrors, ThrowOnError>;
495
+ }
496
+ declare class Session extends HeyApiClient {
497
+ create<ThrowOnError extends boolean = false>(parameters: {
498
+ body: unknown;
499
+ }, options?: Options<never, ThrowOnError>): RequestResult<GatewaySessionCreateResponses, GatewaySessionCreateErrors, ThrowOnError>;
500
+ prompt<ThrowOnError extends boolean = false>(parameters: {
501
+ sessionId: string;
502
+ body: unknown;
503
+ }, options?: Options<never, ThrowOnError>): RequestResult<GatewaySessionPromptResponses, GatewaySessionPromptErrors, ThrowOnError>;
504
+ }
505
+ declare class Subscriptions extends HeyApiClient {
506
+ list<ThrowOnError extends boolean = false>(parameters?: {
507
+ sessionId?: string;
508
+ subscriberId?: string;
509
+ }, options?: Options<never, ThrowOnError>): RequestResult<GatewaySubscriptionsListResponses, unknown, ThrowOnError>;
510
+ }
511
+ declare class Gateway extends HeyApiClient {
512
+ health<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): RequestResult<GatewayHealthResponses, unknown, ThrowOnError>;
513
+ status<ThrowOnError extends boolean = false>(options?: Options<never, ThrowOnError>): RequestResult<GatewayStatusResponses, unknown, ThrowOnError>;
514
+ private _channels?;
515
+ get channels(): Channels;
516
+ private _contacts?;
517
+ get contacts(): Contacts;
518
+ private _sessions?;
519
+ get sessions(): Sessions;
520
+ private _session?;
521
+ get session(): Session;
522
+ private _subscriptions?;
523
+ get subscriptions(): Subscriptions;
524
+ }
525
+ declare class EasbotGatewayClient extends HeyApiClient {
526
+ static readonly __registry: HeyApiRegistry<EasbotGatewayClient>;
527
+ constructor(args?: {
528
+ client?: Client;
529
+ key?: string;
530
+ });
531
+ private _gateway?;
532
+ get gateway(): Gateway;
463
533
  }
464
534
 
465
535
  declare function createEasbotGatewayClient(config?: Config & {
@@ -486,4 +556,4 @@ declare function createEasbotGateway(options?: ServerOptions): Promise<{
486
556
  };
487
557
  }>;
488
558
 
489
- export { type ChannelListResponse, type Client, type ClientOptions$1 as ClientOptions, type ContactInfo, type ContactListResponse, type CreateSessionData, type CreateSessionResponse, type CreateSessionResponse2, type CreateSessionResponses, EasbotGatewayClient, type Config as EasbotGatewayClientConfig, type GetContactData, type GetContactErrors, type GetContactResponse, type GetContactResponses, type GetSessionData, type GetSessionErrors, type GetSessionResponse, type GetSessionResponses, type GetStatusData, type GetStatusResponse, type GetStatusResponses, type HealthCheckData, type HealthCheckResponse, type HealthCheckResponses, type HealthResponse, type ListChannelsData, type ListChannelsResponse, type ListChannelsResponses, type ListContactsData, type ListContactsResponse, type ListContactsResponses, type ListSessionsData, type ListSessionsResponse, type ListSessionsResponses, type Options$1 as Options, type RequestResult, type SendMessageData, type SendMessageErrors, type SendMessageResponse, type SendMessageResponse2, type SendMessageResponses, type ServerOptions, type SessionInfo, type SessionListResponse, type StatusResponse, createEasbotGateway, createEasbotGatewayClient, createEasbotGatewayServer };
559
+ export { type Client, type ClientOptions$1 as ClientOptions, EasbotGatewayClient, type Config as EasbotGatewayClientConfig, type GatewayChannelsListData, type GatewayChannelsListError, type GatewayChannelsListErrors, type GatewayChannelsListResponse, type GatewayChannelsListResponses, type GatewayContactsGetData, type GatewayContactsGetError, type GatewayContactsGetErrors, type GatewayContactsGetResponse, type GatewayContactsGetResponses, type GatewayContactsListData, type GatewayContactsListError, type GatewayContactsListErrors, type GatewayContactsListResponse, type GatewayContactsListResponses, type GatewayHealthData, type GatewayHealthResponse, type GatewayHealthResponses, type GatewaySessionCreateData, type GatewaySessionCreateError, type GatewaySessionCreateErrors, type GatewaySessionCreateResponse, type GatewaySessionCreateResponses, type GatewaySessionPromptData, type GatewaySessionPromptError, type GatewaySessionPromptErrors, type GatewaySessionPromptResponse, type GatewaySessionPromptResponses, type GatewaySessionsGetData, type GatewaySessionsGetError, type GatewaySessionsGetErrors, type GatewaySessionsGetResponse, type GatewaySessionsGetResponses, type GatewaySessionsListData, type GatewaySessionsListResponse, type GatewaySessionsListResponses, type GatewayStatusData, type GatewayStatusResponse, type GatewayStatusResponses, type GatewaySubscriptionsListData, type GatewaySubscriptionsListResponse, type GatewaySubscriptionsListResponses, type Options$1 as Options, type RequestResult, type ServerOptions, createEasbotGateway, createEasbotGatewayClient, createEasbotGatewayServer };