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.PlayFabServerAPI 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.PlayFabServerModels.*;
import com.playfab.PlayFabErrors.*;
import com.playfab.PlayFabSettings;
import java.util.concurrent.*;
import java.util.*;
import com.google.gson.*;
import com.google.gson.reflect.*;
/**
* Provides functionality to allow external (developer-controlled) servers to interact with user inventories and data in a
* trusted manner, and to handle matchmaking and client connection orchestration
*/
public class PlayFabServerAPI {
private static Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").create();
/**
* Increments the character's balance of the specified virtual currency by the stated amount
* @param request AddCharacterVirtualCurrencyRequest
* @return Async Task will return ModifyCharacterVirtualCurrencyResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> AddCharacterVirtualCurrencyAsync(final AddCharacterVirtualCurrencyRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAddCharacterVirtualCurrencyAsync(request);
}
});
}
/**
* Increments the character's balance of the specified virtual currency by the stated amount
* @param request AddCharacterVirtualCurrencyRequest
* @return ModifyCharacterVirtualCurrencyResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult AddCharacterVirtualCurrency(final AddCharacterVirtualCurrencyRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAddCharacterVirtualCurrencyAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Increments the character's balance of the specified virtual currency by the stated amount */
@SuppressWarnings("unchecked")
private static PlayFabResult privateAddCharacterVirtualCurrencyAsync(final AddCharacterVirtualCurrencyRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/AddCharacterVirtualCurrency"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
ModifyCharacterVirtualCurrencyResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Adds the Friend user to the friendlist of the user with PlayFabId. At least one of
* FriendPlayFabId,FriendUsername,FriendEmail, or FriendTitleDisplayName should be initialized.
* @param request AddFriendRequest
* @return Async Task will return EmptyResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> AddFriendAsync(final AddFriendRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAddFriendAsync(request);
}
});
}
/**
* Adds the Friend user to the friendlist of the user with PlayFabId. At least one of
* FriendPlayFabId,FriendUsername,FriendEmail, or FriendTitleDisplayName should be initialized.
* @param request AddFriendRequest
* @return EmptyResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult AddFriend(final AddFriendRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAddFriendAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/**
* Adds the Friend user to the friendlist of the user with PlayFabId. At least one of
* FriendPlayFabId,FriendUsername,FriendEmail, or FriendTitleDisplayName should be initialized.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult privateAddFriendAsync(final AddFriendRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/AddFriend"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
EmptyResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Adds a given tag to a player profile. The tag's namespace is automatically generated based on the source of the tag.
* @param request AddPlayerTagRequest
* @return Async Task will return AddPlayerTagResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> AddPlayerTagAsync(final AddPlayerTagRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAddPlayerTagAsync(request);
}
});
}
/**
* Adds a given tag to a player profile. The tag's namespace is automatically generated based on the source of the tag.
* @param request AddPlayerTagRequest
* @return AddPlayerTagResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult AddPlayerTag(final AddPlayerTagRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAddPlayerTagAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Adds a given tag to a player profile. The tag's namespace is automatically generated based on the source of the tag. */
@SuppressWarnings("unchecked")
private static PlayFabResult privateAddPlayerTagAsync(final AddPlayerTagRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/AddPlayerTag"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
AddPlayerTagResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Adds users to the set of those able to update both the shared data, as well as the set of users in the group. Only users
* in the group (and the server) can add new members. Shared Groups are designed for sharing data between a very small
* number of players, please see our guide: https://api.playfab.com/docs/tutorials/landing-players/shared-groups
* @param request AddSharedGroupMembersRequest
* @return Async Task will return AddSharedGroupMembersResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> AddSharedGroupMembersAsync(final AddSharedGroupMembersRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAddSharedGroupMembersAsync(request);
}
});
}
/**
* Adds users to the set of those able to update both the shared data, as well as the set of users in the group. Only users
* in the group (and the server) can add new members. Shared Groups are designed for sharing data between a very small
* number of players, please see our guide: https://api.playfab.com/docs/tutorials/landing-players/shared-groups
* @param request AddSharedGroupMembersRequest
* @return AddSharedGroupMembersResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult AddSharedGroupMembers(final AddSharedGroupMembersRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAddSharedGroupMembersAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/**
* Adds users to the set of those able to update both the shared data, as well as the set of users in the group. Only users
* in the group (and the server) can add new members. Shared Groups are designed for sharing data between a very small
* number of players, please see our guide: https://api.playfab.com/docs/tutorials/landing-players/shared-groups
*/
@SuppressWarnings("unchecked")
private static PlayFabResult privateAddSharedGroupMembersAsync(final AddSharedGroupMembersRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/AddSharedGroupMembers"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
AddSharedGroupMembersResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Increments the user's balance of the specified virtual currency by the stated amount
* @param request AddUserVirtualCurrencyRequest
* @return Async Task will return ModifyUserVirtualCurrencyResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> AddUserVirtualCurrencyAsync(final AddUserVirtualCurrencyRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAddUserVirtualCurrencyAsync(request);
}
});
}
/**
* Increments the user's balance of the specified virtual currency by the stated amount
* @param request AddUserVirtualCurrencyRequest
* @return ModifyUserVirtualCurrencyResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult AddUserVirtualCurrency(final AddUserVirtualCurrencyRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAddUserVirtualCurrencyAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Increments the user's balance of the specified virtual currency by the stated amount */
@SuppressWarnings("unchecked")
private static PlayFabResult privateAddUserVirtualCurrencyAsync(final AddUserVirtualCurrencyRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/AddUserVirtualCurrency"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
ModifyUserVirtualCurrencyResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Validated a client's session ticket, and if successful, returns details for that user
* @param request AuthenticateSessionTicketRequest
* @return Async Task will return AuthenticateSessionTicketResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> AuthenticateSessionTicketAsync(final AuthenticateSessionTicketRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAuthenticateSessionTicketAsync(request);
}
});
}
/**
* Validated a client's session ticket, and if successful, returns details for that user
* @param request AuthenticateSessionTicketRequest
* @return AuthenticateSessionTicketResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult AuthenticateSessionTicket(final AuthenticateSessionTicketRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAuthenticateSessionTicketAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Validated a client's session ticket, and if successful, returns details for that user */
@SuppressWarnings("unchecked")
private static PlayFabResult privateAuthenticateSessionTicketAsync(final AuthenticateSessionTicketRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/AuthenticateSessionTicket"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
AuthenticateSessionTicketResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Awards the specified users the specified Steam achievements
* @param request AwardSteamAchievementRequest
* @return Async Task will return AwardSteamAchievementResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> AwardSteamAchievementAsync(final AwardSteamAchievementRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAwardSteamAchievementAsync(request);
}
});
}
/**
* Awards the specified users the specified Steam achievements
* @param request AwardSteamAchievementRequest
* @return AwardSteamAchievementResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult AwardSteamAchievement(final AwardSteamAchievementRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateAwardSteamAchievementAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Awards the specified users the specified Steam achievements */
@SuppressWarnings("unchecked")
private static PlayFabResult privateAwardSteamAchievementAsync(final AwardSteamAchievementRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/AwardSteamAchievement"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
AwardSteamAchievementResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Bans users by PlayFab ID with optional IP address, or MAC address for the provided game.
* @param request BanUsersRequest
* @return Async Task will return BanUsersResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> BanUsersAsync(final BanUsersRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateBanUsersAsync(request);
}
});
}
/**
* Bans users by PlayFab ID with optional IP address, or MAC address for the provided game.
* @param request BanUsersRequest
* @return BanUsersResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult BanUsers(final BanUsersRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateBanUsersAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Bans users by PlayFab ID with optional IP address, or MAC address for the provided game. */
@SuppressWarnings("unchecked")
private static PlayFabResult privateBanUsersAsync(final BanUsersRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/BanUsers"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
BanUsersResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Consume uses of a consumable item. When all uses are consumed, it will be removed from the player's inventory.
* @param request ConsumeItemRequest
* @return Async Task will return ConsumeItemResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> ConsumeItemAsync(final ConsumeItemRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateConsumeItemAsync(request);
}
});
}
/**
* Consume uses of a consumable item. When all uses are consumed, it will be removed from the player's inventory.
* @param request ConsumeItemRequest
* @return ConsumeItemResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult ConsumeItem(final ConsumeItemRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateConsumeItemAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Consume uses of a consumable item. When all uses are consumed, it will be removed from the player's inventory. */
@SuppressWarnings("unchecked")
private static PlayFabResult privateConsumeItemAsync(final ConsumeItemRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/ConsumeItem"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
ConsumeItemResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Requests the creation of a shared group object, containing key/value pairs which may be updated by all members of the
* group. When created by a server, the group will initially have no members. Shared Groups are designed for sharing data
* between a very small number of players, please see our guide:
* https://api.playfab.com/docs/tutorials/landing-players/shared-groups
* @param request CreateSharedGroupRequest
* @return Async Task will return CreateSharedGroupResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> CreateSharedGroupAsync(final CreateSharedGroupRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateCreateSharedGroupAsync(request);
}
});
}
/**
* Requests the creation of a shared group object, containing key/value pairs which may be updated by all members of the
* group. When created by a server, the group will initially have no members. Shared Groups are designed for sharing data
* between a very small number of players, please see our guide:
* https://api.playfab.com/docs/tutorials/landing-players/shared-groups
* @param request CreateSharedGroupRequest
* @return CreateSharedGroupResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult CreateSharedGroup(final CreateSharedGroupRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateCreateSharedGroupAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/**
* Requests the creation of a shared group object, containing key/value pairs which may be updated by all members of the
* group. When created by a server, the group will initially have no members. Shared Groups are designed for sharing data
* between a very small number of players, please see our guide:
* https://api.playfab.com/docs/tutorials/landing-players/shared-groups
*/
@SuppressWarnings("unchecked")
private static PlayFabResult privateCreateSharedGroupAsync(final CreateSharedGroupRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/CreateSharedGroup"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
CreateSharedGroupResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Deletes the specific character ID from the specified user.
* @param request DeleteCharacterFromUserRequest
* @return Async Task will return DeleteCharacterFromUserResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> DeleteCharacterFromUserAsync(final DeleteCharacterFromUserRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateDeleteCharacterFromUserAsync(request);
}
});
}
/**
* Deletes the specific character ID from the specified user.
* @param request DeleteCharacterFromUserRequest
* @return DeleteCharacterFromUserResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult DeleteCharacterFromUser(final DeleteCharacterFromUserRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateDeleteCharacterFromUserAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Deletes the specific character ID from the specified user. */
@SuppressWarnings("unchecked")
private static PlayFabResult privateDeleteCharacterFromUserAsync(final DeleteCharacterFromUserRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/DeleteCharacterFromUser"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
DeleteCharacterFromUserResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Removes a user's player account from a title and deletes all associated data
* @param request DeletePlayerRequest
* @return Async Task will return DeletePlayerResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> DeletePlayerAsync(final DeletePlayerRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateDeletePlayerAsync(request);
}
});
}
/**
* Removes a user's player account from a title and deletes all associated data
* @param request DeletePlayerRequest
* @return DeletePlayerResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult DeletePlayer(final DeletePlayerRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateDeletePlayerAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Removes a user's player account from a title and deletes all associated data */
@SuppressWarnings("unchecked")
private static PlayFabResult privateDeletePlayerAsync(final DeletePlayerRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/DeletePlayer"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
DeletePlayerResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Deletes a shared group, freeing up the shared group ID to be reused for a new group. Shared Groups are designed for
* sharing data between a very small number of players, please see our guide:
* https://api.playfab.com/docs/tutorials/landing-players/shared-groups
* @param request DeleteSharedGroupRequest
* @return Async Task will return EmptyResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> DeleteSharedGroupAsync(final DeleteSharedGroupRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateDeleteSharedGroupAsync(request);
}
});
}
/**
* Deletes a shared group, freeing up the shared group ID to be reused for a new group. Shared Groups are designed for
* sharing data between a very small number of players, please see our guide:
* https://api.playfab.com/docs/tutorials/landing-players/shared-groups
* @param request DeleteSharedGroupRequest
* @return EmptyResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult DeleteSharedGroup(final DeleteSharedGroupRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateDeleteSharedGroupAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/**
* Deletes a shared group, freeing up the shared group ID to be reused for a new group. Shared Groups are designed for
* sharing data between a very small number of players, please see our guide:
* https://api.playfab.com/docs/tutorials/landing-players/shared-groups
*/
@SuppressWarnings("unchecked")
private static PlayFabResult privateDeleteSharedGroupAsync(final DeleteSharedGroupRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/DeleteSharedGroup"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
EmptyResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Inform the matchmaker that a Game Server Instance is removed.
* @param request DeregisterGameRequest
* @return Async Task will return DeregisterGameResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> DeregisterGameAsync(final DeregisterGameRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateDeregisterGameAsync(request);
}
});
}
/**
* Inform the matchmaker that a Game Server Instance is removed.
* @param request DeregisterGameRequest
* @return DeregisterGameResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult DeregisterGame(final DeregisterGameRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateDeregisterGameAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Inform the matchmaker that a Game Server Instance is removed. */
@SuppressWarnings("unchecked")
private static PlayFabResult privateDeregisterGameAsync(final DeregisterGameRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/DeregisterGame"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
DeregisterGameResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Returns the result of an evaluation of a Random Result Table - the ItemId from the game Catalog which would have been
* added to the player inventory, if the Random Result Table were added via a Bundle or a call to UnlockContainer.
* @param request EvaluateRandomResultTableRequest
* @return Async Task will return EvaluateRandomResultTableResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> EvaluateRandomResultTableAsync(final EvaluateRandomResultTableRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateEvaluateRandomResultTableAsync(request);
}
});
}
/**
* Returns the result of an evaluation of a Random Result Table - the ItemId from the game Catalog which would have been
* added to the player inventory, if the Random Result Table were added via a Bundle or a call to UnlockContainer.
* @param request EvaluateRandomResultTableRequest
* @return EvaluateRandomResultTableResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult EvaluateRandomResultTable(final EvaluateRandomResultTableRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateEvaluateRandomResultTableAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/**
* Returns the result of an evaluation of a Random Result Table - the ItemId from the game Catalog which would have been
* added to the player inventory, if the Random Result Table were added via a Bundle or a call to UnlockContainer.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult privateEvaluateRandomResultTableAsync(final EvaluateRandomResultTableRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/EvaluateRandomResultTable"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
EvaluateRandomResultTableResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Executes a CloudScript function, with the 'currentPlayerId' variable set to the specified PlayFabId parameter value.
* @param request ExecuteCloudScriptServerRequest
* @return Async Task will return ExecuteCloudScriptResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> ExecuteCloudScriptAsync(final ExecuteCloudScriptServerRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateExecuteCloudScriptAsync(request);
}
});
}
/**
* Executes a CloudScript function, with the 'currentPlayerId' variable set to the specified PlayFabId parameter value.
* @param request ExecuteCloudScriptServerRequest
* @return ExecuteCloudScriptResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult ExecuteCloudScript(final ExecuteCloudScriptServerRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateExecuteCloudScriptAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/** Executes a CloudScript function, with the 'currentPlayerId' variable set to the specified PlayFabId parameter value. */
@SuppressWarnings("unchecked")
private static PlayFabResult privateExecuteCloudScriptAsync(final ExecuteCloudScriptServerRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/ExecuteCloudScript"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
ExecuteCloudScriptResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Retrieves an array of player segment definitions. Results from this can be used in subsequent API calls such as
* GetPlayersInSegment which requires a Segment ID. While segment names can change the ID for that segment will not change.
* @param request GetAllSegmentsRequest
* @return Async Task will return GetAllSegmentsResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> GetAllSegmentsAsync(final GetAllSegmentsRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetAllSegmentsAsync(request);
}
});
}
/**
* Retrieves an array of player segment definitions. Results from this can be used in subsequent API calls such as
* GetPlayersInSegment which requires a Segment ID. While segment names can change the ID for that segment will not change.
* @param request GetAllSegmentsRequest
* @return GetAllSegmentsResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult GetAllSegments(final GetAllSegmentsRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetAllSegmentsAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/**
* Retrieves an array of player segment definitions. Results from this can be used in subsequent API calls such as
* GetPlayersInSegment which requires a Segment ID. While segment names can change the ID for that segment will not change.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult privateGetAllSegmentsAsync(final GetAllSegmentsRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/GetAllSegments"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
GetAllSegmentsResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Lists all of the characters that belong to a specific user. CharacterIds are not globally unique; characterId must be
* evaluated with the parent PlayFabId to guarantee uniqueness.
* @param request ListUsersCharactersRequest
* @return Async Task will return ListUsersCharactersResult
*/
@SuppressWarnings("unchecked")
public static FutureTask> GetAllUsersCharactersAsync(final ListUsersCharactersRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetAllUsersCharactersAsync(request);
}
});
}
/**
* Lists all of the characters that belong to a specific user. CharacterIds are not globally unique; characterId must be
* evaluated with the parent PlayFabId to guarantee uniqueness.
* @param request ListUsersCharactersRequest
* @return ListUsersCharactersResult
*/
@SuppressWarnings("unchecked")
public static PlayFabResult GetAllUsersCharacters(final ListUsersCharactersRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetAllUsersCharactersAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
return null;
}
}
/**
* Lists all of the characters that belong to a specific user. CharacterIds are not globally unique; characterId must be
* evaluated with the parent PlayFabId to guarantee uniqueness.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult privateGetAllUsersCharactersAsync(final ListUsersCharactersRequest request) throws Exception {
if (PlayFabSettings.DeveloperSecretKey == null) throw new Exception ("Must have PlayFabSettings.DeveloperSecretKey set to call this method");
FutureTask task = PlayFabHTTP.doPost(PlayFabSettings.GetURL("/Server/GetAllUsersCharacters"), request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey);
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());
ListUsersCharactersResult result = resultData.data;
PlayFabResult pfResult = new PlayFabResult