PlayPortalProfileClient

This class is responsible for making requests to the playPORTAL user API.
public sealed class PlayPortalProfileClient

The PlayPortalProfileClient class allows your app to request the current user's profile and request the current user's friends, giving your app access to the playPORTAL social network.

You will need to enable the "Profile" scope for your app in the developer dashboard before using the user API.

Properties

public static readonly PlayPortalProfileClient Instance;

Singleton instance of PlayPortalProfileClient. You will access all the available PlayPortalProfileClient methods through this instance.

Methods

GetMyProfile

public void GetMyProfile(Action<Exception, PlayPortalProfile> completion)

Request the currently authenticated user's profile. It's unlikely that you will need to directly use this method, as the Login method on PlayPortalAuthClient will pass an instance of PlayPortalProfile representing the current user.

Parameter

Type

Description

completion

Action<Exception, PlayPortalProfile>

The delegate invoked when the request finishes. Called with an Exception argument if the request fails; otherwise, called with an instance of PlayPortalProfile.

GetMyFriends

public void GetMyFriends(Action<Exception, List<PlayPortalProfile>> completion)

Request the current user's friends list. When running in sandbox mode, you can created friendship links between sandbox users in the developer dashboard, allowing you to create and test a social network in your app.

Parameter

Type

Description

completion

Action<Exception, List<PlayPortalProfile>>

The delegate invoked when the request finishes. Called with an Exception argument if the request fails; otherwise, called with a List representing the current user's friends.

CreateAnonymousUser

public void CreateAnonymousUser(string dateOfBirth, Action<Exception, PlayPortalProfile> completion, string deviceToken = null)

Create an anonymous user that can be used in place of a user created through the playPORTAL signup flow.

The lifetime of an anonymous user is essentially as long as they are logged into the app. Once an anonymous user logs out, a new anonymous user will have to be created.

Anonymous users do not have access to some functionality, such as Leaderboards and Smart Search scopes. Making requests to those APIs, ie, via the PlayPortalLeaderboardClient class, will return an error.

Parameter

Type

Description

dateOfBirth

string

Date string representing the user's date of birth. This is required to create the appropriate type of account for the user.

completion

Action<Exception, PlayPortalProfile>

The delegate invoked when the request finishes. Called with an Exception argument if the request fails; otherwise, called with an instance of PlayPortalProfile representing the anonymous user.

deviceToken

string

Optional argument; defaults to null. Device token used for push notifications for the anonymous user. Only available on mobile.

GetMyProfilePicture

public void GetMyProfilePicture(Action<Exception, byte[]> completion)

Request the currently authenticated user's profile picture data.

Parameter

Type

Description

completion

Action<Exception, byte[]>

The delegate invoked when the request finishes. Called with an Exception argument if the request fails; otherwise, called with a byte array representing the profile picture data.

GetMyCoverPhoto

public void GetMyCoverPhoto(Action<Exception, byte[]> completion)

Request the currently authenticated user's cover photo data.

Parameter

Type

Description

completion

Action<Exception, byte[]>

The delegate invoked when the request finishes. Called with an Exception argument if the request fails; otherwise, called with a byte array representing the profile picture data.