Client Friend API Reference
The Friends service allows developers to manage the player's friend list. The player can invite friends to join a party for matchmaking or to chat.
API List
| API | Description |
|---|---|
| GetFriendList | Get my friend list. |
| AddFriend | Add the player to my friend list. If the peer player is online, he will receive an OnAddFriendRequest event. If the peer player is not online, he can call GetReceivedFriendRequests API when he goes online later to know that someone wants to add him as a friend. Only after the peer player accepts your friend request can the two of you become friends with each other. |
| RemoveFriend | Remove the player from my friend list. If the peer player is online, he will receive an OnFriendRemoved event. If the peer player is not online, he will not receive an OnFriendRemoved event even when he is online, but the friend list will be updated. Note: Only the peer player can receive the OnFriendRemoved event, the API caller(you) can check the callback result for the operation succeeded or not. |
| GetReceivedFriendRequests | Get the list of received friend requests. These friend requests are from the players who want to add me as a friend. |
| GetSentFriendRequests | Get the list of sent friend requests. These friend requests are from me because I want to add some players as a friend. |
| AcceptFriendRequest | Accept the player's request, after that, the two of us become friends with each other. If the peer player is online, he will receive an OnAddFriendResponse event. If the peer player is not online, he will not receive the OnAddFriendResponse event even if he goes online later, but the friend list will be updated. Note: Only the peer player can receive the OnAddFriendResponse event, the API caller(you) can check the callback result for the operation succeeded or not. |
| RejectFriendRequest | Reject the player's request. |
| DelSentFriendRequest | Delete the friend request I sent to other player. Affects the result returned when calling the GetSentFriendRequests API in the future. |
| BatchAddFriend | Add players to my friend list. (max 50 players) |
| SearchPlayers | Search for players. |
| SearchPlayersWithFilter | Search for players with filter. |
| GetRecentPlayers | Get recent players. Players on the blocklist will be filtered out. Return up to 20 recent players who have interacted with the current player. |
| GetRecommendedPlayers | Get recommended players. Friends and blocklisted players will be filtered out. |
| GetPotentialFriends | Get a list of players who may be your friends. Friends and blocklisted players will be filtered out. And the result will be ordered by the mutual friend count descending. |
| SetFriendRemark | Set remark to your friend, for example, "Tommy, a humorous man, met in the battle.", Max remark length: 32 characters. |
| SubscribeFriendPresence | Subscribe to the presence of all friends. You will be notified of presence changes from your friends. |
| UnsubscribeFriendPresence | Unsubscribe friend presence. |
| GetMyFriendsLimit | Query the maximum limit of friends you can have. |
| GetMutualFriendsCount | Get mutual friends count between this player and target players. |
Event List
| Event | Description |
|---|---|
| OnAddFriendRequest | The event will be triggered when receive a request to add friend. |
| OnAddFriendResponse | The event will be triggered when your add-friend request was accepted by player. |
| OnFriendRemoved | The event will be triggered when someone has remove you from his/her friend list. |
| OnBadgeNumOfFriendReq | The event will be triggered when the player login PGOS or the list of friend requests received changes. |
| OnFriendPresenceChanged | The event will be triggered when the presence of a friend changed. The premise is that you must first subscribe to the friend presence. |
API Details
GetFriendList
Get my friend list.
/// <summary>Get my friend list.</summary>
public void GetFriendList(FriendDelegate0 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| callback | FriendDelegate0 |
Return: void
AddFriend
Add the player to my friend list. If the peer player is online, he will receive an OnAddFriendRequest event. If the peer player is not online, he can call GetReceivedFriendRequests API when he goes online later to know that someone wants to add him as a friend. Only after the peer player accepts your friend request can the two of you become friends with each other.
/// <summary>
/// Add the player to my friend list.
/// If the peer player is online, he will receive an OnAddFriendRequest event.
/// If the peer player is not online, he can call GetReceivedFriendRequests API when he goes online later to know that someone wants to add him as a friend.
/// Only after the peer player accepts your friend request can the two of you become friends with each other.
/// </summary>
/// <param name="pgos_params">Request struct for add friend</param>
public void AddFriend(AddFriendParams pgos_params, FriendDelegate1 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | AddFriendParams | Request struct for add friend |
| callback | FriendDelegate1 |
Return: void
RemoveFriend
Remove the player from my friend list. If the peer player is online, he will receive an OnFriendRemoved event. If the peer player is not online, he will not receive an OnFriendRemoved event even when he is online, but the friend list will be updated. Note: Only the peer player can receive the OnFriendRemoved event, the API caller(you) can check the callback result for the operation succeeded or not.
/// <summary>
/// Remove the player from my friend list.
/// If the peer player is online, he will receive an OnFriendRemoved event.
/// If the peer player is not online, he will not receive an OnFriendRemoved event even when he is online, but the friend list will be updated.
/// Note: Only the peer player can receive the OnFriendRemoved event, the API caller(you) can check the callback result for the operation succeeded or not.
/// </summary>
/// <param name="player_id">The player id to remove</param>
public void RemoveFriend(string player_id, FriendDelegate1 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| player_id | string | The player id to remove |
| callback | FriendDelegate1 |
Return: void
GetReceivedFriendRequests
Get the list of received friend requests. These friend requests are from the players who want to add me as a friend.
/// <summary>
/// Get the list of received friend requests.
/// These friend requests are from the players who want to add me as a friend.
/// </summary>
public void GetReceivedFriendRequests(FriendDelegate2 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| callback | FriendDelegate2 |
Return: void
GetSentFriendRequests
Get the list of sent friend requests. These friend requests are from me because I want to add some players as a friend.
/// <summary>
/// Get the list of sent friend requests.
/// These friend requests are from me because I want to add some players as a friend.
/// </summary>
public void GetSentFriendRequests(FriendDelegate2 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| callback | FriendDelegate2 |
Return: void
AcceptFriendRequest
Accept the player's request, after that, the two of us become friends with each other. If the peer player is online, he will receive an OnAddFriendResponse event. If the peer player is not online, he will not receive the OnAddFriendResponse event even if he goes online later, but the friend list will be updated. Note: Only the peer player can receive the OnAddFriendResponse event, the API caller(you) can check the callback result for the operation succeeded or not.
/// <summary>
/// Accept the player's request, after that, the two of us become friends with each other.
/// If the peer player is online, he will receive an OnAddFriendResponse event.
/// If the peer player is not online, he will not receive the OnAddFriendResponse event even if he goes online later, but the friend list will be updated.
/// Note: Only the peer player can receive the OnAddFriendResponse event, the API caller(you) can check the callback result for the operation succeeded or not.
/// </summary>
/// <param name="player_id">The player id who sent the add-friend request</param>
public void AcceptFriendRequest(string player_id, FriendDelegate3 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| player_id | string | The player id who sent the add-friend request |
| callback | FriendDelegate3 |
Return: void
RejectFriendRequest
Reject the player's request.
/// <summary>Reject the player's request.</summary>
/// <param name="player_id">The player id who sent the add-friend request</param>
public void RejectFriendRequest(string player_id, FriendDelegate1 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| player_id | string | The player id who sent the add-friend request |
| callback | FriendDelegate1 |
Return: void
DelSentFriendRequest
Delete the friend request I sent to other player. Affects the result returned when calling the GetSentFriendRequests API in the future.
/// <summary>
/// Delete the friend request I sent to other player.
/// Affects the result returned when calling the GetSentFriendRequests API in the future.
/// </summary>
/// <param name="player_id">The id of other player</param>
public void DelSentFriendRequest(string player_id, FriendDelegate1 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| player_id | string | The id of other player |
| callback | FriendDelegate1 |
Return: void
BatchAddFriend
Add players to my friend list. (max 50 players)
/// <summary>Add players to my friend list. (max 50 players)</summary>
/// <param name="pgos_params">Request struct for batch add friend</param>
public void BatchAddFriend(BatchAddFriendParams pgos_params, FriendDelegate4 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | BatchAddFriendParams | Request struct for batch add friend |
| callback | FriendDelegate4 |
Return: void
SearchPlayers
Search for players.
/// <summary>Search for players.</summary>
/// <param name="pgos_params">Request struct for search players.</param>
public void SearchPlayers(SearchPlayersParams pgos_params, FriendDelegate5 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | SearchPlayersParams | Request struct for search players. |
| callback | FriendDelegate5 |
Return: void
SearchPlayersWithFilter
Search for players with filter.
/// <summary>Search for players with filter.</summary>
/// <param name="pgos_params">Request struct for search players with filter</param>
public void SearchPlayersWithFilter(SearchPlayersWithFilterParams pgos_params, FriendDelegate5 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | SearchPlayersWithFilterParams | Request struct for search players with filter |
| callback | FriendDelegate5 |
Return: void
GetRecentPlayers
Get recent players. Players on the blocklist will be filtered out. Return up to 20 recent players who have interacted with the current player.
/// <summary>Get recent players. Players on the blocklist will be filtered out. Return up to 20 recent players who have interacted with the current player.</summary>
public void GetRecentPlayers(FriendDelegate5 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| callback | FriendDelegate5 |
Return: void
GetRecommendedPlayers
Get recommended players. Friends and blocklisted players will be filtered out.
/// <summary>Get recommended players. Friends and blocklisted players will be filtered out.</summary>
/// <param name="pgos_params">Request struct for get recommended players</param>
public void GetRecommendedPlayers(GetRecommendedPlayersParams pgos_params, FriendDelegate5 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | GetRecommendedPlayersParams | Request struct for get recommended players |
| callback | FriendDelegate5 |
Return: void
GetPotentialFriends
Get a list of players who may be your friends. Friends and blocklisted players will be filtered out. And the result will be ordered by the mutual friend count descending.
/// <summary>
/// Get a list of players who may be your friends. Friends and blocklisted players will be filtered out.
/// And the result will be ordered by the mutual friend count descending.
/// </summary>
/// <param name="pgos_params">Request struct for get potential friends</param>
public void GetPotentialFriends(GetPotentialFriendsParams pgos_params, FriendDelegate6 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | GetPotentialFriendsParams | Request struct for get potential friends |
| callback | FriendDelegate6 |
Return: void
SetFriendRemark
Set remark to your friend, for example, "Tommy, a humorous man, met in the battle.", Max remark length: 32 characters.
/// <summary>Set remark to your friend, for example, "Tommy, a humorous man, met in the battle.", Max remark length: 32 characters.</summary>
/// <param name="pgos_params">Request struct for set friend remark</param>
public void SetFriendRemark(SetFriendRemarkParams pgos_params, FriendDelegate1 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | SetFriendRemarkParams | Request struct for set friend remark |
| callback | FriendDelegate1 |
Return: void
SubscribeFriendPresence
Subscribe to the presence of all friends. You will be notified of presence changes from your friends.
/// <summary>Subscribe to the presence of all friends. You will be notified of presence changes from your friends.</summary>
public void SubscribeFriendPresence(FriendDelegate1 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| callback | FriendDelegate1 |
Return: void
UnsubscribeFriendPresence
Unsubscribe friend presence.
/// <summary>Unsubscribe friend presence.</summary>
public void UnsubscribeFriendPresence(FriendDelegate1 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| callback | FriendDelegate1 |
Return: void
GetMyFriendsLimit
Query the maximum limit of friends you can have.
/// <summary>Query the maximum limit of friends you can have.</summary>
public void GetMyFriendsLimit(FriendDelegate7 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| callback | FriendDelegate7 |
Return: void
GetMutualFriendsCount
Get mutual friends count between this player and target players.
/// <summary>Get mutual friends count between this player and target players.</summary>
/// <param name="pgos_params">Request struct for get mutual friends</param>
public void GetMutualFriendsCount(GetMutualFriendsCountParams pgos_params, FriendDelegate8 callback);
Parameters:
| Param | Type | Description |
|---|---|---|
| pgos_params | GetMutualFriendsCountParams | Request struct for get mutual friends |
| callback | FriendDelegate8 |
Return: void
Event Details
OnAddFriendRequest
The event will be triggered when receive a request to add friend.
/// <summary>The event will be triggered when receive a request to add friend.</summary>
public event FriendDelegate9 OnAddFriendRequest;
Type Reference:
OnAddFriendResponse
The event will be triggered when your add-friend request was accepted by player.
/// <summary>The event will be triggered when your add-friend request was accepted by player.</summary>
public event FriendDelegate10 OnAddFriendResponse;
Type Reference:
OnFriendRemoved
The event will be triggered when someone has remove you from his/her friend list.
/// <summary>The event will be triggered when someone has remove you from his/her friend list.</summary>
public event FriendDelegate11 OnFriendRemoved;
Type Reference:
OnBadgeNumOfFriendReq
The event will be triggered when the player login PGOS or the list of friend requests received changes.
/// <summary>The event will be triggered when the player login PGOS or the list of friend requests received changes.</summary>
public event FriendDelegate12 OnBadgeNumOfFriendReq;
Type Reference:
OnFriendPresenceChanged
The event will be triggered when the presence of a friend changed. The premise is that you must first subscribe to the friend presence.
/// <summary>The event will be triggered when the presence of a friend changed. The premise is that you must first subscribe to the friend presence.</summary>
public event FriendDelegate13 OnFriendPresenceChanged;
Type Reference:
All Delegates
public delegate void FriendDelegate0(PgosResult a0, FriendListInfo a1);
public delegate void FriendDelegate1(PgosResult a0);
public delegate void FriendDelegate2(PgosResult a0, FriendReqListInfo a1);
public delegate void FriendDelegate3(PgosResult a0, AcceptFriendRequestResult a1);
public delegate void FriendDelegate4(PgosResult a0, BatchAddFriendRsp a1);
public delegate void FriendDelegate5(PgosResult a0, PlayerSearchInfoList a1);
public delegate void FriendDelegate6(PgosResult a0, GetPotentialFriendsResult a1);
public delegate void FriendDelegate7(PgosResult a0, GetMyFriendsLimitResult a1);
public delegate void FriendDelegate8(PgosResult a0, GetMutualFriendsCountResult a1);
public delegate void FriendDelegate9(AddFriendRequestEvt a0);
public delegate void FriendDelegate10(AddFriendResponseEvt a0);
public delegate void FriendDelegate11(FriendRemovedEvt a0);
public delegate void FriendDelegate12(BadgeNumOfFriendReqEvt a0);
public delegate void FriendDelegate13(FriendPresenceChangedEvt a0);
Type Reference: