gangtise-openapi-cli 0.5.1 → 0.7.0
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/README.md +43 -16
- package/dist/src/cli.js +156 -69
- package/dist/src/core/args.js +0 -1
- package/dist/src/core/auth.js +0 -1
- package/dist/src/core/client.js +14 -22
- package/dist/src/core/config.js +0 -1
- package/dist/src/core/endpoints.js +67 -12
- package/dist/src/core/errors.js +0 -1
- package/dist/src/core/lookupData/announcement-categories.js +554 -0
- package/dist/src/core/lookupData/broker-orgs.js +722 -0
- package/dist/src/core/lookupData/index.js +19 -0
- package/dist/src/core/lookupData/industries.js +157 -0
- package/dist/src/core/lookupData/industry-codes.js +126 -0
- package/dist/src/core/lookupData/meeting-orgs.js +522 -0
- package/dist/src/core/lookupData/regions.js +78 -0
- package/dist/src/core/lookupData/research-areas.js +266 -0
- package/dist/src/core/lookupData/theme-ids.js +1614 -0
- package/dist/src/core/lookupData/types.js +1 -0
- package/dist/src/core/normalize.js +0 -1
- package/dist/src/core/output.js +0 -1
- package/package.json +2 -3
- package/dist/src/cli.js.map +0 -1
- package/dist/src/core/args.js.map +0 -1
- package/dist/src/core/auth.js.map +0 -1
- package/dist/src/core/client.js.map +0 -1
- package/dist/src/core/config.js.map +0 -1
- package/dist/src/core/endpoints.js.map +0 -1
- package/dist/src/core/errors.js.map +0 -1
- package/dist/src/core/lookupData.js +0 -1816
- package/dist/src/core/lookupData.js.map +0 -1
- package/dist/src/core/normalize.js.map +0 -1
- package/dist/src/core/output.js.map +0 -1
package/dist/src/core/client.js
CHANGED
|
@@ -2,7 +2,7 @@ import { request } from "undici";
|
|
|
2
2
|
import { normalizeToken, readTokenCache, requireAccessCredentials, writeTokenCache } from "./auth.js";
|
|
3
3
|
import { ApiError, ValidationError } from "./errors.js";
|
|
4
4
|
import { ENDPOINTS, ENDPOINT_REGISTRY } from "./endpoints.js";
|
|
5
|
-
import {
|
|
5
|
+
import { getLookupData } from "./lookupData/index.js";
|
|
6
6
|
export class GangtiseClient {
|
|
7
7
|
config;
|
|
8
8
|
constructor(config) {
|
|
@@ -47,26 +47,19 @@ export class GangtiseClient {
|
|
|
47
47
|
return parsed;
|
|
48
48
|
}
|
|
49
49
|
async readLocalLookup(endpoint) {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return REGIONS;
|
|
64
|
-
}
|
|
65
|
-
if (endpoint.key === "lookup.announcement-categories.list") {
|
|
66
|
-
return ANNOUNCEMENT_CATEGORIES;
|
|
67
|
-
}
|
|
68
|
-
if (endpoint.key === "lookup.industry-codes.list") {
|
|
69
|
-
return INDUSTRY_CODES;
|
|
50
|
+
const keyMapping = {
|
|
51
|
+
"lookup.research-areas.list": "research-areas",
|
|
52
|
+
"lookup.broker-orgs.list": "broker-orgs",
|
|
53
|
+
"lookup.meeting-orgs.list": "meeting-orgs",
|
|
54
|
+
"lookup.industries.list": "industries",
|
|
55
|
+
"lookup.regions.list": "regions",
|
|
56
|
+
"lookup.announcement-categories.list": "announcement-categories",
|
|
57
|
+
"lookup.industry-codes.list": "industry-codes",
|
|
58
|
+
"lookup.theme-ids.list": "theme-ids",
|
|
59
|
+
};
|
|
60
|
+
const lookupKey = keyMapping[endpoint.key];
|
|
61
|
+
if (lookupKey) {
|
|
62
|
+
return getLookupData(lookupKey);
|
|
70
63
|
}
|
|
71
64
|
throw new ApiError(`Unsupported local lookup endpoint: ${endpoint.key}`);
|
|
72
65
|
}
|
|
@@ -253,4 +246,3 @@ export class GangtiseClient {
|
|
|
253
246
|
return this.requestJson(endpoint, body);
|
|
254
247
|
}
|
|
255
248
|
}
|
|
256
|
-
//# sourceMappingURL=client.js.map
|
package/dist/src/core/config.js
CHANGED
|
@@ -55,6 +55,13 @@ export const ENDPOINTS = {
|
|
|
55
55
|
kind: "json",
|
|
56
56
|
description: "List Shenwan industry codes from local docs",
|
|
57
57
|
},
|
|
58
|
+
lookupThemeIds: {
|
|
59
|
+
key: "lookup.theme-ids.list",
|
|
60
|
+
method: "GET",
|
|
61
|
+
path: "/guide/theme-ids-local",
|
|
62
|
+
kind: "json",
|
|
63
|
+
description: "List theme IDs from local docs",
|
|
64
|
+
},
|
|
58
65
|
insightOpinionList: {
|
|
59
66
|
key: "insight.opinion.list",
|
|
60
67
|
method: "POST",
|
|
@@ -160,14 +167,35 @@ export const ENDPOINTS = {
|
|
|
160
167
|
method: "POST",
|
|
161
168
|
path: "/application/open-quote/kline/daily",
|
|
162
169
|
kind: "json",
|
|
163
|
-
description: "Query daily kline",
|
|
170
|
+
description: "Query A-share daily kline (SH/SZ/BJ)",
|
|
171
|
+
},
|
|
172
|
+
quoteDayKlineHk: {
|
|
173
|
+
key: "quote.day-kline-hk",
|
|
174
|
+
method: "POST",
|
|
175
|
+
path: "/application/open-quote/kline-hk/daily",
|
|
176
|
+
kind: "json",
|
|
177
|
+
description: "Query HK stock daily kline (HK)",
|
|
164
178
|
},
|
|
165
179
|
fundamentalIncomeStatement: {
|
|
166
180
|
key: "fundamental.income-statement",
|
|
167
181
|
method: "POST",
|
|
168
|
-
path: "/application/open-fundamental/financial-report/income-statement",
|
|
182
|
+
path: "/application/open-fundamental/financial-report/income-statement/accumulated",
|
|
183
|
+
kind: "json",
|
|
184
|
+
description: "Query income statement (accumulated)",
|
|
185
|
+
},
|
|
186
|
+
fundamentalBalanceSheet: {
|
|
187
|
+
key: "fundamental.balance-sheet",
|
|
188
|
+
method: "POST",
|
|
189
|
+
path: "/application/open-fundamental/financial-report/balance-sheet/accumulated",
|
|
190
|
+
kind: "json",
|
|
191
|
+
description: "Query balance sheet (accumulated)",
|
|
192
|
+
},
|
|
193
|
+
fundamentalCashFlow: {
|
|
194
|
+
key: "fundamental.cash-flow",
|
|
195
|
+
method: "POST",
|
|
196
|
+
path: "/application/open-fundamental/financial-report/cash-flow-statement/accumulated",
|
|
169
197
|
kind: "json",
|
|
170
|
-
description: "Query
|
|
198
|
+
description: "Query cash flow statement (accumulated)",
|
|
171
199
|
},
|
|
172
200
|
fundamentalMainBusiness: {
|
|
173
201
|
key: "fundamental.main-business",
|
|
@@ -226,24 +254,51 @@ export const ENDPOINTS = {
|
|
|
226
254
|
kind: "json",
|
|
227
255
|
description: "Generate peer comparison",
|
|
228
256
|
},
|
|
229
|
-
|
|
230
|
-
key: "ai.
|
|
257
|
+
aiEarningsReviewGetId: {
|
|
258
|
+
key: "ai.earnings-review.get-id",
|
|
259
|
+
method: "POST",
|
|
260
|
+
path: "/application/open-ai/agent/earnings-review-getid",
|
|
261
|
+
kind: "json",
|
|
262
|
+
description: "Get earnings review ID",
|
|
263
|
+
},
|
|
264
|
+
aiEarningsReviewGetContent: {
|
|
265
|
+
key: "ai.earnings-review.get-content",
|
|
266
|
+
method: "POST",
|
|
267
|
+
path: "/application/open-ai/agent/earnings-review-getcontent",
|
|
268
|
+
kind: "json",
|
|
269
|
+
description: "Get earnings review content",
|
|
270
|
+
},
|
|
271
|
+
aiThemeTracking: {
|
|
272
|
+
key: "ai.theme-tracking",
|
|
273
|
+
method: "POST",
|
|
274
|
+
path: "/application/open-ai/agent/theme-tracking",
|
|
275
|
+
kind: "json",
|
|
276
|
+
description: "Get theme tracking daily report",
|
|
277
|
+
},
|
|
278
|
+
aiResearchOutline: {
|
|
279
|
+
key: "ai.research-outline",
|
|
280
|
+
method: "POST",
|
|
281
|
+
path: "/application/open-ai/agent/research-outline",
|
|
282
|
+
kind: "json",
|
|
283
|
+
description: "Get company research outline",
|
|
284
|
+
},
|
|
285
|
+
vaultDriveList: {
|
|
286
|
+
key: "vault.drive.list",
|
|
231
287
|
method: "POST",
|
|
232
|
-
path: "/application/open-
|
|
288
|
+
path: "/application/open-vault/drive/getList",
|
|
233
289
|
kind: "json",
|
|
234
|
-
description: "List
|
|
290
|
+
description: "List vault drive files",
|
|
235
291
|
pagination: { enabled: true, maxPageSize: 50 },
|
|
236
292
|
},
|
|
237
|
-
|
|
238
|
-
key: "
|
|
293
|
+
vaultDriveDownload: {
|
|
294
|
+
key: "vault.drive.download",
|
|
239
295
|
method: "GET",
|
|
240
|
-
path: "/application/open-
|
|
296
|
+
path: "/application/open-vault/drive/download/file",
|
|
241
297
|
kind: "download",
|
|
242
|
-
description: "Download
|
|
298
|
+
description: "Download vault drive file",
|
|
243
299
|
},
|
|
244
300
|
};
|
|
245
301
|
export const ENDPOINT_REGISTRY = Object.values(ENDPOINTS).reduce((accumulator, endpoint) => {
|
|
246
302
|
accumulator[endpoint.key] = endpoint;
|
|
247
303
|
return accumulator;
|
|
248
304
|
}, {});
|
|
249
|
-
//# sourceMappingURL=endpoints.js.map
|
package/dist/src/core/errors.js
CHANGED