@skravets/eapi 0.0.29 → 0.0.31
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/api-types.d.cts +134 -2
- package/dist/api-types.d.ts +134 -2
- package/dist/index.cjs +30 -1
- package/dist/index.d.cts +69 -2
- package/dist/index.d.ts +69 -2
- package/dist/index.js +30 -1
- package/package.json +1 -1
package/dist/api-types.d.cts
CHANGED
|
@@ -19,6 +19,10 @@ interface paths {
|
|
|
19
19
|
/** Get messages context around specified message IDs */
|
|
20
20
|
post: operations["messages.getMessagesContext"];
|
|
21
21
|
};
|
|
22
|
+
"/messages/search/webhook/{externalId}": {
|
|
23
|
+
/** Search messages by phrases and time interval (async with webhook) */
|
|
24
|
+
post: operations["messages.searchMessagesWebhook"];
|
|
25
|
+
};
|
|
22
26
|
"/chats": {
|
|
23
27
|
/** Get Hello World! */
|
|
24
28
|
get: operations["channels.getHello"];
|
|
@@ -48,9 +52,13 @@ interface paths {
|
|
|
48
52
|
post: operations["chats.deleteMessages"];
|
|
49
53
|
};
|
|
50
54
|
"/chats/search": {
|
|
51
|
-
/**
|
|
55
|
+
/** Search chats */
|
|
52
56
|
post: operations["chats.search"];
|
|
53
57
|
};
|
|
58
|
+
"/chats/resolve": {
|
|
59
|
+
/** Resolve telegram usernames */
|
|
60
|
+
post: operations["chats.resolveUsername"];
|
|
61
|
+
};
|
|
54
62
|
"/subscriptions": {
|
|
55
63
|
/** Upsert subscription */
|
|
56
64
|
put: operations["subscriptions.upsert"];
|
|
@@ -127,13 +135,50 @@ interface components {
|
|
|
127
135
|
*/
|
|
128
136
|
messageChannelPairs: string[];
|
|
129
137
|
};
|
|
138
|
+
SearchMessagesWebhookPaginationDto: {
|
|
139
|
+
/**
|
|
140
|
+
* @description Chunk size for streamed webhook batches
|
|
141
|
+
* @default 100
|
|
142
|
+
* @example 100
|
|
143
|
+
*/
|
|
144
|
+
chunkSize: number;
|
|
145
|
+
};
|
|
146
|
+
SearchMessagesWebhookDto: {
|
|
147
|
+
/**
|
|
148
|
+
* @description Search phrases (comma-separated)
|
|
149
|
+
* @example phrase1,phrase2
|
|
150
|
+
*/
|
|
151
|
+
phrases: string;
|
|
152
|
+
/**
|
|
153
|
+
* @description Number of days to search back (default: 30)
|
|
154
|
+
* @example 60
|
|
155
|
+
*/
|
|
156
|
+
days?: number;
|
|
157
|
+
/**
|
|
158
|
+
* @description Start date for search (YYYY-MM-DD format)
|
|
159
|
+
* @example 2024-01-01
|
|
160
|
+
*/
|
|
161
|
+
fromDate?: string;
|
|
162
|
+
/**
|
|
163
|
+
* @description End date for search (YYYY-MM-DD format)
|
|
164
|
+
* @example 2024-12-31
|
|
165
|
+
*/
|
|
166
|
+
toDate?: string;
|
|
167
|
+
/**
|
|
168
|
+
* @description Webhook URL to send results to
|
|
169
|
+
* @example https://your-app.com/webhooks/messages-search
|
|
170
|
+
*/
|
|
171
|
+
webhookUrl: string;
|
|
172
|
+
/** @description Optional pagination configuration for streamed results */
|
|
173
|
+
pagination?: components["schemas"]["SearchMessagesWebhookPaginationDto"];
|
|
174
|
+
};
|
|
130
175
|
/** @description Message schema */
|
|
131
176
|
Message: {
|
|
132
177
|
/** @example 123 */
|
|
133
178
|
channel_id: number;
|
|
134
179
|
/**
|
|
135
180
|
* Format: date-time
|
|
136
|
-
* @example 2025-
|
|
181
|
+
* @example 2025-11-20T11:29:31.257Z
|
|
137
182
|
*/
|
|
138
183
|
message_created_at: string;
|
|
139
184
|
/** @example 123 */
|
|
@@ -350,6 +395,41 @@ interface components {
|
|
|
350
395
|
*/
|
|
351
396
|
summary: string;
|
|
352
397
|
};
|
|
398
|
+
RelatedLinkDto: {
|
|
399
|
+
/** @enum {string} */
|
|
400
|
+
type: "invite" | "username";
|
|
401
|
+
value: string;
|
|
402
|
+
href: string;
|
|
403
|
+
};
|
|
404
|
+
UsernameParseExistResultDto: {
|
|
405
|
+
/** @example durov */
|
|
406
|
+
username: string;
|
|
407
|
+
/** @example true */
|
|
408
|
+
exist: boolean;
|
|
409
|
+
/**
|
|
410
|
+
* @example channel
|
|
411
|
+
* @enum {string}
|
|
412
|
+
*/
|
|
413
|
+
type: "channel" | "group" | "other";
|
|
414
|
+
/** @example Title of channel */
|
|
415
|
+
title: string;
|
|
416
|
+
/** @example 120 */
|
|
417
|
+
participantsCount: number;
|
|
418
|
+
/** @example Bio of channel */
|
|
419
|
+
description: string;
|
|
420
|
+
/** @example https://example.com/image.jpg */
|
|
421
|
+
imageUrl: null | string;
|
|
422
|
+
relatedLinks: components["schemas"]["RelatedLinkDto"][];
|
|
423
|
+
};
|
|
424
|
+
UsernameParseNotExistResultDto: {
|
|
425
|
+
/** @example durov */
|
|
426
|
+
username: string;
|
|
427
|
+
/** @example false */
|
|
428
|
+
exist: boolean;
|
|
429
|
+
};
|
|
430
|
+
ResolveUsernamesReqDto: {
|
|
431
|
+
usernames: string[];
|
|
432
|
+
};
|
|
353
433
|
/** @description Which fields of chat to return */
|
|
354
434
|
ChatData: {
|
|
355
435
|
/** @default false */
|
|
@@ -547,6 +627,29 @@ interface operations {
|
|
|
547
627
|
};
|
|
548
628
|
};
|
|
549
629
|
};
|
|
630
|
+
"messages.searchMessagesWebhook": {
|
|
631
|
+
parameters: {
|
|
632
|
+
header: {
|
|
633
|
+
/** @description `Basic token`, where token is `id:secret` base64 encoded */
|
|
634
|
+
Authorization: string;
|
|
635
|
+
};
|
|
636
|
+
path: {
|
|
637
|
+
externalId: string;
|
|
638
|
+
};
|
|
639
|
+
};
|
|
640
|
+
requestBody: {
|
|
641
|
+
content: {
|
|
642
|
+
"application/json": components["schemas"]["SearchMessagesWebhookDto"];
|
|
643
|
+
};
|
|
644
|
+
};
|
|
645
|
+
responses: {
|
|
646
|
+
201: {
|
|
647
|
+
headers: {
|
|
648
|
+
[name: string]: unknown;
|
|
649
|
+
};
|
|
650
|
+
};
|
|
651
|
+
};
|
|
652
|
+
};
|
|
550
653
|
"channels.getHello": {
|
|
551
654
|
parameters: {
|
|
552
655
|
header: {
|
|
@@ -788,6 +891,35 @@ interface operations {
|
|
|
788
891
|
};
|
|
789
892
|
};
|
|
790
893
|
};
|
|
894
|
+
"chats.resolveUsername": {
|
|
895
|
+
parameters: {
|
|
896
|
+
header: {
|
|
897
|
+
/** @description `Basic token`, where token is `id:secret` base64 encoded */
|
|
898
|
+
Authorization: string;
|
|
899
|
+
};
|
|
900
|
+
};
|
|
901
|
+
requestBody: {
|
|
902
|
+
content: {
|
|
903
|
+
"application/json": components["schemas"]["ResolveUsernamesReqDto"];
|
|
904
|
+
};
|
|
905
|
+
};
|
|
906
|
+
responses: {
|
|
907
|
+
200: {
|
|
908
|
+
headers: {
|
|
909
|
+
[name: string]: unknown;
|
|
910
|
+
};
|
|
911
|
+
content: {
|
|
912
|
+
"application/json": (components["schemas"]["UsernameParseExistResultDto"] | components["schemas"]["UsernameParseNotExistResultDto"])[];
|
|
913
|
+
};
|
|
914
|
+
};
|
|
915
|
+
/** @description Unauthorized */
|
|
916
|
+
401: {
|
|
917
|
+
headers: {
|
|
918
|
+
[name: string]: unknown;
|
|
919
|
+
};
|
|
920
|
+
};
|
|
921
|
+
};
|
|
922
|
+
};
|
|
791
923
|
"subscriptions.upsert": {
|
|
792
924
|
parameters: {
|
|
793
925
|
header: {
|
package/dist/api-types.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ interface paths {
|
|
|
19
19
|
/** Get messages context around specified message IDs */
|
|
20
20
|
post: operations["messages.getMessagesContext"];
|
|
21
21
|
};
|
|
22
|
+
"/messages/search/webhook/{externalId}": {
|
|
23
|
+
/** Search messages by phrases and time interval (async with webhook) */
|
|
24
|
+
post: operations["messages.searchMessagesWebhook"];
|
|
25
|
+
};
|
|
22
26
|
"/chats": {
|
|
23
27
|
/** Get Hello World! */
|
|
24
28
|
get: operations["channels.getHello"];
|
|
@@ -48,9 +52,13 @@ interface paths {
|
|
|
48
52
|
post: operations["chats.deleteMessages"];
|
|
49
53
|
};
|
|
50
54
|
"/chats/search": {
|
|
51
|
-
/**
|
|
55
|
+
/** Search chats */
|
|
52
56
|
post: operations["chats.search"];
|
|
53
57
|
};
|
|
58
|
+
"/chats/resolve": {
|
|
59
|
+
/** Resolve telegram usernames */
|
|
60
|
+
post: operations["chats.resolveUsername"];
|
|
61
|
+
};
|
|
54
62
|
"/subscriptions": {
|
|
55
63
|
/** Upsert subscription */
|
|
56
64
|
put: operations["subscriptions.upsert"];
|
|
@@ -127,13 +135,50 @@ interface components {
|
|
|
127
135
|
*/
|
|
128
136
|
messageChannelPairs: string[];
|
|
129
137
|
};
|
|
138
|
+
SearchMessagesWebhookPaginationDto: {
|
|
139
|
+
/**
|
|
140
|
+
* @description Chunk size for streamed webhook batches
|
|
141
|
+
* @default 100
|
|
142
|
+
* @example 100
|
|
143
|
+
*/
|
|
144
|
+
chunkSize: number;
|
|
145
|
+
};
|
|
146
|
+
SearchMessagesWebhookDto: {
|
|
147
|
+
/**
|
|
148
|
+
* @description Search phrases (comma-separated)
|
|
149
|
+
* @example phrase1,phrase2
|
|
150
|
+
*/
|
|
151
|
+
phrases: string;
|
|
152
|
+
/**
|
|
153
|
+
* @description Number of days to search back (default: 30)
|
|
154
|
+
* @example 60
|
|
155
|
+
*/
|
|
156
|
+
days?: number;
|
|
157
|
+
/**
|
|
158
|
+
* @description Start date for search (YYYY-MM-DD format)
|
|
159
|
+
* @example 2024-01-01
|
|
160
|
+
*/
|
|
161
|
+
fromDate?: string;
|
|
162
|
+
/**
|
|
163
|
+
* @description End date for search (YYYY-MM-DD format)
|
|
164
|
+
* @example 2024-12-31
|
|
165
|
+
*/
|
|
166
|
+
toDate?: string;
|
|
167
|
+
/**
|
|
168
|
+
* @description Webhook URL to send results to
|
|
169
|
+
* @example https://your-app.com/webhooks/messages-search
|
|
170
|
+
*/
|
|
171
|
+
webhookUrl: string;
|
|
172
|
+
/** @description Optional pagination configuration for streamed results */
|
|
173
|
+
pagination?: components["schemas"]["SearchMessagesWebhookPaginationDto"];
|
|
174
|
+
};
|
|
130
175
|
/** @description Message schema */
|
|
131
176
|
Message: {
|
|
132
177
|
/** @example 123 */
|
|
133
178
|
channel_id: number;
|
|
134
179
|
/**
|
|
135
180
|
* Format: date-time
|
|
136
|
-
* @example 2025-
|
|
181
|
+
* @example 2025-11-20T11:29:31.257Z
|
|
137
182
|
*/
|
|
138
183
|
message_created_at: string;
|
|
139
184
|
/** @example 123 */
|
|
@@ -350,6 +395,41 @@ interface components {
|
|
|
350
395
|
*/
|
|
351
396
|
summary: string;
|
|
352
397
|
};
|
|
398
|
+
RelatedLinkDto: {
|
|
399
|
+
/** @enum {string} */
|
|
400
|
+
type: "invite" | "username";
|
|
401
|
+
value: string;
|
|
402
|
+
href: string;
|
|
403
|
+
};
|
|
404
|
+
UsernameParseExistResultDto: {
|
|
405
|
+
/** @example durov */
|
|
406
|
+
username: string;
|
|
407
|
+
/** @example true */
|
|
408
|
+
exist: boolean;
|
|
409
|
+
/**
|
|
410
|
+
* @example channel
|
|
411
|
+
* @enum {string}
|
|
412
|
+
*/
|
|
413
|
+
type: "channel" | "group" | "other";
|
|
414
|
+
/** @example Title of channel */
|
|
415
|
+
title: string;
|
|
416
|
+
/** @example 120 */
|
|
417
|
+
participantsCount: number;
|
|
418
|
+
/** @example Bio of channel */
|
|
419
|
+
description: string;
|
|
420
|
+
/** @example https://example.com/image.jpg */
|
|
421
|
+
imageUrl: null | string;
|
|
422
|
+
relatedLinks: components["schemas"]["RelatedLinkDto"][];
|
|
423
|
+
};
|
|
424
|
+
UsernameParseNotExistResultDto: {
|
|
425
|
+
/** @example durov */
|
|
426
|
+
username: string;
|
|
427
|
+
/** @example false */
|
|
428
|
+
exist: boolean;
|
|
429
|
+
};
|
|
430
|
+
ResolveUsernamesReqDto: {
|
|
431
|
+
usernames: string[];
|
|
432
|
+
};
|
|
353
433
|
/** @description Which fields of chat to return */
|
|
354
434
|
ChatData: {
|
|
355
435
|
/** @default false */
|
|
@@ -547,6 +627,29 @@ interface operations {
|
|
|
547
627
|
};
|
|
548
628
|
};
|
|
549
629
|
};
|
|
630
|
+
"messages.searchMessagesWebhook": {
|
|
631
|
+
parameters: {
|
|
632
|
+
header: {
|
|
633
|
+
/** @description `Basic token`, where token is `id:secret` base64 encoded */
|
|
634
|
+
Authorization: string;
|
|
635
|
+
};
|
|
636
|
+
path: {
|
|
637
|
+
externalId: string;
|
|
638
|
+
};
|
|
639
|
+
};
|
|
640
|
+
requestBody: {
|
|
641
|
+
content: {
|
|
642
|
+
"application/json": components["schemas"]["SearchMessagesWebhookDto"];
|
|
643
|
+
};
|
|
644
|
+
};
|
|
645
|
+
responses: {
|
|
646
|
+
201: {
|
|
647
|
+
headers: {
|
|
648
|
+
[name: string]: unknown;
|
|
649
|
+
};
|
|
650
|
+
};
|
|
651
|
+
};
|
|
652
|
+
};
|
|
550
653
|
"channels.getHello": {
|
|
551
654
|
parameters: {
|
|
552
655
|
header: {
|
|
@@ -788,6 +891,35 @@ interface operations {
|
|
|
788
891
|
};
|
|
789
892
|
};
|
|
790
893
|
};
|
|
894
|
+
"chats.resolveUsername": {
|
|
895
|
+
parameters: {
|
|
896
|
+
header: {
|
|
897
|
+
/** @description `Basic token`, where token is `id:secret` base64 encoded */
|
|
898
|
+
Authorization: string;
|
|
899
|
+
};
|
|
900
|
+
};
|
|
901
|
+
requestBody: {
|
|
902
|
+
content: {
|
|
903
|
+
"application/json": components["schemas"]["ResolveUsernamesReqDto"];
|
|
904
|
+
};
|
|
905
|
+
};
|
|
906
|
+
responses: {
|
|
907
|
+
200: {
|
|
908
|
+
headers: {
|
|
909
|
+
[name: string]: unknown;
|
|
910
|
+
};
|
|
911
|
+
content: {
|
|
912
|
+
"application/json": (components["schemas"]["UsernameParseExistResultDto"] | components["schemas"]["UsernameParseNotExistResultDto"])[];
|
|
913
|
+
};
|
|
914
|
+
};
|
|
915
|
+
/** @description Unauthorized */
|
|
916
|
+
401: {
|
|
917
|
+
headers: {
|
|
918
|
+
[name: string]: unknown;
|
|
919
|
+
};
|
|
920
|
+
};
|
|
921
|
+
};
|
|
922
|
+
};
|
|
791
923
|
"subscriptions.upsert": {
|
|
792
924
|
parameters: {
|
|
793
925
|
header: {
|
package/dist/index.cjs
CHANGED
|
@@ -139,6 +139,21 @@ class EApi {
|
|
|
139
139
|
method: "POST",
|
|
140
140
|
...options
|
|
141
141
|
});
|
|
142
|
+
},
|
|
143
|
+
/**
|
|
144
|
+
*
|
|
145
|
+
*
|
|
146
|
+
* @tags messages
|
|
147
|
+
* @summary Search messages by phrases and time interval (async with webhook)
|
|
148
|
+
*
|
|
149
|
+
* [Documentation](.../messages/operation/messages.searchMessagesWebhook)
|
|
150
|
+
*/
|
|
151
|
+
searchMessagesWebhook: (externalId, body, options) => {
|
|
152
|
+
return this.request(
|
|
153
|
+
`/messages/search/webhook/${externalId}`,
|
|
154
|
+
body,
|
|
155
|
+
{ method: "POST", ...options }
|
|
156
|
+
);
|
|
142
157
|
}
|
|
143
158
|
};
|
|
144
159
|
/**
|
|
@@ -244,7 +259,7 @@ class EApi {
|
|
|
244
259
|
*
|
|
245
260
|
*
|
|
246
261
|
* @tags chats
|
|
247
|
-
* @summary
|
|
262
|
+
* @summary Search chats
|
|
248
263
|
*
|
|
249
264
|
* [Documentation](.../chats/operation/chats.search)
|
|
250
265
|
*/
|
|
@@ -253,6 +268,20 @@ class EApi {
|
|
|
253
268
|
method: "POST",
|
|
254
269
|
...options
|
|
255
270
|
});
|
|
271
|
+
},
|
|
272
|
+
/**
|
|
273
|
+
*
|
|
274
|
+
*
|
|
275
|
+
* @tags chats
|
|
276
|
+
* @summary Resolve telegram usernames
|
|
277
|
+
*
|
|
278
|
+
* [Documentation](.../chats/operation/chats.resolveUsername)
|
|
279
|
+
*/
|
|
280
|
+
resolveUsername: (body, options) => {
|
|
281
|
+
return this.request("/chats/resolve", body, {
|
|
282
|
+
method: "POST",
|
|
283
|
+
...options
|
|
284
|
+
});
|
|
256
285
|
}
|
|
257
286
|
};
|
|
258
287
|
/**
|
package/dist/index.d.cts
CHANGED
|
@@ -22,6 +22,9 @@ type RequestOptions = Omit<NonNullable<Parameters<typeof fetch>[1]>, "headers">
|
|
|
22
22
|
mimeType?: "json" | "x-www-form-urlencoded";
|
|
23
23
|
headers?: Record<string, string>;
|
|
24
24
|
};
|
|
25
|
+
type Metadata<T = Record<string, unknown>> = {
|
|
26
|
+
externalId?: string;
|
|
27
|
+
} & T;
|
|
25
28
|
interface ChatStored {
|
|
26
29
|
id: number;
|
|
27
30
|
username: string;
|
|
@@ -200,6 +203,51 @@ interface AccountSpamBlockUpdate {
|
|
|
200
203
|
spamBlockReason?: string;
|
|
201
204
|
};
|
|
202
205
|
}
|
|
206
|
+
type StreamPaginatorFlushReason = "chunk-limit" | "stream-end";
|
|
207
|
+
interface StreamPaginationChunkMeta {
|
|
208
|
+
chunkIndex: number;
|
|
209
|
+
chunkSize: number;
|
|
210
|
+
itemsInChunk: number;
|
|
211
|
+
itemsProcessedTotal: number;
|
|
212
|
+
reason: StreamPaginatorFlushReason;
|
|
213
|
+
isFinalChunk: boolean;
|
|
214
|
+
totalItems?: number;
|
|
215
|
+
progress?: {
|
|
216
|
+
readRows: number;
|
|
217
|
+
readBytes: number;
|
|
218
|
+
totalRowsToRead?: number;
|
|
219
|
+
elapsedMs?: number;
|
|
220
|
+
percentage?: number;
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
interface MessageSearchQuery {
|
|
224
|
+
phrases: string[];
|
|
225
|
+
days?: number;
|
|
226
|
+
fromDate?: string;
|
|
227
|
+
toDate?: string;
|
|
228
|
+
}
|
|
229
|
+
interface PublishersStatusQueueInputClickHouseMessagesResult {
|
|
230
|
+
metadata?: Metadata;
|
|
231
|
+
pagination?: StreamPaginationChunkMeta;
|
|
232
|
+
query: MessageSearchQuery;
|
|
233
|
+
type: "search_results";
|
|
234
|
+
result: {
|
|
235
|
+
type: "success";
|
|
236
|
+
data: {
|
|
237
|
+
id: string;
|
|
238
|
+
text: string;
|
|
239
|
+
message_created_at: string;
|
|
240
|
+
channel_id: number;
|
|
241
|
+
user_id: string;
|
|
242
|
+
channel_username: string;
|
|
243
|
+
}[];
|
|
244
|
+
totalResults?: number;
|
|
245
|
+
processingTimeMs?: number;
|
|
246
|
+
} | {
|
|
247
|
+
type: "error";
|
|
248
|
+
error: string;
|
|
249
|
+
};
|
|
250
|
+
}
|
|
203
251
|
interface EventByType {
|
|
204
252
|
chat_parsed: ChatParsedTyped;
|
|
205
253
|
messages_parsed: MessagesParsedTyped;
|
|
@@ -208,8 +256,9 @@ interface EventByType {
|
|
|
208
256
|
agent_private_message: PublishersStatusQueueInputAgentPrivateMessageResult;
|
|
209
257
|
parsing_error: PublishersStatusQueueParsingErrorResult;
|
|
210
258
|
account_updated: PublishersStatusQueueAccountUpdatedResult;
|
|
259
|
+
search_results: PublishersStatusQueueInputClickHouseMessagesResult;
|
|
211
260
|
}
|
|
212
|
-
type WebhookBody = ChatParsedTyped | MessagesParsedTyped | PublishersStatusQueueInputJoinResult | PublishersStatusQueueInputSendResult | PublishersStatusQueueInputAgentPrivateMessageResult | PublishersStatusQueueParsingErrorResult | PublishersStatusQueueAccountUpdatedResult;
|
|
261
|
+
type WebhookBody = ChatParsedTyped | MessagesParsedTyped | PublishersStatusQueueInputJoinResult | PublishersStatusQueueInputSendResult | PublishersStatusQueueInputAgentPrivateMessageResult | PublishersStatusQueueParsingErrorResult | PublishersStatusQueueAccountUpdatedResult | PublishersStatusQueueInputClickHouseMessagesResult;
|
|
213
262
|
type WebhookBodyTypes = keyof EventByType;
|
|
214
263
|
|
|
215
264
|
declare const frameworks: {
|
|
@@ -309,6 +358,15 @@ declare class EApi {
|
|
|
309
358
|
* [Documentation](.../messages/operation/messages.getMessagesContext)
|
|
310
359
|
*/
|
|
311
360
|
getMessagesContext: (body: GetRequestBody<"/messages/context", "post">, options?: RequestOptions) => Promise<GetResponse<"/messages/context", "post">>;
|
|
361
|
+
/**
|
|
362
|
+
*
|
|
363
|
+
*
|
|
364
|
+
* @tags messages
|
|
365
|
+
* @summary Search messages by phrases and time interval (async with webhook)
|
|
366
|
+
*
|
|
367
|
+
* [Documentation](.../messages/operation/messages.searchMessagesWebhook)
|
|
368
|
+
*/
|
|
369
|
+
searchMessagesWebhook: (externalId: paths["/messages/search/webhook/{externalId}"]["post"]["parameters"]["path"]["externalId"], body: GetRequestBody<"/messages/search/webhook/{externalId}", "post">, options?: RequestOptions) => Promise<GetResponse<"/messages/search/webhook/{externalId}", "post">>;
|
|
312
370
|
};
|
|
313
371
|
/**
|
|
314
372
|
* @tags chats
|
|
@@ -381,11 +439,20 @@ declare class EApi {
|
|
|
381
439
|
*
|
|
382
440
|
*
|
|
383
441
|
* @tags chats
|
|
384
|
-
* @summary
|
|
442
|
+
* @summary Search chats
|
|
385
443
|
*
|
|
386
444
|
* [Documentation](.../chats/operation/chats.search)
|
|
387
445
|
*/
|
|
388
446
|
search: (body: GetRequestBody<"/chats/search", "post">, options?: RequestOptions) => Promise<GetResponse<"/chats/search", "post">>;
|
|
447
|
+
/**
|
|
448
|
+
*
|
|
449
|
+
*
|
|
450
|
+
* @tags chats
|
|
451
|
+
* @summary Resolve telegram usernames
|
|
452
|
+
*
|
|
453
|
+
* [Documentation](.../chats/operation/chats.resolveUsername)
|
|
454
|
+
*/
|
|
455
|
+
resolveUsername: (body: GetRequestBody<"/chats/resolve", "post">, options?: RequestOptions) => Promise<GetResponse<"/chats/resolve", "post">>;
|
|
389
456
|
};
|
|
390
457
|
/**
|
|
391
458
|
* @tags subscriptions
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,9 @@ type RequestOptions = Omit<NonNullable<Parameters<typeof fetch>[1]>, "headers">
|
|
|
22
22
|
mimeType?: "json" | "x-www-form-urlencoded";
|
|
23
23
|
headers?: Record<string, string>;
|
|
24
24
|
};
|
|
25
|
+
type Metadata<T = Record<string, unknown>> = {
|
|
26
|
+
externalId?: string;
|
|
27
|
+
} & T;
|
|
25
28
|
interface ChatStored {
|
|
26
29
|
id: number;
|
|
27
30
|
username: string;
|
|
@@ -200,6 +203,51 @@ interface AccountSpamBlockUpdate {
|
|
|
200
203
|
spamBlockReason?: string;
|
|
201
204
|
};
|
|
202
205
|
}
|
|
206
|
+
type StreamPaginatorFlushReason = "chunk-limit" | "stream-end";
|
|
207
|
+
interface StreamPaginationChunkMeta {
|
|
208
|
+
chunkIndex: number;
|
|
209
|
+
chunkSize: number;
|
|
210
|
+
itemsInChunk: number;
|
|
211
|
+
itemsProcessedTotal: number;
|
|
212
|
+
reason: StreamPaginatorFlushReason;
|
|
213
|
+
isFinalChunk: boolean;
|
|
214
|
+
totalItems?: number;
|
|
215
|
+
progress?: {
|
|
216
|
+
readRows: number;
|
|
217
|
+
readBytes: number;
|
|
218
|
+
totalRowsToRead?: number;
|
|
219
|
+
elapsedMs?: number;
|
|
220
|
+
percentage?: number;
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
interface MessageSearchQuery {
|
|
224
|
+
phrases: string[];
|
|
225
|
+
days?: number;
|
|
226
|
+
fromDate?: string;
|
|
227
|
+
toDate?: string;
|
|
228
|
+
}
|
|
229
|
+
interface PublishersStatusQueueInputClickHouseMessagesResult {
|
|
230
|
+
metadata?: Metadata;
|
|
231
|
+
pagination?: StreamPaginationChunkMeta;
|
|
232
|
+
query: MessageSearchQuery;
|
|
233
|
+
type: "search_results";
|
|
234
|
+
result: {
|
|
235
|
+
type: "success";
|
|
236
|
+
data: {
|
|
237
|
+
id: string;
|
|
238
|
+
text: string;
|
|
239
|
+
message_created_at: string;
|
|
240
|
+
channel_id: number;
|
|
241
|
+
user_id: string;
|
|
242
|
+
channel_username: string;
|
|
243
|
+
}[];
|
|
244
|
+
totalResults?: number;
|
|
245
|
+
processingTimeMs?: number;
|
|
246
|
+
} | {
|
|
247
|
+
type: "error";
|
|
248
|
+
error: string;
|
|
249
|
+
};
|
|
250
|
+
}
|
|
203
251
|
interface EventByType {
|
|
204
252
|
chat_parsed: ChatParsedTyped;
|
|
205
253
|
messages_parsed: MessagesParsedTyped;
|
|
@@ -208,8 +256,9 @@ interface EventByType {
|
|
|
208
256
|
agent_private_message: PublishersStatusQueueInputAgentPrivateMessageResult;
|
|
209
257
|
parsing_error: PublishersStatusQueueParsingErrorResult;
|
|
210
258
|
account_updated: PublishersStatusQueueAccountUpdatedResult;
|
|
259
|
+
search_results: PublishersStatusQueueInputClickHouseMessagesResult;
|
|
211
260
|
}
|
|
212
|
-
type WebhookBody = ChatParsedTyped | MessagesParsedTyped | PublishersStatusQueueInputJoinResult | PublishersStatusQueueInputSendResult | PublishersStatusQueueInputAgentPrivateMessageResult | PublishersStatusQueueParsingErrorResult | PublishersStatusQueueAccountUpdatedResult;
|
|
261
|
+
type WebhookBody = ChatParsedTyped | MessagesParsedTyped | PublishersStatusQueueInputJoinResult | PublishersStatusQueueInputSendResult | PublishersStatusQueueInputAgentPrivateMessageResult | PublishersStatusQueueParsingErrorResult | PublishersStatusQueueAccountUpdatedResult | PublishersStatusQueueInputClickHouseMessagesResult;
|
|
213
262
|
type WebhookBodyTypes = keyof EventByType;
|
|
214
263
|
|
|
215
264
|
declare const frameworks: {
|
|
@@ -309,6 +358,15 @@ declare class EApi {
|
|
|
309
358
|
* [Documentation](.../messages/operation/messages.getMessagesContext)
|
|
310
359
|
*/
|
|
311
360
|
getMessagesContext: (body: GetRequestBody<"/messages/context", "post">, options?: RequestOptions) => Promise<GetResponse<"/messages/context", "post">>;
|
|
361
|
+
/**
|
|
362
|
+
*
|
|
363
|
+
*
|
|
364
|
+
* @tags messages
|
|
365
|
+
* @summary Search messages by phrases and time interval (async with webhook)
|
|
366
|
+
*
|
|
367
|
+
* [Documentation](.../messages/operation/messages.searchMessagesWebhook)
|
|
368
|
+
*/
|
|
369
|
+
searchMessagesWebhook: (externalId: paths["/messages/search/webhook/{externalId}"]["post"]["parameters"]["path"]["externalId"], body: GetRequestBody<"/messages/search/webhook/{externalId}", "post">, options?: RequestOptions) => Promise<GetResponse<"/messages/search/webhook/{externalId}", "post">>;
|
|
312
370
|
};
|
|
313
371
|
/**
|
|
314
372
|
* @tags chats
|
|
@@ -381,11 +439,20 @@ declare class EApi {
|
|
|
381
439
|
*
|
|
382
440
|
*
|
|
383
441
|
* @tags chats
|
|
384
|
-
* @summary
|
|
442
|
+
* @summary Search chats
|
|
385
443
|
*
|
|
386
444
|
* [Documentation](.../chats/operation/chats.search)
|
|
387
445
|
*/
|
|
388
446
|
search: (body: GetRequestBody<"/chats/search", "post">, options?: RequestOptions) => Promise<GetResponse<"/chats/search", "post">>;
|
|
447
|
+
/**
|
|
448
|
+
*
|
|
449
|
+
*
|
|
450
|
+
* @tags chats
|
|
451
|
+
* @summary Resolve telegram usernames
|
|
452
|
+
*
|
|
453
|
+
* [Documentation](.../chats/operation/chats.resolveUsername)
|
|
454
|
+
*/
|
|
455
|
+
resolveUsername: (body: GetRequestBody<"/chats/resolve", "post">, options?: RequestOptions) => Promise<GetResponse<"/chats/resolve", "post">>;
|
|
389
456
|
};
|
|
390
457
|
/**
|
|
391
458
|
* @tags subscriptions
|
package/dist/index.js
CHANGED
|
@@ -137,6 +137,21 @@ class EApi {
|
|
|
137
137
|
method: "POST",
|
|
138
138
|
...options
|
|
139
139
|
});
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
*
|
|
143
|
+
*
|
|
144
|
+
* @tags messages
|
|
145
|
+
* @summary Search messages by phrases and time interval (async with webhook)
|
|
146
|
+
*
|
|
147
|
+
* [Documentation](.../messages/operation/messages.searchMessagesWebhook)
|
|
148
|
+
*/
|
|
149
|
+
searchMessagesWebhook: (externalId, body, options) => {
|
|
150
|
+
return this.request(
|
|
151
|
+
`/messages/search/webhook/${externalId}`,
|
|
152
|
+
body,
|
|
153
|
+
{ method: "POST", ...options }
|
|
154
|
+
);
|
|
140
155
|
}
|
|
141
156
|
};
|
|
142
157
|
/**
|
|
@@ -242,7 +257,7 @@ class EApi {
|
|
|
242
257
|
*
|
|
243
258
|
*
|
|
244
259
|
* @tags chats
|
|
245
|
-
* @summary
|
|
260
|
+
* @summary Search chats
|
|
246
261
|
*
|
|
247
262
|
* [Documentation](.../chats/operation/chats.search)
|
|
248
263
|
*/
|
|
@@ -251,6 +266,20 @@ class EApi {
|
|
|
251
266
|
method: "POST",
|
|
252
267
|
...options
|
|
253
268
|
});
|
|
269
|
+
},
|
|
270
|
+
/**
|
|
271
|
+
*
|
|
272
|
+
*
|
|
273
|
+
* @tags chats
|
|
274
|
+
* @summary Resolve telegram usernames
|
|
275
|
+
*
|
|
276
|
+
* [Documentation](.../chats/operation/chats.resolveUsername)
|
|
277
|
+
*/
|
|
278
|
+
resolveUsername: (body, options) => {
|
|
279
|
+
return this.request("/chats/resolve", body, {
|
|
280
|
+
method: "POST",
|
|
281
|
+
...options
|
|
282
|
+
});
|
|
254
283
|
}
|
|
255
284
|
};
|
|
256
285
|
/**
|