harvester_sdk 1.0.30 → 1.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.
package/dist/sdk.d.ts CHANGED
@@ -36,6 +36,8 @@ export interface GetDataParams extends PaginationParams {
36
36
  region_ids?: string[];
37
37
  time_range?: TimeRange;
38
38
  relative_time?: RelativeTimeRange;
39
+ start_time?: number;
40
+ end_time?: number;
39
41
  platform?: Platform;
40
42
  platforms?: Platform[];
41
43
  source_id?: string;
@@ -68,6 +70,12 @@ export interface SDKResponse<T> {
68
70
  error?: string;
69
71
  message?: string;
70
72
  }
73
+ export interface TokenCountResult {
74
+ total_tokens: number;
75
+ data_text_tokens: number;
76
+ data_url_tokens: number;
77
+ documents_count: number;
78
+ }
71
79
  /**
72
80
  * Harvester SDK - Client for interacting with the Harvester API
73
81
  *
@@ -208,6 +216,23 @@ export declare class HarvesterSDK {
208
216
  * @returns Count of matching data items
209
217
  */
210
218
  getDataCount(params?: GetDataParams): Promise<number>;
219
+ /**
220
+ * Get token count for data matching the filters
221
+ *
222
+ * @param params - Filter parameters
223
+ * @returns Token count result with total tokens, text tokens, url tokens, and document count
224
+ *
225
+ * @example
226
+ * ```typescript
227
+ * const tokenCount = await harvester.getDataTokenCount({
228
+ * region_id: 'region-id',
229
+ * platform: 'telegram',
230
+ * relative_time: { value: 24, unit: 'hours' }
231
+ * });
232
+ * console.log(`Total tokens: ${tokenCount.total_tokens}`);
233
+ * ```
234
+ */
235
+ getDataTokenCount(params?: GetDataParams): Promise<TokenCountResult>;
211
236
  /**
212
237
  * Get data aggregated by a field
213
238
  *
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.32",
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
@@ -49,6 +49,8 @@ export interface GetDataParams extends PaginationParams {
49
49
  // Time filters
50
50
  time_range?: TimeRange;
51
51
  relative_time?: RelativeTimeRange;
52
+ start_time?: number;
53
+ end_time?: number;
52
54
 
53
55
  // Platform filters
54
56
  platform?: Platform;
@@ -99,6 +101,13 @@ export interface SDKResponse<T> {
99
101
  message?: string;
100
102
  }
101
103
 
104
+ export interface TokenCountResult {
105
+ total_tokens: number;
106
+ data_text_tokens: number;
107
+ data_url_tokens: number;
108
+ documents_count: number;
109
+ }
110
+
102
111
  /**
103
112
  * Harvester SDK - Client for interacting with the Harvester API
104
113
  *
@@ -361,6 +370,32 @@ export class HarvesterSDK {
361
370
  return response.data.data;
362
371
  }
363
372
 
373
+ /**
374
+ * Get token count for data matching the filters
375
+ *
376
+ * @param params - Filter parameters
377
+ * @returns Token count result with total tokens, text tokens, url tokens, and document count
378
+ *
379
+ * @example
380
+ * ```typescript
381
+ * const tokenCount = await harvester.getDataTokenCount({
382
+ * region_id: 'region-id',
383
+ * platform: 'telegram',
384
+ * relative_time: { value: 24, unit: 'hours' }
385
+ * });
386
+ * console.log(`Total tokens: ${tokenCount.total_tokens}`);
387
+ * ```
388
+ */
389
+ async getDataTokenCount(params?: GetDataParams): Promise<TokenCountResult> {
390
+ const queryParams = this.buildDataQueryParams(params);
391
+ const response = await this.client.get<{ data: TokenCountResult }>('/data/token-count', {
392
+ params: queryParams,
393
+ });
394
+ return response.data.data;
395
+ }
396
+
397
+
398
+
364
399
  /**
365
400
  * Get data aggregated by a field
366
401
  *