Persona API文档
Persona API文档
基本信息
- 标题: Passport
- 版本: 1.0
API Endpoint
https://p.unity.cn
API 接口
GET /v1/personas/
摘要: 获取角色
路径参数
| 参数名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| personaID | string | 是 | 角色ID |
响应
200 A successful response.
响应结构: passportGetPersonaResponse
响应示例
{
"persona": {
"idDomainID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"iconUrl": "http://example.com/xx.png",
"displayName": "string",
"personaID": "1000000001",
"userID": "10000000001",
"realmID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"properties": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
},
"createdAt": "2023-08-16T08:13:48.289Z",
"modifiedAt": "2023-08-16T08:13:48.289Z",
"realmName": "exampleRealmName",
"status": "Active"
}
}default An unexpected error response.
响应结构: rpcStatus
DELETE /v1/personas/
摘要: 删除角色
路径参数
| 参数名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| personaID | string | 是 | 角色ID |
响应
200 A successful response.
响应结构: passportDeletePersonaResponse
default An unexpected error response.
响应结构: rpcStatus
PUT /v1/personas/
摘要: 更新角色信息
路径参数
| 参数名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| personaID | string | 是 | - |
请求体参数
| 参数名 | 必填 | 说明 |
|---|---|---|
| body | 是 | - |
请求体结构: PassportUpdatePersonaBody
请求体示例
{
"status": "Active",
"displayName": "string",
"iconUrl": "http://example.com/xx.png",
"properties": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
}
}响应
200 A successful response.
响应结构: passportUpdatePersonaResponse
响应示例
{
"persona": {
"idDomainID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"iconUrl": "http://example.com/xx.png",
"displayName": "string",
"personaID": "1000000001",
"userID": "10000000001",
"realmID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"properties": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
},
"createdAt": "2023-08-16T08:13:48.289Z",
"modifiedAt": "2023-08-16T08:13:48.289Z",
"realmName": "exampleRealmName",
"status": "Active"
}
}default An unexpected error response.
响应结构: rpcStatus
POST /v1/personas/search
摘要: 搜索角色
请求体参数
| 参数名 | 必填 | 说明 |
|---|---|---|
| body | 是 | - |
请求体结构: passportListPersonasRequest
响应
200 A successful response.
响应结构: passportListPersonasResponse
响应示例
{
"start": 0,
"count": 20,
"total": 1,
"personas": [
{
"idDomainID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"iconUrl": "http://example.com/xx.png",
"displayName": "string",
"personaID": "1000000001",
"userID": "10000000001",
"realmID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"properties": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
},
"createdAt": "2023-08-16T08:13:48.289Z",
"modifiedAt": "2023-08-16T08:13:48.289Z",
"realmName": "exampleRealmName",
"status": "Active"
}
]
}default An unexpected error response.
响应结构: rpcStatus
POST /v1/personas/{personaID}/ban
摘要: 封禁角色
路径参数
| 参数名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| personaID | string | 是 | 角色ID |
请求体参数
| 参数名 | 必填 | 说明 |
|---|---|---|
| body | 是 | - |
请求体结构: PassportBanPersonaBody
响应
200 A successful response.
响应结构: passportBanPersonaResponse
响应示例
{
"persona": {
"idDomainID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"iconUrl": "http://example.com/xx.png",
"displayName": "string",
"personaID": "1000000001",
"userID": "10000000001",
"realmID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"properties": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
},
"createdAt": "2023-08-16T08:13:48.289Z",
"modifiedAt": "2023-08-16T08:13:48.289Z",
"realmName": "exampleRealmName",
"status": "Banned"
}
}default An unexpected error response.
响应结构: rpcStatus
POST /v1/personas/{personaID}/unban
摘要: 解封角色
路径参数
| 参数名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| personaID | string | 是 | 角色ID |
请求体参数
| 参数名 | 必填 | 说明 |
|---|---|---|
| body | 是 | - |
请求体结构: PassportUnbanPersonaBody
响应
200 A successful response.
响应结构: passportUnbanPersonaResponse
响应示例
{
"persona": {
"idDomainID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"iconUrl": "http://example.com/xx.png",
"displayName": "string",
"personaID": "1000000001",
"userID": "10000000001",
"realmID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"properties": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
},
"createdAt": "2023-08-16T08:13:48.289Z",
"modifiedAt": "2023-08-16T08:13:48.289Z",
"realmName": "exampleRealmName",
"status": "Active"
}
}default An unexpected error response.
响应结构: rpcStatus
数据模型定义
PassportBanPersonaBody
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| reason | string | 否 | 封禁理由 | |
| unbanAt | string | date-time | 否 | 解封时间(UTC),为空表示永久封禁 |
| sendPush | boolean | 否 | 是否推送push信息 |
PassportUnbanPersonaBody
PassportUpdatePersonaBody
标题: UpdatePersonaRequest
更新Persona信息请求
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| displayName | string | 否 | 角色昵称 | |
| properties | object | 否 | 自定义信息 | |
| iconUrl | string | 否 | 头像地址 | |
| status | passportPlayerStatuse | 否 | 角色状态,修改角色状态建议使用封禁/解封角色的接口 | |
| propertyKeysToRemove | array<string> | 否 | 要删除的自定义信息Key | |
| publicProperties | object | 否 | 公共信息 | |
| publicPropertyKeysToRemove | array<string> | 否 | 要移除的公共信息Key |
模型示例
{
"status": "Active",
"displayName": "string",
"iconUrl": "http://example.com/xx.png",
"properties": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
}
}passportBanPersonaResponse
标题: BanPersonaResponse
封禁Persona响应
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| persona | passportPersona | 否 | - |
模型示例
{
"persona": {
"idDomainID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"iconUrl": "http://example.com/xx.png",
"displayName": "string",
"personaID": "1000000001",
"userID": "10000000001",
"realmID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"properties": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
},
"createdAt": "2023-08-16T08:13:48.289Z",
"modifiedAt": "2023-08-16T08:13:48.289Z",
"realmName": "exampleRealmName",
"status": "Banned"
}
}passportDeletePersonaResponse
passportGetPersonaResponse
标题: GetPersonaResponse
获取Persona响应
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| Persona | passportPersona | 否 | - |
模型示例
{
"persona": {
"idDomainID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"iconUrl": "http://example.com/xx.png",
"displayName": "string",
"personaID": "1000000001",
"userID": "10000000001",
"realmID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"properties": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
},
"createdAt": "2023-08-16T08:13:48.289Z",
"modifiedAt": "2023-08-16T08:13:48.289Z",
"realmName": "exampleRealmName",
"status": "Active"
}
}passportListPersonasRequest
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| realmID | string | 否 | 服务器ID | |
| userID | string | 否 | 用户ID | |
| personaID | string | 否 | 角色ID | |
| displayName | string | 否 | 角色昵称 | |
| start | integer | int64 | 否 | 起始点 |
| count | integer | int64 | 否 | 返回数量 |
| status | passportPlayerStatuse | 否 | 角色状态 | |
| externalPersonaID | string | 否 | 角色外部ID | |
| orderByModifiedAt | boolean | 否 | 是否根据 modifiedAt 排序 |
passportListPersonasResponse
标题: ListPersonasResponse
获取persona列表响应
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| personas | array<passportPersona> | 否 | - | |
| start | integer | int64 | 否 | 起始点 |
| count | integer | int64 | 否 | 数量 |
| total | integer | int64 | 否 | 总数 |
模型示例
{
"start": 0,
"count": 20,
"total": 1,
"personas": [
{
"idDomainID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"iconUrl": "http://example.com/xx.png",
"displayName": "string",
"personaID": "1000000001",
"userID": "10000000001",
"realmID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"properties": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
},
"createdAt": "2023-08-16T08:13:48.289Z",
"modifiedAt": "2023-08-16T08:13:48.289Z",
"realmName": "exampleRealmName",
"status": "Active"
}
]
}passportPersona
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| idDomainID | string | 是 | @gotags: bson:"id_domain_id" id domain user belongs to | |
| displayName | string | 否 | @gotags: bson:"display_name" id domain user belongs to | |
| personaID | string | 是 | @gotags: bson:"persona_id" persona id | |
| userID | string | 是 | @gotags: bson:"user_id" user id | |
| realmID | string | 是 | @gotags: bson:"realm_id" user id | |
| createdAt | string | date-time | 否 | @gotags: bson:"created_at" create time stamp |
| modifiedAt | string | date-time | 否 | @gotags: bson:"modified_at" update time stamp |
| status | passportPlayerStatuse | 否 | @gotags: bson:"status" update time stamp | |
| iconUrl | string | 否 | @gotags: bson:"icon_url" update time stamp | |
| properties | object | 否 | @gotags: bson:"properties" extra info | |
| systemProperties | object | 否 | @gotags: bson:"system_properties" system level custom info | |
| lastLogin | string | date-time | 否 | @gotags: bson:"last_login" persona last login time |
| banReason | string | 否 | @gotags: bson:"ban_reason" persona ban reason | |
| unbanAt | string | date-time | 否 | @gotags: bson:"unban_at" persona unban time stamp |
| externalPersonaID | string | 否 | @gotags: bson:"external_persona_id" external persona id | |
| publicProperties | object | 否 | @gotags: bson:"public_properties" public properties |
passportPlayerStatuse
标题: - Active: 正常
- Banned: 封禁
- Sealed: 归档/删除
枚举值
| 枚举值 | 描述 |
|---|---|
Active | - |
Banned | - |
Sealed | - |
passportUnbanPersonaResponse
标题: UnbanPersonaResponse
解封Persona响应
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| persona | passportPersona | 否 | - |
模型示例
{
"persona": {
"idDomainID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"iconUrl": "http://example.com/xx.png",
"displayName": "string",
"personaID": "1000000001",
"userID": "10000000001",
"realmID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"properties": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
},
"createdAt": "2023-08-16T08:13:48.289Z",
"modifiedAt": "2023-08-16T08:13:48.289Z",
"realmName": "exampleRealmName",
"status": "Active"
}
}passportUpdatePersonaResponse
标题: UpdatePersonaResponse
更新Persona信息响应
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| persona | passportPersona | 否 | - |
模型示例
{
"persona": {
"idDomainID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"iconUrl": "http://example.com/xx.png",
"displayName": "string",
"personaID": "1000000001",
"userID": "10000000001",
"realmID": "7bba5ff1-b4a3-498c-9c0b-24cad73cff54",
"properties": {
"key1": "value1",
"key2": "value2",
"key3": "value3"
},
"createdAt": "2023-08-16T08:13:48.289Z",
"modifiedAt": "2023-08-16T08:13:48.289Z",
"realmName": "exampleRealmName",
"status": "Active"
}
}protobufAny
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| @type | string | 否 | - |
rpcStatus
| 属性名 | 类型 | 格式 | 必填 | 说明 |
|---|---|---|---|---|
| code | integer | int32 | 否 | - |
| message | string | 否 | - | |
| details | array<protobufAny> | 否 | - |