Client Party API Reference
Party is a service for creating an instant team for players. The player can use it to build a "temporary virtual team" and then fire a battle.
API List
| API | Description |
|---|---|
| CreateParty | Create a new party |
| GetPartyInfo | Get detailed information of a party |
| SetPartyStrategy | Change the join/invite strategy of the current party |
| GetPlayerPartyInfo | Get the player's current party information from server |
| InvitePlayerToParty | Invite other players to join current party |
| JoinParty | Join a party |
| LeaveParty | Leave the current party |
| DismissParty | Dismiss the current party. Only the leader has right to do this |
| KickPartyMember | Kick out a player in current party. Only the leader has right to do this |
| TransferPartyLeader | Transfer leader right of current party to another player. Only the leader has right to do this |
| SendPartyChatTextMsg | Send party chat text message. Only enable_chatting in CreatePartyParams is True when the party was created |
| SendPartyChatCustomMsg | Send party chat custom message. Only enable_chatting in CreatePartyParams is True when the party was created |
| CurrentParty | Get the cached information of the player's current party |
| SetGlobalCustomData | Set global custom data for party. Only Leader has permission to do it. The maximum length for custom data in a narrow-character string is 4096 bytes, If it is a wide-character string, it should be converted to a utf-8 narrow-character string before calculating its length. |
| SetPlayerCustomData | Set the player owned custom data. The maximum length for custom data in a narrow-character string is 4096 bytes, If it is a wide-character string, it should be converted to a utf-8 narrow-character string before calculating its length. |
Event List
| Event | Description |
|---|---|
| SetOnPartyStrategyChanged | The event will be triggered when party strategies changed. |
| SetOnPartyMemberJoined | The event will be triggered when new players joined the party. |
| SetOnPartyMemberLeft | The event will be triggered when players left the party. |
| SetOnPartyDismissed | The event will be triggered when the party was dismissed. |
| SetOnPartyLeaderTransferred | The event will be triggered when the leader status was transferred. |
| SetOnReceivePartyInvitation | The event will be triggered when receive a party invitation. |
| SetOnReceivePartyChatMsg | The event will be triggered when party chat message arrived. |
| SetOnCustomDataChanged | The event will be triggered when party custom data changed. |
| SetOnPartyInfoUpdated | The event will be triggered when party info updated. |
API Details
CreateParty
Create a new party
/**
* Create a new party
*
* @param params Request struct for create party
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void CreateParty(
const CreatePartyParams& params,
PgosDataCallback<PartyInfo> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const CreatePartyParams& | Request struct for create party |
| result_callback | PgosDataCallback<PartyInfo> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
GetPartyInfo
Get detailed information of a party
/**
* Get detailed information of a party
*
* @param party_id The id of party to query
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void GetPartyInfo(
const pgos::pstring& party_id,
PgosDataCallback<PartyInfo> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| party_id | const std::string& | The id of party to query |
| result_callback | PgosDataCallback<PartyInfo> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
SetPartyStrategy
Change the join/invite strategy of the current party
/**
* Change the join/invite strategy of the current party
*
* @param params Request struct for changing party strategy
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void SetPartyStrategy(
const SetPartyStrategyParams& params,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const SetPartyStrategyParams& | Request struct for changing party strategy |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
GetPlayerPartyInfo
Get the player's current party information from server
/**
* Get the player's current party information from server
*
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void GetPlayerPartyInfo(
PgosDataCallback<PartyInfo> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| result_callback | PgosDataCallback<PartyInfo> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
InvitePlayerToParty
Invite other players to join current party
/**
* Invite other players to join current party
*
* @param party_id The id of party to invite to
* @param invitee_player_ids List of player id
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void InvitePlayerToParty(
const pgos::pstring& party_id,
const pgos::pvector<pgos::pstring>& invitee_player_ids,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| party_id | const std::string& | The id of party to invite to |
| invitee_player_ids | const std::vector<std::string>& | List of player id |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
JoinParty
Join a party
/**
* Join a party
*
* @param party_id The id of party to join
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void JoinParty(
const pgos::pstring& party_id,
PgosDataCallback<PartyInfo> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| party_id | const std::string& | The id of party to join |
| result_callback | PgosDataCallback<PartyInfo> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
LeaveParty
Leave the current party
/**
* Leave the current party
*
* @param party_id The id of party to leave
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void LeaveParty(
const pgos::pstring& party_id,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| party_id | const std::string& | The id of party to leave |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
DismissParty
Dismiss the current party. Only the leader has right to do this
/**
* Dismiss the current party. Only the leader has right to do this
*
* @param party_id The id of party to dismiss
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void DismissParty(
const pgos::pstring& party_id,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| party_id | const std::string& | The id of party to dismiss |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
KickPartyMember
Kick out a player in current party. Only the leader has right to do this
/**
* Kick out a player in current party. Only the leader has right to do this
*
* @param party_id The id of party to kick out member
* @param kick_player_id The player id of member to kick out
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void KickPartyMember(
const pgos::pstring& party_id,
const pgos::pstring& kick_player_id,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| party_id | const std::string& | The id of party to kick out member |
| kick_player_id | const std::string& | The player id of member to kick out |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
TransferPartyLeader
Transfer leader right of current party to another player. Only the leader has right to do this
/**
* Transfer leader right of current party to another player. Only the leader has right to do this
*
* @param party_id The id of party to transfer leadership
* @param new_leader_player_id The player id of the new leader
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void TransferPartyLeader(
const pgos::pstring& party_id,
const pgos::pstring& new_leader_player_id,
PgosCallback result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| party_id | const std::string& | The id of party to transfer leadership |
| new_leader_player_id | const std::string& | The player id of the new leader |
| result_callback | PgosCallback | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
SendPartyChatTextMsg
Send party chat text message. Only enable_chatting in CreatePartyParams is True when the party was created
/**
* Send party chat text message.
* Only enable_chatting in CreatePartyParams is True when the party was created
*
* @param params Request struct for sending party chat message
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void SendPartyChatTextMsg(
const SendPartyChatMsgParams& params,
PgosDataCallback<ChatMsgInfo> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const SendPartyChatMsgParams& | Request struct for sending party chat message |
| result_callback | PgosDataCallback<ChatMsgInfo> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
SendPartyChatCustomMsg
Send party chat custom message. Only enable_chatting in CreatePartyParams is True when the party was created
/**
* Send party chat custom message.
* Only enable_chatting in CreatePartyParams is True when the party was created
*
* @param params Request struct for sending party chat message
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void SendPartyChatCustomMsg(
const SendPartyChatMsgParams& params,
PgosDataCallback<ChatMsgInfo> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| params | const SendPartyChatMsgParams& | Request struct for sending party chat message |
| result_callback | PgosDataCallback<ChatMsgInfo> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
CurrentParty
Get the cached information of the player's current party
/**
* Get the cached information of the player's current party
*
* @param dst The latest party information detail
* @return false if not in a party, or don't get the detail information of the current party
*/
bool CurrentParty(
PartyInfo& dst);
Parameters:
| Param | Type | Description |
|---|---|---|
| dst | PartyInfo& | The latest party information detail |
Return: bool
false if not in a party, or don't get the detail information of the current party
SetGlobalCustomData
Set global custom data for party. Only Leader has permission to do it. The maximum length for custom data in a narrow-character string is 4096 bytes, If it is a wide-character string, it should be converted to a utf-8 narrow-character string before calculating its length.
/**
* Set global custom data for party. Only Leader has permission to do it.
* The maximum length for custom data in a narrow-character string is 4096 bytes,
* If it is a wide-character string, it should be converted to a utf-8 narrow-character string before calculating its length.
*
* @param party_id Party ID.
* @param global_custom_data Global custom data string.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void SetGlobalCustomData(
const pgos::pstring& party_id,
const pgos::pstring& global_custom_data,
PgosDataCallback<PartyCustomData> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| party_id | const std::string& | Party ID. |
| global_custom_data | const std::string& | Global custom data string. |
| result_callback | PgosDataCallback<PartyCustomData> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
SetPlayerCustomData
Set the player owned custom data. The maximum length for custom data in a narrow-character string is 4096 bytes, If it is a wide-character string, it should be converted to a utf-8 narrow-character string before calculating its length.
/**
* Set the player owned custom data.
* The maximum length for custom data in a narrow-character string is 4096 bytes,
* If it is a wide-character string, it should be converted to a utf-8 narrow-character string before calculating its length.
*
* @param party_id Party ID.
* @param player_custom_data Player custom data string.
* @param result_callback The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD.
*/
void SetPlayerCustomData(
const pgos::pstring& party_id,
const pgos::pstring& player_custom_data,
PgosDataCallback<PartyCustomData> result_callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| party_id | const std::string& | Party ID. |
| player_custom_data | const std::string& | Player custom data string. |
| result_callback | PgosDataCallback<PartyCustomData> | The result callback after the API execution ends, and it will be called in an ASYNCHRONOUS CHILD THREAD. |
Return: void
Event Details
SetOnPartyStrategyChanged
The event will be triggered when party strategies changed.
/**
* OnSetOnPartyStrategyChanged:
* The event will be triggered when party strategies changed.
*
* @param event Event result.
*/
void SetOnPartyStrategyChanged(
const PartyStrategyChangedEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const PartyStrategyChangedEvt& | Event result. |
SetOnPartyMemberJoined
The event will be triggered when new players joined the party.
/**
* OnSetOnPartyMemberJoined:
* The event will be triggered when new players joined the party.
*
* @param event Event result.
*/
void SetOnPartyMemberJoined(
const PartyMemberJoinedEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const PartyMemberJoinedEvt& | Event result. |
SetOnPartyMemberLeft
The event will be triggered when players left the party.
/**
* OnSetOnPartyMemberLeft:
* The event will be triggered when players left the party.
*
* @param event Event result.
*/
void SetOnPartyMemberLeft(
const PartyMemberLeftEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const PartyMemberLeftEvt& | Event result. |
SetOnPartyDismissed
The event will be triggered when the party was dismissed.
/**
* OnSetOnPartyDismissed:
* The event will be triggered when the party was dismissed.
*
* @param event Event result.
*/
void SetOnPartyDismissed(
const PartyDismissedEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const PartyDismissedEvt& | Event result. |
SetOnPartyLeaderTransferred
The event will be triggered when the leader status was transferred.
/**
* OnSetOnPartyLeaderTransferred:
* The event will be triggered when the leader status was transferred.
*
* @param event Event result.
*/
void SetOnPartyLeaderTransferred(
const PartyLeaderTransferredEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const PartyLeaderTransferredEvt& | Event result. |
SetOnReceivePartyInvitation
The event will be triggered when receive a party invitation.
/**
* OnSetOnReceivePartyInvitation:
* The event will be triggered when receive a party invitation.
*
* @param event Event result.
*/
void SetOnReceivePartyInvitation(
const ReceivePartyInvitationEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const ReceivePartyInvitationEvt& | Event result. |
SetOnReceivePartyChatMsg
The event will be triggered when party chat message arrived.
/**
* OnSetOnReceivePartyChatMsg:
* The event will be triggered when party chat message arrived.
*
* @param event Event result.
*/
void SetOnReceivePartyChatMsg(
const ReceivePartyChatMsgEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const ReceivePartyChatMsgEvt& | Event result. |
SetOnCustomDataChanged
The event will be triggered when party custom data changed.
/**
* OnSetOnCustomDataChanged:
* The event will be triggered when party custom data changed.
*
* @param event Event result.
*/
void SetOnCustomDataChanged(
const PartyCustomDataChangedEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const PartyCustomDataChangedEvt& | Event result. |
SetOnPartyInfoUpdated
The event will be triggered when party info updated.
/**
* OnSetOnPartyInfoUpdated:
* The event will be triggered when party info updated.
*
* @param event Event result.
*/
void SetOnPartyInfoUpdated(
const PartyInfoUpdatedEvt& event);
Parameters:
| Param | Type | Description |
|---|---|---|
| event | const PartyInfoUpdatedEvt& | Event result. |