Server Battle API Reference
Battle session is the foundation of battle service. Battle session instances can be created through services such as Lobby / Matchmaking / World or via the PGOS HTTP API, and placed in online or local DS via the DS Hosting service. The battle session also manages data such as the players in the game and the DS access information.
API List
| API | Description |
|---|---|
| UpdateBattleRecord | Now, there is no need to manually establish the association between battle session id and player ids, as PGOS will automatically complete this task. |
| SetBattleTags | Set tags for a battle session record. |
| UpdateBattleData | Update the data of battle |
| UpdateBattleBrief | Update the brief of battle |
| UpdateBattleDetail | Update the detail of battle. |
| DeleteBattleData | Delete the data of the specified key of battle |
API Details
UpdateBattleRecord
Now, there is no need to manually establish the association between battle session id and player ids, as PGOS will automatically complete this task.
Deprecated, use SetBattleTags instead.
/**
* Now, there is no need to manually establish the association between battle session id and player ids, as PGOS will automatically complete this task.
* [DEPRECATED!!!] UpdateBattleRecord was declared deprecated, consider using SetBattleTags instead.
*
* @param battle_session_id The id of battle session.
* @param player_ids IDs of all players in the battle, array cannot be empty.
* @param tags The tags of battle.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void UpdateBattleRecord(
const pgos::pstring& battle_session_id,
const pgos::pvector<pgos::pstring>& player_ids,
const pgos::pvector<pgos::pstring>& tags,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | The id of battle session. |
| player_ids | const std::vector<std::string>& | IDs of all players in the battle, array cannot be empty. |
| tags | const std::vector<std::string>& | The tags of battle. |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
SetBattleTags
Set tags for a battle session record.
/**
* Set tags for a battle session record.
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void SetBattleTags(
const SetBattleTagsParams& params,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const SetBattleTagsParams& | |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
UpdateBattleData
Update the data of battle
/**
* Update the data of battle
*
* @param battle_session_id The id of battle session.
* @param record_data The data of battle.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void UpdateBattleData(
const pgos::pstring& battle_session_id,
const pgos::pmap<pgos::pstring, pgos::pstring>& record_data,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | The id of battle session. |
| record_data | const std::map<std::string, std::string>& | The data of battle. |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
UpdateBattleBrief
Update the brief of battle
/**
* Update the brief of battle
*
* @param battle_session_id The id of battle session.
* @param brief The data of battle.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void UpdateBattleBrief(
const pgos::pstring& battle_session_id,
const pgos::pstring& brief,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | The id of battle session. |
| brief | const std::string& | The data of battle. |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
UpdateBattleDetail
Update the detail of battle.
/**
* Update the detail of battle.
*
* @param battle_session_id The id of battle session.
* @param detail The data of battle.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void UpdateBattleDetail(
const pgos::pstring& battle_session_id,
const pgos::pstring& detail,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | The id of battle session. |
| detail | const std::string& | The data of battle. |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
DeleteBattleData
Delete the data of the specified key of battle
/**
* Delete the data of the specified key of battle
*
* @param battle_session_id The id of battle session.
* @param keys The specified keys to be deleted, if the keys is empty, nothing will happen.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void DeleteBattleData(
const pgos::pstring& battle_session_id,
const pgos::pvector<pgos::pstring>& keys,
PgosDataCallback<DelBattleDataRsp> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| battle_session_id | const std::string& | The id of battle session. |
| keys | const std::vector<std::string>& | The specified keys to be deleted, if the keys is empty, nothing will happen. |
| result_callback | PgosDataCallback<DelBattleDataRsp> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void