harvester_sdk 1.0.30 → 1.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/sdk.d.ts CHANGED
@@ -68,6 +68,12 @@ export interface SDKResponse<T> {
68
68
  error?: string;
69
69
  message?: string;
70
70
  }
71
+ export interface TokenCountResult {
72
+ total_tokens: number;
73
+ data_text_tokens: number;
74
+ data_url_tokens: number;
75
+ documents_count: number;
76
+ }
71
77
  /**
72
78
  * Harvester SDK - Client for interacting with the Harvester API
73
79
  *
@@ -208,6 +214,23 @@ export declare class HarvesterSDK {
208
214
  * @returns Count of matching data items
209
215
  */
210
216
  getDataCount(params?: GetDataParams): Promise<number>;
217
+ /**
218
+ * Get token count for data matching the filters
219
+ *
220
+ * @param params - Filter parameters
221
+ * @returns Token count result with total tokens, text tokens, url tokens, and document count
222
+ *
223
+ * @example
224
+ * ```typescript
225
+ * const tokenCount = await harvester.getDataTokenCount({
226
+ * region_id: 'region-id',
227
+ * platform: 'telegram',
228
+ * relative_time: { value: 24, unit: 'hours' }
229
+ * });
230
+ * console.log(`Total tokens: ${tokenCount.total_tokens}`);
231
+ * ```
232
+ */
233
+ getDataTokenCount(params?: GetDataParams): Promise<TokenCountResult>;
211
234
  /**
212
235
  * Get data aggregated by a field
213
236
  *
package/dist/sdk.js CHANGED
@@ -210,6 +210,29 @@ class HarvesterSDK {
210
210
  });
211
211
  return response.data.data;
212
212
  }
213
+ /**
214
+ * Get token count for data matching the filters
215
+ *
216
+ * @param params - Filter parameters
217
+ * @returns Token count result with total tokens, text tokens, url tokens, and document count
218
+ *
219
+ * @example
220
+ * ```typescript
221
+ * const tokenCount = await harvester.getDataTokenCount({
222
+ * region_id: 'region-id',
223
+ * platform: 'telegram',
224
+ * relative_time: { value: 24, unit: 'hours' }
225
+ * });
226
+ * console.log(`Total tokens: ${tokenCount.total_tokens}`);
227
+ * ```
228
+ */
229
+ async getDataTokenCount(params) {
230
+ const queryParams = this.buildDataQueryParams(params);
231
+ const response = await this.client.get('/data/token-count', {
232
+ params: queryParams,
233
+ });
234
+ return response.data.data;
235
+ }
213
236
  /**
214
237
  * Get data aggregated by a field
215
238
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "harvester_sdk",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "SDK for interacting with the Harvester API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/sdk.ts CHANGED
@@ -99,6 +99,13 @@ export interface SDKResponse<T> {
99
99
  message?: string;
100
100
  }
101
101
 
102
+ export interface TokenCountResult {
103
+ total_tokens: number;
104
+ data_text_tokens: number;
105
+ data_url_tokens: number;
106
+ documents_count: number;
107
+ }
108
+
102
109
  /**
103
110
  * Harvester SDK - Client for interacting with the Harvester API
104
111
  *
@@ -361,6 +368,32 @@ export class HarvesterSDK {
361
368
  return response.data.data;
362
369
  }
363
370
 
371
+ /**
372
+ * Get token count for data matching the filters
373
+ *
374
+ * @param params - Filter parameters
375
+ * @returns Token count result with total tokens, text tokens, url tokens, and document count
376
+ *
377
+ * @example
378
+ * ```typescript
379
+ * const tokenCount = await harvester.getDataTokenCount({
380
+ * region_id: 'region-id',
381
+ * platform: 'telegram',
382
+ * relative_time: { value: 24, unit: 'hours' }
383
+ * });
384
+ * console.log(`Total tokens: ${tokenCount.total_tokens}`);
385
+ * ```
386
+ */
387
+ async getDataTokenCount(params?: GetDataParams): Promise<TokenCountResult> {
388
+ const queryParams = this.buildDataQueryParams(params);
389
+ const response = await this.client.get<{ data: TokenCountResult }>('/data/token-count', {
390
+ params: queryParams,
391
+ });
392
+ return response.data.data;
393
+ }
394
+
395
+
396
+
364
397
  /**
365
398
  * Get data aggregated by a field
366
399
  *