#if !DISABLE_PLAYFABENTITY_API && !DISABLE_PLAYFAB_STATIC_API using System; using System.Collections.Generic; using PlayFab.InsightsModels; using PlayFab.Internal; namespace PlayFab { /// /// Manage the Insights performance level and data storage retention settings. /// public static class PlayFabInsightsAPI { static PlayFabInsightsAPI() {} /// /// Verify entity login. /// public static bool IsEntityLoggedIn() { return PlayFabSettings.staticPlayer.IsEntityLoggedIn(); } /// /// Clear the Client SessionToken which allows this Client to call API calls requiring login. /// A new/fresh login will be required after calling this. /// public static void ForgetAllCredentials() { PlayFabSettings.staticPlayer.ForgetAllCredentials(); } /// /// Gets the current values for the Insights performance and data storage retention, list of pending operations, and the /// performance and data storage retention limits. /// public static void GetDetails(InsightsEmptyRequest request, Action resultCallback, Action errorCallback, object customData = null, Dictionary 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("/Insights/GetDetails", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings); } /// /// Retrieves the range of allowed values for performance and data storage retention values as well as the submeter details /// for each performance level. /// public static void GetLimits(InsightsEmptyRequest request, Action resultCallback, Action errorCallback, object customData = null, Dictionary 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("/Insights/GetLimits", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings); } /// /// Gets the status of a SetPerformance or SetStorageRetention operation. /// public static void GetOperationStatus(InsightsGetOperationStatusRequest request, Action resultCallback, Action errorCallback, object customData = null, Dictionary 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("/Insights/GetOperationStatus", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings); } /// /// Gets a list of pending SetPerformance and/or SetStorageRetention operations for the title. /// public static void GetPendingOperations(InsightsGetPendingOperationsRequest request, Action resultCallback, Action errorCallback, object customData = null, Dictionary 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("/Insights/GetPendingOperations", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings); } /// /// Sets the Insights performance level value for the title. /// public static void SetPerformance(InsightsSetPerformanceRequest request, Action resultCallback, Action errorCallback, object customData = null, Dictionary 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("/Insights/SetPerformance", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings); } /// /// Sets the Insights data storage retention days value for the title. /// public static void SetStorageRetention(InsightsSetStorageRetentionRequest request, Action resultCallback, Action errorCallback, object customData = null, Dictionary 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("/Insights/SetStorageRetention", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings); } } } #endif