@geoly-ai/social-hub-sdk 0.1.18 → 0.1.19
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.ts +69 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -1
- package/dist/subreddit-assets.test.js +16 -0
- package/dist/subreddit-assets.test.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1849,6 +1849,57 @@ export type ScrapeUrlResponse = (ScrapeResponseCommon & {
|
|
|
1849
1849
|
export declare const CONTENT_REVIEW_AUTHOR_RELATION_MISMATCH: "AUTHOR_RELATION_MISMATCH";
|
|
1850
1850
|
/** 该错误是否为 {@link CONTENT_REVIEW_AUTHOR_RELATION_MISMATCH}(422 + 稳定 code)。 */
|
|
1851
1851
|
export declare function isAuthorRelationMismatchError(error: unknown): error is SocialHubHttpError;
|
|
1852
|
+
/**
|
|
1853
|
+
* 页面周指标(周访客 / 周贡献)—— 与 contracts `OwnedSubredditWeeklyStats*` 同形。
|
|
1854
|
+
* SDK 不能 import contracts(private 包),所以这里手写镜像;改契约时同步这里。
|
|
1855
|
+
*/
|
|
1856
|
+
export type OwnedSubredditWeeklyMetric = {
|
|
1857
|
+
/** 页面原文,如 "1.2K";从未命中为 null。 */
|
|
1858
|
+
text: string | null;
|
|
1859
|
+
/** 解析后的整数;原文解析不了为 null(此时 text 仍在)。 */
|
|
1860
|
+
num: number | null;
|
|
1861
|
+
observedAt: string | null;
|
|
1862
|
+
status: "ok" | "missing" | "stale";
|
|
1863
|
+
/** 与相邻上一 UTC 周的环比(%);前值缺失 / 为 0 / 不可解析为 null(⛔ 不是 0)。 */
|
|
1864
|
+
deltaPct: number | null;
|
|
1865
|
+
};
|
|
1866
|
+
export type OwnedSubredditWeeklyLastAttempt = {
|
|
1867
|
+
at: string;
|
|
1868
|
+
outcome: "ok" | "failed" | "not_visible" | "quota_skipped";
|
|
1869
|
+
reason: string | null;
|
|
1870
|
+
};
|
|
1871
|
+
export type OwnedSubredditWeeklyStats = {
|
|
1872
|
+
weekStart: string | null;
|
|
1873
|
+
visitors: OwnedSubredditWeeklyMetric;
|
|
1874
|
+
contributions: OwnedSubredditWeeklyMetric;
|
|
1875
|
+
lastAttempt: OwnedSubredditWeeklyLastAttempt | null;
|
|
1876
|
+
};
|
|
1877
|
+
export type OwnedSubredditWeeklyTrendMetricPoint = {
|
|
1878
|
+
text: string;
|
|
1879
|
+
num: number | null;
|
|
1880
|
+
observedAt: string;
|
|
1881
|
+
};
|
|
1882
|
+
export type OwnedSubredditWeeklyTrend = {
|
|
1883
|
+
ownedSubredditId: string;
|
|
1884
|
+
name: string;
|
|
1885
|
+
weeks: number;
|
|
1886
|
+
/** 长度恒为 weeks,旧 → 新;缺周的指标为 null(不压缩、不补 0)。 */
|
|
1887
|
+
points: Array<{
|
|
1888
|
+
weekStart: string;
|
|
1889
|
+
visitors: OwnedSubredditWeeklyTrendMetricPoint | null;
|
|
1890
|
+
contributions: OwnedSubredditWeeklyTrendMetricPoint | null;
|
|
1891
|
+
}>;
|
|
1892
|
+
lastAttempt: OwnedSubredditWeeklyLastAttempt | null;
|
|
1893
|
+
};
|
|
1894
|
+
export type OwnedSubredditWeeklyRefreshAccepted = {
|
|
1895
|
+
status: "queued";
|
|
1896
|
+
ownedSubredditId: string;
|
|
1897
|
+
subreddit: string;
|
|
1898
|
+
runId: string;
|
|
1899
|
+
businessDate: string;
|
|
1900
|
+
/** 下一业务日起点(同一板块下次允许再手动刷新的最早时刻)。 */
|
|
1901
|
+
nextAllowedAt: string;
|
|
1902
|
+
};
|
|
1852
1903
|
export declare class SocialHubClient {
|
|
1853
1904
|
private readonly opts;
|
|
1854
1905
|
constructor(opts: SocialHubClientOptions);
|
|
@@ -4305,6 +4356,24 @@ export declare class SocialHubClient {
|
|
|
4305
4356
|
}): Promise<{
|
|
4306
4357
|
items: unknown[];
|
|
4307
4358
|
}>;
|
|
4359
|
+
/**
|
|
4360
|
+
* GET :id/weekly-stats — 板块页面周指标趋势(周访客 / 周贡献,默认 12 周,最多 52)。
|
|
4361
|
+
*
|
|
4362
|
+
* 返回长度恒为 `weeks` 的按周序列(旧 → 新);缺周的指标为 null —— ⛔ 不是 0。
|
|
4363
|
+
* 列表接口 `listOwnedSubreddits` 的每行另带 `weeklyStats`(当前值 + 环比)。
|
|
4364
|
+
*/
|
|
4365
|
+
getOwnedSubredditWeeklyStats(ownedSubredditId: string, params?: {
|
|
4366
|
+
weeks?: number;
|
|
4367
|
+
}): Promise<OwnedSubredditWeeklyTrend>;
|
|
4368
|
+
/**
|
|
4369
|
+
* POST :id/weekly-stats/refresh — 手动刷新该板块的页面周指标(202 入队)。
|
|
4370
|
+
*
|
|
4371
|
+
* 每板块每业务日最多真实抓一次:当日已抓/已入队 → 409,`error.details.code` 为
|
|
4372
|
+
* `refresh_already_charged_today`,`details.nextAllowedAt` 是下一业务日起点;
|
|
4373
|
+
* 其余稳定码见 contracts `WEEKLY_STATS_REFRESH_REJECT_CODES`。
|
|
4374
|
+
* 仅 active 资产;写权限同其它写端点(真实登录 admin,拒 API Key)。
|
|
4375
|
+
*/
|
|
4376
|
+
refreshOwnedSubredditWeeklyStats(ownedSubredditId: string): Promise<OwnedSubredditWeeklyRefreshAccepted>;
|
|
4308
4377
|
/** GET :id — 单条资产详情(不可见时返 404,不返 403:避免变成枚举面)。 */
|
|
4309
4378
|
getOwnedSubreddit(ownedSubredditId: string): Promise<unknown>;
|
|
4310
4379
|
/**
|