Friend SDK Reference #
This section provides references for Friend service methods, classes, and events in the Pragma SDK for Unreal and Unity. For information on Pragma Engine backend classes and plugins, see Friend Backend Reference.
Friend API #
The table below contains a list of the SDK methods relevant to the Friend service. These methods are available via the FriendApi
.
Call | description |
---|---|
AcceptFriendInvite | Accepts a friend invite. Inviter and invitee are added to each other’s friend list |
Block | Allows a player top block another player from sending them invites by adding them to a blocklist |
DeclineFriendInvite | Declines a friend invite |
DisableIncomingFriendInvites | Prevents a player from receiving friend invites |
EnableIncomingFriendInvites | Allows player to receive friend invites |
ForceSync | Forcibly synchronizes the player client FriendApi with the friend information in the Pragma Engine backend |
GetFriends | Retrieves a list of Friend objects in a player’s friend list |
GetReceivedInvites | Retrieves a list of Friend Overview objects representing players whose friend invites you have not yet accepted/rejected |
GetSentInvites | Retrieves a list of Friend Overview objects representing players who have not responded yet to your friend invites |
GetBlockedList | Retrieves a list of Friend Overview object representing players who are blocked from sending the player a friend invite |
Initialize | Initializes the Friend API. Required to use the Friend SDK functions. |
RemoveFriend | Removes a friend from your friend list using the friend’s social ID |
SendFriendInviteByDisplayName | Sends an invite using the invitee’s display name |
SendFriendInviteBySocialId | Sends an invite using the invitee’s social ID |
Unblock | Removes a player from another player’s blocklist, allowing the unblocked player to send the unblocker friend invites |
Unreal classes #
The SDK for Unreal makes use of Pragma-defined Unreal classes. The following sections list methods available on each class:
FPragmaFriend #
method | returns |
---|---|
SocialId() | friend’s social ID |
DisplayName() | friend’s Pragma account display name |
PlayerId() | friend’s player ID |
PlayerIdByGameShard() | list of friend’s player IDs across game shards |
Presence() | list of friend’s FPragmaPresence |
PresenceByGameShard() | list of friend’s FPragmaPresence values across game shards |
ProviderAccountsByIdProvider() | map of provider IDs and provider accounts |
FPragmaFriendOverview #
method | returns |
---|---|
SocialId() | friend’s social ID |
DisplayName() | friend’s Pragma account display name |
PlayerId() | friend’s player ID |
PlayerIdByGameShard() | list of friend’s player IDs across game shards |
Events #
There are several friend-related events that player clients can listen to. The following table describes the bindable events relevant to the Friend service.
The following events are handled by the player client.
Event | Trigger | Data returned |
---|---|---|
OnFriendsListChanged | A friend is added or removed from a player’s friend list, or a friend’s presence status changes | list of FPragmaFriend on your friend list |
OnFriendUpdated | A friend’s presence status changes | FPragmaFriend |
OnSentInvitesChanged | The status of a sent invite changes | list of FPragmaFriendOverview for pending sent invites |
OnReceivedInvitesChanged | The status of a received invite changes | list of FPragmaFriendOverview for pending received invites |
OnBlockedListChanged | An account is added or removed from the player’s blocklist | list of FPragmaFriendOverview for accounts on your blocklist |
OnFriendInviteReceived | A player receives an invite | FPragmaFriendOverview |
OnFriendInviteAccepted | An invitee accepts a friend invite | FPragmaFriendOverview |
OnFriendInviteDeclined | An invitee declines a friend invite | FPragmaFriendOverview |
OnRemovedAsFriend | A player is removed from another player’s friend list | FPragmaFriend |
OnIncomingFriendInvitesEnabledChanged | A player’s ability to receive invites changes | true/false |
If notifications from the engine are received out of order due to a network issue, the friend cache will automatically refresh and the ‘On Changed’ events will be broadcasted.