@skravets/eapi 0.0.30 → 0.0.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.
@@ -52,9 +52,13 @@ interface paths {
52
52
  post: operations["chats.deleteMessages"];
53
53
  };
54
54
  "/chats/search": {
55
- /** search chats */
55
+ /** Search chats */
56
56
  post: operations["chats.search"];
57
57
  };
58
+ "/chats/resolve": {
59
+ /** Resolve telegram usernames */
60
+ post: operations["chats.resolveUsername"];
61
+ };
58
62
  "/subscriptions": {
59
63
  /** Upsert subscription */
60
64
  put: operations["subscriptions.upsert"];
@@ -96,6 +100,11 @@ interface components {
96
100
  * @example 2024-12-31
97
101
  */
98
102
  toDate?: string;
103
+ /**
104
+ * @description Maximum number of messages to return
105
+ * @example 1000
106
+ */
107
+ limit?: number;
99
108
  };
100
109
  GetMessagesContextDto: {
101
110
  /**
@@ -131,6 +140,14 @@ interface components {
131
140
  */
132
141
  messageChannelPairs: string[];
133
142
  };
143
+ SearchMessagesWebhookPaginationDto: {
144
+ /**
145
+ * @description Chunk size for streamed webhook batches
146
+ * @default 100
147
+ * @example 100
148
+ */
149
+ chunkSize: number;
150
+ };
134
151
  SearchMessagesWebhookDto: {
135
152
  /**
136
153
  * @description Search phrases (comma-separated)
@@ -152,11 +169,18 @@ interface components {
152
169
  * @example 2024-12-31
153
170
  */
154
171
  toDate?: string;
172
+ /**
173
+ * @description Maximum number of messages to return
174
+ * @example 1000
175
+ */
176
+ limit?: number;
155
177
  /**
156
178
  * @description Webhook URL to send results to
157
179
  * @example https://your-app.com/webhooks/messages-search
158
180
  */
159
181
  webhookUrl: string;
182
+ /** @description Optional pagination configuration for streamed results */
183
+ pagination?: components["schemas"]["SearchMessagesWebhookPaginationDto"];
160
184
  };
161
185
  /** @description Message schema */
162
186
  Message: {
@@ -164,7 +188,7 @@ interface components {
164
188
  channel_id: number;
165
189
  /**
166
190
  * Format: date-time
167
- * @example 2025-11-10T14:35:07.235Z
191
+ * @example 2025-11-20T12:03:00.734Z
168
192
  */
169
193
  message_created_at: string;
170
194
  /** @example 123 */
@@ -381,6 +405,41 @@ interface components {
381
405
  */
382
406
  summary: string;
383
407
  };
408
+ RelatedLinkDto: {
409
+ /** @enum {string} */
410
+ type: "invite" | "username";
411
+ value: string;
412
+ href: string;
413
+ };
414
+ UsernameParseExistResultDto: {
415
+ /** @example durov */
416
+ username: string;
417
+ /** @example true */
418
+ exist: boolean;
419
+ /**
420
+ * @example channel
421
+ * @enum {string}
422
+ */
423
+ type: "channel" | "group" | "other";
424
+ /** @example Title of channel */
425
+ title: string;
426
+ /** @example 120 */
427
+ participantsCount: number;
428
+ /** @example Bio of channel */
429
+ description: string;
430
+ /** @example https://example.com/image.jpg */
431
+ imageUrl: null | string;
432
+ relatedLinks: components["schemas"]["RelatedLinkDto"][];
433
+ };
434
+ UsernameParseNotExistResultDto: {
435
+ /** @example durov */
436
+ username: string;
437
+ /** @example false */
438
+ exist: boolean;
439
+ };
440
+ ResolveUsernamesReqDto: {
441
+ usernames: string[];
442
+ };
384
443
  /** @description Which fields of chat to return */
385
444
  ChatData: {
386
445
  /** @default false */
@@ -842,6 +901,35 @@ interface operations {
842
901
  };
843
902
  };
844
903
  };
904
+ "chats.resolveUsername": {
905
+ parameters: {
906
+ header: {
907
+ /** @description `Basic token`, where token is `id:secret` base64 encoded */
908
+ Authorization: string;
909
+ };
910
+ };
911
+ requestBody: {
912
+ content: {
913
+ "application/json": components["schemas"]["ResolveUsernamesReqDto"];
914
+ };
915
+ };
916
+ responses: {
917
+ 200: {
918
+ headers: {
919
+ [name: string]: unknown;
920
+ };
921
+ content: {
922
+ "application/json": (components["schemas"]["UsernameParseExistResultDto"] | components["schemas"]["UsernameParseNotExistResultDto"])[];
923
+ };
924
+ };
925
+ /** @description Unauthorized */
926
+ 401: {
927
+ headers: {
928
+ [name: string]: unknown;
929
+ };
930
+ };
931
+ };
932
+ };
845
933
  "subscriptions.upsert": {
846
934
  parameters: {
847
935
  header: {
@@ -52,9 +52,13 @@ interface paths {
52
52
  post: operations["chats.deleteMessages"];
53
53
  };
54
54
  "/chats/search": {
55
- /** search chats */
55
+ /** Search chats */
56
56
  post: operations["chats.search"];
57
57
  };
58
+ "/chats/resolve": {
59
+ /** Resolve telegram usernames */
60
+ post: operations["chats.resolveUsername"];
61
+ };
58
62
  "/subscriptions": {
59
63
  /** Upsert subscription */
60
64
  put: operations["subscriptions.upsert"];
@@ -96,6 +100,11 @@ interface components {
96
100
  * @example 2024-12-31
97
101
  */
98
102
  toDate?: string;
103
+ /**
104
+ * @description Maximum number of messages to return
105
+ * @example 1000
106
+ */
107
+ limit?: number;
99
108
  };
100
109
  GetMessagesContextDto: {
101
110
  /**
@@ -131,6 +140,14 @@ interface components {
131
140
  */
132
141
  messageChannelPairs: string[];
133
142
  };
143
+ SearchMessagesWebhookPaginationDto: {
144
+ /**
145
+ * @description Chunk size for streamed webhook batches
146
+ * @default 100
147
+ * @example 100
148
+ */
149
+ chunkSize: number;
150
+ };
134
151
  SearchMessagesWebhookDto: {
135
152
  /**
136
153
  * @description Search phrases (comma-separated)
@@ -152,11 +169,18 @@ interface components {
152
169
  * @example 2024-12-31
153
170
  */
154
171
  toDate?: string;
172
+ /**
173
+ * @description Maximum number of messages to return
174
+ * @example 1000
175
+ */
176
+ limit?: number;
155
177
  /**
156
178
  * @description Webhook URL to send results to
157
179
  * @example https://your-app.com/webhooks/messages-search
158
180
  */
159
181
  webhookUrl: string;
182
+ /** @description Optional pagination configuration for streamed results */
183
+ pagination?: components["schemas"]["SearchMessagesWebhookPaginationDto"];
160
184
  };
161
185
  /** @description Message schema */
162
186
  Message: {
@@ -164,7 +188,7 @@ interface components {
164
188
  channel_id: number;
165
189
  /**
166
190
  * Format: date-time
167
- * @example 2025-11-10T14:35:07.235Z
191
+ * @example 2025-11-20T12:03:00.734Z
168
192
  */
169
193
  message_created_at: string;
170
194
  /** @example 123 */
@@ -381,6 +405,41 @@ interface components {
381
405
  */
382
406
  summary: string;
383
407
  };
408
+ RelatedLinkDto: {
409
+ /** @enum {string} */
410
+ type: "invite" | "username";
411
+ value: string;
412
+ href: string;
413
+ };
414
+ UsernameParseExistResultDto: {
415
+ /** @example durov */
416
+ username: string;
417
+ /** @example true */
418
+ exist: boolean;
419
+ /**
420
+ * @example channel
421
+ * @enum {string}
422
+ */
423
+ type: "channel" | "group" | "other";
424
+ /** @example Title of channel */
425
+ title: string;
426
+ /** @example 120 */
427
+ participantsCount: number;
428
+ /** @example Bio of channel */
429
+ description: string;
430
+ /** @example https://example.com/image.jpg */
431
+ imageUrl: null | string;
432
+ relatedLinks: components["schemas"]["RelatedLinkDto"][];
433
+ };
434
+ UsernameParseNotExistResultDto: {
435
+ /** @example durov */
436
+ username: string;
437
+ /** @example false */
438
+ exist: boolean;
439
+ };
440
+ ResolveUsernamesReqDto: {
441
+ usernames: string[];
442
+ };
384
443
  /** @description Which fields of chat to return */
385
444
  ChatData: {
386
445
  /** @default false */
@@ -842,6 +901,35 @@ interface operations {
842
901
  };
843
902
  };
844
903
  };
904
+ "chats.resolveUsername": {
905
+ parameters: {
906
+ header: {
907
+ /** @description `Basic token`, where token is `id:secret` base64 encoded */
908
+ Authorization: string;
909
+ };
910
+ };
911
+ requestBody: {
912
+ content: {
913
+ "application/json": components["schemas"]["ResolveUsernamesReqDto"];
914
+ };
915
+ };
916
+ responses: {
917
+ 200: {
918
+ headers: {
919
+ [name: string]: unknown;
920
+ };
921
+ content: {
922
+ "application/json": (components["schemas"]["UsernameParseExistResultDto"] | components["schemas"]["UsernameParseNotExistResultDto"])[];
923
+ };
924
+ };
925
+ /** @description Unauthorized */
926
+ 401: {
927
+ headers: {
928
+ [name: string]: unknown;
929
+ };
930
+ };
931
+ };
932
+ };
845
933
  "subscriptions.upsert": {
846
934
  parameters: {
847
935
  header: {
package/dist/index.cjs CHANGED
@@ -259,7 +259,7 @@ class EApi {
259
259
  *
260
260
  *
261
261
  * @tags chats
262
- * @summary search chats
262
+ * @summary Search chats
263
263
  *
264
264
  * [Documentation](.../chats/operation/chats.search)
265
265
  */
@@ -268,6 +268,20 @@ class EApi {
268
268
  method: "POST",
269
269
  ...options
270
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
+ });
271
285
  }
272
286
  };
273
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,52 @@ 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
+ limit?: number;
229
+ }
230
+ interface PublishersStatusQueueInputClickHouseMessagesResult {
231
+ metadata?: Metadata;
232
+ pagination?: StreamPaginationChunkMeta;
233
+ query: MessageSearchQuery;
234
+ type: "search_results";
235
+ result: {
236
+ type: "success";
237
+ data: {
238
+ id: string;
239
+ text: string;
240
+ message_created_at: string;
241
+ channel_id: number;
242
+ user_id: string;
243
+ channel_username: string;
244
+ }[];
245
+ totalResults?: number;
246
+ processingTimeMs?: number;
247
+ } | {
248
+ type: "error";
249
+ error: string;
250
+ };
251
+ }
203
252
  interface EventByType {
204
253
  chat_parsed: ChatParsedTyped;
205
254
  messages_parsed: MessagesParsedTyped;
@@ -208,8 +257,9 @@ interface EventByType {
208
257
  agent_private_message: PublishersStatusQueueInputAgentPrivateMessageResult;
209
258
  parsing_error: PublishersStatusQueueParsingErrorResult;
210
259
  account_updated: PublishersStatusQueueAccountUpdatedResult;
260
+ search_results: PublishersStatusQueueInputClickHouseMessagesResult;
211
261
  }
212
- type WebhookBody = ChatParsedTyped | MessagesParsedTyped | PublishersStatusQueueInputJoinResult | PublishersStatusQueueInputSendResult | PublishersStatusQueueInputAgentPrivateMessageResult | PublishersStatusQueueParsingErrorResult | PublishersStatusQueueAccountUpdatedResult;
262
+ type WebhookBody = ChatParsedTyped | MessagesParsedTyped | PublishersStatusQueueInputJoinResult | PublishersStatusQueueInputSendResult | PublishersStatusQueueInputAgentPrivateMessageResult | PublishersStatusQueueParsingErrorResult | PublishersStatusQueueAccountUpdatedResult | PublishersStatusQueueInputClickHouseMessagesResult;
213
263
  type WebhookBodyTypes = keyof EventByType;
214
264
 
215
265
  declare const frameworks: {
@@ -390,11 +440,20 @@ declare class EApi {
390
440
  *
391
441
  *
392
442
  * @tags chats
393
- * @summary search chats
443
+ * @summary Search chats
394
444
  *
395
445
  * [Documentation](.../chats/operation/chats.search)
396
446
  */
397
447
  search: (body: GetRequestBody<"/chats/search", "post">, options?: RequestOptions) => Promise<GetResponse<"/chats/search", "post">>;
448
+ /**
449
+ *
450
+ *
451
+ * @tags chats
452
+ * @summary Resolve telegram usernames
453
+ *
454
+ * [Documentation](.../chats/operation/chats.resolveUsername)
455
+ */
456
+ resolveUsername: (body: GetRequestBody<"/chats/resolve", "post">, options?: RequestOptions) => Promise<GetResponse<"/chats/resolve", "post">>;
398
457
  };
399
458
  /**
400
459
  * @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,52 @@ 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
+ limit?: number;
229
+ }
230
+ interface PublishersStatusQueueInputClickHouseMessagesResult {
231
+ metadata?: Metadata;
232
+ pagination?: StreamPaginationChunkMeta;
233
+ query: MessageSearchQuery;
234
+ type: "search_results";
235
+ result: {
236
+ type: "success";
237
+ data: {
238
+ id: string;
239
+ text: string;
240
+ message_created_at: string;
241
+ channel_id: number;
242
+ user_id: string;
243
+ channel_username: string;
244
+ }[];
245
+ totalResults?: number;
246
+ processingTimeMs?: number;
247
+ } | {
248
+ type: "error";
249
+ error: string;
250
+ };
251
+ }
203
252
  interface EventByType {
204
253
  chat_parsed: ChatParsedTyped;
205
254
  messages_parsed: MessagesParsedTyped;
@@ -208,8 +257,9 @@ interface EventByType {
208
257
  agent_private_message: PublishersStatusQueueInputAgentPrivateMessageResult;
209
258
  parsing_error: PublishersStatusQueueParsingErrorResult;
210
259
  account_updated: PublishersStatusQueueAccountUpdatedResult;
260
+ search_results: PublishersStatusQueueInputClickHouseMessagesResult;
211
261
  }
212
- type WebhookBody = ChatParsedTyped | MessagesParsedTyped | PublishersStatusQueueInputJoinResult | PublishersStatusQueueInputSendResult | PublishersStatusQueueInputAgentPrivateMessageResult | PublishersStatusQueueParsingErrorResult | PublishersStatusQueueAccountUpdatedResult;
262
+ type WebhookBody = ChatParsedTyped | MessagesParsedTyped | PublishersStatusQueueInputJoinResult | PublishersStatusQueueInputSendResult | PublishersStatusQueueInputAgentPrivateMessageResult | PublishersStatusQueueParsingErrorResult | PublishersStatusQueueAccountUpdatedResult | PublishersStatusQueueInputClickHouseMessagesResult;
213
263
  type WebhookBodyTypes = keyof EventByType;
214
264
 
215
265
  declare const frameworks: {
@@ -390,11 +440,20 @@ declare class EApi {
390
440
  *
391
441
  *
392
442
  * @tags chats
393
- * @summary search chats
443
+ * @summary Search chats
394
444
  *
395
445
  * [Documentation](.../chats/operation/chats.search)
396
446
  */
397
447
  search: (body: GetRequestBody<"/chats/search", "post">, options?: RequestOptions) => Promise<GetResponse<"/chats/search", "post">>;
448
+ /**
449
+ *
450
+ *
451
+ * @tags chats
452
+ * @summary Resolve telegram usernames
453
+ *
454
+ * [Documentation](.../chats/operation/chats.resolveUsername)
455
+ */
456
+ resolveUsername: (body: GetRequestBody<"/chats/resolve", "post">, options?: RequestOptions) => Promise<GetResponse<"/chats/resolve", "post">>;
398
457
  };
399
458
  /**
400
459
  * @tags subscriptions
package/dist/index.js CHANGED
@@ -257,7 +257,7 @@ class EApi {
257
257
  *
258
258
  *
259
259
  * @tags chats
260
- * @summary search chats
260
+ * @summary Search chats
261
261
  *
262
262
  * [Documentation](.../chats/operation/chats.search)
263
263
  */
@@ -266,6 +266,20 @@ class EApi {
266
266
  method: "POST",
267
267
  ...options
268
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
+ });
269
283
  }
270
284
  };
271
285
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skravets/eapi",
3
- "version": "0.0.30",
3
+ "version": "0.0.32",
4
4
  "module": "./dist/index.js",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.ts",