gangtise-openapi-cli 0.17.1 → 0.18.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/dist/src/cli.js CHANGED
@@ -131,6 +131,7 @@ const announcement = new Command("announcement");
131
131
  const announcementHk = new Command("announcement-hk");
132
132
  const foreignOpinion = new Command("foreign-opinion");
133
133
  const independentOpinion = new Command("independent-opinion");
134
+ const officialAccount = new Command("official-account");
134
135
  addTimeFilters(opinion.command("list").option("--rank-type <number>", "Rank type", "1").option("--research-area <id>", "Research area ID", collectList, []).option("--chief <id>", "Chief ID", collectList, []).option("--security <code>", "Security code", collectList, []).option("--broker <id>", "Broker ID", collectList, []).option("--industry <id>", "Industry ID", collectList, []).option("--concept <id>", "Concept ID", collectList, []).option("--llm-tag <tag>", "Semantic tag", collectList, []).option("--source <source>", "Source", collectList, []).option("--format <format>", "Output format", "table").option("--output <path>", "Output path")).action((options) => emit(options, (client) => client.call("insight.opinion.list", {
135
136
  from: parseFrom(options.from), size: parseSize(options.size), startTime: options.startTime, endTime: options.endTime,
136
137
  rankType: parseNumberOption(options.rankType, "--rank-type", { integer: true, min: 1 }), keyword: options.keyword, researchAreaList: maybeArray(options.researchArea), chiefList: maybeArray(options.chief),
@@ -247,6 +248,16 @@ addTimeFilters(independentOpinion.command("list").option("--rank-type <number>",
247
248
  ratingList: maybeArray(options.rating), ratingChangeList: maybeArray(options.ratingChange),
248
249
  })));
249
250
  addDownloadCommand(independentOpinion, { endpointKey: "insight.independent-opinion.download", idOption: "--independent-opinion-id", idField: "independentOpinionId", fallbackPrefix: "independent-opinion", fileType: { description: "File type: 1=original HTML 2=CN-translated HTML", required: true } });
251
+ addTimeFilters(officialAccount.command("list").option("--search-type <number>", "Search type: 1=title 2=fulltext", "1").option("--rank-type <number>", "Rank type: 1=composite 2=time desc", "1").option("--account-id <id>", "Official account ID", collectList, []).option("--security <code>", "Security code (e.g. 000001.SZ)", collectList, []).option("--category <type>", "Article type: news/law/report/view/data/event/meeting/notice/recruit/investEdu/brand/notes/other", collectList, []).option("--industry <id>", "Industry ID (constant-list citicIndustry/swIndustry)", collectList, []).option("--format <format>", "Output format", "table").option("--output <path>", "Output path")).action((options) => emit(options, (client) => client.call("insight.official-account.list", {
252
+ from: parseFrom(options.from), size: parseSize(options.size),
253
+ startTime: options.startTime, endTime: options.endTime,
254
+ searchType: parseNumberOption(options.searchType, "--search-type", { integer: true, min: 1 }),
255
+ rankType: parseNumberOption(options.rankType, "--rank-type", { integer: true, min: 1 }),
256
+ keyword: options.keyword,
257
+ accountIdList: maybeArray(options.accountId), securityList: maybeArray(options.security),
258
+ categoryList: maybeArray(options.category), industryList: maybeArray(options.industry),
259
+ }), { endpointKey: "insight.official-account.list", idField: "articleId" }));
260
+ addDownloadCommand(officialAccount, { endpointKey: "insight.official-account.download", idOption: "--article-id", idField: "articleId", fallbackPrefix: "official-account", fileType: { description: "File type: 1=txt(default) 2=HTML", default: "1" }, titleListEndpoint: "insight.official-account.list" });
250
261
  insight.addCommand(opinion);
251
262
  insight.addCommand(summary);
252
263
  insight.addCommand(roadshow);
@@ -259,6 +270,7 @@ insight.addCommand(announcement);
259
270
  insight.addCommand(announcementHk);
260
271
  insight.addCommand(foreignOpinion);
261
272
  insight.addCommand(independentOpinion);
273
+ insight.addCommand(officialAccount);
262
274
  program.addCommand(insight);
263
275
  const quote = new Command("quote").description("Quote APIs");
264
276
  const addKlineCommand = (name, endpointKey, securityHelp, shardDays) => quote.command(name)
@@ -9,7 +9,10 @@ import { ENDPOINTS } from "./endpoints.js";
9
9
  import { getLookupData } from "./lookupData/index.js";
10
10
  import { getDispatcher, isVerbose, logTiming, markRetryable, runWithConcurrency, withRetry } from "./transport.js";
11
11
  const PAGINATION_CONCURRENCY = Number(process.env.GANGTISE_PAGE_CONCURRENCY ?? 5) || 5;
12
- const AUTH_RETRY_CODES = new Set(["8000014", "8000015"]);
12
+ // Auth errors that warrant a forced re-login + one replay. 8000014/8000015 are
13
+ // AK/SK errors; 0000001008 is a server-side token invalidation (the token still
14
+ // looks valid by local expiry, so only a forced refresh recovers it).
15
+ const AUTH_RETRY_CODES = new Set(["8000014", "8000015", "0000001008"]);
13
16
  export class GangtiseClient {
14
17
  config;
15
18
  refreshPromise = null;
@@ -161,6 +161,21 @@ export const ENDPOINTS = {
161
161
  kind: "download",
162
162
  description: "Download foreign independent opinion file",
163
163
  },
164
+ "insight.official-account.list": {
165
+ key: "insight.official-account.list",
166
+ method: "POST",
167
+ path: "/application/open-insight/officialAccount/getList",
168
+ kind: "json",
169
+ description: "List WeChat official account articles",
170
+ pagination: { enabled: true, maxPageSize: 50 },
171
+ },
172
+ "insight.official-account.download": {
173
+ key: "insight.official-account.download",
174
+ method: "GET",
175
+ path: "/application/open-insight/officialAccount/download/file",
176
+ kind: "download",
177
+ description: "Download WeChat official account article (txt/HTML)",
178
+ },
164
179
  // ─── reference ───
165
180
  "reference.securities-search": {
166
181
  key: "reference.securities-search",
@@ -16,6 +16,7 @@ const ERROR_HINTS = {
16
16
  "999995": "当前账号积分不足。",
17
17
  "900002": "请求缺少 uid。",
18
18
  "900001": "请求参数为空或缺少必填项。",
19
+ "0000001008": "Token 已失效(多为他处登录挤掉本会话);有 AK/SK 时 CLI 会自动重新登录重试一次,否则请重新登录。",
19
20
  "8000014": "GANGTISE_ACCESS_KEY 错误。",
20
21
  "8000015": "GANGTISE_SECRET_KEY 错误。",
21
22
  "8000016": "开发账号状态异常。",
@@ -1,2 +1,2 @@
1
1
  // Auto-generated — DO NOT EDIT
2
- export const CLI_VERSION = "0.17.1";
2
+ export const CLI_VERSION = "0.18.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gangtise-openapi-cli",
3
- "version": "0.17.1",
3
+ "version": "0.18.0",
4
4
  "description": "CLI for Gangtise OpenAPI",
5
5
  "license": "MIT",
6
6
  "repository": {