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.PlayFabInsightsAPI 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.PlayFabInsightsModels.*;
import com.playfab.PlayFabErrors.*;
import com.playfab.PlayFabSettings;
import java.util.concurrent.*;
import java.util.*;
import com.google.gson.*;
import com.google.gson.reflect.*;
/** Manage the Insights performance level and data storage retention settings. */
public class PlayFabInsightsAPI {
private static Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").create();
/**
* Gets the current values for the Insights performance and data storage retention, list of pending operations, and the
* performance and data storage retention limits.
* @param request InsightsEmptyRequest
* @return Async Task will return InsightsGetDetailsResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> GetDetailsAsync(final InsightsEmptyRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetDetailsAsync(request);
}
});
}
/**
* Gets the current values for the Insights performance and data storage retention, list of pending operations, and the
* performance and data storage retention limits.
* @param request InsightsEmptyRequest
* @return InsightsGetDetailsResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult GetDetails(final InsightsEmptyRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetDetailsAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
PlayFabResult exceptionResult = new PlayFabResult();
exceptionResult.Error = PlayFabHTTP.GeneratePfError(-1, PlayFabErrorCode.Unknown, e.getMessage(), null);
return exceptionResult;
}
}
/**
* Gets the current values for the Insights performance and data storage retention, list of pending operations, and the
* performance and data storage retention limits.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult privateGetDetailsAsync(final InsightsEmptyRequest 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("/Insights/GetDetails"), 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());
InsightsGetDetailsResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Retrieves the range of allowed values for performance and data storage retention values as well as the submeter details
* for each performance level.
* @param request InsightsEmptyRequest
* @return Async Task will return InsightsGetLimitsResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> GetLimitsAsync(final InsightsEmptyRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetLimitsAsync(request);
}
});
}
/**
* Retrieves the range of allowed values for performance and data storage retention values as well as the submeter details
* for each performance level.
* @param request InsightsEmptyRequest
* @return InsightsGetLimitsResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult GetLimits(final InsightsEmptyRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetLimitsAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
PlayFabResult exceptionResult = new PlayFabResult();
exceptionResult.Error = PlayFabHTTP.GeneratePfError(-1, PlayFabErrorCode.Unknown, e.getMessage(), null);
return exceptionResult;
}
}
/**
* Retrieves the range of allowed values for performance and data storage retention values as well as the submeter details
* for each performance level.
*/
@SuppressWarnings("unchecked")
private static PlayFabResult privateGetLimitsAsync(final InsightsEmptyRequest 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("/Insights/GetLimits"), 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());
InsightsGetLimitsResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Gets the status of a SetPerformance or SetStorageRetention operation.
* @param request InsightsGetOperationStatusRequest
* @return Async Task will return InsightsGetOperationStatusResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> GetOperationStatusAsync(final InsightsGetOperationStatusRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetOperationStatusAsync(request);
}
});
}
/**
* Gets the status of a SetPerformance or SetStorageRetention operation.
* @param request InsightsGetOperationStatusRequest
* @return InsightsGetOperationStatusResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult GetOperationStatus(final InsightsGetOperationStatusRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetOperationStatusAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
PlayFabResult exceptionResult = new PlayFabResult();
exceptionResult.Error = PlayFabHTTP.GeneratePfError(-1, PlayFabErrorCode.Unknown, e.getMessage(), null);
return exceptionResult;
}
}
/** Gets the status of a SetPerformance or SetStorageRetention operation. */
@SuppressWarnings("unchecked")
private static PlayFabResult privateGetOperationStatusAsync(final InsightsGetOperationStatusRequest 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("/Insights/GetOperationStatus"), 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());
InsightsGetOperationStatusResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Gets a list of pending SetPerformance and/or SetStorageRetention operations for the title.
* @param request InsightsGetPendingOperationsRequest
* @return Async Task will return InsightsGetPendingOperationsResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> GetPendingOperationsAsync(final InsightsGetPendingOperationsRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetPendingOperationsAsync(request);
}
});
}
/**
* Gets a list of pending SetPerformance and/or SetStorageRetention operations for the title.
* @param request InsightsGetPendingOperationsRequest
* @return InsightsGetPendingOperationsResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult GetPendingOperations(final InsightsGetPendingOperationsRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateGetPendingOperationsAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
PlayFabResult exceptionResult = new PlayFabResult();
exceptionResult.Error = PlayFabHTTP.GeneratePfError(-1, PlayFabErrorCode.Unknown, e.getMessage(), null);
return exceptionResult;
}
}
/** Gets a list of pending SetPerformance and/or SetStorageRetention operations for the title. */
@SuppressWarnings("unchecked")
private static PlayFabResult privateGetPendingOperationsAsync(final InsightsGetPendingOperationsRequest 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("/Insights/GetPendingOperations"), 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());
InsightsGetPendingOperationsResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Sets the Insights performance level value for the title.
* @param request InsightsSetPerformanceRequest
* @return Async Task will return InsightsOperationResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> SetPerformanceAsync(final InsightsSetPerformanceRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateSetPerformanceAsync(request);
}
});
}
/**
* Sets the Insights performance level value for the title.
* @param request InsightsSetPerformanceRequest
* @return InsightsOperationResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult SetPerformance(final InsightsSetPerformanceRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateSetPerformanceAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
PlayFabResult exceptionResult = new PlayFabResult();
exceptionResult.Error = PlayFabHTTP.GeneratePfError(-1, PlayFabErrorCode.Unknown, e.getMessage(), null);
return exceptionResult;
}
}
/** Sets the Insights performance level value for the title. */
@SuppressWarnings("unchecked")
private static PlayFabResult privateSetPerformanceAsync(final InsightsSetPerformanceRequest 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("/Insights/SetPerformance"), 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());
InsightsOperationResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
/**
* Sets the Insights data storage retention days value for the title.
* @param request InsightsSetStorageRetentionRequest
* @return Async Task will return InsightsOperationResponse
*/
@SuppressWarnings("unchecked")
public static FutureTask> SetStorageRetentionAsync(final InsightsSetStorageRetentionRequest request) {
return new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateSetStorageRetentionAsync(request);
}
});
}
/**
* Sets the Insights data storage retention days value for the title.
* @param request InsightsSetStorageRetentionRequest
* @return InsightsOperationResponse
*/
@SuppressWarnings("unchecked")
public static PlayFabResult SetStorageRetention(final InsightsSetStorageRetentionRequest request) {
FutureTask> task = new FutureTask(new Callable>() {
public PlayFabResult call() throws Exception {
return privateSetStorageRetentionAsync(request);
}
});
try {
task.run();
return task.get();
} catch(Exception e) {
PlayFabResult exceptionResult = new PlayFabResult();
exceptionResult.Error = PlayFabHTTP.GeneratePfError(-1, PlayFabErrorCode.Unknown, e.getMessage(), null);
return exceptionResult;
}
}
/** Sets the Insights data storage retention days value for the title. */
@SuppressWarnings("unchecked")
private static PlayFabResult privateSetStorageRetentionAsync(final InsightsSetStorageRetentionRequest 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("/Insights/SetStorageRetention"), 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());
InsightsOperationResponse result = resultData.data;
PlayFabResult pfResult = new PlayFabResult();
pfResult.Result = result;
return pfResult;
}
}