reportify-sdk 0.2.8 → 0.2.10
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/index.d.mts +670 -169
- package/dist/index.d.ts +670 -169
- package/dist/index.js +989 -299
- package/dist/index.mjs +983 -298
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21,7 +21,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
APIError: () => APIError,
|
|
24
|
+
AgentModule: () => AgentModule,
|
|
24
25
|
AuthenticationError: () => AuthenticationError,
|
|
26
|
+
ChannelsModule: () => ChannelsModule,
|
|
27
|
+
ChatModule: () => ChatModule,
|
|
25
28
|
ConceptsModule: () => ConceptsModule,
|
|
26
29
|
DocsModule: () => DocsModule,
|
|
27
30
|
KBModule: () => KBModule,
|
|
@@ -30,8 +33,10 @@ __export(index_exports, {
|
|
|
30
33
|
RateLimitError: () => RateLimitError,
|
|
31
34
|
Reportify: () => Reportify,
|
|
32
35
|
ReportifyError: () => ReportifyError,
|
|
36
|
+
SearchModule: () => SearchModule,
|
|
33
37
|
StockModule: () => StockModule,
|
|
34
|
-
TimelineModule: () => TimelineModule
|
|
38
|
+
TimelineModule: () => TimelineModule,
|
|
39
|
+
UserModule: () => UserModule
|
|
35
40
|
});
|
|
36
41
|
module.exports = __toCommonJS(index_exports);
|
|
37
42
|
|
|
@@ -82,11 +87,17 @@ var StockModule = class {
|
|
|
82
87
|
* Get list of major shareholders
|
|
83
88
|
*
|
|
84
89
|
* @param symbol - Stock symbol
|
|
90
|
+
* @param options.type - Type of shareholders ('shareholders' or 'outstanding_shareholders')
|
|
91
|
+
* @param options.limit - Number of results to return (default: 10)
|
|
85
92
|
*/
|
|
86
|
-
async shareholders(symbol) {
|
|
93
|
+
async shareholders(symbol, options = {}) {
|
|
87
94
|
const response = await this.client.post(
|
|
88
95
|
"/v1/stock/company-shareholders",
|
|
89
|
-
{
|
|
96
|
+
{
|
|
97
|
+
symbol,
|
|
98
|
+
type: options.type || "shareholders",
|
|
99
|
+
limit: options.limit || 10
|
|
100
|
+
}
|
|
90
101
|
);
|
|
91
102
|
return Array.isArray(response) ? response : response.shareholders || [];
|
|
92
103
|
}
|
|
@@ -97,17 +108,28 @@ var StockModule = class {
|
|
|
97
108
|
* Get income statement data
|
|
98
109
|
*
|
|
99
110
|
* @param symbol - Stock symbol
|
|
100
|
-
* @param options.period - "annual" or "quarterly"
|
|
101
|
-
* @param options.limit - Number of periods to return
|
|
111
|
+
* @param options.period - "annual", "quarterly", or "cumulative quarterly"
|
|
112
|
+
* @param options.limit - Number of periods to return (default: 8)
|
|
113
|
+
* @param options.startDate - Start date (YYYY-MM-DD)
|
|
114
|
+
* @param options.endDate - End date (YYYY-MM-DD)
|
|
115
|
+
* @param options.calendar - "calendar" or "fiscal" (default: "fiscal")
|
|
116
|
+
* @param options.fiscalYear - Specific fiscal year (e.g., "2023")
|
|
117
|
+
* @param options.fiscalQuarter - Specific fiscal quarter (Q1, Q2, Q3, Q4, FY, H1)
|
|
102
118
|
*/
|
|
103
119
|
async incomeStatement(symbol, options = {}) {
|
|
120
|
+
const body = {
|
|
121
|
+
symbol,
|
|
122
|
+
period: options.period || "annual",
|
|
123
|
+
limit: options.limit || 8,
|
|
124
|
+
calendar: options.calendar || "fiscal"
|
|
125
|
+
};
|
|
126
|
+
if (options.startDate) body.start_date = options.startDate;
|
|
127
|
+
if (options.endDate) body.end_date = options.endDate;
|
|
128
|
+
if (options.fiscalYear) body.fiscal_year = options.fiscalYear;
|
|
129
|
+
if (options.fiscalQuarter) body.fiscal_quarter = options.fiscalQuarter;
|
|
104
130
|
const response = await this.client.post(
|
|
105
131
|
"/v1/stock/company-income-statement",
|
|
106
|
-
|
|
107
|
-
symbol,
|
|
108
|
-
period: options.period || "annual",
|
|
109
|
-
limit: options.limit || 10
|
|
110
|
-
}
|
|
132
|
+
body
|
|
111
133
|
);
|
|
112
134
|
return this.normalizeArrayResponse(response);
|
|
113
135
|
}
|
|
@@ -116,16 +138,27 @@ var StockModule = class {
|
|
|
116
138
|
*
|
|
117
139
|
* @param symbol - Stock symbol
|
|
118
140
|
* @param options.period - "annual" or "quarterly"
|
|
119
|
-
* @param options.limit - Number of periods to return
|
|
141
|
+
* @param options.limit - Number of periods to return (default: 8)
|
|
142
|
+
* @param options.startDate - Start date (YYYY-MM-DD)
|
|
143
|
+
* @param options.endDate - End date (YYYY-MM-DD)
|
|
144
|
+
* @param options.calendar - "calendar" or "fiscal" (default: "fiscal")
|
|
145
|
+
* @param options.fiscalYear - Specific fiscal year (e.g., "2023")
|
|
146
|
+
* @param options.fiscalQuarter - Specific fiscal quarter (Q1, Q2, Q3, Q4, FY)
|
|
120
147
|
*/
|
|
121
148
|
async balanceSheet(symbol, options = {}) {
|
|
149
|
+
const body = {
|
|
150
|
+
symbol,
|
|
151
|
+
period: options.period || "annual",
|
|
152
|
+
limit: options.limit || 8,
|
|
153
|
+
calendar: options.calendar || "fiscal"
|
|
154
|
+
};
|
|
155
|
+
if (options.startDate) body.start_date = options.startDate;
|
|
156
|
+
if (options.endDate) body.end_date = options.endDate;
|
|
157
|
+
if (options.fiscalYear) body.fiscal_year = options.fiscalYear;
|
|
158
|
+
if (options.fiscalQuarter) body.fiscal_quarter = options.fiscalQuarter;
|
|
122
159
|
const response = await this.client.post(
|
|
123
160
|
"/v1/stock/company-balance-sheet",
|
|
124
|
-
|
|
125
|
-
symbol,
|
|
126
|
-
period: options.period || "annual",
|
|
127
|
-
limit: options.limit || 10
|
|
128
|
-
}
|
|
161
|
+
body
|
|
129
162
|
);
|
|
130
163
|
return this.normalizeArrayResponse(response);
|
|
131
164
|
}
|
|
@@ -133,33 +166,51 @@ var StockModule = class {
|
|
|
133
166
|
* Get cash flow statement data
|
|
134
167
|
*
|
|
135
168
|
* @param symbol - Stock symbol
|
|
136
|
-
* @param options.period - "annual" or "quarterly"
|
|
137
|
-
* @param options.limit - Number of periods to return
|
|
169
|
+
* @param options.period - "annual", "quarterly", or "cumulative quarterly"
|
|
170
|
+
* @param options.limit - Number of periods to return (default: 8)
|
|
171
|
+
* @param options.startDate - Start date (YYYY-MM-DD)
|
|
172
|
+
* @param options.endDate - End date (YYYY-MM-DD)
|
|
173
|
+
* @param options.calendar - "calendar" or "fiscal" (default: "fiscal")
|
|
174
|
+
* @param options.fiscalYear - Specific fiscal year (e.g., "2023")
|
|
175
|
+
* @param options.fiscalQuarter - Specific fiscal quarter (Q1, Q2, Q3, Q4, FY, H1)
|
|
138
176
|
*/
|
|
139
177
|
async cashflowStatement(symbol, options = {}) {
|
|
178
|
+
const body = {
|
|
179
|
+
symbol,
|
|
180
|
+
period: options.period || "annual",
|
|
181
|
+
limit: options.limit || 8,
|
|
182
|
+
calendar: options.calendar || "fiscal"
|
|
183
|
+
};
|
|
184
|
+
if (options.startDate) body.start_date = options.startDate;
|
|
185
|
+
if (options.endDate) body.end_date = options.endDate;
|
|
186
|
+
if (options.fiscalYear) body.fiscal_year = options.fiscalYear;
|
|
187
|
+
if (options.fiscalQuarter) body.fiscal_quarter = options.fiscalQuarter;
|
|
140
188
|
const response = await this.client.post(
|
|
141
189
|
"/v1/stock/company-cashflow-statement",
|
|
142
|
-
|
|
143
|
-
symbol,
|
|
144
|
-
period: options.period || "annual",
|
|
145
|
-
limit: options.limit || 10
|
|
146
|
-
}
|
|
190
|
+
body
|
|
147
191
|
);
|
|
148
192
|
return this.normalizeArrayResponse(response);
|
|
149
193
|
}
|
|
150
194
|
/**
|
|
151
|
-
* Get revenue breakdown
|
|
195
|
+
* Get revenue breakdown
|
|
152
196
|
*
|
|
153
197
|
* @param symbol - Stock symbol
|
|
154
|
-
* @param options.
|
|
198
|
+
* @param options.period - Report cycle (e.g., "FY", "Q2")
|
|
199
|
+
* @param options.limit - Number of records to return (default: 6)
|
|
200
|
+
* @param options.startDate - Start date (YYYY-MM-DD)
|
|
201
|
+
* @param options.endDate - End date (YYYY-MM-DD)
|
|
202
|
+
* @param options.fiscalYear - Specific fiscal year (e.g., "2023")
|
|
155
203
|
*/
|
|
156
204
|
async revenueBreakdown(symbol, options = {}) {
|
|
205
|
+
const body = { symbol };
|
|
206
|
+
if (options.period) body.period = options.period;
|
|
207
|
+
if (options.limit !== void 0) body.limit = options.limit;
|
|
208
|
+
if (options.startDate) body.start_date = options.startDate;
|
|
209
|
+
if (options.endDate) body.end_date = options.endDate;
|
|
210
|
+
if (options.fiscalYear) body.fiscal_year = options.fiscalYear;
|
|
157
211
|
const response = await this.client.post(
|
|
158
212
|
"/v1/stock/company-revenue-breakdown",
|
|
159
|
-
|
|
160
|
-
symbol,
|
|
161
|
-
breakdown_type: options.breakdownType || "segment"
|
|
162
|
-
}
|
|
213
|
+
body
|
|
163
214
|
);
|
|
164
215
|
return this.normalizeArrayResponse(response);
|
|
165
216
|
}
|
|
@@ -173,65 +224,43 @@ var StockModule = class {
|
|
|
173
224
|
* @param options - Query options
|
|
174
225
|
*/
|
|
175
226
|
async prices(symbol, options = {}) {
|
|
227
|
+
const body = { symbol };
|
|
228
|
+
if (options.startDate) body.start_date = options.startDate;
|
|
229
|
+
if (options.endDate) body.end_date = options.endDate;
|
|
176
230
|
const response = await this.client.post(
|
|
177
231
|
"/v1/stock/company-prices",
|
|
178
|
-
|
|
179
|
-
symbol,
|
|
180
|
-
start_date: options.startDate,
|
|
181
|
-
end_date: options.endDate,
|
|
182
|
-
limit: options.limit || 100
|
|
183
|
-
}
|
|
232
|
+
body
|
|
184
233
|
);
|
|
185
234
|
return this.normalizeArrayResponse(response);
|
|
186
235
|
}
|
|
187
236
|
/**
|
|
188
|
-
* Get
|
|
237
|
+
* Get real-time stock quote
|
|
189
238
|
*
|
|
190
239
|
* @param symbol - Stock symbol
|
|
191
|
-
* @param options - Query options
|
|
192
|
-
*/
|
|
193
|
-
async kline(symbol, options = {}) {
|
|
194
|
-
const response = await this.client.post(
|
|
195
|
-
"/v1/stock/kline",
|
|
196
|
-
{
|
|
197
|
-
symbol,
|
|
198
|
-
interval: options.interval || "1d",
|
|
199
|
-
adjust: options.adjust || "forward",
|
|
200
|
-
start_date: options.startDate,
|
|
201
|
-
end_date: options.endDate,
|
|
202
|
-
limit: options.limit || 100
|
|
203
|
-
}
|
|
204
|
-
);
|
|
205
|
-
return this.normalizeArrayResponse(response);
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* Get real-time stock quotes
|
|
209
|
-
*
|
|
210
|
-
* @param symbols - Single symbol or array of symbols
|
|
211
240
|
*/
|
|
212
|
-
async quote(
|
|
213
|
-
const symbolList = Array.isArray(symbols) ? symbols : [symbols];
|
|
241
|
+
async quote(symbol) {
|
|
214
242
|
const response = await this.client.post(
|
|
215
243
|
"/v1/stock/quote-realtime",
|
|
216
|
-
{
|
|
244
|
+
{ symbol }
|
|
217
245
|
);
|
|
218
|
-
|
|
246
|
+
if ("data" in response) {
|
|
247
|
+
return response.data;
|
|
248
|
+
}
|
|
249
|
+
return response;
|
|
219
250
|
}
|
|
220
251
|
/**
|
|
221
252
|
* Get stock index prices
|
|
222
253
|
*
|
|
223
|
-
* @param symbol - Index symbol
|
|
254
|
+
* @param symbol - Index symbol (e.g., HSI, SPX, DJI)
|
|
224
255
|
* @param options - Query options
|
|
225
256
|
*/
|
|
226
257
|
async indexPrices(symbol, options = {}) {
|
|
258
|
+
const body = { symbol };
|
|
259
|
+
if (options.startDate) body.start_date = options.startDate;
|
|
260
|
+
if (options.endDate) body.end_date = options.endDate;
|
|
227
261
|
const response = await this.client.post(
|
|
228
262
|
"/v1/stock/index-prices",
|
|
229
|
-
|
|
230
|
-
symbol,
|
|
231
|
-
start_date: options.startDate,
|
|
232
|
-
end_date: options.endDate,
|
|
233
|
-
limit: options.limit || 100
|
|
234
|
-
}
|
|
263
|
+
body
|
|
235
264
|
);
|
|
236
265
|
return this.normalizeArrayResponse(response);
|
|
237
266
|
}
|
|
@@ -242,39 +271,54 @@ var StockModule = class {
|
|
|
242
271
|
* Screen stocks based on various criteria
|
|
243
272
|
*/
|
|
244
273
|
async screener(options = {}) {
|
|
274
|
+
const body = {
|
|
275
|
+
limit: options.limit || 100
|
|
276
|
+
};
|
|
277
|
+
if (options.marketCapMoreThan !== void 0) body.market_cap_more_than = options.marketCapMoreThan;
|
|
278
|
+
if (options.marketCapLowerThan !== void 0) body.market_cap_lower_than = options.marketCapLowerThan;
|
|
279
|
+
if (options.priceMoreThan !== void 0) body.price_more_than = options.priceMoreThan;
|
|
280
|
+
if (options.priceLowerThan !== void 0) body.price_lower_than = options.priceLowerThan;
|
|
281
|
+
if (options.changePercentageMoreThan !== void 0) body.change_percentage_more_than = options.changePercentageMoreThan;
|
|
282
|
+
if (options.changePercentageLowerThan !== void 0) body.change_percentage_lower_than = options.changePercentageLowerThan;
|
|
283
|
+
if (options.volumeMoreThan !== void 0) body.volume_more_than = options.volumeMoreThan;
|
|
284
|
+
if (options.volumeLowerThan !== void 0) body.volume_lower_than = options.volumeLowerThan;
|
|
285
|
+
if (options.country) body.country = options.country;
|
|
286
|
+
if (options.exchange) body.exchange = options.exchange;
|
|
287
|
+
if (options.dividendYieldMoreThan !== void 0) body.dividend_yield_more_than = options.dividendYieldMoreThan;
|
|
288
|
+
if (options.dividendYieldLowerThan !== void 0) body.dividend_yield_lower_than = options.dividendYieldLowerThan;
|
|
289
|
+
if (options.peTtmMoreThan !== void 0) body.pe_ttm_more_than = options.peTtmMoreThan;
|
|
290
|
+
if (options.peTtmLowerThan !== void 0) body.pe_ttm_lower_than = options.peTtmLowerThan;
|
|
245
291
|
const response = await this.client.post(
|
|
246
292
|
"/v1/stock/screener",
|
|
247
|
-
|
|
248
|
-
market: options.market,
|
|
249
|
-
sector: options.sector,
|
|
250
|
-
min_market_cap: options.minMarketCap,
|
|
251
|
-
max_market_cap: options.maxMarketCap,
|
|
252
|
-
min_pe: options.minPe,
|
|
253
|
-
max_pe: options.maxPe,
|
|
254
|
-
limit: options.limit || 50
|
|
255
|
-
}
|
|
293
|
+
body
|
|
256
294
|
);
|
|
257
295
|
return this.normalizeArrayResponse(response);
|
|
258
296
|
}
|
|
259
297
|
/**
|
|
260
298
|
* Get earnings announcement calendar
|
|
299
|
+
*
|
|
300
|
+
* @param options.market - Required: Stock market (cn, hk, us)
|
|
301
|
+
* @param options.startDate - Required: Start date (YYYY-MM-DD)
|
|
302
|
+
* @param options.endDate - Required: End date (YYYY-MM-DD)
|
|
303
|
+
* @param options.symbol - Optional: Stock symbol
|
|
261
304
|
*/
|
|
262
|
-
async earningsCalendar(options
|
|
305
|
+
async earningsCalendar(options) {
|
|
306
|
+
const body = {
|
|
307
|
+
market: options.market,
|
|
308
|
+
start_date: options.startDate,
|
|
309
|
+
end_date: options.endDate
|
|
310
|
+
};
|
|
311
|
+
if (options.symbol) body.symbol = options.symbol;
|
|
263
312
|
const response = await this.client.post(
|
|
264
313
|
"/v1/stock/earnings-calendar",
|
|
265
|
-
|
|
266
|
-
market: options.market || "us",
|
|
267
|
-
start_date: options.startDate,
|
|
268
|
-
end_date: options.endDate,
|
|
269
|
-
symbol: options.symbol
|
|
270
|
-
}
|
|
314
|
+
body
|
|
271
315
|
);
|
|
272
316
|
return this.normalizeArrayResponse(response);
|
|
273
317
|
}
|
|
274
318
|
/**
|
|
275
319
|
* Get Hong Kong IPO calendar
|
|
276
320
|
*/
|
|
277
|
-
async ipoCalendarHK(status
|
|
321
|
+
async ipoCalendarHK(status) {
|
|
278
322
|
const response = await this.client.post(
|
|
279
323
|
"/v1/stock/ipo-calendar-hk",
|
|
280
324
|
{ status }
|
|
@@ -364,184 +408,247 @@ var StockModule = class {
|
|
|
364
408
|
}
|
|
365
409
|
};
|
|
366
410
|
|
|
367
|
-
// src/
|
|
368
|
-
var
|
|
411
|
+
// src/docs.ts
|
|
412
|
+
var DocsModule = class {
|
|
369
413
|
constructor(client) {
|
|
370
414
|
this.client = client;
|
|
371
415
|
}
|
|
372
416
|
/**
|
|
373
|
-
* Get
|
|
374
|
-
*
|
|
375
|
-
* Returns recent content related to companies the user is following.
|
|
417
|
+
* Get document content and metadata
|
|
376
418
|
*
|
|
377
|
-
* @param
|
|
419
|
+
* @param docId - Document ID
|
|
378
420
|
*/
|
|
379
|
-
async
|
|
380
|
-
|
|
381
|
-
"/v1/tools/timeline/companies",
|
|
382
|
-
{ num: options.num || 10 }
|
|
383
|
-
);
|
|
384
|
-
return response.docs || [];
|
|
421
|
+
async get(docId) {
|
|
422
|
+
return this.client.get(`/v1/docs/${docId}`);
|
|
385
423
|
}
|
|
386
424
|
/**
|
|
387
|
-
* Get
|
|
388
|
-
*
|
|
389
|
-
* Returns recent content related to custom topics the user is following.
|
|
425
|
+
* Get document summary
|
|
390
426
|
*
|
|
391
|
-
* @param
|
|
427
|
+
* @param docId - Document ID
|
|
392
428
|
*/
|
|
393
|
-
async
|
|
394
|
-
|
|
395
|
-
"/v1/tools/timeline/topics",
|
|
396
|
-
{ num: options.num || 10 }
|
|
397
|
-
);
|
|
398
|
-
return response.docs || [];
|
|
429
|
+
async summary(docId) {
|
|
430
|
+
return this.client.get(`/v1/docs/${docId}/summary`);
|
|
399
431
|
}
|
|
400
432
|
/**
|
|
401
|
-
* Get
|
|
402
|
-
*
|
|
403
|
-
* Returns recent content from research institutions, banks, etc.
|
|
433
|
+
* Get raw document content
|
|
404
434
|
*
|
|
405
|
-
* @param
|
|
435
|
+
* @param docId - Document ID
|
|
406
436
|
*/
|
|
407
|
-
async
|
|
408
|
-
|
|
409
|
-
"/v1/tools/timeline/institutes",
|
|
410
|
-
{ num: options.num || 10 }
|
|
411
|
-
);
|
|
412
|
-
return response.docs || [];
|
|
437
|
+
async rawContent(docId) {
|
|
438
|
+
return this.client.get(`/v1/docs/${docId}/raw-content`);
|
|
413
439
|
}
|
|
414
440
|
/**
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
* Returns recent content from public media accounts.
|
|
441
|
+
* List documents with filters
|
|
418
442
|
*
|
|
419
|
-
* @param options
|
|
443
|
+
* @param options - Filter options
|
|
420
444
|
*/
|
|
421
|
-
async
|
|
422
|
-
const
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
445
|
+
async list(options = {}) {
|
|
446
|
+
const body = {
|
|
447
|
+
page_num: options.pageNum || 1,
|
|
448
|
+
page_size: options.pageSize || 10
|
|
449
|
+
};
|
|
450
|
+
if (options.symbols) body.symbols = options.symbols;
|
|
451
|
+
if (options.categories) body.categories = options.categories;
|
|
452
|
+
if (options.markets) body.markets = options.markets;
|
|
453
|
+
if (options.institutions) body.institutions = options.institutions;
|
|
454
|
+
if (options.tags) body.tags = options.tags;
|
|
455
|
+
if (options.startDate) body.start_date = options.startDate;
|
|
456
|
+
if (options.endDate) body.end_date = options.endDate;
|
|
457
|
+
if (options.minScore !== void 0) body.min_score = options.minScore;
|
|
458
|
+
if (options.extendedFilters) body.extended_filters = options.extendedFilters;
|
|
459
|
+
if (options.folderIds) body.folder_ids = options.folderIds;
|
|
460
|
+
const response = await this.client.post("/v1/docs", body);
|
|
461
|
+
return {
|
|
462
|
+
items: response.docs || [],
|
|
463
|
+
total: response.total_count || 0,
|
|
464
|
+
page: response.page_num || 1,
|
|
465
|
+
pageSize: response.page_size || 10
|
|
466
|
+
};
|
|
427
467
|
}
|
|
428
468
|
/**
|
|
429
|
-
*
|
|
430
|
-
*
|
|
431
|
-
* Returns recent content from social media accounts.
|
|
469
|
+
* Query documents by symbols
|
|
432
470
|
*
|
|
433
|
-
* @param
|
|
471
|
+
* @param symbols - Required: Stock symbols
|
|
472
|
+
* @param options - Filter options
|
|
434
473
|
*/
|
|
435
|
-
async
|
|
436
|
-
const
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
474
|
+
async queryBySymbols(symbols, options = {}) {
|
|
475
|
+
const body = {
|
|
476
|
+
symbols,
|
|
477
|
+
page_num: options.pageNum || 1,
|
|
478
|
+
page_size: options.pageSize || 10
|
|
479
|
+
};
|
|
480
|
+
if (options.categories) body.categories = options.categories;
|
|
481
|
+
if (options.markets) body.markets = options.markets;
|
|
482
|
+
if (options.startDate) body.start_date = options.startDate;
|
|
483
|
+
if (options.endDate) body.end_date = options.endDate;
|
|
484
|
+
const response = await this.client.post("/v1/docs/symbols", body);
|
|
485
|
+
return {
|
|
486
|
+
items: response.docs || [],
|
|
487
|
+
total: response.total_count || 0,
|
|
488
|
+
page: response.page_num || 1,
|
|
489
|
+
pageSize: response.page_size || 10
|
|
490
|
+
};
|
|
448
491
|
}
|
|
449
492
|
/**
|
|
450
|
-
*
|
|
493
|
+
* Query documents by tags
|
|
451
494
|
*
|
|
452
|
-
*
|
|
495
|
+
* @param tags - Required: Document tags
|
|
496
|
+
* @param options - Filter options
|
|
497
|
+
*/
|
|
498
|
+
async queryByTags(tags, options = {}) {
|
|
499
|
+
const body = {
|
|
500
|
+
tags,
|
|
501
|
+
page_num: options.pageNum || 1,
|
|
502
|
+
page_size: options.pageSize || 10
|
|
503
|
+
};
|
|
504
|
+
if (options.categories) body.categories = options.categories;
|
|
505
|
+
if (options.markets) body.markets = options.markets;
|
|
506
|
+
if (options.startDate) body.start_date = options.startDate;
|
|
507
|
+
if (options.endDate) body.end_date = options.endDate;
|
|
508
|
+
const response = await this.client.post("/v1/docs/tags", body);
|
|
509
|
+
return {
|
|
510
|
+
items: response.docs || [],
|
|
511
|
+
total: response.total_count || 0,
|
|
512
|
+
page: response.page_num || 1,
|
|
513
|
+
pageSize: response.page_size || 10
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Search document chunks semantically
|
|
453
518
|
*
|
|
454
519
|
* @param query - Search query string
|
|
455
520
|
* @param options - Search options
|
|
456
|
-
*
|
|
457
|
-
* @example
|
|
458
|
-
* ```typescript
|
|
459
|
-
* const results = await client.kb.search('quarterly revenue', { num: 5 });
|
|
460
|
-
* results.forEach(chunk => console.log(chunk.content));
|
|
461
|
-
* ```
|
|
462
521
|
*/
|
|
463
|
-
async
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
);
|
|
522
|
+
async searchChunks(query, options = {}) {
|
|
523
|
+
const body = {
|
|
524
|
+
query,
|
|
525
|
+
num: options.num || 10
|
|
526
|
+
};
|
|
527
|
+
if (options.symbols) body.symbols = options.symbols;
|
|
528
|
+
if (options.categories) body.categories = options.categories;
|
|
529
|
+
if (options.folderIds) body.folder_ids = options.folderIds;
|
|
530
|
+
if (options.docIds) body.doc_ids = options.docIds;
|
|
531
|
+
if (options.markets) body.markets = options.markets;
|
|
532
|
+
if (options.institutions) body.institutions = options.institutions;
|
|
533
|
+
if (options.tags) body.tags = options.tags;
|
|
534
|
+
if (options.startDate) body.start_date = options.startDate;
|
|
535
|
+
if (options.endDate) body.end_date = options.endDate;
|
|
536
|
+
if (options.minScore !== void 0) body.min_score = options.minScore;
|
|
537
|
+
if (options.extendedFilters) body.extended_filters = options.extendedFilters;
|
|
538
|
+
if (options.includeDocExtraDetails !== void 0) body.include_doc_extra_details = options.includeDocExtraDetails;
|
|
539
|
+
if (options.refineQuestion !== void 0) body.refine_question = options.refineQuestion;
|
|
540
|
+
if (options.dateRange) body.date_range = options.dateRange;
|
|
541
|
+
const response = await this.client.post("/v1/search/chunks", body);
|
|
475
542
|
return response.chunks || [];
|
|
476
543
|
}
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
//
|
|
480
|
-
var DocsModule = class {
|
|
481
|
-
constructor(client) {
|
|
482
|
-
this.client = client;
|
|
483
|
-
}
|
|
544
|
+
// ===========================================================================
|
|
545
|
+
// Folder Management
|
|
546
|
+
// ===========================================================================
|
|
484
547
|
/**
|
|
485
|
-
*
|
|
548
|
+
* Create a new document folder
|
|
486
549
|
*
|
|
487
|
-
* @param
|
|
550
|
+
* @param name - Folder name
|
|
551
|
+
* @returns Folder ID
|
|
488
552
|
*/
|
|
489
|
-
async
|
|
490
|
-
|
|
553
|
+
async createFolder(name) {
|
|
554
|
+
const response = await this.client.post("/v1/docs/folder/create", { name });
|
|
555
|
+
return { folderId: response.folder_id };
|
|
491
556
|
}
|
|
492
557
|
/**
|
|
493
|
-
*
|
|
558
|
+
* Delete a document folder and all files within it
|
|
494
559
|
*
|
|
495
|
-
* @param
|
|
560
|
+
* @param folderId - Folder ID to delete
|
|
561
|
+
* @returns Deleted folder ID and document IDs
|
|
496
562
|
*/
|
|
497
|
-
async
|
|
498
|
-
|
|
563
|
+
async deleteFolder(folderId) {
|
|
564
|
+
const response = await this.client.delete(
|
|
565
|
+
"/v1/docs/folder/delete",
|
|
566
|
+
{ folder_id: folderId }
|
|
567
|
+
);
|
|
568
|
+
return { folderId: response.folder_id, docIds: response.doc_ids };
|
|
499
569
|
}
|
|
570
|
+
// ===========================================================================
|
|
571
|
+
// Document Upload
|
|
572
|
+
// ===========================================================================
|
|
500
573
|
/**
|
|
501
|
-
*
|
|
574
|
+
* Upload documents by URL
|
|
502
575
|
*
|
|
503
|
-
* @param
|
|
576
|
+
* @param docs - Array of document upload requests
|
|
577
|
+
* @param options.folderId - Optional folder ID
|
|
578
|
+
* @param options.pdfParsingMode - PDF parsing mode (1: by page, 3: by logic)
|
|
504
579
|
*/
|
|
505
|
-
async
|
|
506
|
-
|
|
580
|
+
async uploadDocs(docs, options = {}) {
|
|
581
|
+
const body = {
|
|
582
|
+
docs: docs.map((doc) => ({
|
|
583
|
+
url: doc.url,
|
|
584
|
+
name: doc.name,
|
|
585
|
+
metadatas: doc.metadatas,
|
|
586
|
+
published_at: doc.publishedAt,
|
|
587
|
+
tags: doc.tags
|
|
588
|
+
}))
|
|
589
|
+
};
|
|
590
|
+
if (options.folderId) body.folder_id = options.folderId;
|
|
591
|
+
if (options.pdfParsingMode !== void 0) body.pdf_parsing_mode = options.pdfParsingMode;
|
|
592
|
+
const response = await this.client.post("/v1/docs/upload", body);
|
|
593
|
+
return {
|
|
594
|
+
docs: response.docs.map((doc) => ({
|
|
595
|
+
id: doc.id,
|
|
596
|
+
title: doc.title,
|
|
597
|
+
originalUrl: doc.original_url
|
|
598
|
+
}))
|
|
599
|
+
};
|
|
507
600
|
}
|
|
508
601
|
/**
|
|
509
|
-
*
|
|
602
|
+
* Upload documents by URL asynchronously
|
|
510
603
|
*
|
|
511
|
-
* @param
|
|
604
|
+
* @param docs - Array of document upload requests
|
|
605
|
+
* @param options.folderId - Optional folder ID
|
|
606
|
+
* @param options.pdfParsingMode - PDF parsing mode (1: by page, 3: by logic)
|
|
512
607
|
*/
|
|
513
|
-
async
|
|
514
|
-
const
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
608
|
+
async uploadDocsAsync(docs, options = {}) {
|
|
609
|
+
const body = {
|
|
610
|
+
docs: docs.map((doc) => ({
|
|
611
|
+
url: doc.url,
|
|
612
|
+
name: doc.name,
|
|
613
|
+
metadatas: doc.metadatas,
|
|
614
|
+
published_at: doc.publishedAt,
|
|
615
|
+
tags: doc.tags
|
|
616
|
+
}))
|
|
617
|
+
};
|
|
618
|
+
if (options.folderId) body.folder_id = options.folderId;
|
|
619
|
+
if (options.pdfParsingMode !== void 0) body.pdf_parsing_mode = options.pdfParsingMode;
|
|
620
|
+
const response = await this.client.post("/v1/docs/upload/async", body);
|
|
522
621
|
return {
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
622
|
+
docs: response.docs.map((doc) => ({
|
|
623
|
+
id: doc.id,
|
|
624
|
+
title: doc.title,
|
|
625
|
+
originalUrl: doc.original_url
|
|
626
|
+
}))
|
|
527
627
|
};
|
|
528
628
|
}
|
|
529
629
|
/**
|
|
530
|
-
*
|
|
630
|
+
* Get upload status of a document
|
|
531
631
|
*
|
|
532
|
-
* @param
|
|
533
|
-
* @
|
|
632
|
+
* @param docId - Document ID
|
|
633
|
+
* @returns Upload status (pending, processing, completed)
|
|
534
634
|
*/
|
|
535
|
-
async
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
635
|
+
async getUploadStatus(docId) {
|
|
636
|
+
return this.client.get(
|
|
637
|
+
`/v1/docs/${docId}/upload/status`
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
/**
|
|
641
|
+
* Delete documents
|
|
642
|
+
*
|
|
643
|
+
* @param docIds - Array of document IDs to delete
|
|
644
|
+
* @returns Deleted document IDs
|
|
645
|
+
*/
|
|
646
|
+
async deleteDocs(docIds) {
|
|
647
|
+
const response = await this.client.delete(
|
|
648
|
+
"/v1/docs/delete",
|
|
649
|
+
{ doc_ids: docIds }
|
|
650
|
+
);
|
|
651
|
+
return { docIds: response.doc_ids };
|
|
545
652
|
}
|
|
546
653
|
};
|
|
547
654
|
|
|
@@ -850,18 +957,633 @@ var ConceptsModule = class {
|
|
|
850
957
|
}
|
|
851
958
|
};
|
|
852
959
|
|
|
853
|
-
// src/
|
|
854
|
-
var
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
super(message);
|
|
858
|
-
this.name = "ReportifyError";
|
|
859
|
-
this.statusCode = statusCode;
|
|
960
|
+
// src/channels.ts
|
|
961
|
+
var ChannelsModule = class {
|
|
962
|
+
constructor(client) {
|
|
963
|
+
this.client = client;
|
|
860
964
|
}
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
965
|
+
/**
|
|
966
|
+
* Search for channels by query string
|
|
967
|
+
*
|
|
968
|
+
* @param query - Search query string
|
|
969
|
+
* @param options - Pagination options
|
|
970
|
+
*/
|
|
971
|
+
async search(query, options = {}) {
|
|
972
|
+
const response = await this.client.post("/v1/channels/search", {
|
|
973
|
+
query,
|
|
974
|
+
page_num: options.pageNum || 1,
|
|
975
|
+
page_size: options.pageSize || 10
|
|
976
|
+
});
|
|
977
|
+
return {
|
|
978
|
+
items: response.channels.map((ch) => ({
|
|
979
|
+
id: ch.id,
|
|
980
|
+
name: ch.name,
|
|
981
|
+
description: ch.description,
|
|
982
|
+
avatarUrl: ch.avatar_url,
|
|
983
|
+
following: ch.following
|
|
984
|
+
})),
|
|
985
|
+
total: response.total_count || 0,
|
|
986
|
+
page: response.page_num || 1,
|
|
987
|
+
pageSize: response.page_size || 10
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* Get list of channels user is following
|
|
992
|
+
*
|
|
993
|
+
* @param options - Pagination options
|
|
994
|
+
*/
|
|
995
|
+
async getFollowings(options = {}) {
|
|
996
|
+
const response = await this.client.get("/v1/channels/followings", {
|
|
997
|
+
page_num: options.pageNum || 1,
|
|
998
|
+
page_size: options.pageSize || 10
|
|
999
|
+
});
|
|
1000
|
+
return {
|
|
1001
|
+
items: response.channels.map((ch) => ({
|
|
1002
|
+
id: ch.id,
|
|
1003
|
+
name: ch.name,
|
|
1004
|
+
description: ch.description,
|
|
1005
|
+
avatarUrl: ch.avatar_url,
|
|
1006
|
+
following: ch.following
|
|
1007
|
+
})),
|
|
1008
|
+
total: response.total_count || 0,
|
|
1009
|
+
page: response.page_num || 1,
|
|
1010
|
+
pageSize: response.page_size || 10
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
/**
|
|
1014
|
+
* Follow a channel
|
|
1015
|
+
*
|
|
1016
|
+
* @param channelId - Channel ID to follow
|
|
1017
|
+
*/
|
|
1018
|
+
async follow(channelId) {
|
|
1019
|
+
const response = await this.client.post(`/v1/channels/${channelId}/follow`);
|
|
1020
|
+
return {
|
|
1021
|
+
id: response.id,
|
|
1022
|
+
name: response.name,
|
|
1023
|
+
description: response.description,
|
|
1024
|
+
avatarUrl: response.avatar_url,
|
|
1025
|
+
following: response.following
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Unfollow a channel
|
|
1030
|
+
*
|
|
1031
|
+
* @param channelId - Channel ID to unfollow
|
|
1032
|
+
*/
|
|
1033
|
+
async unfollow(channelId) {
|
|
1034
|
+
return this.client.delete(
|
|
1035
|
+
`/v1/channels/${channelId}/unfollow`
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
1038
|
+
/**
|
|
1039
|
+
* Get documents from followed channels
|
|
1040
|
+
*
|
|
1041
|
+
* @param options - Query options
|
|
1042
|
+
*/
|
|
1043
|
+
async getDocs(options = {}) {
|
|
1044
|
+
const params = {
|
|
1045
|
+
page_num: options.pageNum || 1,
|
|
1046
|
+
page_size: options.pageSize || 10
|
|
1047
|
+
};
|
|
1048
|
+
if (options.channelIds) params.channel_ids = options.channelIds;
|
|
1049
|
+
const response = await this.client.get("/v1/channels/followings/docs", params);
|
|
1050
|
+
return {
|
|
1051
|
+
items: response.docs || [],
|
|
1052
|
+
total: response.total_count || 0,
|
|
1053
|
+
page: response.page_num || 1,
|
|
1054
|
+
pageSize: response.page_size || 10
|
|
1055
|
+
};
|
|
1056
|
+
}
|
|
1057
|
+
};
|
|
1058
|
+
|
|
1059
|
+
// src/chat.ts
|
|
1060
|
+
var ChatModule = class {
|
|
1061
|
+
constructor(client) {
|
|
1062
|
+
this.client = client;
|
|
1063
|
+
}
|
|
1064
|
+
/**
|
|
1065
|
+
* Chat completion based on document content
|
|
1066
|
+
*
|
|
1067
|
+
* @param query - User query
|
|
1068
|
+
* @param options - Chat options
|
|
1069
|
+
*/
|
|
1070
|
+
async completion(query, options = {}) {
|
|
1071
|
+
const body = {
|
|
1072
|
+
query,
|
|
1073
|
+
mode: options.mode || "concise",
|
|
1074
|
+
session_id: options.sessionId || "",
|
|
1075
|
+
stream: options.stream ?? true
|
|
1076
|
+
};
|
|
1077
|
+
if (options.folderIds) body.folder_ids = options.folderIds;
|
|
1078
|
+
if (options.docIds) body.doc_ids = options.docIds;
|
|
1079
|
+
if (options.categories) body.categories = options.categories;
|
|
1080
|
+
if (options.markets) body.markets = options.markets;
|
|
1081
|
+
if (options.institutions) body.institutions = options.institutions;
|
|
1082
|
+
if (options.symbols) body.symbols = options.symbols;
|
|
1083
|
+
if (options.tags) body.tags = options.tags;
|
|
1084
|
+
if (options.startDate) body.start_date = options.startDate;
|
|
1085
|
+
if (options.endDate) body.end_date = options.endDate;
|
|
1086
|
+
if (options.minScore !== void 0) body.min_score = options.minScore;
|
|
1087
|
+
if (options.extendedFilters) body.extended_filters = options.extendedFilters;
|
|
1088
|
+
const response = await this.client.post("/v1/chat/completion", body);
|
|
1089
|
+
return {
|
|
1090
|
+
type: response.type,
|
|
1091
|
+
messageId: response.message_id,
|
|
1092
|
+
message: response.message,
|
|
1093
|
+
extra: response.extra
|
|
1094
|
+
};
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
// src/agent.ts
|
|
1099
|
+
var AgentModule = class {
|
|
1100
|
+
constructor(client) {
|
|
1101
|
+
this.client = client;
|
|
1102
|
+
}
|
|
1103
|
+
/**
|
|
1104
|
+
* Create a new agent conversation
|
|
1105
|
+
*
|
|
1106
|
+
* @param agentId - Agent ID
|
|
1107
|
+
* @param title - Optional conversation title
|
|
1108
|
+
*/
|
|
1109
|
+
async createConversation(agentId, title) {
|
|
1110
|
+
const body = { agent_id: agentId };
|
|
1111
|
+
if (title) body.title = title;
|
|
1112
|
+
const response = await this.client.post("/v1/agent/conversations", body);
|
|
1113
|
+
return {
|
|
1114
|
+
id: response.id,
|
|
1115
|
+
userId: response.user_id,
|
|
1116
|
+
agentId: response.agent_id,
|
|
1117
|
+
type: response.type,
|
|
1118
|
+
title: response.title,
|
|
1119
|
+
status: response.status,
|
|
1120
|
+
createdAt: response.created_at,
|
|
1121
|
+
updatedAt: response.updated_at
|
|
1122
|
+
};
|
|
1123
|
+
}
|
|
1124
|
+
/**
|
|
1125
|
+
* Chat with agent in a conversation
|
|
1126
|
+
*
|
|
1127
|
+
* @param conversationId - Conversation ID
|
|
1128
|
+
* @param message - User message
|
|
1129
|
+
* @param options - Chat options
|
|
1130
|
+
*/
|
|
1131
|
+
async chat(conversationId, message, options = {}) {
|
|
1132
|
+
const body = {
|
|
1133
|
+
message,
|
|
1134
|
+
stream: options.stream ?? true
|
|
1135
|
+
};
|
|
1136
|
+
if (options.documents) {
|
|
1137
|
+
body.documents = options.documents.map((doc) => ({
|
|
1138
|
+
doc_id: doc.docId,
|
|
1139
|
+
doc_title: doc.docTitle,
|
|
1140
|
+
file_type: doc.fileType
|
|
1141
|
+
}));
|
|
1142
|
+
}
|
|
1143
|
+
return this.client.post(`/v1/agent/conversations/${conversationId}/chat`, body);
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Get conversation details
|
|
1147
|
+
*
|
|
1148
|
+
* @param conversationId - Conversation ID
|
|
1149
|
+
*/
|
|
1150
|
+
async getConversation(conversationId) {
|
|
1151
|
+
const response = await this.client.get(`/v1/agent/conversations/${conversationId}`);
|
|
1152
|
+
return {
|
|
1153
|
+
id: response.id,
|
|
1154
|
+
userId: response.user_id,
|
|
1155
|
+
agentId: response.agent_id,
|
|
1156
|
+
type: response.type,
|
|
1157
|
+
title: response.title,
|
|
1158
|
+
status: response.status,
|
|
1159
|
+
createdAt: response.created_at,
|
|
1160
|
+
updatedAt: response.updated_at
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1163
|
+
/**
|
|
1164
|
+
* List messages in a conversation
|
|
1165
|
+
*
|
|
1166
|
+
* @param conversationId - Conversation ID
|
|
1167
|
+
* @param options - Query options
|
|
1168
|
+
*/
|
|
1169
|
+
async listMessages(conversationId, options = {}) {
|
|
1170
|
+
const params = {
|
|
1171
|
+
limit: options.limit || 10
|
|
1172
|
+
};
|
|
1173
|
+
if (options.beforeMessageId) params.before_message_id = options.beforeMessageId;
|
|
1174
|
+
const response = await this.client.get(`/v1/agent/conversations/${conversationId}/messages`, params);
|
|
1175
|
+
return {
|
|
1176
|
+
messages: response.messages.map((msg) => ({
|
|
1177
|
+
id: msg.id,
|
|
1178
|
+
userId: msg.user_id,
|
|
1179
|
+
conversationId: msg.conversation_id,
|
|
1180
|
+
turnId: msg.turn_id,
|
|
1181
|
+
role: msg.role,
|
|
1182
|
+
replyToMessageId: msg.reply_to_message_id,
|
|
1183
|
+
content: msg.content,
|
|
1184
|
+
status: msg.status,
|
|
1185
|
+
errorInfo: msg.error_info,
|
|
1186
|
+
assistantMessageId: msg.assistant_message_id,
|
|
1187
|
+
createdAt: msg.created_at,
|
|
1188
|
+
updatedAt: msg.updated_at,
|
|
1189
|
+
assistantEvents: msg.assistant_events
|
|
1190
|
+
}))
|
|
1191
|
+
};
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Get assistant message events (streaming or non-streaming)
|
|
1195
|
+
*
|
|
1196
|
+
* @param conversationId - Conversation ID
|
|
1197
|
+
* @param assistantMessageId - Assistant message ID from chat response header
|
|
1198
|
+
* @param options - Query options
|
|
1199
|
+
*/
|
|
1200
|
+
async getAssistantMessageEvents(conversationId, assistantMessageId, options = {}) {
|
|
1201
|
+
const params = {
|
|
1202
|
+
stream: options.stream ?? true,
|
|
1203
|
+
timeout: options.timeout || 1800,
|
|
1204
|
+
from_offset: options.fromOffset || 0
|
|
1205
|
+
};
|
|
1206
|
+
return this.client.get(
|
|
1207
|
+
`/v1/agent/conversations/${conversationId}/messages/${assistantMessageId}`,
|
|
1208
|
+
params
|
|
1209
|
+
);
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* Cancel agent execution
|
|
1213
|
+
*
|
|
1214
|
+
* @param conversationId - Conversation ID
|
|
1215
|
+
* @param assistantMessageId - Assistant message ID
|
|
1216
|
+
*/
|
|
1217
|
+
async cancelExecution(conversationId, assistantMessageId) {
|
|
1218
|
+
const response = await this.client.post(`/v1/agent/conversations/${conversationId}/messages/${assistantMessageId}/cancel`);
|
|
1219
|
+
return {
|
|
1220
|
+
responseId: response.response_id,
|
|
1221
|
+
status: response.status
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* Get agent generated file
|
|
1226
|
+
*
|
|
1227
|
+
* @param fileId - Agent generated file ID
|
|
1228
|
+
* @returns File content as ArrayBuffer
|
|
1229
|
+
*
|
|
1230
|
+
* @example
|
|
1231
|
+
* ```typescript
|
|
1232
|
+
* const fileContent = await client.agent.getFile('file_abc123');
|
|
1233
|
+
* // Save to file in Node.js
|
|
1234
|
+
* fs.writeFileSync('output.xlsx', Buffer.from(fileContent));
|
|
1235
|
+
* ```
|
|
1236
|
+
*/
|
|
1237
|
+
async getFile(fileId) {
|
|
1238
|
+
return this.client.getBytes(`/v1/agent/files/${fileId}`);
|
|
1239
|
+
}
|
|
1240
|
+
};
|
|
1241
|
+
|
|
1242
|
+
// src/kb.ts
|
|
1243
|
+
var KBModule = class {
|
|
1244
|
+
constructor(client) {
|
|
1245
|
+
this.client = client;
|
|
1246
|
+
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Search user's knowledge base
|
|
1249
|
+
*
|
|
1250
|
+
* @deprecated This method uses an internal API not documented in the public OpenAPI spec.
|
|
1251
|
+
* Consider using client.docs.searchChunks() instead.
|
|
1252
|
+
*
|
|
1253
|
+
* Performs semantic search across documents the user has uploaded
|
|
1254
|
+
* to their personal knowledge base.
|
|
1255
|
+
*
|
|
1256
|
+
* @param query - Search query string
|
|
1257
|
+
* @param options - Search options
|
|
1258
|
+
*
|
|
1259
|
+
* @example
|
|
1260
|
+
* ```typescript
|
|
1261
|
+
* const results = await client.kb.search('quarterly revenue', { num: 5 });
|
|
1262
|
+
* results.forEach(chunk => console.log(chunk.content));
|
|
1263
|
+
* ```
|
|
1264
|
+
*/
|
|
1265
|
+
async search(query, options = {}) {
|
|
1266
|
+
console.warn(
|
|
1267
|
+
"kb.search() uses an internal API not documented in the public OpenAPI spec. Consider using docs.searchChunks() instead."
|
|
1268
|
+
);
|
|
1269
|
+
const body = {
|
|
1270
|
+
query,
|
|
1271
|
+
num: options.num || 10
|
|
1272
|
+
};
|
|
1273
|
+
if (options.folderIds) body.folder_ids = options.folderIds;
|
|
1274
|
+
if (options.docIds) body.doc_ids = options.docIds;
|
|
1275
|
+
if (options.startDate) body.start_date = options.startDate;
|
|
1276
|
+
if (options.endDate) body.end_date = options.endDate;
|
|
1277
|
+
const response = await this.client.post(
|
|
1278
|
+
"/v1/tools/kb/search",
|
|
1279
|
+
body
|
|
1280
|
+
);
|
|
1281
|
+
return response.chunks || [];
|
|
1282
|
+
}
|
|
1283
|
+
};
|
|
1284
|
+
|
|
1285
|
+
// src/timeline.ts
|
|
1286
|
+
function emitDeprecationWarning(methodName) {
|
|
1287
|
+
console.warn(
|
|
1288
|
+
`timeline.${methodName}() uses an internal API not documented in the public OpenAPI spec. This endpoint may change without notice.`
|
|
1289
|
+
);
|
|
1290
|
+
}
|
|
1291
|
+
var TimelineModule = class {
|
|
1292
|
+
constructor(client) {
|
|
1293
|
+
this.client = client;
|
|
1294
|
+
}
|
|
1295
|
+
/**
|
|
1296
|
+
* Get timeline for followed companies
|
|
1297
|
+
*
|
|
1298
|
+
* @deprecated This method uses an internal API not documented in the public OpenAPI spec.
|
|
1299
|
+
*
|
|
1300
|
+
* Returns recent content related to companies the user is following.
|
|
1301
|
+
*
|
|
1302
|
+
* @param options.num - Number of items to return (default: 10, max: 100)
|
|
1303
|
+
*/
|
|
1304
|
+
async companies(options = {}) {
|
|
1305
|
+
emitDeprecationWarning("companies");
|
|
1306
|
+
const response = await this.client.post(
|
|
1307
|
+
"/v1/tools/timeline/companies",
|
|
1308
|
+
{ num: options.num || 10 }
|
|
1309
|
+
);
|
|
1310
|
+
return response.docs || [];
|
|
1311
|
+
}
|
|
1312
|
+
/**
|
|
1313
|
+
* Get timeline for followed topics
|
|
1314
|
+
*
|
|
1315
|
+
* @deprecated This method uses an internal API not documented in the public OpenAPI spec.
|
|
1316
|
+
*
|
|
1317
|
+
* Returns recent content related to custom topics the user is following.
|
|
1318
|
+
*
|
|
1319
|
+
* @param options.num - Number of items to return
|
|
1320
|
+
*/
|
|
1321
|
+
async topics(options = {}) {
|
|
1322
|
+
emitDeprecationWarning("topics");
|
|
1323
|
+
const response = await this.client.post(
|
|
1324
|
+
"/v1/tools/timeline/topics",
|
|
1325
|
+
{ num: options.num || 10 }
|
|
1326
|
+
);
|
|
1327
|
+
return response.docs || [];
|
|
1328
|
+
}
|
|
1329
|
+
/**
|
|
1330
|
+
* Get timeline for followed professional institutes
|
|
1331
|
+
*
|
|
1332
|
+
* @deprecated This method uses an internal API not documented in the public OpenAPI spec.
|
|
1333
|
+
*
|
|
1334
|
+
* Returns recent content from research institutions, banks, etc.
|
|
1335
|
+
*
|
|
1336
|
+
* @param options.num - Number of items to return
|
|
1337
|
+
*/
|
|
1338
|
+
async institutes(options = {}) {
|
|
1339
|
+
emitDeprecationWarning("institutes");
|
|
1340
|
+
const response = await this.client.post(
|
|
1341
|
+
"/v1/tools/timeline/institutes",
|
|
1342
|
+
{ num: options.num || 10 }
|
|
1343
|
+
);
|
|
1344
|
+
return response.docs || [];
|
|
1345
|
+
}
|
|
1346
|
+
/**
|
|
1347
|
+
* Get timeline for followed public media
|
|
1348
|
+
*
|
|
1349
|
+
* @deprecated This method uses an internal API not documented in the public OpenAPI spec.
|
|
1350
|
+
*
|
|
1351
|
+
* Returns recent content from public media accounts.
|
|
1352
|
+
*
|
|
1353
|
+
* @param options.num - Number of items to return
|
|
1354
|
+
*/
|
|
1355
|
+
async publicMedia(options = {}) {
|
|
1356
|
+
emitDeprecationWarning("publicMedia");
|
|
1357
|
+
const response = await this.client.post(
|
|
1358
|
+
"/v1/tools/timeline/public-media",
|
|
1359
|
+
{ num: options.num || 10 }
|
|
1360
|
+
);
|
|
1361
|
+
return response.docs || [];
|
|
1362
|
+
}
|
|
1363
|
+
/**
|
|
1364
|
+
* Get timeline for followed social media
|
|
1365
|
+
*
|
|
1366
|
+
* @deprecated This method uses an internal API not documented in the public OpenAPI spec.
|
|
1367
|
+
*
|
|
1368
|
+
* Returns recent content from social media accounts.
|
|
1369
|
+
*
|
|
1370
|
+
* @param options.num - Number of items to return
|
|
1371
|
+
*/
|
|
1372
|
+
async socialMedia(options = {}) {
|
|
1373
|
+
emitDeprecationWarning("socialMedia");
|
|
1374
|
+
const response = await this.client.post(
|
|
1375
|
+
"/v1/tools/timeline/social-media",
|
|
1376
|
+
{ num: options.num || 10 }
|
|
1377
|
+
);
|
|
1378
|
+
return response.docs || [];
|
|
1379
|
+
}
|
|
1380
|
+
};
|
|
1381
|
+
|
|
1382
|
+
// src/user.ts
|
|
1383
|
+
var UserModule = class {
|
|
1384
|
+
constructor(client) {
|
|
1385
|
+
this.client = client;
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Get all companies followed by the user
|
|
1389
|
+
*
|
|
1390
|
+
* Returns a list of companies that the user is following,
|
|
1391
|
+
* including company details like symbol, name, logo, and follow timestamp.
|
|
1392
|
+
*
|
|
1393
|
+
* @example
|
|
1394
|
+
* ```typescript
|
|
1395
|
+
* const companies = await client.user.followedCompanies();
|
|
1396
|
+
* companies.forEach(company => {
|
|
1397
|
+
* console.log(`${company.symbol}: ${company.name}`);
|
|
1398
|
+
* });
|
|
1399
|
+
* ```
|
|
1400
|
+
*/
|
|
1401
|
+
async followedCompanies() {
|
|
1402
|
+
const response = await this.client.get("/v1/tools/user/followed-companies");
|
|
1403
|
+
return (response.companies || []).map((company) => ({
|
|
1404
|
+
symbol: company.symbol,
|
|
1405
|
+
ticker: company.ticker,
|
|
1406
|
+
market: company.market,
|
|
1407
|
+
name: company.name,
|
|
1408
|
+
chineseName: company.chinese_name,
|
|
1409
|
+
englishName: company.english_name,
|
|
1410
|
+
logo: company.logo,
|
|
1411
|
+
followedAt: company.followed_at
|
|
1412
|
+
}));
|
|
1413
|
+
}
|
|
1414
|
+
};
|
|
1415
|
+
|
|
1416
|
+
// src/search.ts
|
|
1417
|
+
var SearchModule = class {
|
|
1418
|
+
constructor(client) {
|
|
1419
|
+
this.client = client;
|
|
1420
|
+
}
|
|
1421
|
+
/**
|
|
1422
|
+
* Search documents across all categories
|
|
1423
|
+
*
|
|
1424
|
+
* @param query - Search query string
|
|
1425
|
+
* @param options - Search options
|
|
1426
|
+
* @returns List of matching documents
|
|
1427
|
+
*/
|
|
1428
|
+
async all(query, options = {}) {
|
|
1429
|
+
const body = {
|
|
1430
|
+
query,
|
|
1431
|
+
num: options.num || 10
|
|
1432
|
+
};
|
|
1433
|
+
if (options.categories) body.categories = options.categories;
|
|
1434
|
+
if (options.symbols) body.symbols = options.symbols;
|
|
1435
|
+
if (options.industries) body.industries = options.industries;
|
|
1436
|
+
if (options.channelIds) body.channel_ids = options.channelIds;
|
|
1437
|
+
if (options.startDatetime) body.start_datetime = options.startDatetime;
|
|
1438
|
+
if (options.endDatetime) body.end_datetime = options.endDatetime;
|
|
1439
|
+
const response = await this.client.post("/v2/search", body);
|
|
1440
|
+
return response.docs || [];
|
|
1441
|
+
}
|
|
1442
|
+
/**
|
|
1443
|
+
* Search news articles
|
|
1444
|
+
*/
|
|
1445
|
+
async news(query, options = {}) {
|
|
1446
|
+
const body = {
|
|
1447
|
+
query,
|
|
1448
|
+
num: options.num || 10
|
|
1449
|
+
};
|
|
1450
|
+
if (options.symbols) body.symbols = options.symbols;
|
|
1451
|
+
if (options.channelIds) body.channel_ids = options.channelIds;
|
|
1452
|
+
if (options.startDatetime) body.start_datetime = options.startDatetime;
|
|
1453
|
+
if (options.endDatetime) body.end_datetime = options.endDatetime;
|
|
1454
|
+
const response = await this.client.post("/v2/search/news", body);
|
|
1455
|
+
return response.docs || [];
|
|
1456
|
+
}
|
|
1457
|
+
/**
|
|
1458
|
+
* Search research reports
|
|
1459
|
+
*/
|
|
1460
|
+
async reports(query, options = {}) {
|
|
1461
|
+
const body = {
|
|
1462
|
+
query,
|
|
1463
|
+
num: options.num || 10
|
|
1464
|
+
};
|
|
1465
|
+
if (options.symbols) body.symbols = options.symbols;
|
|
1466
|
+
if (options.industries) body.industries = options.industries;
|
|
1467
|
+
if (options.channelIds) body.channel_ids = options.channelIds;
|
|
1468
|
+
if (options.startDatetime) body.start_datetime = options.startDatetime;
|
|
1469
|
+
if (options.endDatetime) body.end_datetime = options.endDatetime;
|
|
1470
|
+
const response = await this.client.post("/v2/search/reports", body);
|
|
1471
|
+
return response.docs || [];
|
|
1472
|
+
}
|
|
1473
|
+
/**
|
|
1474
|
+
* Search company filings
|
|
1475
|
+
*
|
|
1476
|
+
* @param query - Search query string
|
|
1477
|
+
* @param symbols - Required: Stock symbols to filter by
|
|
1478
|
+
* @param options - Search options
|
|
1479
|
+
*/
|
|
1480
|
+
async filings(query, symbols, options = {}) {
|
|
1481
|
+
const body = {
|
|
1482
|
+
query,
|
|
1483
|
+
symbols,
|
|
1484
|
+
num: options.num || 10
|
|
1485
|
+
};
|
|
1486
|
+
if (options.startDatetime) body.start_datetime = options.startDatetime;
|
|
1487
|
+
if (options.endDatetime) body.end_datetime = options.endDatetime;
|
|
1488
|
+
const response = await this.client.post("/v2/search/filings", body);
|
|
1489
|
+
return response.docs || [];
|
|
1490
|
+
}
|
|
1491
|
+
/**
|
|
1492
|
+
* Search earnings call transcripts and slides
|
|
1493
|
+
*
|
|
1494
|
+
* @param query - Search query string
|
|
1495
|
+
* @param symbols - Required: Stock symbols to filter by
|
|
1496
|
+
* @param options - Search options including fiscal year/quarter filters
|
|
1497
|
+
*/
|
|
1498
|
+
async conferenceCalls(query, symbols, options = {}) {
|
|
1499
|
+
const body = {
|
|
1500
|
+
query,
|
|
1501
|
+
symbols,
|
|
1502
|
+
num: options.num || 10
|
|
1503
|
+
};
|
|
1504
|
+
if (options.startDatetime) body.start_datetime = options.startDatetime;
|
|
1505
|
+
if (options.endDatetime) body.end_datetime = options.endDatetime;
|
|
1506
|
+
if (options.fiscalYear) body.fiscal_year = options.fiscalYear;
|
|
1507
|
+
if (options.fiscalQuarter) body.fiscal_quarter = options.fiscalQuarter;
|
|
1508
|
+
const response = await this.client.post("/v2/search/conference-calls", body);
|
|
1509
|
+
return response.docs || [];
|
|
1510
|
+
}
|
|
1511
|
+
/**
|
|
1512
|
+
* Search earnings financial reports
|
|
1513
|
+
*
|
|
1514
|
+
* @param query - Search query string
|
|
1515
|
+
* @param symbols - Required: Stock symbols to filter by
|
|
1516
|
+
* @param options - Search options including fiscal year/quarter filters
|
|
1517
|
+
*/
|
|
1518
|
+
async earningsPack(query, symbols, options = {}) {
|
|
1519
|
+
const body = {
|
|
1520
|
+
query,
|
|
1521
|
+
symbols,
|
|
1522
|
+
num: options.num || 10
|
|
1523
|
+
};
|
|
1524
|
+
if (options.startDatetime) body.start_datetime = options.startDatetime;
|
|
1525
|
+
if (options.endDatetime) body.end_datetime = options.endDatetime;
|
|
1526
|
+
if (options.fiscalYear) body.fiscal_year = options.fiscalYear;
|
|
1527
|
+
if (options.fiscalQuarter) body.fiscal_quarter = options.fiscalQuarter;
|
|
1528
|
+
const response = await this.client.post("/v2/search/earnings-pack", body);
|
|
1529
|
+
return response.docs || [];
|
|
1530
|
+
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Search conference calls and IR (Investor Relations) meetings
|
|
1533
|
+
*/
|
|
1534
|
+
async minutes(query, options = {}) {
|
|
1535
|
+
const body = {
|
|
1536
|
+
query,
|
|
1537
|
+
num: options.num || 10
|
|
1538
|
+
};
|
|
1539
|
+
if (options.symbols) body.symbols = options.symbols;
|
|
1540
|
+
if (options.startDatetime) body.start_datetime = options.startDatetime;
|
|
1541
|
+
if (options.endDatetime) body.end_datetime = options.endDatetime;
|
|
1542
|
+
const response = await this.client.post("/v2/search/minutes", body);
|
|
1543
|
+
return response.docs || [];
|
|
1544
|
+
}
|
|
1545
|
+
/**
|
|
1546
|
+
* Search social media content
|
|
1547
|
+
*/
|
|
1548
|
+
async socials(query, options = {}) {
|
|
1549
|
+
const body = {
|
|
1550
|
+
query,
|
|
1551
|
+
num: options.num || 10
|
|
1552
|
+
};
|
|
1553
|
+
if (options.symbols) body.symbols = options.symbols;
|
|
1554
|
+
if (options.channelIds) body.channel_ids = options.channelIds;
|
|
1555
|
+
if (options.startDatetime) body.start_datetime = options.startDatetime;
|
|
1556
|
+
if (options.endDatetime) body.end_datetime = options.endDatetime;
|
|
1557
|
+
const response = await this.client.post("/v2/search/socials", body);
|
|
1558
|
+
return response.docs || [];
|
|
1559
|
+
}
|
|
1560
|
+
/**
|
|
1561
|
+
* Search webpage content
|
|
1562
|
+
*/
|
|
1563
|
+
async webpages(query, options = {}) {
|
|
1564
|
+
const body = {
|
|
1565
|
+
query,
|
|
1566
|
+
num: options.num || 10
|
|
1567
|
+
};
|
|
1568
|
+
if (options.startDatetime) body.start_datetime = options.startDatetime;
|
|
1569
|
+
if (options.endDatetime) body.end_datetime = options.endDatetime;
|
|
1570
|
+
const response = await this.client.post("/v2/search/webpages", body);
|
|
1571
|
+
return response.docs || [];
|
|
1572
|
+
}
|
|
1573
|
+
};
|
|
1574
|
+
|
|
1575
|
+
// src/types.ts
|
|
1576
|
+
var ReportifyError = class extends Error {
|
|
1577
|
+
statusCode;
|
|
1578
|
+
constructor(message, statusCode) {
|
|
1579
|
+
super(message);
|
|
1580
|
+
this.name = "ReportifyError";
|
|
1581
|
+
this.statusCode = statusCode;
|
|
1582
|
+
}
|
|
1583
|
+
};
|
|
1584
|
+
var AuthenticationError = class extends ReportifyError {
|
|
1585
|
+
constructor(message = "Invalid or missing API key") {
|
|
1586
|
+
super(message, 401);
|
|
865
1587
|
this.name = "AuthenticationError";
|
|
866
1588
|
}
|
|
867
1589
|
};
|
|
@@ -892,12 +1614,17 @@ var Reportify = class {
|
|
|
892
1614
|
baseUrl;
|
|
893
1615
|
timeout;
|
|
894
1616
|
// Sub-modules
|
|
1617
|
+
search;
|
|
895
1618
|
stock;
|
|
896
|
-
timeline;
|
|
897
|
-
kb;
|
|
898
1619
|
docs;
|
|
899
1620
|
quant;
|
|
900
1621
|
concepts;
|
|
1622
|
+
channels;
|
|
1623
|
+
chat;
|
|
1624
|
+
agent;
|
|
1625
|
+
kb;
|
|
1626
|
+
timeline;
|
|
1627
|
+
user;
|
|
901
1628
|
constructor(config) {
|
|
902
1629
|
if (!config.apiKey) {
|
|
903
1630
|
throw new AuthenticationError("API key is required");
|
|
@@ -905,12 +1632,17 @@ var Reportify = class {
|
|
|
905
1632
|
this.apiKey = config.apiKey;
|
|
906
1633
|
this.baseUrl = (config.baseUrl || DEFAULT_BASE_URL).replace(/\/$/, "");
|
|
907
1634
|
this.timeout = config.timeout || DEFAULT_TIMEOUT;
|
|
1635
|
+
this.search = new SearchModule(this);
|
|
908
1636
|
this.stock = new StockModule(this);
|
|
909
|
-
this.timeline = new TimelineModule(this);
|
|
910
|
-
this.kb = new KBModule(this);
|
|
911
1637
|
this.docs = new DocsModule(this);
|
|
912
1638
|
this.quant = new QuantModule(this);
|
|
913
1639
|
this.concepts = new ConceptsModule(this);
|
|
1640
|
+
this.channels = new ChannelsModule(this);
|
|
1641
|
+
this.chat = new ChatModule(this);
|
|
1642
|
+
this.agent = new AgentModule(this);
|
|
1643
|
+
this.kb = new KBModule(this);
|
|
1644
|
+
this.timeline = new TimelineModule(this);
|
|
1645
|
+
this.user = new UserModule(this);
|
|
914
1646
|
}
|
|
915
1647
|
/**
|
|
916
1648
|
* Make an HTTP request to the API
|
|
@@ -932,7 +1664,7 @@ var Reportify = class {
|
|
|
932
1664
|
headers: {
|
|
933
1665
|
Authorization: `Bearer ${this.apiKey}`,
|
|
934
1666
|
"Content-Type": "application/json",
|
|
935
|
-
"User-Agent": "reportify-sdk-js/0.2.
|
|
1667
|
+
"User-Agent": "reportify-sdk-js/0.2.10"
|
|
936
1668
|
},
|
|
937
1669
|
body: options.body ? JSON.stringify(options.body) : void 0,
|
|
938
1670
|
signal: controller.signal
|
|
@@ -977,90 +1709,46 @@ var Reportify = class {
|
|
|
977
1709
|
async post(path, body) {
|
|
978
1710
|
return this.request("POST", path, { body });
|
|
979
1711
|
}
|
|
980
|
-
// ===========================================================================
|
|
981
|
-
// Search Methods
|
|
982
|
-
// ===========================================================================
|
|
983
|
-
/**
|
|
984
|
-
* Search documents across all categories
|
|
985
|
-
*
|
|
986
|
-
* @param query - Search query string
|
|
987
|
-
* @param options - Search options
|
|
988
|
-
* @returns List of matching documents
|
|
989
|
-
*
|
|
990
|
-
* @example
|
|
991
|
-
* ```typescript
|
|
992
|
-
* const docs = await client.search('Tesla earnings', { num: 10 });
|
|
993
|
-
* docs.forEach(doc => console.log(doc.title));
|
|
994
|
-
* ```
|
|
995
|
-
*/
|
|
996
|
-
async search(query, options = {}) {
|
|
997
|
-
const response = await this.post("/v2/search", {
|
|
998
|
-
query,
|
|
999
|
-
num: options.num || 10,
|
|
1000
|
-
categories: options.categories,
|
|
1001
|
-
symbols: options.symbols,
|
|
1002
|
-
start_date: options.startDate,
|
|
1003
|
-
end_date: options.endDate
|
|
1004
|
-
});
|
|
1005
|
-
return response.docs || [];
|
|
1006
|
-
}
|
|
1007
1712
|
/**
|
|
1008
|
-
*
|
|
1713
|
+
* Make a DELETE request
|
|
1009
1714
|
*/
|
|
1010
|
-
async
|
|
1011
|
-
|
|
1012
|
-
query,
|
|
1013
|
-
num: options.num || 10,
|
|
1014
|
-
symbols: options.symbols,
|
|
1015
|
-
start_date: options.startDate,
|
|
1016
|
-
end_date: options.endDate
|
|
1017
|
-
});
|
|
1018
|
-
return response.docs || [];
|
|
1715
|
+
async delete(path, body) {
|
|
1716
|
+
return this.request("DELETE", path, { body });
|
|
1019
1717
|
}
|
|
1020
1718
|
/**
|
|
1021
|
-
*
|
|
1719
|
+
* Make a GET request and return raw bytes (for file downloads)
|
|
1022
1720
|
*/
|
|
1023
|
-
async
|
|
1024
|
-
const
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
}
|
|
1033
|
-
/**
|
|
1034
|
-
* Search company filings
|
|
1035
|
-
*/
|
|
1036
|
-
async searchFilings(query, options = {}) {
|
|
1037
|
-
const response = await this.post("/v2/search/filings", {
|
|
1038
|
-
query,
|
|
1039
|
-
num: options.num || 10,
|
|
1040
|
-
symbols: options.symbols,
|
|
1041
|
-
start_date: options.startDate,
|
|
1042
|
-
end_date: options.endDate
|
|
1043
|
-
});
|
|
1044
|
-
return response.docs || [];
|
|
1045
|
-
}
|
|
1046
|
-
/**
|
|
1047
|
-
* Search earnings call transcripts
|
|
1048
|
-
*/
|
|
1049
|
-
async searchTranscripts(query, options = {}) {
|
|
1050
|
-
const response = await this.post("/v2/search/conference-calls", {
|
|
1051
|
-
query,
|
|
1052
|
-
num: options.num || 10,
|
|
1053
|
-
symbols: options.symbols,
|
|
1054
|
-
start_date: options.startDate,
|
|
1055
|
-
end_date: options.endDate
|
|
1721
|
+
async getBytes(path) {
|
|
1722
|
+
const url = `${this.baseUrl}${path}`;
|
|
1723
|
+
const response = await fetch(url, {
|
|
1724
|
+
method: "GET",
|
|
1725
|
+
headers: {
|
|
1726
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
1727
|
+
"Content-Type": "application/json",
|
|
1728
|
+
"User-Agent": "reportify-sdk-typescript/0.2.10"
|
|
1729
|
+
}
|
|
1056
1730
|
});
|
|
1057
|
-
|
|
1731
|
+
if (!response.ok) {
|
|
1732
|
+
if (response.status === 401) {
|
|
1733
|
+
throw new AuthenticationError("Invalid API key");
|
|
1734
|
+
} else if (response.status === 404) {
|
|
1735
|
+
throw new NotFoundError(`Resource not found: ${path}`);
|
|
1736
|
+
} else if (response.status === 429) {
|
|
1737
|
+
throw new RateLimitError("Rate limit exceeded");
|
|
1738
|
+
} else {
|
|
1739
|
+
throw new APIError(`API error: ${response.status}`);
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
return response.arrayBuffer();
|
|
1058
1743
|
}
|
|
1059
1744
|
};
|
|
1060
1745
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1061
1746
|
0 && (module.exports = {
|
|
1062
1747
|
APIError,
|
|
1748
|
+
AgentModule,
|
|
1063
1749
|
AuthenticationError,
|
|
1750
|
+
ChannelsModule,
|
|
1751
|
+
ChatModule,
|
|
1064
1752
|
ConceptsModule,
|
|
1065
1753
|
DocsModule,
|
|
1066
1754
|
KBModule,
|
|
@@ -1069,6 +1757,8 @@ var Reportify = class {
|
|
|
1069
1757
|
RateLimitError,
|
|
1070
1758
|
Reportify,
|
|
1071
1759
|
ReportifyError,
|
|
1760
|
+
SearchModule,
|
|
1072
1761
|
StockModule,
|
|
1073
|
-
TimelineModule
|
|
1762
|
+
TimelineModule,
|
|
1763
|
+
UserModule
|
|
1074
1764
|
});
|