You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
159 lines
9.0 KiB
C#
159 lines
9.0 KiB
C#
1 month ago
|
#if !DISABLE_PLAYFABENTITY_API && !DISABLE_PLAYFAB_STATIC_API
|
||
|
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using PlayFab.ProfilesModels;
|
||
|
using PlayFab.Internal;
|
||
|
|
||
|
namespace PlayFab
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// All PlayFab entities have profiles, which hold top-level properties about the entity. These APIs give you the tools
|
||
|
/// needed to manage entity profiles.
|
||
|
/// </summary>
|
||
|
public static class PlayFabProfilesAPI
|
||
|
{
|
||
|
static PlayFabProfilesAPI() {}
|
||
|
|
||
|
|
||
|
/// <summary>
|
||
|
/// Verify entity login.
|
||
|
/// </summary>
|
||
|
public static bool IsEntityLoggedIn()
|
||
|
{
|
||
|
return PlayFabSettings.staticPlayer.IsEntityLoggedIn();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Clear the Client SessionToken which allows this Client to call API calls requiring login.
|
||
|
/// A new/fresh login will be required after calling this.
|
||
|
/// </summary>
|
||
|
public static void ForgetAllCredentials()
|
||
|
{
|
||
|
PlayFabSettings.staticPlayer.ForgetAllCredentials();
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Gets the global title access policy
|
||
|
/// </summary>
|
||
|
public static void GetGlobalPolicy(GetGlobalPolicyRequest request, Action<GetGlobalPolicyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
||
|
{
|
||
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
||
|
var callSettings = PlayFabSettings.staticSettings;
|
||
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
||
|
|
||
|
|
||
|
PlayFabHttp.MakeApiCall("/Profile/GetGlobalPolicy", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Retrieves the entity's profile.
|
||
|
/// </summary>
|
||
|
public static void GetProfile(GetEntityProfileRequest request, Action<GetEntityProfileResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
||
|
{
|
||
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
||
|
var callSettings = PlayFabSettings.staticSettings;
|
||
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
||
|
|
||
|
|
||
|
PlayFabHttp.MakeApiCall("/Profile/GetProfile", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Retrieves the entity's profile.
|
||
|
/// </summary>
|
||
|
public static void GetProfiles(GetEntityProfilesRequest request, Action<GetEntityProfilesResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
||
|
{
|
||
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
||
|
var callSettings = PlayFabSettings.staticSettings;
|
||
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
||
|
|
||
|
|
||
|
PlayFabHttp.MakeApiCall("/Profile/GetProfiles", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Retrieves the title player accounts associated with the given master player account.
|
||
|
/// </summary>
|
||
|
public static void GetTitlePlayersFromMasterPlayerAccountIds(GetTitlePlayersFromMasterPlayerAccountIdsRequest request, Action<GetTitlePlayersFromMasterPlayerAccountIdsResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
||
|
{
|
||
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
||
|
var callSettings = PlayFabSettings.staticSettings;
|
||
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
||
|
|
||
|
|
||
|
PlayFabHttp.MakeApiCall("/Profile/GetTitlePlayersFromMasterPlayerAccountIds", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Retrieves the title player accounts associated with the given XUIDs.
|
||
|
/// </summary>
|
||
|
public static void GetTitlePlayersFromXboxLiveIDs(GetTitlePlayersFromXboxLiveIDsRequest request, Action<GetTitlePlayersFromProviderIDsResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
||
|
{
|
||
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
||
|
var callSettings = PlayFabSettings.staticSettings;
|
||
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
||
|
|
||
|
|
||
|
PlayFabHttp.MakeApiCall("/Profile/GetTitlePlayersFromXboxLiveIDs", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Update the display name of the entity
|
||
|
/// </summary>
|
||
|
public static void SetDisplayName(SetDisplayNameRequest request, Action<SetDisplayNameResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
||
|
{
|
||
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
||
|
var callSettings = PlayFabSettings.staticSettings;
|
||
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
||
|
|
||
|
|
||
|
PlayFabHttp.MakeApiCall("/Profile/SetDisplayName", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Sets the global title access policy
|
||
|
/// </summary>
|
||
|
public static void SetGlobalPolicy(SetGlobalPolicyRequest request, Action<SetGlobalPolicyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
||
|
{
|
||
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
||
|
var callSettings = PlayFabSettings.staticSettings;
|
||
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
||
|
|
||
|
|
||
|
PlayFabHttp.MakeApiCall("/Profile/SetGlobalPolicy", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Updates the entity's language. The precedence hierarchy for communication to the player is Title Player Account
|
||
|
/// language, Master Player Account language, and then title default language if the first two aren't set or supported.
|
||
|
/// </summary>
|
||
|
public static void SetProfileLanguage(SetProfileLanguageRequest request, Action<SetProfileLanguageResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
||
|
{
|
||
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
||
|
var callSettings = PlayFabSettings.staticSettings;
|
||
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
||
|
|
||
|
|
||
|
PlayFabHttp.MakeApiCall("/Profile/SetProfileLanguage", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// Sets the profiles access policy
|
||
|
/// </summary>
|
||
|
public static void SetProfilePolicy(SetEntityProfilePolicyRequest request, Action<SetEntityProfilePolicyResponse> resultCallback, Action<PlayFabError> errorCallback, object customData = null, Dictionary<string, string> extraHeaders = null)
|
||
|
{
|
||
|
var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;
|
||
|
var callSettings = PlayFabSettings.staticSettings;
|
||
|
if (!context.IsEntityLoggedIn()) throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn,"Must be logged in to call this method");
|
||
|
|
||
|
|
||
|
PlayFabHttp.MakeApiCall("/Profile/SetProfilePolicy", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings);
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endif
|