Settings API文档
Settings API文档
基本信息
- 标题: Cloud
- 版本: 1.0
API Endpoint
https://c.unity.cn
API 接口
POST /v1/settings
摘要: 获取玩家全局设置 (与玩家的用户ID和角色ID无关)
请求体参数
| 参数名 | 必填 | 说明 |
|---|---|---|
| body | 是 | 获取玩家配置请求 |
请求体结构: cloudGetPlayerSettingsRequest
请求体示例
{
"keys": [
"key1",
"key2"
],
"types": [
"INT"
]
}响应
200 A successful response.
响应结构: cloudGetPlayerSettingsResponse
响应示例
{
"settings": {
"key1": {
"value": "123",
"type": "INT"
},
"key2": {
"value": "456",
"type": "LONG"
}
}
}default An unexpected error response.
响应结构: rpcStatus
POST /v1/settings/overrides
摘要: 获取玩家覆盖设置 (与玩家的用户ID和角色ID有关)
请求体参数
| 参数名 | 必填 | 说明 |
|---|---|---|
| body | 是 | 获取玩家配置Overrides请求 |
请求体结构: cloudGetPlayerOverridesRequest
请求体示例
{
"userId": "0cb3fbaa-e66f-4919-9bb2-cbc2aa5a13af",
"personaId": "4bab2f9d-07a9-46f4-86a9-9b4fbdc29ac2",
"keys": [
"key1",
"key2"
],
"types": [
"JSON",
"INT",
"BOOL"
],
"isDebugBuild": true,
"packageVersion": "2.1.1",
"attributes": {
"unity": {
"appVersion": "1.0",
"appBuildVersion": "23",
"country": "US",
"cpu": "Intel(R) Core(TM) i7-7920 HQ CPU @ 3.10GHz",
"cpuFrequency": "3100",
"graphicsDeviceVendor": "Apple",
"language": "en",
"osVersion": "Mac OS X 10.14.4",
"platform": "macOS",
"ram": 8192,
"model": "Macbook Pro 13",
"timeSinceStart": 60000
},
"app": {
"isDebugBuild": true,
"packageVersion": "2.1.1"
},
"user": {
"rank": 10
}
}
}响应
200 A successful response.
响应结构: cloudGetPlayerOverridesResponse
响应示例
{
"settings": {
"key1": {
"value": "123",
"type": "INT"
},
"key2": {
"value": "456",
"type": "LONG"
}
}
}default An unexpected error response.
响应结构: rpcStatus
POST /v1/settings/simulate
摘要: 模拟玩家设置
请求体参数
| 参数名 | 必填 | 说明 |
|---|---|---|
| body | 是 | 模拟玩家配置请求 |
请求体结构: cloudSimulateSettingsRequest
请求体示例
{
"userId": "user-111",
"personaId": "persona-1111",
"attributes": {
"unity": {
"appVersion": "1.0",
"appBuildVersion": "23",
"country": "US"
},
"app": {
"packageVersion": "2.1.1"
},
"user": {
"level": 10,
"score": 2500
}
}
}响应
200 A successful response.
响应结构: cloudSimulateSettingsResponse
响应示例
{
"values": [
{
"configId": "940045ba-576a-4603-8d1e-2a94f5dd3f4e",
"key": "bossHealth",
"type": "INT",
"originalValue": "2000",
"currentValue": "1800",
"isOriginal": false,
"overrideId": "205b53c6-92aa-42c5-a1e0-27e3619920fa",
"overrideName": "playerWithCheatCode",
"variantName": "variant-2"
}
]
}default An unexpected error response.
响应结构: rpcStatus
数据模型定义
cloudConfigType
枚举值
| 枚举值 | 描述 |
|---|---|
Unknown | - |
INT | - |
LONG | - |
FLOAT | - |
BOOL | - |
STRING | - |
JSON | - |
cloudGetPlayerOverridesRequest
标题: GetPlayerOverridesRequest
获取玩家配置Overrides请求
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| userId | string | 否 | 用户 ID | |
| personaId | string | 否 | 角色 ID | |
| keys | array<string> | 否 | 查询过滤参数:key名称列表(若为空,则不过滤并返回所有) | |
| types | array<cloudConfigType> | 否 | 查询过滤参数:类型列表(只有keys为空时,该参数才有效;若为空,则不过滤并返回所有) | |
| isDebugBuild | boolean | 否 | 是否为 debug build | |
| packageVersion | string | 否 | 版本号 | |
| attributes | 否 | 玩家属性,其中包括 'unity', 'app', 'user' 3个结构体 | ||
| expanded | boolean | 否 | 是否返回展开的variant信息 |
模型示例
{
"userId": "0cb3fbaa-e66f-4919-9bb2-cbc2aa5a13af",
"personaId": "4bab2f9d-07a9-46f4-86a9-9b4fbdc29ac2",
"keys": [
"key1",
"key2"
],
"types": [
"JSON",
"INT",
"BOOL"
],
"isDebugBuild": true,
"packageVersion": "2.1.1",
"attributes": {
"unity": {
"appVersion": "1.0",
"appBuildVersion": "23",
"country": "US",
"cpu": "Intel(R) Core(TM) i7-7920 HQ CPU @ 3.10GHz",
"cpuFrequency": "3100",
"graphicsDeviceVendor": "Apple",
"language": "en",
"osVersion": "Mac OS X 10.14.4",
"platform": "macOS",
"ram": 8192,
"model": "Macbook Pro 13",
"timeSinceStart": 60000
},
"app": {
"isDebugBuild": true,
"packageVersion": "2.1.1"
},
"user": {
"rank": 10
}
}
}cloudGetPlayerOverridesResponse
标题: GetPlayerOverridesResponse
获取玩家配置Override响应
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| settings | object | 否 | 玩家设定(key 到值与类型的映射) |
模型示例
{
"settings": {
"key1": {
"value": "123",
"type": "INT"
},
"key2": {
"value": "456",
"type": "LONG"
}
}
}cloudGetPlayerSettingsRequest
标题: GetPlayerSettingsRequest
获取玩家配置请求
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| keys | array<string> | 否 | 查询过滤参数:key名称列表(若为空,则不过滤并返回所有) | |
| types | array<cloudConfigType> | 否 | 查询过滤参数:类型列表(只有keys为空时,该参数才有效;若为空,则不过滤并返回所有) |
模型示例
{
"keys": [
"key1",
"key2"
],
"types": [
"INT"
]
}cloudGetPlayerSettingsResponse
标题: GetPlayerSettingsResponse
获取玩家配置响应
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| settings | object | 否 | 玩家设定 |
模型示例
{
"settings": {
"key1": {
"value": "123",
"type": "INT"
},
"key2": {
"value": "456",
"type": "LONG"
}
}
}cloudSimulateSettingsRequest
标题: SimulateSettingsRequest
模拟玩家配置请求
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| userId | string | 否 | 用户 ID | |
| personaId | string | 否 | 角色 ID | |
| attributes | 否 | 玩家属性,其中包括 'unity', 'app', 'user' 3个结构体 |
模型示例
{
"userId": "user-111",
"personaId": "persona-1111",
"attributes": {
"unity": {
"appVersion": "1.0",
"appBuildVersion": "23",
"country": "US"
},
"app": {
"packageVersion": "2.1.1"
},
"user": {
"level": 10,
"score": 2500
}
}
}cloudSimulateSettingsResponse
标题: SimulateSettingsResponse
模拟玩家配置响应
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| values | array<cloudSimulationResult> | 否 | 模拟结果列表 |
模型示例
{
"values": [
{
"configId": "940045ba-576a-4603-8d1e-2a94f5dd3f4e",
"key": "bossHealth",
"type": "INT",
"originalValue": "2000",
"currentValue": "1800",
"isOriginal": false,
"overrideId": "205b53c6-92aa-42c5-a1e0-27e3619920fa",
"overrideName": "playerWithCheatCode",
"variantName": "variant-2"
}
]
}cloudSimulationResult
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| configId | string | 否 | 配置ID | |
| key | string | 否 | 配置名称 | |
| type | cloudConfigType | 否 | 配置类型 | |
| originalValue | string | 否 | 原始配置值 | |
| currentValue | string | 否 | 当前配置值 | |
| isOriginal | boolean | 否 | 是否为配置原始值 | |
| overrideId | string | 否 | Override ID | |
| overrideName | string | 否 | Override 名称 | |
| variantName | string | 否 | 变量组合名称 |
protobufAny
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| @type | string | 否 | - |
rpcStatus
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| code | integer | int32 | 否 | - |
| message | string | 否 | - | |
| details | array<protobufAny> | 否 | - |