@heybox/hb-sdk 0.6.9 → 0.7.0-alpha.2
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/CHANGELOG.md +51 -7
- package/README.md +83 -20
- package/dist/cli-chunks/{build-BtGxhrcV.cjs → build-DLIhlBQA.cjs} +4 -4
- package/dist/cli-chunks/{context-DX1KG-8A.cjs → context-Bl_Q4RKq.cjs} +15 -2
- package/dist/cli-chunks/{create-DAD0OF1r.cjs → create-C--pwY0l.cjs} +1 -1
- package/dist/cli-chunks/{dev-Dh4HY0I8.cjs → dev-B1tyT5ql.cjs} +197 -13
- package/dist/cli-chunks/{doctor-BfKdiD3H.cjs → doctor-D9M2scaJ.cjs} +1 -1
- package/dist/cli-chunks/{index-tCURDEx8.cjs → index-BnBeTd0B.cjs} +15 -14
- package/dist/cli-chunks/{index-DB6Q8HaC.cjs → index-HNB8i51C.cjs} +2 -2
- package/dist/cli-chunks/{login-D60EJLgs.cjs → login-DnX81kof.cjs} +2 -2
- package/dist/cli-chunks/{project-vite-DAUaP0_3.cjs → project-vite-CgnCpNDZ.cjs} +1 -1
- package/dist/cli-chunks/{remote-nQDniAUY.cjs → remote-CETqg77E.cjs} +6 -6
- package/dist/cli-chunks/{runtime-gate-BWlU-R4h.cjs → runtime-gate-CtV7rWyX.cjs} +1 -1
- package/dist/cli-chunks/{runtime-permission-env-DKrhgVM3.cjs → runtime-permission-env-D-8_jPG3.cjs} +2 -0
- package/dist/cli-chunks/{session-D6jOKXeu.cjs → session-Davw2CMd.cjs} +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/devtools/mock-host/index.html +9 -2
- package/dist/devtools/mock-host/main.js +426 -802
- package/dist/index.cjs.js +46 -90
- package/dist/index.esm.js +46 -90
- package/dist/miniapp-publish.cjs.js +2 -0
- package/dist/miniapp-publish.esm.js +2 -1
- package/dist/protocol.cjs.js +98 -42
- package/dist/protocol.esm.js +93 -39
- package/dist/templates/vue3-vite-ts/README.md.ejs +1 -1
- package/dist/templates/vue3-vite-ts/src/App.vue +22 -17
- package/dist/templates/vue3-vite-ts/src/__tests__/App.spec.ts +37 -29
- package/dist/templates/vue3-vite-ts/src/auth-handoff.ts +46 -0
- package/dist/vite.cjs.js +2 -2
- package/dist/vite.esm.js +2 -2
- package/package.json +2 -2
- package/skill/SKILL.md +16 -12
- package/skill/references/api-protocol.md +22 -28
- package/skill/references/api-root.md +127 -112
- package/skill/references/cli.md +15 -20
- package/skill/references/examples.md +29 -17
- package/skill/references/recipes.md +180 -134
- package/skill/references/safety-boundaries.md +9 -3
- package/skill/scripts/sync-references.mjs +235 -139
- package/skill/scripts/validate-skill.mjs +18 -14
- package/skill/skill.json +4 -4
- package/types/index.d.ts +4 -4
- package/types/miniapp-publish/index.d.ts +1 -0
- package/types/modules/auth/index.d.ts +16 -28
- package/types/modules/cloud/index.d.ts +2 -2
- package/types/modules/network/index.d.ts +1 -2
- package/types/modules/user/get-info.d.ts +4 -4
- package/types/modules/user/get-local-identity.d.ts +9 -0
- package/types/modules/user/index.d.ts +13 -41
- package/types/modules/user/revoke-authorization.d.ts +7 -0
- package/types/modules/user/steam-game-list.d.ts +72 -0
- package/types/modules/user/types.d.ts +37 -302
- package/types/protocol/capabilities.d.ts +24 -49
- package/types/protocol/constants.d.ts +1 -1
- package/types/protocol/network-policy.d.ts +10 -0
- package/types/protocol/types.d.ts +10 -6
- package/types/protocol.d.ts +4 -3
- package/types/modules/user/get-current-user-detail.d.ts +0 -9
- package/types/modules/user/get-current-user-profile.d.ts +0 -9
- package/types/modules/user/get-platform-account-info.d.ts +0 -12
- package/types/modules/user/get-platform-account-overview.d.ts +0 -9
- package/types/modules/user/get-steam-game-list.d.ts +0 -12
package/skill/skill.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hb-sdk",
|
|
3
|
-
"skillVersion": "0.
|
|
3
|
+
"skillVersion": "0.7.0-alpha.2+skill.c5541658a22b",
|
|
4
4
|
"sdk": {
|
|
5
5
|
"package": "@heybox/hb-sdk",
|
|
6
|
-
"version": "0.
|
|
7
|
-
"compatibility": "0.
|
|
6
|
+
"version": "0.7.0-alpha.2",
|
|
7
|
+
"compatibility": "0.7.0-alpha.2"
|
|
8
8
|
},
|
|
9
9
|
"source": "https://open.xiaoheihe.cn/agent-skills/hb-sdk",
|
|
10
|
-
"integrity": "sha256-
|
|
10
|
+
"integrity": "sha256-c5541658a22b5ef1a47a24dcdd617e59ef2a118858bedf547ac2833637f865b8"
|
|
11
11
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export { HbMiniProgramSDKError, HbMiniProgramNetworkError } from './core/errors';
|
|
2
2
|
export { ready, on, off, auth, user, share, viewport, storage, network, ui, device, navigation, cloud } from './core/singleton';
|
|
3
|
-
export type { MiniProgramEventHandler, MiniProgramEventName, MiniProgramEventPayloadMap
|
|
4
|
-
export type { LoginPayload, LoginResult, MiniProgramAuthModule } from './modules/auth';
|
|
3
|
+
export type { MiniProgramEventHandler, MiniProgramEventName, MiniProgramEventPayloadMap } from './protocol/types';
|
|
4
|
+
export type { LoginOptions, LoginPayload, LoginResult, LoginScope, MiniProgramAuthModule } from './modules/auth';
|
|
5
5
|
export type { DeleteCurrentUserLeaderboardEntryPayload, DeleteCurrentUserLeaderboardEntryResult, GetCurrentUserLeaderboardEntryPayload, GetCurrentUserLeaderboardEntryResult, GetLeaderboardInfoPayload, GetLeaderboardInfoResult, GetLeaderboardListPayload, GetLeaderboardListResult, LeaderboardEntry, LeaderboardOrder, MiniProgramCloudLeaderboardModule, MiniProgramCloudModule, SubmitLeaderboardEntryPayload, SubmitLeaderboardEntryResult, } from './modules/cloud';
|
|
6
|
-
export type {
|
|
6
|
+
export type { AuthorizedUserInfo, GetLocalIdentityPayload, GetLocalIdentityResult, GetUserInfoPayload, GetUserInfoResult, RevokeAuthorizationPayload, RevokeAuthorizationResult, GetSteamGameListOptions, GetSteamGameListPayload, GetSteamGameListResult, MiniProgramUserInfoResult, MiniProgramUserModule, UserInfoAuthorization, UserInfoAuthorizationStatus, SteamGameListData, SteamGameListItem, SteamGamePrice, SteamGameListSort, } from './modules/user';
|
|
7
7
|
export type { MiniProgramScreenshotOptions, MiniProgramScreenshotRect, MiniProgramShareChannel, MiniProgramShareModule, MiniProgramSharePostOptions, MiniProgramShowShareMenuOptions, ScreenshotPayload, ScreenshotResult, ShowShareMenuPayload, ShowShareMenuResult, } from './modules/share';
|
|
8
8
|
export type { GetWindowInfoPayload, GetWindowInfoResult, MiniProgramNavigationBarForegroundStyle, MiniProgramSafeArea, MiniProgramSetNavigationBarStyleOptions, MiniProgramViewportModule, MiniProgramWindowInfoResult, SetNavigationBarStylePayload, SetNavigationBarStyleResult, } from './modules/viewport';
|
|
9
|
-
export type { GetStoragePayload, GetStorageResult, MiniProgramStorageModule, SetStoragePayload
|
|
9
|
+
export type { GetStoragePayload, GetStorageResult, MiniProgramStorageModule, SetStoragePayload } from './modules/storage';
|
|
10
10
|
export type { MiniProgramNetworkHeaders, MiniProgramNetworkModule, MiniProgramNetworkParams, MiniProgramNetworkRequestConfig, MiniProgramNetworkRequestMethod, MiniProgramNetworkResponse, MiniProgramNetworkValidateStatus, NetworkRequestPayload, NetworkResponsePayload, } from './modules/network';
|
|
11
11
|
export type { HideLoadingPayload, HideLoadingResult, MiniProgramToastStatus, MiniProgramUiModule, ShowLoadingPayload, ShowLoadingResult, ShowToastPayload, ShowToastResult, } from './modules/ui';
|
|
12
12
|
export type { MiniProgramDeviceModule, MiniProgramVibrateIntensity, SetClipboardPayload, SetClipboardResult, VibratePayload, VibrateResult, } from './modules/device';
|
|
@@ -8,6 +8,7 @@ export declare const DEVELOPER_ENTITY_SWITCH_API_PATH = "/mall/developer/entity/
|
|
|
8
8
|
export declare const LIST_USER_MINIPROGRAM_API_PATH = "/mall/developer/user_miniprogram/list";
|
|
9
9
|
export declare const CREATE_USER_MINIPROGRAM_API_PATH = "/mall/developer/user_miniprogram/create";
|
|
10
10
|
export declare const DETAIL_USER_MINIPROGRAM_API_PATH = "/mall/developer/user_miniprogram/detail";
|
|
11
|
+
export declare const CREATE_USER_MINIPROGRAM_LOCAL_DEV_LAUNCH_TOKEN_API_PATH = "/mall/developer/user_miniprogram/local_dev_launch_token";
|
|
11
12
|
export declare const USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH = "/mall/developer/user_miniprogram/preview_allowlist";
|
|
12
13
|
export declare const UPDATE_USER_MINIPROGRAM_PREVIEW_ALLOWLIST_API_PATH = "/mall/developer/user_miniprogram/preview_allowlist/update";
|
|
13
14
|
export declare const CREATE_USER_MINIPROGRAM_LEADERBOARD_API_PATH = "/mall/developer/user_miniprogram/leaderboard/create";
|
|
@@ -1,35 +1,23 @@
|
|
|
1
1
|
import type { MiniProgramRequester } from '../../core/client';
|
|
2
|
-
import type { MiniProgramUserInfoResult } from '../user';
|
|
3
2
|
export { AUTH_LOGIN_METHOD } from '../../protocol/capabilities';
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export type LoginScope = 'identity' | 'profile';
|
|
4
|
+
export interface LoginOptions {
|
|
5
|
+
scopes?: LoginScope[];
|
|
6
|
+
}
|
|
7
|
+
export type LoginPayload = LoginOptions | undefined;
|
|
8
|
+
/** 小程序服务端用于换取当前用户身份的短期授权码。 */
|
|
9
|
+
export interface LoginResult {
|
|
10
|
+
code: string;
|
|
11
|
+
expiresIn: number;
|
|
12
|
+
scopes: LoginScope[];
|
|
13
|
+
}
|
|
8
14
|
export type { MiniProgramAuthMethod } from '../../protocol/capabilities';
|
|
9
15
|
/** 外部小程序可调用的授权模块。 */
|
|
10
16
|
export interface MiniProgramAuthModule {
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
*
|
|
14
|
-
* 该能力不会向小程序暴露 token、cookie 或任何登录凭据。
|
|
15
|
-
*/
|
|
16
|
-
login(): Promise<LoginResult>;
|
|
17
|
+
/** 获取短期授权码;不会向小程序暴露 token、cookie 或黑盒用户资料。 */
|
|
18
|
+
login(options?: LoginOptions): Promise<LoginResult>;
|
|
17
19
|
}
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* @param requester 底层 bridge 请求能力。
|
|
22
|
-
* @returns 登录流程完成后的最新用户登录态与公开资料。
|
|
23
|
-
* @throws {HbMiniProgramSDKError} 当 bridge、父容器或宿主运行时调用失败时抛出。
|
|
24
|
-
*
|
|
25
|
-
* @remarks
|
|
26
|
-
* 该能力不会向小程序暴露 token、cookie 或其他登录凭据。
|
|
27
|
-
*/
|
|
28
|
-
export declare function login(requester: MiniProgramRequester): Promise<LoginResult>;
|
|
29
|
-
/**
|
|
30
|
-
* 创建授权模块。
|
|
31
|
-
*
|
|
32
|
-
* @param requester 底层 bridge 请求能力。
|
|
33
|
-
* @returns 面向业务层的授权模块对象。
|
|
34
|
-
*/
|
|
20
|
+
/** 获取短期授权码。 */
|
|
21
|
+
export declare function login(requester: MiniProgramRequester, options?: LoginOptions): Promise<LoginResult>;
|
|
22
|
+
/** 创建授权模块。 */
|
|
35
23
|
export declare function createAuthModule(requester: MiniProgramRequester): MiniProgramAuthModule;
|
|
@@ -8,8 +8,8 @@ export interface LeaderboardEntry {
|
|
|
8
8
|
rank: number;
|
|
9
9
|
/** 是否进入展示范围并位于当前用户排名计算上限内。 */
|
|
10
10
|
ranked: boolean;
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/** 当前小程序内稳定的用户标识,由平台注入,前端不能传入。 */
|
|
12
|
+
appUserId: string;
|
|
13
13
|
/** 分数,排行榜唯一排序字段。 */
|
|
14
14
|
score: number;
|
|
15
15
|
/** 展示附加信息,不参与排序和查询。 */
|
|
@@ -22,8 +22,7 @@ export type MiniProgramNetworkValidateStatus = (status: number) => boolean;
|
|
|
22
22
|
* 对外开放的网络请求配置。
|
|
23
23
|
*
|
|
24
24
|
* @remarks
|
|
25
|
-
* 该配置面向业务层,保持 axios-like
|
|
26
|
-
* 等宿主协议的原始字段。
|
|
25
|
+
* 该配置面向业务层,保持 axios-like 的窄接口,不暴露宿主协议的原始字段。
|
|
27
26
|
*/
|
|
28
27
|
export interface MiniProgramNetworkRequestConfig {
|
|
29
28
|
/** 请求地址。 */
|
|
@@ -12,12 +12,12 @@ export type GetUserInfoResult = MiniProgramUserInfoResult;
|
|
|
12
12
|
/**
|
|
13
13
|
* 获取当前访问小程序用户的公开基础资料。
|
|
14
14
|
*
|
|
15
|
-
* @param requester 底层 bridge 请求能力。
|
|
16
15
|
* @returns 当前用户的登录态与公开基础资料。
|
|
17
16
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* 该能力仅在身份授权后返回按小程序隔离的 `app_user_id`,仅在 profile
|
|
18
|
+
* 授权后返回昵称与头像。未登录时返回
|
|
19
|
+
* `{ isHeyboxAppLoggedIn: false, authorization: null, userInfo: null }`。
|
|
20
20
|
*
|
|
21
|
-
* @throws {HbMiniProgramSDKError} 当
|
|
21
|
+
* @throws {HbMiniProgramSDKError} 当 SDK 调用失败时抛出。
|
|
22
22
|
*/
|
|
23
23
|
export declare function getInfo(requester: MiniProgramRequester): Promise<GetUserInfoResult>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MiniProgramRequester } from '../../core/client';
|
|
2
|
+
export { USER_GET_LOCAL_IDENTITY_METHOD } from '../../protocol/capabilities';
|
|
3
|
+
/** `user.getLocalIdentity` 不需要入参。 */
|
|
4
|
+
export type GetLocalIdentityPayload = void;
|
|
5
|
+
/** 当前用户在本小程序内稳定且隔离的身份。 */
|
|
6
|
+
export interface GetLocalIdentityResult {
|
|
7
|
+
appUserId: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function getLocalIdentity(requester: MiniProgramRequester): Promise<GetLocalIdentityResult>;
|
|
@@ -1,51 +1,23 @@
|
|
|
1
1
|
import type { MiniProgramRequester } from '../../core/client';
|
|
2
2
|
import { USER_GET_INFO_METHOD, type GetUserInfoResult } from './get-info';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { USER_GET_PLATFORM_ACCOUNT_OVERVIEW_METHOD, type GetPlatformAccountOverviewResult } from './get-platform-account-overview';
|
|
7
|
-
import { USER_GET_STEAM_GAME_LIST_METHOD, type GetSteamGameListOptions, type GetSteamGameListResult } from './get-steam-game-list';
|
|
8
|
-
import type { PlatformAccountType } from './types';
|
|
3
|
+
import { USER_GET_LOCAL_IDENTITY_METHOD, type GetLocalIdentityResult } from './get-local-identity';
|
|
4
|
+
import { USER_REVOKE_AUTHORIZATION_METHOD, type RevokeAuthorizationResult } from './revoke-authorization';
|
|
5
|
+
import { USER_GET_STEAM_GAME_LIST_METHOD, type GetSteamGameListOptions, type GetSteamGameListResult } from './steam-game-list';
|
|
9
6
|
export * from './get-info';
|
|
10
|
-
export * from './get-
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './
|
|
13
|
-
export * from './get-platform-account-overview';
|
|
14
|
-
export * from './get-steam-game-list';
|
|
7
|
+
export * from './get-local-identity';
|
|
8
|
+
export * from './revoke-authorization';
|
|
9
|
+
export * from './steam-game-list';
|
|
15
10
|
export * from './types';
|
|
16
|
-
export type { MiniProgramUserMethod } from '../../protocol/capabilities';
|
|
17
11
|
/** 外部小程序可调用的用户模块。 */
|
|
18
12
|
export interface MiniProgramUserModule {
|
|
19
|
-
/**
|
|
20
|
-
* 获取当前用户登录态与公开基础资料。
|
|
21
|
-
*/
|
|
13
|
+
/** 获取当前黑盒 APP 登录态、授权状态和已获准披露的资料。 */
|
|
22
14
|
getInfo(): Promise<GetUserInfoResult>;
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* 获取当前用户敏感资料详情。
|
|
29
|
-
*/
|
|
30
|
-
getCurrentUserProfile(): Promise<GetCurrentUserProfileResult>;
|
|
31
|
-
/**
|
|
32
|
-
* 获取当前用户平台账号绑定/隐藏状态概览。
|
|
33
|
-
*/
|
|
34
|
-
getPlatformAccountOverview(): Promise<GetPlatformAccountOverviewResult>;
|
|
35
|
-
/**
|
|
36
|
-
* 获取当前用户指定平台账号详情。
|
|
37
|
-
*/
|
|
38
|
-
getPlatformAccountInfo<T extends PlatformAccountType>(platform: T): Promise<GetPlatformAccountInfoResult<T>>;
|
|
39
|
-
/**
|
|
40
|
-
* 获取当前用户 Steam 游戏库。
|
|
41
|
-
*/
|
|
15
|
+
/** 获取当前用户在本小程序内稳定且隔离的身份。 */
|
|
16
|
+
getLocalIdentity(): Promise<GetLocalIdentityResult>;
|
|
17
|
+
/** 撤销当前用户授予本小程序的授权;必须由可信用户操作触发。 */
|
|
18
|
+
revokeAuthorization(): Promise<RevokeAuthorizationResult>;
|
|
19
|
+
/** 获取当前用户的 Steam 游戏库。 */
|
|
42
20
|
getSteamGameList(options?: GetSteamGameListOptions): Promise<GetSteamGameListResult>;
|
|
43
21
|
}
|
|
44
|
-
/**
|
|
45
|
-
* 创建用户模块。
|
|
46
|
-
*
|
|
47
|
-
* @param requester 底层 bridge 请求能力。
|
|
48
|
-
* @returns 面向业务层的用户模块对象。
|
|
49
|
-
*/
|
|
50
22
|
export declare function createUserModule(requester: MiniProgramRequester): MiniProgramUserModule;
|
|
51
|
-
export { USER_GET_INFO_METHOD,
|
|
23
|
+
export { USER_GET_INFO_METHOD, USER_GET_LOCAL_IDENTITY_METHOD, USER_GET_STEAM_GAME_LIST_METHOD, USER_REVOKE_AUTHORIZATION_METHOD, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MiniProgramRequester } from '../../core/client';
|
|
2
|
+
export { USER_REVOKE_AUTHORIZATION_METHOD } from '../../protocol/capabilities';
|
|
3
|
+
/** `user.revokeAuthorization` 不接收入参。 */
|
|
4
|
+
export type RevokeAuthorizationPayload = void;
|
|
5
|
+
/** 撤销成功后不返回用户身份或资料。 */
|
|
6
|
+
export type RevokeAuthorizationResult = void;
|
|
7
|
+
export declare function revokeAuthorization(requester: MiniProgramRequester): Promise<RevokeAuthorizationResult>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { MiniProgramRequester } from '../../core/client';
|
|
2
|
+
/** Steam 游戏库排序方式。 */
|
|
3
|
+
export type SteamGameListSort = 'weeks' | 'all' | 'achieved';
|
|
4
|
+
/** Steam 游戏库查询与分页参数。 */
|
|
5
|
+
export interface GetSteamGameListOptions {
|
|
6
|
+
/** 指定当前用户绑定的 Steam ID;不传时使用默认主账号。 */
|
|
7
|
+
steamId?: string;
|
|
8
|
+
/** 分页数量,默认 20,最大 100。 */
|
|
9
|
+
limit?: number;
|
|
10
|
+
/** 分页偏移量,默认 0。 */
|
|
11
|
+
offset?: number;
|
|
12
|
+
/** 排序方式,默认 `weeks`。 */
|
|
13
|
+
sort?: SteamGameListSort;
|
|
14
|
+
/** 搜索关键词。 */
|
|
15
|
+
q?: string;
|
|
16
|
+
/** 是否包含当前用户隐藏的游戏,默认 `false`。 */
|
|
17
|
+
includeHidden?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/** `user.getSteamGameList` 请求参数。 */
|
|
20
|
+
export type GetSteamGameListPayload = GetSteamGameListOptions | undefined;
|
|
21
|
+
/** Steam 游戏库条目。 */
|
|
22
|
+
export interface SteamGamePrice {
|
|
23
|
+
current?: string;
|
|
24
|
+
initial?: string;
|
|
25
|
+
discount?: number;
|
|
26
|
+
lowestPrice?: number;
|
|
27
|
+
deadlineDate?: string;
|
|
28
|
+
deadlineTimestamp?: number;
|
|
29
|
+
}
|
|
30
|
+
/** Steam 游戏库条目。 */
|
|
31
|
+
export interface SteamGameListItem {
|
|
32
|
+
appid: number;
|
|
33
|
+
steamAppid: number;
|
|
34
|
+
name: string;
|
|
35
|
+
image?: string;
|
|
36
|
+
icon?: string;
|
|
37
|
+
playtimeForever?: number;
|
|
38
|
+
playtime2Weeks?: number;
|
|
39
|
+
tags?: string[];
|
|
40
|
+
price?: SteamGamePrice;
|
|
41
|
+
}
|
|
42
|
+
/** Steam 游戏库分页数据。 */
|
|
43
|
+
export interface SteamGameListData {
|
|
44
|
+
gameList: SteamGameListItem[];
|
|
45
|
+
total?: number;
|
|
46
|
+
hasMore: boolean;
|
|
47
|
+
nextOffset: number;
|
|
48
|
+
isMe?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/** `user.getSteamGameList` 返回当前用户的 Steam 绑定状态和游戏库。 */
|
|
51
|
+
export type GetSteamGameListResult = {
|
|
52
|
+
isLogin: false;
|
|
53
|
+
isBound: false;
|
|
54
|
+
data: null;
|
|
55
|
+
} | {
|
|
56
|
+
isLogin: true;
|
|
57
|
+
isBound: false;
|
|
58
|
+
data: null;
|
|
59
|
+
} | {
|
|
60
|
+
isLogin: true;
|
|
61
|
+
isBound: true;
|
|
62
|
+
data: SteamGameListData;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* 获取当前用户 Steam 游戏库。
|
|
66
|
+
*
|
|
67
|
+
* @param requester 底层 bridge 请求能力。
|
|
68
|
+
* @param options 查询与分页参数。
|
|
69
|
+
* @returns 当前用户 Steam 游戏库;未登录或未绑定 Steam 时返回状态对象。
|
|
70
|
+
*/
|
|
71
|
+
export declare function getSteamGameList(requester: MiniProgramRequester, options?: GetSteamGameListOptions): Promise<GetSteamGameListResult>;
|
|
72
|
+
export { USER_GET_STEAM_GAME_LIST_METHOD } from '../../protocol/capabilities';
|
|
@@ -1,312 +1,47 @@
|
|
|
1
|
+
/** 用户资料授权状态。 */
|
|
2
|
+
export type UserInfoAuthorizationStatus = 'not_required' | 'not_requested' | 'granted' | 'denied';
|
|
3
|
+
/** 当前小程序对用户身份与公开资料的授权状态。 */
|
|
4
|
+
export interface UserInfoAuthorization {
|
|
5
|
+
identity: UserInfoAuthorizationStatus;
|
|
6
|
+
profile: UserInfoAuthorizationStatus;
|
|
7
|
+
}
|
|
1
8
|
/**
|
|
2
|
-
*
|
|
9
|
+
* 已获准向当前小程序披露的用户资料。
|
|
3
10
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* 只有 `identity` 已授权时,`user.getInfo()` 才会返回该对象。撤销 `identity`
|
|
13
|
+
* 后 `userInfo` 变为 `null`,调用方应停止使用并清理本地缓存的旧身份。
|
|
6
14
|
*/
|
|
7
|
-
export interface
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
export interface AuthorizedUserInfo {
|
|
16
|
+
/**
|
|
17
|
+
* 当前黑盒用户在当前小程序内稳定且不可逆的关联标识。
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* 同一用户在不同小程序中的值不同。它不是黑盒用户 ID、登录凭据或主站私有接口凭据,
|
|
21
|
+
* 只应作为当前小程序自己的业务关联键使用。示例:
|
|
22
|
+
* `au_1_x7K9mQ2pL4vN8cR3tY6wB1zD5fH`。调用方必须把完整值视为不透明字符串,
|
|
23
|
+
* 不应解析格式或依赖固定长度。
|
|
24
|
+
*/
|
|
25
|
+
app_user_id: string;
|
|
26
|
+
/** 仅在 `profile` 授权后返回昵称与头像。 */
|
|
27
|
+
profile: {
|
|
28
|
+
nickname: string;
|
|
29
|
+
avatar: string;
|
|
30
|
+
} | null;
|
|
14
31
|
}
|
|
15
32
|
/**
|
|
16
|
-
*
|
|
33
|
+
* 当前黑盒 APP 登录态、授权状态和已获准披露的用户资料。
|
|
17
34
|
*
|
|
18
35
|
* @remarks
|
|
19
|
-
* 未登录时 `
|
|
20
|
-
*
|
|
36
|
+
* 未登录时 `isHeyboxAppLoggedIn` 为 `false`,授权状态和用户资料均为 `null`。
|
|
37
|
+
* 已登录但 identity 未授权时,`userInfo` 仍为 `null`。
|
|
21
38
|
*/
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
userInfo: MiniProgramUserInfo | null;
|
|
27
|
-
}
|
|
28
|
-
/** 当前用户作用域的登录态包装。 */
|
|
29
|
-
export type UserScopedResult<T> = {
|
|
30
|
-
/** 当前访问小程序的用户已登录黑盒账号。 */
|
|
31
|
-
isLogin: true;
|
|
32
|
-
/** 当前用户作用域数据。 */
|
|
33
|
-
data: T;
|
|
39
|
+
export type MiniProgramUserInfoResult = {
|
|
40
|
+
isHeyboxAppLoggedIn: false;
|
|
41
|
+
authorization: null;
|
|
42
|
+
userInfo: null;
|
|
34
43
|
} | {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
data: null;
|
|
44
|
+
isHeyboxAppLoggedIn: true;
|
|
45
|
+
authorization: UserInfoAuthorization;
|
|
46
|
+
userInfo: AuthorizedUserInfo | null;
|
|
39
47
|
};
|
|
40
|
-
/** 当前用户等级展示信息。 */
|
|
41
|
-
export interface CurrentUserLevelInfo {
|
|
42
|
-
level?: string;
|
|
43
|
-
level_name?: string;
|
|
44
|
-
exp?: string;
|
|
45
|
-
next_exp?: string;
|
|
46
|
-
icon?: string;
|
|
47
|
-
}
|
|
48
|
-
/** 当前用户徽章展示信息。 */
|
|
49
|
-
export interface CurrentUserMedal {
|
|
50
|
-
id?: string;
|
|
51
|
-
name?: string;
|
|
52
|
-
desc?: string;
|
|
53
|
-
icon?: string;
|
|
54
|
-
image?: string;
|
|
55
|
-
is_wearing?: boolean;
|
|
56
|
-
}
|
|
57
|
-
/** 当前用户头像装扮信息。 */
|
|
58
|
-
export interface CurrentUserAvatarDecoration {
|
|
59
|
-
id?: string;
|
|
60
|
-
name?: string;
|
|
61
|
-
image?: string;
|
|
62
|
-
frame_url?: string;
|
|
63
|
-
is_using?: boolean;
|
|
64
|
-
}
|
|
65
|
-
/** 当前用户头像配置。 */
|
|
66
|
-
export interface CurrentUserAvatarConfig {
|
|
67
|
-
avatar?: string;
|
|
68
|
-
frame_url?: string;
|
|
69
|
-
pendant_url?: string;
|
|
70
|
-
}
|
|
71
|
-
/** 当前用户社区资料摘要。 */
|
|
72
|
-
export interface CurrentUserBbsInfo {
|
|
73
|
-
uid?: string;
|
|
74
|
-
nickname?: string;
|
|
75
|
-
avatar?: string;
|
|
76
|
-
level?: string;
|
|
77
|
-
}
|
|
78
|
-
/** 当前用户公开/展示详情。 */
|
|
79
|
-
export interface CurrentUserDetail {
|
|
80
|
-
heybox_id: string;
|
|
81
|
-
nickname: string;
|
|
82
|
-
avatar: string;
|
|
83
|
-
sex?: string;
|
|
84
|
-
signature?: string;
|
|
85
|
-
ip_location?: string;
|
|
86
|
-
friends_count?: string;
|
|
87
|
-
level_info?: CurrentUserLevelInfo;
|
|
88
|
-
medals?: CurrentUserMedal[];
|
|
89
|
-
avatar_decoration?: CurrentUserAvatarDecoration;
|
|
90
|
-
avatar_config?: CurrentUserAvatarConfig;
|
|
91
|
-
bbs_info?: CurrentUserBbsInfo;
|
|
92
|
-
}
|
|
93
|
-
/** 当前用户敏感资料/编辑详情。 */
|
|
94
|
-
export interface CurrentUserProfile {
|
|
95
|
-
heybox_id: string;
|
|
96
|
-
nickname?: string;
|
|
97
|
-
avatar?: string;
|
|
98
|
-
gender?: string;
|
|
99
|
-
birthday?: string;
|
|
100
|
-
email?: string;
|
|
101
|
-
education?: string;
|
|
102
|
-
career?: string;
|
|
103
|
-
signature?: string;
|
|
104
|
-
}
|
|
105
|
-
/** 第一版支持的平台账号类型。 */
|
|
106
|
-
export type PlatformAccountType = 'steam' | 'epic' | 'xbox' | 'psn' | 'switch' | 'pc_hardware' | 'mobile';
|
|
107
|
-
/** 平台账号轻量展示统计项。 */
|
|
108
|
-
export interface PlatformStatItem {
|
|
109
|
-
key?: string;
|
|
110
|
-
name?: string;
|
|
111
|
-
desc?: string;
|
|
112
|
-
value?: string;
|
|
113
|
-
num?: string;
|
|
114
|
-
icon?: string;
|
|
115
|
-
img?: string;
|
|
116
|
-
color?: string;
|
|
117
|
-
}
|
|
118
|
-
/** 平台账号通用基础资料。 */
|
|
119
|
-
export interface BasePlatformAccountInfo {
|
|
120
|
-
nickname?: string;
|
|
121
|
-
avatar?: string;
|
|
122
|
-
background_url?: string;
|
|
123
|
-
stats?: PlatformStatItem[];
|
|
124
|
-
}
|
|
125
|
-
/** Steam 平台账号详情。 */
|
|
126
|
-
export interface SteamPlatformAccountInfo extends BasePlatformAccountInfo {
|
|
127
|
-
steamid: string;
|
|
128
|
-
short_id?: string;
|
|
129
|
-
level?: string;
|
|
130
|
-
city?: string;
|
|
131
|
-
province?: string;
|
|
132
|
-
country?: string;
|
|
133
|
-
country_code?: string;
|
|
134
|
-
country_flag?: string;
|
|
135
|
-
avatar_frame?: string;
|
|
136
|
-
head_image?: string;
|
|
137
|
-
head_video?: string;
|
|
138
|
-
update_time?: string;
|
|
139
|
-
account_year?: string;
|
|
140
|
-
individuality_signature?: string;
|
|
141
|
-
level_icon?: string;
|
|
142
|
-
total_badge_count?: string;
|
|
143
|
-
total_dlcs_count?: string;
|
|
144
|
-
total_game_count?: string;
|
|
145
|
-
total_game_price?: string;
|
|
146
|
-
total_player_time?: string;
|
|
147
|
-
friend_code?: string;
|
|
148
|
-
friend_code_show?: boolean;
|
|
149
|
-
inventory_open?: boolean;
|
|
150
|
-
personal_information_open?: boolean;
|
|
151
|
-
has_history?: boolean;
|
|
152
|
-
}
|
|
153
|
-
/** Steam 游戏库排序方式。 */
|
|
154
|
-
export type SteamGameListSort = 'weeks' | 'all' | 'achieved';
|
|
155
|
-
/** Steam 游戏库请求参数。 */
|
|
156
|
-
export interface GetSteamGameListOptions {
|
|
157
|
-
/** 指定当前用户绑定的 Steam ID;不传时由宿主使用默认主账号。 */
|
|
158
|
-
steamId?: string;
|
|
159
|
-
/** 分页数量,默认 20,最大 100。 */
|
|
160
|
-
limit?: number;
|
|
161
|
-
/** 分页偏移量,默认 0。 */
|
|
162
|
-
offset?: number;
|
|
163
|
-
/** 排序方式,默认 `weeks`。 */
|
|
164
|
-
sort?: SteamGameListSort;
|
|
165
|
-
/** 搜索关键词。 */
|
|
166
|
-
q?: string;
|
|
167
|
-
/** 是否包含当前用户隐藏的游戏,默认 `false`。 */
|
|
168
|
-
includeHidden?: boolean;
|
|
169
|
-
}
|
|
170
|
-
/** `user.getSteamGameList` 请求参数。 */
|
|
171
|
-
export type GetSteamGameListPayload = GetSteamGameListOptions | undefined;
|
|
172
|
-
/** Steam 游戏价格信息。 */
|
|
173
|
-
export interface SteamGamePrice {
|
|
174
|
-
current?: string;
|
|
175
|
-
initial?: string;
|
|
176
|
-
discount?: number;
|
|
177
|
-
lowestPrice?: number;
|
|
178
|
-
deadlineDate?: string;
|
|
179
|
-
deadlineTimestamp?: number;
|
|
180
|
-
}
|
|
181
|
-
/** 当前用户 Steam 游戏库条目。 */
|
|
182
|
-
export interface SteamGameListItem {
|
|
183
|
-
appid: number;
|
|
184
|
-
steamAppid: number;
|
|
185
|
-
name: string;
|
|
186
|
-
image?: string;
|
|
187
|
-
icon?: string;
|
|
188
|
-
background?: string;
|
|
189
|
-
verticalImage?: string;
|
|
190
|
-
playtimeForever?: number;
|
|
191
|
-
playtime2Weeks?: number;
|
|
192
|
-
playtimePercent?: number;
|
|
193
|
-
achievedCount?: number;
|
|
194
|
-
achievementCount?: number;
|
|
195
|
-
isCleared?: boolean;
|
|
196
|
-
score?: string;
|
|
197
|
-
isFree?: boolean;
|
|
198
|
-
notOwned?: boolean;
|
|
199
|
-
hidden?: boolean;
|
|
200
|
-
onlinePlayer?: string;
|
|
201
|
-
tags?: string[];
|
|
202
|
-
genres?: string[];
|
|
203
|
-
price?: SteamGamePrice;
|
|
204
|
-
}
|
|
205
|
-
/** 当前用户 Steam 游戏库分页数据。 */
|
|
206
|
-
export interface SteamGameListData {
|
|
207
|
-
gameList: SteamGameListItem[];
|
|
208
|
-
total?: number;
|
|
209
|
-
hasMore: boolean;
|
|
210
|
-
nextOffset: number;
|
|
211
|
-
isMe?: boolean;
|
|
212
|
-
}
|
|
213
|
-
/** `user.getSteamGameList` 返回当前用户 Steam 游戏库。 */
|
|
214
|
-
export type GetSteamGameListResult = {
|
|
215
|
-
isLogin: false;
|
|
216
|
-
isBound: false;
|
|
217
|
-
data: null;
|
|
218
|
-
} | {
|
|
219
|
-
isLogin: true;
|
|
220
|
-
isBound: false;
|
|
221
|
-
data: null;
|
|
222
|
-
} | {
|
|
223
|
-
isLogin: true;
|
|
224
|
-
isBound: true;
|
|
225
|
-
data: SteamGameListData;
|
|
226
|
-
};
|
|
227
|
-
/** Epic 平台账号详情。 */
|
|
228
|
-
export interface EpicPlatformAccountInfo extends BasePlatformAccountInfo {
|
|
229
|
-
xuid?: string;
|
|
230
|
-
head_color?: string;
|
|
231
|
-
desc?: string;
|
|
232
|
-
}
|
|
233
|
-
/** Xbox 平台账号详情。 */
|
|
234
|
-
export interface XboxPlatformAccountInfo extends BasePlatformAccountInfo {
|
|
235
|
-
xuid?: string;
|
|
236
|
-
desc?: string;
|
|
237
|
-
}
|
|
238
|
-
/** PSN 平台账号详情。 */
|
|
239
|
-
export interface PsnPlatformAccountInfo extends BasePlatformAccountInfo {
|
|
240
|
-
name?: string;
|
|
241
|
-
level?: string;
|
|
242
|
-
description?: string;
|
|
243
|
-
is_open?: boolean;
|
|
244
|
-
}
|
|
245
|
-
/** Switch 平台账号详情。 */
|
|
246
|
-
export interface SwitchPlatformAccountInfo extends BasePlatformAccountInfo {
|
|
247
|
-
heybox_id?: string;
|
|
248
|
-
friend_code?: string;
|
|
249
|
-
friends_total?: string;
|
|
250
|
-
games_total?: string;
|
|
251
|
-
server_name?: string;
|
|
252
|
-
type?: string;
|
|
253
|
-
desc?: string;
|
|
254
|
-
}
|
|
255
|
-
/** PC 硬件账号详情。 */
|
|
256
|
-
export interface PcHardwareAccountInfo {
|
|
257
|
-
cpu?: string;
|
|
258
|
-
gpu?: string;
|
|
259
|
-
board?: string;
|
|
260
|
-
perf_level?: string;
|
|
261
|
-
}
|
|
262
|
-
/** 移动设备平台账号详情。 */
|
|
263
|
-
export interface MobilePlatformAccountInfo {
|
|
264
|
-
current_device?: {
|
|
265
|
-
id?: string;
|
|
266
|
-
name?: string;
|
|
267
|
-
desc?: string;
|
|
268
|
-
model?: string;
|
|
269
|
-
img_url?: string;
|
|
270
|
-
update_time?: string;
|
|
271
|
-
stats?: PlatformStatItem[];
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
/** 平台类型到平台账号详情的映射。 */
|
|
275
|
-
export interface PlatformAccountInfoMap {
|
|
276
|
-
steam: SteamPlatformAccountInfo;
|
|
277
|
-
epic: EpicPlatformAccountInfo;
|
|
278
|
-
xbox: XboxPlatformAccountInfo;
|
|
279
|
-
psn: PsnPlatformAccountInfo;
|
|
280
|
-
switch: SwitchPlatformAccountInfo;
|
|
281
|
-
pc_hardware: PcHardwareAccountInfo;
|
|
282
|
-
mobile: MobilePlatformAccountInfo;
|
|
283
|
-
}
|
|
284
|
-
/** 单个平台账号详情返回结构。 */
|
|
285
|
-
export type PlatformAccountResult<T extends PlatformAccountType> = {
|
|
286
|
-
isLogin: true;
|
|
287
|
-
platform: T;
|
|
288
|
-
is_bound: true;
|
|
289
|
-
is_hidden: boolean;
|
|
290
|
-
account_info: PlatformAccountInfoMap[T];
|
|
291
|
-
} | {
|
|
292
|
-
isLogin: true;
|
|
293
|
-
platform: T;
|
|
294
|
-
is_bound: false;
|
|
295
|
-
is_hidden: boolean;
|
|
296
|
-
account_info: null;
|
|
297
|
-
} | {
|
|
298
|
-
isLogin: false;
|
|
299
|
-
platform: T;
|
|
300
|
-
is_bound: false;
|
|
301
|
-
is_hidden: false;
|
|
302
|
-
account_info: null;
|
|
303
|
-
};
|
|
304
|
-
/** 平台账号绑定/隐藏状态概览。 */
|
|
305
|
-
export interface PlatformAccountOverview {
|
|
306
|
-
platforms: Array<{
|
|
307
|
-
platform: PlatformAccountType;
|
|
308
|
-
is_bound: boolean;
|
|
309
|
-
is_hidden: boolean;
|
|
310
|
-
}>;
|
|
311
|
-
display_order: PlatformAccountType[];
|
|
312
|
-
}
|