@seayoo-io/combo-sdk-node 1.6.0 → 1.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 +27 -0
- package/dist/api/index.d.ts +7 -1
- package/dist/api/types.d.ts +10 -0
- package/dist/const.d.ts +1 -1
- package/dist/index.cjs +25 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +25 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -207,6 +207,33 @@ interface VerifyOtpResponse {
|
|
|
207
207
|
> - `sendOtp` 在请求失败时(如触发发送冷却、参数错误、服务端错误)会**抛出异常**,请使用 try/catch 捕获处理。
|
|
208
208
|
> - `verifyOtp` 仅在请求本身失败时抛出异常。**验证码不正确属于正常业务结果**,此时会返回 `{ valid: false }` 而不会抛出异常,游戏侧需要根据 `valid` 字段判断验证是否通过。
|
|
209
209
|
|
|
210
|
+
### 申请语音审核 VoiceModerationRequest
|
|
211
|
+
|
|
212
|
+
玩家认为语音房间内某些玩家存在语音违规行为时,可提交语音审核申请。调用前提是:游戏已经在世游开启语音审核服务。
|
|
213
|
+
|
|
214
|
+
```js
|
|
215
|
+
const ok = await client.voiceModerationRequest({
|
|
216
|
+
/** 房间实例 ID,唯一标识某个语音房间的一次存续(从开启到关闭) */
|
|
217
|
+
room_instance_id: "<RoomInstanceID>",
|
|
218
|
+
/** 游戏服务器 ID */
|
|
219
|
+
server_id: 1001,
|
|
220
|
+
/** 提交审核申请的玩家角色 ID */
|
|
221
|
+
requester_role_id: "<PlayerRoleID>",
|
|
222
|
+
/** 被提交语音审核的玩家角色 ID 列表,一次最多提交 32 个 */
|
|
223
|
+
target_role_ids: ["<TargetRoleID1>", "<TargetRoleID2>"],
|
|
224
|
+
})
|
|
225
|
+
|
|
226
|
+
// ok 为 true 表示提交成功,false 表示提交失败(已自动打印错误日志)
|
|
227
|
+
if (ok) {
|
|
228
|
+
// 提交成功
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
> ⚠️ 注意事项
|
|
233
|
+
>
|
|
234
|
+
> - `voiceModerationRequest` 不会在失败时抛出异常,而是返回 `false`。游戏侧可根据返回值决定后续处理。
|
|
235
|
+
> - `target_role_ids` 一次最多提交 32 个玩家角色 ID。
|
|
236
|
+
|
|
210
237
|
## Notify
|
|
211
238
|
|
|
212
239
|
### Step 1 准备参数
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type IRequestGlobalConfig } from "../request";
|
|
2
2
|
import { type SDKBaseConfig } from "../utils";
|
|
3
|
-
import type { CreateOrderOption, CreateOrderResponse, SendOtpOption, SendOtpResponse, VerifyOtpOption, VerifyOtpResponse } from "./types";
|
|
3
|
+
import type { CreateOrderOption, CreateOrderResponse, SendOtpOption, SendOtpResponse, VerifyOtpOption, VerifyOtpResponse, VoiceModerationRequestOption } from "./types";
|
|
4
4
|
/** Api Client Config */
|
|
5
5
|
export interface ApiClientConfig extends SDKBaseConfig {
|
|
6
6
|
/** 自动重试次数,默认重试 1 次 */
|
|
@@ -52,4 +52,10 @@ export declare class ApiClient {
|
|
|
52
52
|
* @param option 验证码验证参数
|
|
53
53
|
*/
|
|
54
54
|
verifyOtp(option: VerifyOtpOption): Promise<VerifyOtpResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* 申请语音审核。
|
|
57
|
+
*
|
|
58
|
+
* 玩家认为语音房间内某些玩家存在语音违规行为时,可提交语音审核申请。调用前提是:游戏已经在世游开启语音审核服务。
|
|
59
|
+
*/
|
|
60
|
+
voiceModerationRequest(option: VoiceModerationRequestOption): Promise<boolean>;
|
|
55
61
|
}
|
package/dist/api/types.d.ts
CHANGED
|
@@ -85,3 +85,13 @@ export interface VerifyOtpResponse {
|
|
|
85
85
|
*/
|
|
86
86
|
valid: boolean;
|
|
87
87
|
}
|
|
88
|
+
export interface VoiceModerationRequestOption {
|
|
89
|
+
/** 房间实例 ID,唯一标识某个语音房间的一次存续(从开启到关闭)。 */
|
|
90
|
+
room_instance_id: string;
|
|
91
|
+
/** 游戏服务器 ID。 */
|
|
92
|
+
server_id: number;
|
|
93
|
+
/** 提交审核申请的玩家角色 ID。 */
|
|
94
|
+
requester_role_id: string;
|
|
95
|
+
/** 被提交语音审核的玩家角色 ID 列表,一次最多提交 32 个。 */
|
|
96
|
+
target_role_ids: string[];
|
|
97
|
+
}
|
package/dist/const.d.ts
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -12,7 +12,7 @@ var https__default = /*#__PURE__*/_interopDefaultLegacy(https);
|
|
|
12
12
|
/** SDK 名称 */
|
|
13
13
|
const SDKName = "combo-sdk-node";
|
|
14
14
|
/** SDK 版本,在编译前会被动态替换 */
|
|
15
|
-
const SDKVersion = "1.
|
|
15
|
+
const SDKVersion = "1.7.0";
|
|
16
16
|
/**
|
|
17
17
|
* 世游支持的服务端点列表
|
|
18
18
|
*/
|
|
@@ -1215,6 +1215,30 @@ class ApiClient {
|
|
|
1215
1215
|
}
|
|
1216
1216
|
return data;
|
|
1217
1217
|
}
|
|
1218
|
+
/**
|
|
1219
|
+
* 申请语音审核。
|
|
1220
|
+
*
|
|
1221
|
+
* 玩家认为语音房间内某些玩家存在语音违规行为时,可提交语音审核申请。调用前提是:游戏已经在世游开启语音审核服务。
|
|
1222
|
+
*/
|
|
1223
|
+
async voiceModerationRequest(option) {
|
|
1224
|
+
const {
|
|
1225
|
+
ok,
|
|
1226
|
+
status,
|
|
1227
|
+
code,
|
|
1228
|
+
message,
|
|
1229
|
+
headers
|
|
1230
|
+
} = await this.req.post("voice-moderation-request", option);
|
|
1231
|
+
if (!ok) {
|
|
1232
|
+
console.error({
|
|
1233
|
+
type: "voiceModerationRequest Error",
|
|
1234
|
+
status,
|
|
1235
|
+
code,
|
|
1236
|
+
message,
|
|
1237
|
+
traceId: headers[TraceIdField]
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
return ok;
|
|
1241
|
+
}
|
|
1218
1242
|
}
|
|
1219
1243
|
function isCreateOrderResponse(data) {
|
|
1220
1244
|
return isObject(data) && ["order_id", "order_token"].every(field => field in data) && "expires_at" in data && typeof data.expires_at === "number";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ApiClient } from "./api";
|
|
2
2
|
export type { ApiClientConfig } from "./api";
|
|
3
3
|
export type { CreateOrderOption, OrderMetaData, CreateOrderResponse } from "./api/types";
|
|
4
|
-
export type { SendOtpOption, SendOtpMetaData, SendOtpResponse, SupportedOtpChannel, VerifyOtpOption, VerifyOtpResponse } from "./api/types";
|
|
4
|
+
export type { SendOtpOption, SendOtpMetaData, SendOtpResponse, SupportedOtpChannel, VerifyOtpOption, VerifyOtpResponse, VoiceModerationRequestOption, } from "./api/types";
|
|
5
5
|
export { TokenVerifier } from "./verify";
|
|
6
6
|
export type { IdentityPayload } from "./verify/id";
|
|
7
7
|
export type { AdPayload } from "./verify/ads";
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { verify } from 'jsonwebtoken';
|
|
|
7
7
|
/** SDK 名称 */
|
|
8
8
|
const SDKName = "combo-sdk-node";
|
|
9
9
|
/** SDK 版本,在编译前会被动态替换 */
|
|
10
|
-
const SDKVersion = "1.
|
|
10
|
+
const SDKVersion = "1.7.0";
|
|
11
11
|
/**
|
|
12
12
|
* 世游支持的服务端点列表
|
|
13
13
|
*/
|
|
@@ -1210,6 +1210,30 @@ class ApiClient {
|
|
|
1210
1210
|
}
|
|
1211
1211
|
return data;
|
|
1212
1212
|
}
|
|
1213
|
+
/**
|
|
1214
|
+
* 申请语音审核。
|
|
1215
|
+
*
|
|
1216
|
+
* 玩家认为语音房间内某些玩家存在语音违规行为时,可提交语音审核申请。调用前提是:游戏已经在世游开启语音审核服务。
|
|
1217
|
+
*/
|
|
1218
|
+
async voiceModerationRequest(option) {
|
|
1219
|
+
const {
|
|
1220
|
+
ok,
|
|
1221
|
+
status,
|
|
1222
|
+
code,
|
|
1223
|
+
message,
|
|
1224
|
+
headers
|
|
1225
|
+
} = await this.req.post("voice-moderation-request", option);
|
|
1226
|
+
if (!ok) {
|
|
1227
|
+
console.error({
|
|
1228
|
+
type: "voiceModerationRequest Error",
|
|
1229
|
+
status,
|
|
1230
|
+
code,
|
|
1231
|
+
message,
|
|
1232
|
+
traceId: headers[TraceIdField]
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1235
|
+
return ok;
|
|
1236
|
+
}
|
|
1213
1237
|
}
|
|
1214
1238
|
function isCreateOrderResponse(data) {
|
|
1215
1239
|
return isObject(data) && ["order_id", "order_token"].every(field => field in data) && "expires_at" in data && typeof data.expires_at === "number";
|