Skip to main content

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

APIDescription
CreatePartyCreate a new party
GetPartyInfoGet detailed information of a party
SetPartyStrategyChange the join/invite strategy of the current party
GetPlayerPartyInfoGet the player's current party information from server
InvitePlayerToPartyInvite other players to join current party
JoinPartyJoin a party
LeavePartyLeave the current party
DismissPartyDismiss the current party. Only the leader has right to do this
KickPartyMemberKick out a player in current party. Only the leader has right to do this
TransferPartyLeaderTransfer leader right of current party to another player. Only the leader has right to do this
SendPartyChatTextMsgSend party chat text message. Only enable_chatting in CreatePartyParams is True when the party was created
SendPartyChatCustomMsgSend party chat custom message. Only enable_chatting in CreatePartyParams is True when the party was created
CurrentPartyGet the cached information of the player's current party
SetGlobalCustomDataSet 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.
SetPlayerCustomDataSet 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

EventDescription
SetOnPartyStrategyChangedThe event will be triggered when party strategies changed.
SetOnPartyMemberJoinedThe event will be triggered when new players joined the party.
SetOnPartyMemberLeftThe event will be triggered when players left the party.
SetOnPartyDismissedThe event will be triggered when the party was dismissed.
SetOnPartyLeaderTransferredThe event will be triggered when the leader status was transferred.
SetOnReceivePartyInvitationThe event will be triggered when receive a party invitation.
SetOnReceivePartyChatMsgThe event will be triggered when party chat message arrived.
SetOnCustomDataChangedThe event will be triggered when party custom data changed.
SetOnPartyInfoUpdatedThe 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:

ParamTypeDescription
paramsconst CreatePartyParams&Request struct for create party
result_callbackPgosDataCallback<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:

ParamTypeDescription
party_idconst std::string&The id of party to query
result_callbackPgosDataCallback<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:

ParamTypeDescription
paramsconst SetPartyStrategyParams&Request struct for changing party strategy
result_callbackPgosCallbackThe 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:

ParamTypeDescription
result_callbackPgosDataCallback<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:

ParamTypeDescription
party_idconst std::string&The id of party to invite to
invitee_player_idsconst std::vector<std::string>&List of player id
result_callbackPgosCallbackThe 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:

ParamTypeDescription
party_idconst std::string&The id of party to join
result_callbackPgosDataCallback<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:

ParamTypeDescription
party_idconst std::string&The id of party to leave
result_callbackPgosCallbackThe 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:

ParamTypeDescription
party_idconst std::string&The id of party to dismiss
result_callbackPgosCallbackThe 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:

ParamTypeDescription
party_idconst std::string&The id of party to kick out member
kick_player_idconst std::string&The player id of member to kick out
result_callbackPgosCallbackThe 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:

ParamTypeDescription
party_idconst std::string&The id of party to transfer leadership
new_leader_player_idconst std::string&The player id of the new leader
result_callbackPgosCallbackThe 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:

ParamTypeDescription
paramsconst SendPartyChatMsgParams&Request struct for sending party chat message
result_callbackPgosDataCallback<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:

ParamTypeDescription
paramsconst SendPartyChatMsgParams&Request struct for sending party chat message
result_callbackPgosDataCallback<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:

ParamTypeDescription
dstPartyInfo&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:

ParamTypeDescription
party_idconst std::string&Party ID.
global_custom_dataconst std::string&Global custom data string.
result_callbackPgosDataCallback<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:

ParamTypeDescription
party_idconst std::string&Party ID.
player_custom_dataconst std::string&Player custom data string.
result_callbackPgosDataCallback<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:

ParamTypeDescription
eventconst 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:

ParamTypeDescription
eventconst 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:

ParamTypeDescription
eventconst 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:

ParamTypeDescription
eventconst 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:

ParamTypeDescription
eventconst 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:

ParamTypeDescription
eventconst 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:

ParamTypeDescription
eventconst 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:

ParamTypeDescription
eventconst 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:

ParamTypeDescription
eventconst PartyInfoUpdatedEvt&Event result.