@skravets/eapi 0.0.30 → 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.
@@ -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"];
@@ -131,6 +135,14 @@ interface components {
131
135
  */
132
136
  messageChannelPairs: string[];
133
137
  };
138
+ SearchMessagesWebhookPaginationDto: {
139
+ /**
140
+ * @description Chunk size for streamed webhook batches
141
+ * @default 100
142
+ * @example 100
143
+ */
144
+ chunkSize: number;
145
+ };
134
146
  SearchMessagesWebhookDto: {
135
147
  /**
136
148
  * @description Search phrases (comma-separated)
@@ -157,6 +169,8 @@ interface components {
157
169
  * @example https://your-app.com/webhooks/messages-search
158
170
  */
159
171
  webhookUrl: string;
172
+ /** @description Optional pagination configuration for streamed results */
173
+ pagination?: components["schemas"]["SearchMessagesWebhookPaginationDto"];
160
174
  };
161
175
  /** @description Message schema */
162
176
  Message: {
@@ -164,7 +178,7 @@ interface components {
164
178
  channel_id: number;
165
179
  /**
166
180
  * Format: date-time
167
- * @example 2025-11-10T14:35:07.235Z
181
+ * @example 2025-11-20T11:29:31.257Z
168
182
  */
169
183
  message_created_at: string;
170
184
  /** @example 123 */
@@ -381,6 +395,41 @@ interface components {
381
395
  */
382
396
  summary: string;
383
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
+ };
384
433
  /** @description Which fields of chat to return */
385
434
  ChatData: {
386
435
  /** @default false */
@@ -842,6 +891,35 @@ interface operations {
842
891
  };
843
892
  };
844
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
+ };
845
923
  "subscriptions.upsert": {
846
924
  parameters: {
847
925
  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"];
@@ -131,6 +135,14 @@ interface components {
131
135
  */
132
136
  messageChannelPairs: string[];
133
137
  };
138
+ SearchMessagesWebhookPaginationDto: {
139
+ /**
140
+ * @description Chunk size for streamed webhook batches
141
+ * @default 100
142
+ * @example 100
143
+ */
144
+ chunkSize: number;
145
+ };
134
146
  SearchMessagesWebhookDto: {
135
147
  /**
136
148
  * @description Search phrases (comma-separated)
@@ -157,6 +169,8 @@ interface components {
157
169
  * @example https://your-app.com/webhooks/messages-search
158
170
  */
159
171
  webhookUrl: string;
172
+ /** @description Optional pagination configuration for streamed results */
173
+ pagination?: components["schemas"]["SearchMessagesWebhookPaginationDto"];
160
174
  };
161
175
  /** @description Message schema */
162
176
  Message: {
@@ -164,7 +178,7 @@ interface components {
164
178
  channel_id: number;
165
179
  /**
166
180
  * Format: date-time
167
- * @example 2025-11-10T14:35:07.235Z
181
+ * @example 2025-11-20T11:29:31.257Z
168
182
  */
169
183
  message_created_at: string;
170
184
  /** @example 123 */
@@ -381,6 +395,41 @@ interface components {
381
395
  */
382
396
  summary: string;
383
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
+ };
384
433
  /** @description Which fields of chat to return */
385
434
  ChatData: {
386
435
  /** @default false */
@@ -842,6 +891,35 @@ interface operations {
842
891
  };
843
892
  };
844
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
+ };
845
923
  "subscriptions.upsert": {
846
924
  parameters: {
847
925
  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,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: {
@@ -390,11 +439,20 @@ declare class EApi {
390
439
  *
391
440
  *
392
441
  * @tags chats
393
- * @summary search chats
442
+ * @summary Search chats
394
443
  *
395
444
  * [Documentation](.../chats/operation/chats.search)
396
445
  */
397
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">>;
398
456
  };
399
457
  /**
400
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: {
@@ -390,11 +439,20 @@ declare class EApi {
390
439
  *
391
440
  *
392
441
  * @tags chats
393
- * @summary search chats
442
+ * @summary Search chats
394
443
  *
395
444
  * [Documentation](.../chats/operation/chats.search)
396
445
  */
397
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">>;
398
456
  };
399
457
  /**
400
458
  * @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.31",
4
4
  "module": "./dist/index.js",
5
5
  "main": "./dist/index.cjs",
6
6
  "types": "./dist/index.d.ts",