All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.playfab.PlayFabProfilesAPI Maven / Gradle / Ivy
Go to download
PlayFab is the unified backend platform for games — everything you need to build and operate your game, all in one place, so you can focus on creating and delivering a great player experience.
package com.playfab;
import com.playfab.internal.*;
import com.playfab.PlayFabProfilesModels.*;
import com.playfab.PlayFabErrors.*;
import com.playfab.PlayFabSettings;
import java.util.concurrent.*;
import java.util.*;
import com.google.gson.*;
import com.google.gson.reflect.*;
/**
* All PlayFab entities have profiles, which hold top-level properties about the entity. These APIs give you the tools
* needed to manage entity profiles.
*/
public class PlayFabProfilesAPI {
private static Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").create();
/**
* Gets the global title access policy
* @param request GetGlobalPolicyRequest
* @return Async Task will return GetGlobalPolicyResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> GetGlobalPolicyAsync(final GetGlobalPolicyRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetGlobalPolicyAsync(request);
}
});
}
/**
* Gets the global title access policy
* @param request GetGlobalPolicyRequest
* @return GetGlobalPolicyResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult GetGlobalPolicy(final GetGlobalPolicyRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetGlobalPolicyAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Gets the global title access policy */
@SuppressWarnings("unchecked")
private static PlayFabResult privateGetGlobalPolicyAsync(final GetGlobalPolicyRequest request) throws Exception {
if (PlayFabSettings.EntityToken == null) throw new Exception ("Must call GetEntityToken before you can use the Entity API");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Profile/GetGlobalPolicy"), request, "X-EntityToken", PlayFabSettings.EntityToken);
task.run();
Object httpResult = task.get();
if (httpResult instanceof PlayFabError) {
PlayFabError error = (PlayFabError)httpResult;
if (PlayFabSettings.GlobalErrorHandler != null)
PlayFabSettings.GlobalErrorHandler.callback(error);
PlayFabResult result = new PlayFabResult();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;
PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType());
GetGlobalPolicyResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Retrieves the entity's profile.
* @param request GetEntityProfileRequest
* @return Async Task will return GetEntityProfileResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> GetProfileAsync(final GetEntityProfileRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetProfileAsync(request);
}
});
}
/**
* Retrieves the entity's profile.
* @param request GetEntityProfileRequest
* @return GetEntityProfileResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult GetProfile(final GetEntityProfileRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetProfileAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Retrieves the entity's profile. */
@SuppressWarnings("unchecked")
private static PlayFabResult privateGetProfileAsync(final GetEntityProfileRequest request) throws Exception {
if (PlayFabSettings.EntityToken == null) throw new Exception ("Must call GetEntityToken before you can use the Entity API");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Profile/GetProfile"), request, "X-EntityToken", PlayFabSettings.EntityToken);
task.run();
Object httpResult = task.get();
if (httpResult instanceof PlayFabError) {
PlayFabError error = (PlayFabError)httpResult;
if (PlayFabSettings.GlobalErrorHandler != null)
PlayFabSettings.GlobalErrorHandler.callback(error);
PlayFabResult result = new PlayFabResult();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;
PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType());
GetEntityProfileResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Retrieves the entity's profile.
* @param request GetEntityProfilesRequest
* @return Async Task will return GetEntityProfilesResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> GetProfilesAsync(final GetEntityProfilesRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetProfilesAsync(request);
}
});
}
/**
* Retrieves the entity's profile.
* @param request GetEntityProfilesRequest
* @return GetEntityProfilesResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult GetProfiles(final GetEntityProfilesRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetProfilesAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Retrieves the entity's profile. */
@SuppressWarnings("unchecked")
private static PlayFabResult privateGetProfilesAsync(final GetEntityProfilesRequest request) throws Exception {
if (PlayFabSettings.EntityToken == null) throw new Exception ("Must call GetEntityToken before you can use the Entity API");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Profile/GetProfiles"), request, "X-EntityToken", PlayFabSettings.EntityToken);
task.run();
Object httpResult = task.get();
if (httpResult instanceof PlayFabError) {
PlayFabError error = (PlayFabError)httpResult;
if (PlayFabSettings.GlobalErrorHandler != null)
PlayFabSettings.GlobalErrorHandler.callback(error);
PlayFabResult result = new PlayFabResult();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;
PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType());
GetEntityProfilesResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Sets the global title access policy
* @param request SetGlobalPolicyRequest
* @return Async Task will return SetGlobalPolicyResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> SetGlobalPolicyAsync(final SetGlobalPolicyRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateSetGlobalPolicyAsync(request);
}
});
}
/**
* Sets the global title access policy
* @param request SetGlobalPolicyRequest
* @return SetGlobalPolicyResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult SetGlobalPolicy(final SetGlobalPolicyRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateSetGlobalPolicyAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Sets the global title access policy */
@SuppressWarnings("unchecked")
private static PlayFabResult privateSetGlobalPolicyAsync(final SetGlobalPolicyRequest request) throws Exception {
if (PlayFabSettings.EntityToken == null) throw new Exception ("Must call GetEntityToken before you can use the Entity API");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Profile/SetGlobalPolicy"), request, "X-EntityToken", PlayFabSettings.EntityToken);
task.run();
Object httpResult = task.get();
if (httpResult instanceof PlayFabError) {
PlayFabError error = (PlayFabError)httpResult;
if (PlayFabSettings.GlobalErrorHandler != null)
PlayFabSettings.GlobalErrorHandler.callback(error);
PlayFabResult result = new PlayFabResult();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;
PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType());
SetGlobalPolicyResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* 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.
* @param request SetProfileLanguageRequest
* @return Async Task will return SetProfileLanguageResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> SetProfileLanguageAsync(final SetProfileLanguageRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateSetProfileLanguageAsync(request);
}
});
}
/**
* 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.
* @param request SetProfileLanguageRequest
* @return SetProfileLanguageResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult SetProfileLanguage(final SetProfileLanguageRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateSetProfileLanguageAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/**
* 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.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult privateSetProfileLanguageAsync(final SetProfileLanguageRequest request) throws Exception {
if (PlayFabSettings.EntityToken == null) throw new Exception ("Must call GetEntityToken before you can use the Entity API");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Profile/SetProfileLanguage"), request, "X-EntityToken", PlayFabSettings.EntityToken);
task.run();
Object httpResult = task.get();
if (httpResult instanceof PlayFabError) {
PlayFabError error = (PlayFabError)httpResult;
if (PlayFabSettings.GlobalErrorHandler != null)
PlayFabSettings.GlobalErrorHandler.callback(error);
PlayFabResult result = new PlayFabResult();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;
PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType());
SetProfileLanguageResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Sets the profiles access policy
* @param request SetEntityProfilePolicyRequest
* @return Async Task will return SetEntityProfilePolicyResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> SetProfilePolicyAsync(final SetEntityProfilePolicyRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateSetProfilePolicyAsync(request);
}
});
}
/**
* Sets the profiles access policy
* @param request SetEntityProfilePolicyRequest
* @return SetEntityProfilePolicyResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult SetProfilePolicy(final SetEntityProfilePolicyRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateSetProfilePolicyAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Sets the profiles access policy */
@SuppressWarnings("unchecked")
private static PlayFabResult privateSetProfilePolicyAsync(final SetEntityProfilePolicyRequest request) throws Exception {
if (PlayFabSettings.EntityToken == null) throw new Exception ("Must call GetEntityToken before you can use the Entity API");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Profile/SetProfilePolicy"), request, "X-EntityToken", PlayFabSettings.EntityToken);
task.run();
Object httpResult = task.get();
if (httpResult instanceof PlayFabError) {
PlayFabError error = (PlayFabError)httpResult;
if (PlayFabSettings.GlobalErrorHandler != null)
PlayFabSettings.GlobalErrorHandler.callback(error);
PlayFabResult result = new PlayFabResult();
result.Error = error;
return result;
}
String resultRawJson = (String) httpResult;
PlayFabJsonSuccess resultData = gson.fromJson(resultRawJson, new TypeToken>(){}.getType());
SetEntityProfilePolicyResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
}