Player API文档
Player API文档
基本信息
- 标题: Push
- 版本: 1.0
API Endpoint
https://push.unity.cn
API 接口
GET /v1/players/properties
摘要: 获取玩家属性,需联系我们获取权限方可使用该API
查询参数
| 参数名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| appId | string | 否 | - | |
| playerId | string | 否 | - |
响应
200 A successful response.
响应结构: appGetPlayerPropertiesResponse
default An unexpected error response.
响应结构: rpcStatus
DELETE /v1/players/properties
摘要: 删除玩家属性,需联系我们获取权限方可使用该API
查询参数
| 参数名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| appId | string | 否 | - | |
| playerId | string | 否 | 玩家id | |
| propertyNames | array | 否 | 玩家属性名,该字段不填代表删除所有属性,填了代表删除指定的属性 |
响应
200 A successful response.
default An unexpected error response.
响应结构: rpcStatus
POST /v1/players/properties
摘要: 设置玩家属性,需联系我们获取权限方可使用该API
请求体参数
| 参数名 | 必填 | 说明 |
|---|---|---|
| body | 是 | - |
请求体结构: appSetPlayerPropertiesRequest
响应
200 A successful response.
default An unexpected error response.
响应结构: rpcStatus
POST /v1/players/random
摘要: 随机获取在线玩家(从online 状态玩家中随机抽取),需联系我们获取权限方可使用该API
请求体参数
| 参数名 | 必填 | 说明 |
|---|---|---|
| body | 是 | - |
请求体结构: appRandomOnlinePlayersRequest
响应
200 A successful response.
响应结构: appRandomOnlinePlayersResponse
default An unexpected error response.
响应结构: rpcStatus
GET /v1/players/status
摘要: 批量查询玩家在线状态
查询参数
| 参数名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| appId | string | 否 | - | |
| playerIds | array | 否 | - |
响应
200 A successful response.
响应结构: appQueryPlayersStatusResponse
default An unexpected error response.
响应结构: rpcStatus
POST /v1/players/status
摘要: 设置玩家在线状态,需联系我们获取权限方可使用该API
请求体参数
| 参数名 | 必填 | 说明 |
|---|---|---|
| body | 是 | - |
请求体结构: appSetPlayerStatusRequest
响应
200 A successful response.
default An unexpected error response.
响应结构: rpcStatus
数据模型定义
appGetPlayerPropertiesResponse
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| properties | object | 否 | - |
appPlayerStatus
标题: - ONLINE: 在线状态,空闲,可被邀请加入队伍
- OFFLINE: 离线状态
- BUSY: 繁忙状态,比如对局游戏中,不可被邀请
枚举值
| 枚举值 | 描述 |
|---|---|
ONLINE | - |
OFFLINE | - |
BUSY | - |
appPropertyRange
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| propertyName | string | 否 | 属性名称 | |
| min | number | double | 否 | 最小值 |
| max | number | double | 否 | 最大值 |
appQueryPlayersStatusResponse
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| appId | string | 否 | - | |
| players | object | 否 | - |
appRandomOnlinePlayersRequest
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| appId | string | 否 | - | |
| playerId | string | 否 | 玩家id | |
| propertyRanges | array<appPropertyRange> | 否 | 玩家属性范围,比如需要在战力值1000-2000之间,以及等级20-230之间的10位玩家。不填代表从所有在线玩家中随机10位 | |
| playerCount | integer | int32 | 否 | 随机数量。最大为20 |
appRandomOnlinePlayersResponse
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| playerIds | array<string> | 否 | - |
appSetPlayerPropertiesRequest
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| appId | string | 否 | - | |
| playerId | string | 否 | 玩家id | |
| properties | object | 否 | 玩家属性 |
appSetPlayerStatusRequest
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| appId | string | 否 | - | |
| playerId | string | 否 | 玩家id | |
| status | appPlayerStatus | 否 | 玩家状态: ONLINE(在线状态,空闲,可被邀请加入队伍), OFFLINE(离线状态), BUSY(繁忙状态,比如对局游戏中,不可被邀请) | |
| customStatus | string | 否 | 自定义状态,比如当status为BUSY时,可以设置此字段为正在对局中或者正在队伍中 |
protobufAny
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| @type | string | 否 | - |
rpcStatus
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| code | integer | int32 | 否 | - |
| message | string | 否 | - | |
| details | array<protobufAny> | 否 | - |