diff --git a/build/Linux/makefile b/build/Linux/makefile index 44cb75fd..af021437 100644 --- a/build/Linux/makefile +++ b/build/Linux/makefile @@ -41,6 +41,8 @@ OBJS = stdafx.o \ PlayFabEventsInstanceApi.o \ PlayFabExperimentationApi.o \ PlayFabExperimentationInstanceApi.o \ + PlayFabInsightsApi.o \ + PlayFabInsightsInstanceApi.o \ PlayFabGroupsApi.o \ PlayFabGroupsInstanceApi.o \ PlayFabLocalizationApi.o \ diff --git a/build/Windows/XPlatCppWindows.vcxproj b/build/Windows/XPlatCppWindows.vcxproj index bedda8ca..4b204f0b 100644 --- a/build/Windows/XPlatCppWindows.vcxproj +++ b/build/Windows/XPlatCppWindows.vcxproj @@ -143,6 +143,9 @@ + + + @@ -200,6 +203,8 @@ + + diff --git a/build/Windows/XPlatCppWindows.vcxproj.filters b/build/Windows/XPlatCppWindows.vcxproj.filters index 843d5fbf..0611ec35 100644 --- a/build/Windows/XPlatCppWindows.vcxproj.filters +++ b/build/Windows/XPlatCppWindows.vcxproj.filters @@ -122,6 +122,15 @@ Header Files\playfab + + Header Files\playfab + + + Header Files\playfab + + + Header Files\playfab + Header Files\playfab @@ -289,6 +298,12 @@ Source Files\playfab + + Source Files\playfab + + + Source Files\playfab + Source Files\playfab diff --git a/build/Xbox/XPlatXbox.vcxproj b/build/Xbox/XPlatXbox.vcxproj index fdff62fa..847c008a 100644 --- a/build/Xbox/XPlatXbox.vcxproj +++ b/build/Xbox/XPlatXbox.vcxproj @@ -203,6 +203,9 @@ + + + @@ -261,6 +264,8 @@ + + diff --git a/build/Xbox/XPlatXbox.vcxproj.filters b/build/Xbox/XPlatXbox.vcxproj.filters index 82eec1e8..83622285 100644 --- a/build/Xbox/XPlatXbox.vcxproj.filters +++ b/build/Xbox/XPlatXbox.vcxproj.filters @@ -122,6 +122,15 @@ Header Files\playfab + + Header Files\playfab + + + Header Files\playfab + + + Header Files\playfab + Header Files\playfab @@ -292,6 +301,12 @@ Source Files\playfab + + Source Files\playfab + + + Source Files\playfab + Source Files\playfab diff --git a/code/include/playfab/PlayFabAdminDataModels.h b/code/include/playfab/PlayFabAdminDataModels.h index 2e06e59a..86d86cb2 100644 --- a/code/include/playfab/PlayFabAdminDataModels.h +++ b/code/include/playfab/PlayFabAdminDataModels.h @@ -5449,6 +5449,7 @@ namespace PlayFab GenericErrorCodesExportQuerySchemaMissingRequiredColumns, GenericErrorCodesExportCannotParseQuery, GenericErrorCodesExportControlCommandsNotAllowed, + GenericErrorCodesExportQueryMissingTableReference, GenericErrorCodesTitleNotEnabledForParty, GenericErrorCodesPartyVersionNotFound, GenericErrorCodesMultiplayerServerBuildReferencedByMatchmakingQueue, @@ -5466,6 +5467,7 @@ namespace PlayFab GenericErrorCodesExperimentationTreatmentAssignmentDisabled, GenericErrorCodesExperimentationInvalidDuration, GenericErrorCodesExperimentationMaxExperimentsReached, + GenericErrorCodesExperimentationExperimentSchedulingInProgress, GenericErrorCodesMaxActionDepthExceeded, GenericErrorCodesTitleNotOnUpdatedPricingPlan, GenericErrorCodesSnapshotNotFound @@ -8258,6 +8260,11 @@ namespace PlayFab output = Json::Value("ExportControlCommandsNotAllowed"); return; } + if (input == GenericErrorCodes::GenericErrorCodesExportQueryMissingTableReference) + { + output = Json::Value("ExportQueryMissingTableReference"); + return; + } if (input == GenericErrorCodes::GenericErrorCodesTitleNotEnabledForParty) { output = Json::Value("TitleNotEnabledForParty"); @@ -8343,6 +8350,11 @@ namespace PlayFab output = Json::Value("ExperimentationMaxExperimentsReached"); return; } + if (input == GenericErrorCodes::GenericErrorCodesExperimentationExperimentSchedulingInProgress) + { + output = Json::Value("ExperimentationExperimentSchedulingInProgress"); + return; + } if (input == GenericErrorCodes::GenericErrorCodesMaxActionDepthExceeded) { output = Json::Value("MaxActionDepthExceeded"); @@ -11151,6 +11163,11 @@ namespace PlayFab output = GenericErrorCodes::GenericErrorCodesExportControlCommandsNotAllowed; return; } + if (inputStr == "ExportQueryMissingTableReference") + { + output = GenericErrorCodes::GenericErrorCodesExportQueryMissingTableReference; + return; + } if (inputStr == "TitleNotEnabledForParty") { output = GenericErrorCodes::GenericErrorCodesTitleNotEnabledForParty; @@ -11236,6 +11253,11 @@ namespace PlayFab output = GenericErrorCodes::GenericErrorCodesExperimentationMaxExperimentsReached; return; } + if (inputStr == "ExperimentationExperimentSchedulingInProgress") + { + output = GenericErrorCodes::GenericErrorCodesExperimentationExperimentSchedulingInProgress; + return; + } if (inputStr == "MaxActionDepthExceeded") { output = GenericErrorCodes::GenericErrorCodesMaxActionDepthExceeded; diff --git a/code/include/playfab/PlayFabError.h b/code/include/playfab/PlayFabError.h index 9d53c119..047b4f73 100644 --- a/code/include/playfab/PlayFabError.h +++ b/code/include/playfab/PlayFabError.h @@ -568,6 +568,7 @@ namespace PlayFab PlayFabErrorExportQuerySchemaMissingRequiredColumns = 5023, PlayFabErrorExportCannotParseQuery = 5024, PlayFabErrorExportControlCommandsNotAllowed = 5025, + PlayFabErrorExportQueryMissingTableReference = 5026, PlayFabErrorTitleNotEnabledForParty = 6000, PlayFabErrorPartyVersionNotFound = 6001, PlayFabErrorMultiplayerServerBuildReferencedByMatchmakingQueue = 6002, @@ -585,6 +586,7 @@ namespace PlayFab PlayFabErrorExperimentationTreatmentAssignmentDisabled = 7011, PlayFabErrorExperimentationInvalidDuration = 7012, PlayFabErrorExperimentationMaxExperimentsReached = 7013, + PlayFabErrorExperimentationExperimentSchedulingInProgress = 7014, PlayFabErrorMaxActionDepthExceeded = 8000, PlayFabErrorTitleNotOnUpdatedPricingPlan = 9000, PlayFabErrorSnapshotNotFound = 11000, diff --git a/code/include/playfab/PlayFabInsightsApi.h b/code/include/playfab/PlayFabInsightsApi.h new file mode 100644 index 00000000..51cc0195 --- /dev/null +++ b/code/include/playfab/PlayFabInsightsApi.h @@ -0,0 +1,47 @@ +#pragma once + +#if !defined(DISABLE_PLAYFABENTITY_API) + +#include +#include + +namespace PlayFab +{ + class CallRequestContainerBase; + class CallRequestContainer; + + /// + /// Main interface for PlayFab Sdk, specifically all Insights APIs + /// + class PlayFabInsightsAPI + { + public: + static size_t Update(); + static void ForgetAllCredentials(); + + + // ------------ Generated API calls + static void GetDetails(InsightsModels::InsightsEmptyRequest& request, const ProcessApiCallback callback, const ErrorCallback errorCallback = nullptr, void* customData = nullptr); + static void GetLimits(InsightsModels::InsightsEmptyRequest& request, const ProcessApiCallback callback, const ErrorCallback errorCallback = nullptr, void* customData = nullptr); + static void GetOperationStatus(InsightsModels::InsightsGetOperationStatusRequest& request, const ProcessApiCallback callback, const ErrorCallback errorCallback = nullptr, void* customData = nullptr); + static void GetPendingOperations(InsightsModels::InsightsGetPendingOperationsRequest& request, const ProcessApiCallback callback, const ErrorCallback errorCallback = nullptr, void* customData = nullptr); + static void SetPerformance(InsightsModels::InsightsSetPerformanceRequest& request, const ProcessApiCallback callback, const ErrorCallback errorCallback = nullptr, void* customData = nullptr); + static void SetStorageRetention(InsightsModels::InsightsSetStorageRetentionRequest& request, const ProcessApiCallback callback, const ErrorCallback errorCallback = nullptr, void* customData = nullptr); + + private: + PlayFabInsightsAPI(); // Private constructor, static class should never have an instance + PlayFabInsightsAPI(const PlayFabInsightsAPI& other); // Private copy-constructor, static class should never have an instance + + // ------------ Generated result handlers + static void OnGetDetailsResult(int httpCode, const std::string& result, const std::shared_ptr& reqContainer); + static void OnGetLimitsResult(int httpCode, const std::string& result, const std::shared_ptr& reqContainer); + static void OnGetOperationStatusResult(int httpCode, const std::string& result, const std::shared_ptr& reqContainer); + static void OnGetPendingOperationsResult(int httpCode, const std::string& result, const std::shared_ptr& reqContainer); + static void OnSetPerformanceResult(int httpCode, const std::string& result, const std::shared_ptr& reqContainer); + static void OnSetStorageRetentionResult(int httpCode, const std::string& result, const std::shared_ptr& reqContainer); + + static bool ValidateResult(PlayFabResultCommon& resultCommon, const CallRequestContainer& container); + }; +} + +#endif // #if !defined(DISABLE_PLAYFABENTITY_API) diff --git a/code/include/playfab/PlayFabInsightsDataModels.h b/code/include/playfab/PlayFabInsightsDataModels.h new file mode 100644 index 00000000..fcab968e --- /dev/null +++ b/code/include/playfab/PlayFabInsightsDataModels.h @@ -0,0 +1,456 @@ +#pragma once + +#if !defined(DISABLE_PLAYFABENTITY_API) + +#include +#include + +namespace PlayFab +{ + namespace InsightsModels + { + // Insights Enums + // Insights Classes + struct InsightsEmptyRequest : public PlayFabRequestCommon + { + + InsightsEmptyRequest() : + PlayFabRequestCommon() + {} + + InsightsEmptyRequest(const InsightsEmptyRequest&) : + PlayFabRequestCommon() + {} + + ~InsightsEmptyRequest() = default; + + void FromJson(const Json::Value&) override + { + } + + Json::Value ToJson() const override + { + Json::Value output; + return output; + } + }; + + struct InsightsPerformanceLevel : public PlayFabBaseModel + { + Int32 ActiveEventExports; + Int32 CacheSizeMB; + Int32 Concurrency; + double CreditsPerMinute; + Int32 EventsPerSecond; + Int32 Level; + Int32 MaxMemoryPerQueryMB; + Int32 VirtualCpuCores; + + InsightsPerformanceLevel() : + PlayFabBaseModel(), + ActiveEventExports(), + CacheSizeMB(), + Concurrency(), + CreditsPerMinute(), + EventsPerSecond(), + Level(), + MaxMemoryPerQueryMB(), + VirtualCpuCores() + {} + + InsightsPerformanceLevel(const InsightsPerformanceLevel& src) : + PlayFabBaseModel(), + ActiveEventExports(src.ActiveEventExports), + CacheSizeMB(src.CacheSizeMB), + Concurrency(src.Concurrency), + CreditsPerMinute(src.CreditsPerMinute), + EventsPerSecond(src.EventsPerSecond), + Level(src.Level), + MaxMemoryPerQueryMB(src.MaxMemoryPerQueryMB), + VirtualCpuCores(src.VirtualCpuCores) + {} + + ~InsightsPerformanceLevel() = default; + + void FromJson(const Json::Value& input) override + { + FromJsonUtilP(input["ActiveEventExports"], ActiveEventExports); + FromJsonUtilP(input["CacheSizeMB"], CacheSizeMB); + FromJsonUtilP(input["Concurrency"], Concurrency); + FromJsonUtilP(input["CreditsPerMinute"], CreditsPerMinute); + FromJsonUtilP(input["EventsPerSecond"], EventsPerSecond); + FromJsonUtilP(input["Level"], Level); + FromJsonUtilP(input["MaxMemoryPerQueryMB"], MaxMemoryPerQueryMB); + FromJsonUtilP(input["VirtualCpuCores"], VirtualCpuCores); + } + + Json::Value ToJson() const override + { + Json::Value output; + Json::Value each_ActiveEventExports; ToJsonUtilP(ActiveEventExports, each_ActiveEventExports); output["ActiveEventExports"] = each_ActiveEventExports; + Json::Value each_CacheSizeMB; ToJsonUtilP(CacheSizeMB, each_CacheSizeMB); output["CacheSizeMB"] = each_CacheSizeMB; + Json::Value each_Concurrency; ToJsonUtilP(Concurrency, each_Concurrency); output["Concurrency"] = each_Concurrency; + Json::Value each_CreditsPerMinute; ToJsonUtilP(CreditsPerMinute, each_CreditsPerMinute); output["CreditsPerMinute"] = each_CreditsPerMinute; + Json::Value each_EventsPerSecond; ToJsonUtilP(EventsPerSecond, each_EventsPerSecond); output["EventsPerSecond"] = each_EventsPerSecond; + Json::Value each_Level; ToJsonUtilP(Level, each_Level); output["Level"] = each_Level; + Json::Value each_MaxMemoryPerQueryMB; ToJsonUtilP(MaxMemoryPerQueryMB, each_MaxMemoryPerQueryMB); output["MaxMemoryPerQueryMB"] = each_MaxMemoryPerQueryMB; + Json::Value each_VirtualCpuCores; ToJsonUtilP(VirtualCpuCores, each_VirtualCpuCores); output["VirtualCpuCores"] = each_VirtualCpuCores; + return output; + } + }; + + struct InsightsGetLimitsResponse : public PlayFabResultCommon + { + Int32 DefaultPerformanceLevel; + Int32 DefaultStorageRetentionDays; + Int32 StorageMaxRetentionDays; + Int32 StorageMinRetentionDays; + std::list SubMeters; + + InsightsGetLimitsResponse() : + PlayFabResultCommon(), + DefaultPerformanceLevel(), + DefaultStorageRetentionDays(), + StorageMaxRetentionDays(), + StorageMinRetentionDays(), + SubMeters() + {} + + InsightsGetLimitsResponse(const InsightsGetLimitsResponse& src) : + PlayFabResultCommon(), + DefaultPerformanceLevel(src.DefaultPerformanceLevel), + DefaultStorageRetentionDays(src.DefaultStorageRetentionDays), + StorageMaxRetentionDays(src.StorageMaxRetentionDays), + StorageMinRetentionDays(src.StorageMinRetentionDays), + SubMeters(src.SubMeters) + {} + + ~InsightsGetLimitsResponse() = default; + + void FromJson(const Json::Value& input) override + { + FromJsonUtilP(input["DefaultPerformanceLevel"], DefaultPerformanceLevel); + FromJsonUtilP(input["DefaultStorageRetentionDays"], DefaultStorageRetentionDays); + FromJsonUtilP(input["StorageMaxRetentionDays"], StorageMaxRetentionDays); + FromJsonUtilP(input["StorageMinRetentionDays"], StorageMinRetentionDays); + FromJsonUtilO(input["SubMeters"], SubMeters); + } + + Json::Value ToJson() const override + { + Json::Value output; + Json::Value each_DefaultPerformanceLevel; ToJsonUtilP(DefaultPerformanceLevel, each_DefaultPerformanceLevel); output["DefaultPerformanceLevel"] = each_DefaultPerformanceLevel; + Json::Value each_DefaultStorageRetentionDays; ToJsonUtilP(DefaultStorageRetentionDays, each_DefaultStorageRetentionDays); output["DefaultStorageRetentionDays"] = each_DefaultStorageRetentionDays; + Json::Value each_StorageMaxRetentionDays; ToJsonUtilP(StorageMaxRetentionDays, each_StorageMaxRetentionDays); output["StorageMaxRetentionDays"] = each_StorageMaxRetentionDays; + Json::Value each_StorageMinRetentionDays; ToJsonUtilP(StorageMinRetentionDays, each_StorageMinRetentionDays); output["StorageMinRetentionDays"] = each_StorageMinRetentionDays; + Json::Value each_SubMeters; ToJsonUtilO(SubMeters, each_SubMeters); output["SubMeters"] = each_SubMeters; + return output; + } + }; + + struct InsightsGetOperationStatusResponse : public PlayFabResultCommon + { + std::string Message; + time_t OperationCompletedTime; + std::string OperationId; + time_t OperationLastUpdated; + time_t OperationStartedTime; + std::string OperationType; + Int32 OperationValue; + std::string Status; + + InsightsGetOperationStatusResponse() : + PlayFabResultCommon(), + Message(), + OperationCompletedTime(), + OperationId(), + OperationLastUpdated(), + OperationStartedTime(), + OperationType(), + OperationValue(), + Status() + {} + + InsightsGetOperationStatusResponse(const InsightsGetOperationStatusResponse& src) : + PlayFabResultCommon(), + Message(src.Message), + OperationCompletedTime(src.OperationCompletedTime), + OperationId(src.OperationId), + OperationLastUpdated(src.OperationLastUpdated), + OperationStartedTime(src.OperationStartedTime), + OperationType(src.OperationType), + OperationValue(src.OperationValue), + Status(src.Status) + {} + + ~InsightsGetOperationStatusResponse() = default; + + void FromJson(const Json::Value& input) override + { + FromJsonUtilS(input["Message"], Message); + FromJsonUtilT(input["OperationCompletedTime"], OperationCompletedTime); + FromJsonUtilS(input["OperationId"], OperationId); + FromJsonUtilT(input["OperationLastUpdated"], OperationLastUpdated); + FromJsonUtilT(input["OperationStartedTime"], OperationStartedTime); + FromJsonUtilS(input["OperationType"], OperationType); + FromJsonUtilP(input["OperationValue"], OperationValue); + FromJsonUtilS(input["Status"], Status); + } + + Json::Value ToJson() const override + { + Json::Value output; + Json::Value each_Message; ToJsonUtilS(Message, each_Message); output["Message"] = each_Message; + Json::Value each_OperationCompletedTime; ToJsonUtilT(OperationCompletedTime, each_OperationCompletedTime); output["OperationCompletedTime"] = each_OperationCompletedTime; + Json::Value each_OperationId; ToJsonUtilS(OperationId, each_OperationId); output["OperationId"] = each_OperationId; + Json::Value each_OperationLastUpdated; ToJsonUtilT(OperationLastUpdated, each_OperationLastUpdated); output["OperationLastUpdated"] = each_OperationLastUpdated; + Json::Value each_OperationStartedTime; ToJsonUtilT(OperationStartedTime, each_OperationStartedTime); output["OperationStartedTime"] = each_OperationStartedTime; + Json::Value each_OperationType; ToJsonUtilS(OperationType, each_OperationType); output["OperationType"] = each_OperationType; + Json::Value each_OperationValue; ToJsonUtilP(OperationValue, each_OperationValue); output["OperationValue"] = each_OperationValue; + Json::Value each_Status; ToJsonUtilS(Status, each_Status); output["Status"] = each_Status; + return output; + } + }; + + struct InsightsGetDetailsResponse : public PlayFabResultCommon + { + Uint32 DataUsageMb; + std::string ErrorMessage; + Boxed Limits; + std::list PendingOperations; + Int32 PerformanceLevel; + Int32 RetentionDays; + + InsightsGetDetailsResponse() : + PlayFabResultCommon(), + DataUsageMb(), + ErrorMessage(), + Limits(), + PendingOperations(), + PerformanceLevel(), + RetentionDays() + {} + + InsightsGetDetailsResponse(const InsightsGetDetailsResponse& src) : + PlayFabResultCommon(), + DataUsageMb(src.DataUsageMb), + ErrorMessage(src.ErrorMessage), + Limits(src.Limits), + PendingOperations(src.PendingOperations), + PerformanceLevel(src.PerformanceLevel), + RetentionDays(src.RetentionDays) + {} + + ~InsightsGetDetailsResponse() = default; + + void FromJson(const Json::Value& input) override + { + FromJsonUtilP(input["DataUsageMb"], DataUsageMb); + FromJsonUtilS(input["ErrorMessage"], ErrorMessage); + FromJsonUtilO(input["Limits"], Limits); + FromJsonUtilO(input["PendingOperations"], PendingOperations); + FromJsonUtilP(input["PerformanceLevel"], PerformanceLevel); + FromJsonUtilP(input["RetentionDays"], RetentionDays); + } + + Json::Value ToJson() const override + { + Json::Value output; + Json::Value each_DataUsageMb; ToJsonUtilP(DataUsageMb, each_DataUsageMb); output["DataUsageMb"] = each_DataUsageMb; + Json::Value each_ErrorMessage; ToJsonUtilS(ErrorMessage, each_ErrorMessage); output["ErrorMessage"] = each_ErrorMessage; + Json::Value each_Limits; ToJsonUtilO(Limits, each_Limits); output["Limits"] = each_Limits; + Json::Value each_PendingOperations; ToJsonUtilO(PendingOperations, each_PendingOperations); output["PendingOperations"] = each_PendingOperations; + Json::Value each_PerformanceLevel; ToJsonUtilP(PerformanceLevel, each_PerformanceLevel); output["PerformanceLevel"] = each_PerformanceLevel; + Json::Value each_RetentionDays; ToJsonUtilP(RetentionDays, each_RetentionDays); output["RetentionDays"] = each_RetentionDays; + return output; + } + }; + + struct InsightsGetOperationStatusRequest : public PlayFabRequestCommon + { + std::string OperationId; + + InsightsGetOperationStatusRequest() : + PlayFabRequestCommon(), + OperationId() + {} + + InsightsGetOperationStatusRequest(const InsightsGetOperationStatusRequest& src) : + PlayFabRequestCommon(), + OperationId(src.OperationId) + {} + + ~InsightsGetOperationStatusRequest() = default; + + void FromJson(const Json::Value& input) override + { + FromJsonUtilS(input["OperationId"], OperationId); + } + + Json::Value ToJson() const override + { + Json::Value output; + Json::Value each_OperationId; ToJsonUtilS(OperationId, each_OperationId); output["OperationId"] = each_OperationId; + return output; + } + }; + + struct InsightsGetPendingOperationsRequest : public PlayFabRequestCommon + { + std::string OperationType; + + InsightsGetPendingOperationsRequest() : + PlayFabRequestCommon(), + OperationType() + {} + + InsightsGetPendingOperationsRequest(const InsightsGetPendingOperationsRequest& src) : + PlayFabRequestCommon(), + OperationType(src.OperationType) + {} + + ~InsightsGetPendingOperationsRequest() = default; + + void FromJson(const Json::Value& input) override + { + FromJsonUtilS(input["OperationType"], OperationType); + } + + Json::Value ToJson() const override + { + Json::Value output; + Json::Value each_OperationType; ToJsonUtilS(OperationType, each_OperationType); output["OperationType"] = each_OperationType; + return output; + } + }; + + struct InsightsGetPendingOperationsResponse : public PlayFabResultCommon + { + std::list PendingOperations; + + InsightsGetPendingOperationsResponse() : + PlayFabResultCommon(), + PendingOperations() + {} + + InsightsGetPendingOperationsResponse(const InsightsGetPendingOperationsResponse& src) : + PlayFabResultCommon(), + PendingOperations(src.PendingOperations) + {} + + ~InsightsGetPendingOperationsResponse() = default; + + void FromJson(const Json::Value& input) override + { + FromJsonUtilO(input["PendingOperations"], PendingOperations); + } + + Json::Value ToJson() const override + { + Json::Value output; + Json::Value each_PendingOperations; ToJsonUtilO(PendingOperations, each_PendingOperations); output["PendingOperations"] = each_PendingOperations; + return output; + } + }; + + struct InsightsOperationResponse : public PlayFabResultCommon + { + std::string Message; + std::string OperationId; + std::string OperationType; + + InsightsOperationResponse() : + PlayFabResultCommon(), + Message(), + OperationId(), + OperationType() + {} + + InsightsOperationResponse(const InsightsOperationResponse& src) : + PlayFabResultCommon(), + Message(src.Message), + OperationId(src.OperationId), + OperationType(src.OperationType) + {} + + ~InsightsOperationResponse() = default; + + void FromJson(const Json::Value& input) override + { + FromJsonUtilS(input["Message"], Message); + FromJsonUtilS(input["OperationId"], OperationId); + FromJsonUtilS(input["OperationType"], OperationType); + } + + Json::Value ToJson() const override + { + Json::Value output; + Json::Value each_Message; ToJsonUtilS(Message, each_Message); output["Message"] = each_Message; + Json::Value each_OperationId; ToJsonUtilS(OperationId, each_OperationId); output["OperationId"] = each_OperationId; + Json::Value each_OperationType; ToJsonUtilS(OperationType, each_OperationType); output["OperationType"] = each_OperationType; + return output; + } + }; + + struct InsightsSetPerformanceRequest : public PlayFabRequestCommon + { + Int32 PerformanceLevel; + + InsightsSetPerformanceRequest() : + PlayFabRequestCommon(), + PerformanceLevel() + {} + + InsightsSetPerformanceRequest(const InsightsSetPerformanceRequest& src) : + PlayFabRequestCommon(), + PerformanceLevel(src.PerformanceLevel) + {} + + ~InsightsSetPerformanceRequest() = default; + + void FromJson(const Json::Value& input) override + { + FromJsonUtilP(input["PerformanceLevel"], PerformanceLevel); + } + + Json::Value ToJson() const override + { + Json::Value output; + Json::Value each_PerformanceLevel; ToJsonUtilP(PerformanceLevel, each_PerformanceLevel); output["PerformanceLevel"] = each_PerformanceLevel; + return output; + } + }; + + struct InsightsSetStorageRetentionRequest : public PlayFabRequestCommon + { + Int32 RetentionDays; + + InsightsSetStorageRetentionRequest() : + PlayFabRequestCommon(), + RetentionDays() + {} + + InsightsSetStorageRetentionRequest(const InsightsSetStorageRetentionRequest& src) : + PlayFabRequestCommon(), + RetentionDays(src.RetentionDays) + {} + + ~InsightsSetStorageRetentionRequest() = default; + + void FromJson(const Json::Value& input) override + { + FromJsonUtilP(input["RetentionDays"], RetentionDays); + } + + Json::Value ToJson() const override + { + Json::Value output; + Json::Value each_RetentionDays; ToJsonUtilP(RetentionDays, each_RetentionDays); output["RetentionDays"] = each_RetentionDays; + return output; + } + }; + + } +} + +#endif diff --git a/code/include/playfab/PlayFabInsightsInstanceApi.h b/code/include/playfab/PlayFabInsightsInstanceApi.h new file mode 100644 index 00000000..3e3af338 --- /dev/null +++ b/code/include/playfab/PlayFabInsightsInstanceApi.h @@ -0,0 +1,58 @@ +#pragma once + +#if !defined(DISABLE_PLAYFABENTITY_API) + +#include +#include + +namespace PlayFab +{ + class CallRequestContainerBase; + class CallRequestContainer; + class PlayFabApiSettings; + class PlayFabAuthenticationContext; + + /// + /// Main interface for PlayFab Sdk, specifically all Insights APIs + /// + class PlayFabInsightsInstanceAPI + { + private: + std::shared_ptr m_settings; + std::shared_ptr m_context; + + public: + PlayFabInsightsInstanceAPI(const std::shared_ptr& authenticationContext); + PlayFabInsightsInstanceAPI(const std::shared_ptr& apiSettings, const std::shared_ptr& authenticationContext); + + ~PlayFabInsightsInstanceAPI() = default; + PlayFabInsightsInstanceAPI(const PlayFabInsightsInstanceAPI& source) = delete; // disable copy + PlayFabInsightsInstanceAPI(PlayFabInsightsInstanceAPI&&) = delete; // disable move + PlayFabInsightsInstanceAPI& operator=(const PlayFabInsightsInstanceAPI& source) = delete; // disable assignment + PlayFabInsightsInstanceAPI& operator=(PlayFabInsightsInstanceAPI&& other) = delete; // disable move assignment + + std::shared_ptr GetSettings() const; + std::shared_ptr GetAuthenticationContext() const; + size_t Update(); + void ForgetAllCredentials(); + + // ------------ Generated API calls + void GetDetails(InsightsModels::InsightsEmptyRequest& request, const ProcessApiCallback callback, const ErrorCallback errorCallback = nullptr, void* customData = nullptr); + void GetLimits(InsightsModels::InsightsEmptyRequest& request, const ProcessApiCallback callback, const ErrorCallback errorCallback = nullptr, void* customData = nullptr); + void GetOperationStatus(InsightsModels::InsightsGetOperationStatusRequest& request, const ProcessApiCallback callback, const ErrorCallback errorCallback = nullptr, void* customData = nullptr); + void GetPendingOperations(InsightsModels::InsightsGetPendingOperationsRequest& request, const ProcessApiCallback callback, const ErrorCallback errorCallback = nullptr, void* customData = nullptr); + void SetPerformance(InsightsModels::InsightsSetPerformanceRequest& request, const ProcessApiCallback callback, const ErrorCallback errorCallback = nullptr, void* customData = nullptr); + void SetStorageRetention(InsightsModels::InsightsSetStorageRetentionRequest& request, const ProcessApiCallback callback, const ErrorCallback errorCallback = nullptr, void* customData = nullptr); + + // ------------ Generated result handlers + void OnGetDetailsResult(int httpCode, const std::string& result, const std::shared_ptr& reqContainer); + void OnGetLimitsResult(int httpCode, const std::string& result, const std::shared_ptr& reqContainer); + void OnGetOperationStatusResult(int httpCode, const std::string& result, const std::shared_ptr& reqContainer); + void OnGetPendingOperationsResult(int httpCode, const std::string& result, const std::shared_ptr& reqContainer); + void OnSetPerformanceResult(int httpCode, const std::string& result, const std::shared_ptr& reqContainer); + void OnSetStorageRetentionResult(int httpCode, const std::string& result, const std::shared_ptr& reqContainer); + bool ValidateResult(PlayFabResultCommon& resultCommon, const CallRequestContainer& container); + }; +} + +#endif diff --git a/code/include/playfab/PlayFabServerDataModels.h b/code/include/playfab/PlayFabServerDataModels.h index 1bc59742..9e7f3189 100644 --- a/code/include/playfab/PlayFabServerDataModels.h +++ b/code/include/playfab/PlayFabServerDataModels.h @@ -5351,6 +5351,7 @@ namespace PlayFab GenericErrorCodesExportQuerySchemaMissingRequiredColumns, GenericErrorCodesExportCannotParseQuery, GenericErrorCodesExportControlCommandsNotAllowed, + GenericErrorCodesExportQueryMissingTableReference, GenericErrorCodesTitleNotEnabledForParty, GenericErrorCodesPartyVersionNotFound, GenericErrorCodesMultiplayerServerBuildReferencedByMatchmakingQueue, @@ -5368,6 +5369,7 @@ namespace PlayFab GenericErrorCodesExperimentationTreatmentAssignmentDisabled, GenericErrorCodesExperimentationInvalidDuration, GenericErrorCodesExperimentationMaxExperimentsReached, + GenericErrorCodesExperimentationExperimentSchedulingInProgress, GenericErrorCodesMaxActionDepthExceeded, GenericErrorCodesTitleNotOnUpdatedPricingPlan, GenericErrorCodesSnapshotNotFound @@ -8160,6 +8162,11 @@ namespace PlayFab output = Json::Value("ExportControlCommandsNotAllowed"); return; } + if (input == GenericErrorCodes::GenericErrorCodesExportQueryMissingTableReference) + { + output = Json::Value("ExportQueryMissingTableReference"); + return; + } if (input == GenericErrorCodes::GenericErrorCodesTitleNotEnabledForParty) { output = Json::Value("TitleNotEnabledForParty"); @@ -8245,6 +8252,11 @@ namespace PlayFab output = Json::Value("ExperimentationMaxExperimentsReached"); return; } + if (input == GenericErrorCodes::GenericErrorCodesExperimentationExperimentSchedulingInProgress) + { + output = Json::Value("ExperimentationExperimentSchedulingInProgress"); + return; + } if (input == GenericErrorCodes::GenericErrorCodesMaxActionDepthExceeded) { output = Json::Value("MaxActionDepthExceeded"); @@ -11053,6 +11065,11 @@ namespace PlayFab output = GenericErrorCodes::GenericErrorCodesExportControlCommandsNotAllowed; return; } + if (inputStr == "ExportQueryMissingTableReference") + { + output = GenericErrorCodes::GenericErrorCodesExportQueryMissingTableReference; + return; + } if (inputStr == "TitleNotEnabledForParty") { output = GenericErrorCodes::GenericErrorCodesTitleNotEnabledForParty; @@ -11138,6 +11155,11 @@ namespace PlayFab output = GenericErrorCodes::GenericErrorCodesExperimentationMaxExperimentsReached; return; } + if (inputStr == "ExperimentationExperimentSchedulingInProgress") + { + output = GenericErrorCodes::GenericErrorCodesExperimentationExperimentSchedulingInProgress; + return; + } if (inputStr == "MaxActionDepthExceeded") { output = GenericErrorCodes::GenericErrorCodesMaxActionDepthExceeded; diff --git a/code/source/playfab/PlayFabIOSHttpPlugin.mm b/code/source/playfab/PlayFabIOSHttpPlugin.mm index 7dd45b9c..05dc6f7e 100644 --- a/code/source/playfab/PlayFabIOSHttpPlugin.mm +++ b/code/source/playfab/PlayFabIOSHttpPlugin.mm @@ -268,7 +268,10 @@ void Cancel() NSString* body = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; CallRequestContainer& requestContainer = request->RequestContainer(); - requestContainer.responseString = [body UTF8String]; + if(body != nil) + { + requestContainer.responseString = [body UTF8String]; + } ProcessResponse(*request, static_cast(httpResponse.statusCode)); { // LOCK httpRequestMutex lock->lock(); diff --git a/code/source/playfab/PlayFabInsightsApi.cpp b/code/source/playfab/PlayFabInsightsApi.cpp new file mode 100644 index 00000000..212c0b65 --- /dev/null +++ b/code/source/playfab/PlayFabInsightsApi.cpp @@ -0,0 +1,353 @@ +#include + +#if !defined(DISABLE_PLAYFABENTITY_API) + +#include +#include +#include +#include +#include + +#if defined(PLAYFAB_PLATFORM_WINDOWS) +#pragma warning (disable: 4100) // formal parameters are part of a public interface +#endif // defined(PLAYFAB_PLATFORM_WINDOWS) + +namespace PlayFab +{ + using namespace InsightsModels; + + size_t PlayFabInsightsAPI::Update() + { + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + return http.Update(); + } + + void PlayFabInsightsAPI::ForgetAllCredentials() + { + return PlayFabSettings::ForgetAllCredentials(); + } + + // PlayFabInsights APIs + + void PlayFabInsightsAPI::GetDetails( + InsightsEmptyRequest& request, + const ProcessApiCallback callback, + const ErrorCallback errorCallback, + void* customData + ) + { + std::shared_ptr context = request.authenticationContext != nullptr ? request.authenticationContext : PlayFabSettings::staticPlayer; + std::shared_ptr settings = PlayFabSettings::staticSettings; + + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + const Json::Value requestJson = request.ToJson(); + std::string jsonAsString = requestJson.toStyledString(); + + std::unordered_map headers; + headers.emplace("X-EntityToken", context->entityToken); + + auto reqContainer = std::unique_ptr(new CallRequestContainer( + "/Insights/GetDetails", + headers, + jsonAsString, + OnGetDetailsResult, + settings, + context, + customData)); + + reqContainer->successCallback = std::shared_ptr((callback == nullptr) ? nullptr : new ProcessApiCallback(callback)); + reqContainer->errorCallback = errorCallback; + + http.MakePostRequest(std::unique_ptr(static_cast(reqContainer.release()))); + } + + void PlayFabInsightsAPI::OnGetDetailsResult(int /*httpCode*/, const std::string& /*result*/, const std::shared_ptr& reqContainer) + { + CallRequestContainer& container = static_cast(*reqContainer); + std::shared_ptr context = container.GetContext(); + + InsightsGetDetailsResponse outResult; + if (ValidateResult(outResult, container)) + { + std::shared_ptr internalPtr = container.successCallback; + if (internalPtr.get() != nullptr) + { + const auto& callback = (*static_cast *>(internalPtr.get())); + callback(outResult, container.GetCustomData()); + } + } + } + + void PlayFabInsightsAPI::GetLimits( + InsightsEmptyRequest& request, + const ProcessApiCallback callback, + const ErrorCallback errorCallback, + void* customData + ) + { + std::shared_ptr context = request.authenticationContext != nullptr ? request.authenticationContext : PlayFabSettings::staticPlayer; + std::shared_ptr settings = PlayFabSettings::staticSettings; + + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + const Json::Value requestJson = request.ToJson(); + std::string jsonAsString = requestJson.toStyledString(); + + std::unordered_map headers; + headers.emplace("X-EntityToken", context->entityToken); + + auto reqContainer = std::unique_ptr(new CallRequestContainer( + "/Insights/GetLimits", + headers, + jsonAsString, + OnGetLimitsResult, + settings, + context, + customData)); + + reqContainer->successCallback = std::shared_ptr((callback == nullptr) ? nullptr : new ProcessApiCallback(callback)); + reqContainer->errorCallback = errorCallback; + + http.MakePostRequest(std::unique_ptr(static_cast(reqContainer.release()))); + } + + void PlayFabInsightsAPI::OnGetLimitsResult(int /*httpCode*/, const std::string& /*result*/, const std::shared_ptr& reqContainer) + { + CallRequestContainer& container = static_cast(*reqContainer); + std::shared_ptr context = container.GetContext(); + + InsightsGetLimitsResponse outResult; + if (ValidateResult(outResult, container)) + { + std::shared_ptr internalPtr = container.successCallback; + if (internalPtr.get() != nullptr) + { + const auto& callback = (*static_cast *>(internalPtr.get())); + callback(outResult, container.GetCustomData()); + } + } + } + + void PlayFabInsightsAPI::GetOperationStatus( + InsightsGetOperationStatusRequest& request, + const ProcessApiCallback callback, + const ErrorCallback errorCallback, + void* customData + ) + { + std::shared_ptr context = request.authenticationContext != nullptr ? request.authenticationContext : PlayFabSettings::staticPlayer; + std::shared_ptr settings = PlayFabSettings::staticSettings; + + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + const Json::Value requestJson = request.ToJson(); + std::string jsonAsString = requestJson.toStyledString(); + + std::unordered_map headers; + headers.emplace("X-EntityToken", context->entityToken); + + auto reqContainer = std::unique_ptr(new CallRequestContainer( + "/Insights/GetOperationStatus", + headers, + jsonAsString, + OnGetOperationStatusResult, + settings, + context, + customData)); + + reqContainer->successCallback = std::shared_ptr((callback == nullptr) ? nullptr : new ProcessApiCallback(callback)); + reqContainer->errorCallback = errorCallback; + + http.MakePostRequest(std::unique_ptr(static_cast(reqContainer.release()))); + } + + void PlayFabInsightsAPI::OnGetOperationStatusResult(int /*httpCode*/, const std::string& /*result*/, const std::shared_ptr& reqContainer) + { + CallRequestContainer& container = static_cast(*reqContainer); + std::shared_ptr context = container.GetContext(); + + InsightsGetOperationStatusResponse outResult; + if (ValidateResult(outResult, container)) + { + std::shared_ptr internalPtr = container.successCallback; + if (internalPtr.get() != nullptr) + { + const auto& callback = (*static_cast *>(internalPtr.get())); + callback(outResult, container.GetCustomData()); + } + } + } + + void PlayFabInsightsAPI::GetPendingOperations( + InsightsGetPendingOperationsRequest& request, + const ProcessApiCallback callback, + const ErrorCallback errorCallback, + void* customData + ) + { + std::shared_ptr context = request.authenticationContext != nullptr ? request.authenticationContext : PlayFabSettings::staticPlayer; + std::shared_ptr settings = PlayFabSettings::staticSettings; + + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + const Json::Value requestJson = request.ToJson(); + std::string jsonAsString = requestJson.toStyledString(); + + std::unordered_map headers; + headers.emplace("X-EntityToken", context->entityToken); + + auto reqContainer = std::unique_ptr(new CallRequestContainer( + "/Insights/GetPendingOperations", + headers, + jsonAsString, + OnGetPendingOperationsResult, + settings, + context, + customData)); + + reqContainer->successCallback = std::shared_ptr((callback == nullptr) ? nullptr : new ProcessApiCallback(callback)); + reqContainer->errorCallback = errorCallback; + + http.MakePostRequest(std::unique_ptr(static_cast(reqContainer.release()))); + } + + void PlayFabInsightsAPI::OnGetPendingOperationsResult(int /*httpCode*/, const std::string& /*result*/, const std::shared_ptr& reqContainer) + { + CallRequestContainer& container = static_cast(*reqContainer); + std::shared_ptr context = container.GetContext(); + + InsightsGetPendingOperationsResponse outResult; + if (ValidateResult(outResult, container)) + { + std::shared_ptr internalPtr = container.successCallback; + if (internalPtr.get() != nullptr) + { + const auto& callback = (*static_cast *>(internalPtr.get())); + callback(outResult, container.GetCustomData()); + } + } + } + + void PlayFabInsightsAPI::SetPerformance( + InsightsSetPerformanceRequest& request, + const ProcessApiCallback callback, + const ErrorCallback errorCallback, + void* customData + ) + { + std::shared_ptr context = request.authenticationContext != nullptr ? request.authenticationContext : PlayFabSettings::staticPlayer; + std::shared_ptr settings = PlayFabSettings::staticSettings; + + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + const Json::Value requestJson = request.ToJson(); + std::string jsonAsString = requestJson.toStyledString(); + + std::unordered_map headers; + headers.emplace("X-EntityToken", context->entityToken); + + auto reqContainer = std::unique_ptr(new CallRequestContainer( + "/Insights/SetPerformance", + headers, + jsonAsString, + OnSetPerformanceResult, + settings, + context, + customData)); + + reqContainer->successCallback = std::shared_ptr((callback == nullptr) ? nullptr : new ProcessApiCallback(callback)); + reqContainer->errorCallback = errorCallback; + + http.MakePostRequest(std::unique_ptr(static_cast(reqContainer.release()))); + } + + void PlayFabInsightsAPI::OnSetPerformanceResult(int /*httpCode*/, const std::string& /*result*/, const std::shared_ptr& reqContainer) + { + CallRequestContainer& container = static_cast(*reqContainer); + std::shared_ptr context = container.GetContext(); + + InsightsOperationResponse outResult; + if (ValidateResult(outResult, container)) + { + std::shared_ptr internalPtr = container.successCallback; + if (internalPtr.get() != nullptr) + { + const auto& callback = (*static_cast *>(internalPtr.get())); + callback(outResult, container.GetCustomData()); + } + } + } + + void PlayFabInsightsAPI::SetStorageRetention( + InsightsSetStorageRetentionRequest& request, + const ProcessApiCallback callback, + const ErrorCallback errorCallback, + void* customData + ) + { + std::shared_ptr context = request.authenticationContext != nullptr ? request.authenticationContext : PlayFabSettings::staticPlayer; + std::shared_ptr settings = PlayFabSettings::staticSettings; + + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + const Json::Value requestJson = request.ToJson(); + std::string jsonAsString = requestJson.toStyledString(); + + std::unordered_map headers; + headers.emplace("X-EntityToken", context->entityToken); + + auto reqContainer = std::unique_ptr(new CallRequestContainer( + "/Insights/SetStorageRetention", + headers, + jsonAsString, + OnSetStorageRetentionResult, + settings, + context, + customData)); + + reqContainer->successCallback = std::shared_ptr((callback == nullptr) ? nullptr : new ProcessApiCallback(callback)); + reqContainer->errorCallback = errorCallback; + + http.MakePostRequest(std::unique_ptr(static_cast(reqContainer.release()))); + } + + void PlayFabInsightsAPI::OnSetStorageRetentionResult(int /*httpCode*/, const std::string& /*result*/, const std::shared_ptr& reqContainer) + { + CallRequestContainer& container = static_cast(*reqContainer); + std::shared_ptr context = container.GetContext(); + + InsightsOperationResponse outResult; + if (ValidateResult(outResult, container)) + { + std::shared_ptr internalPtr = container.successCallback; + if (internalPtr.get() != nullptr) + { + const auto& callback = (*static_cast *>(internalPtr.get())); + callback(outResult, container.GetCustomData()); + } + } + } + + bool PlayFabInsightsAPI::ValidateResult(PlayFabResultCommon& resultCommon, const CallRequestContainer& container) + { + if (container.errorWrapper.HttpCode == 200) + { + resultCommon.FromJson(container.errorWrapper.Data); + resultCommon.Request = container.errorWrapper.Request; + return true; + } + else // Process the error case + { + if (PlayFabSettings::globalErrorHandler != nullptr) + { + PlayFabSettings::globalErrorHandler(container.errorWrapper, container.GetCustomData()); + } + if (container.errorCallback != nullptr) + { + container.errorCallback(container.errorWrapper, container.GetCustomData()); + } + return false; + } + } +} + +#endif // #if !defined(DISABLE_PLAYFABENTITY_API) + +#if defined(PLAYFAB_PLATFORM_WINDOWS) +#pragma warning (default: 4100) // formal parameters are part of a public interface +#endif // defined(PLAYFAB_PLATFORM_WINDOWS) diff --git a/code/source/playfab/PlayFabInsightsInstanceApi.cpp b/code/source/playfab/PlayFabInsightsInstanceApi.cpp new file mode 100644 index 00000000..458c1113 --- /dev/null +++ b/code/source/playfab/PlayFabInsightsInstanceApi.cpp @@ -0,0 +1,390 @@ +#include + +#if !defined(DISABLE_PLAYFABENTITY_API) + +#include +#include +#include + +#if defined(PLAYFAB_PLATFORM_WINDOWS) +#pragma warning (disable: 4100) // formal parameters are part of a public interface +#endif // defined(PLAYFAB_PLATFORM_WINDOWS) + +namespace PlayFab +{ + using namespace InsightsModels; + + PlayFabInsightsInstanceAPI::PlayFabInsightsInstanceAPI(const std::shared_ptr& authenticationContext) + { + if (authenticationContext == nullptr) + { + throw PlayFabException(PlayFabExceptionCode::AuthContextRequired, "Context cannot be null, create a PlayFabAuthenticationContext for each player in advance, or get .authenticationContext"); + } + this->m_context = authenticationContext; + } + + PlayFabInsightsInstanceAPI::PlayFabInsightsInstanceAPI(const std::shared_ptr& apiSettings, const std::shared_ptr& authenticationContext) + { + if (authenticationContext == nullptr) + { + throw PlayFabException(PlayFabExceptionCode::AuthContextRequired, "Context cannot be null, create a PlayFabAuthenticationContext for each player in advance, or get .authenticationContext"); + } + this->m_settings = apiSettings; + this->m_context = authenticationContext; + } + + std::shared_ptr PlayFabInsightsInstanceAPI::GetSettings() const + { + return this->m_settings; + } + + std::shared_ptr PlayFabInsightsInstanceAPI::GetAuthenticationContext() const + { + return this->m_context; + } + + size_t PlayFabInsightsInstanceAPI::Update() + { + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + return http.Update(); + } + + void PlayFabInsightsInstanceAPI::ForgetAllCredentials() + { + if (this->m_context != nullptr) + { + this->m_context->ForgetAllCredentials(); + } + } + + // PlayFabInsights instance APIs + + void PlayFabInsightsInstanceAPI::GetDetails( + InsightsEmptyRequest& request, + const ProcessApiCallback callback, + const ErrorCallback errorCallback, + void* customData + ) + { + std::shared_ptr context = request.authenticationContext != nullptr ? request.authenticationContext : this->m_context; + std::shared_ptr settings = this->m_settings != nullptr ? this->m_settings : PlayFabSettings::staticSettings; + + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + const Json::Value requestJson = request.ToJson(); + std::string jsonAsString = requestJson.toStyledString(); + + std::shared_ptr authenticationContext = request.authenticationContext == nullptr ? this->m_context : request.authenticationContext; + std::unordered_map headers; + headers.emplace("X-EntityToken", context->entityToken); + + auto reqContainer = std::unique_ptr(new CallRequestContainer( + "/Insights/GetDetails", + headers, + jsonAsString, + std::bind(&PlayFabInsightsInstanceAPI::OnGetDetailsResult, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), + settings, + context, + customData)); + + reqContainer->successCallback = std::shared_ptr((callback == nullptr) ? nullptr : new ProcessApiCallback(callback)); + reqContainer->errorCallback = errorCallback; + + http.MakePostRequest(std::unique_ptr(static_cast(reqContainer.release()))); + } + + void PlayFabInsightsInstanceAPI::OnGetDetailsResult(int /*httpCode*/, const std::string& /*result*/, const std::shared_ptr& reqContainer) + { + CallRequestContainer& container = static_cast(*reqContainer); + std::shared_ptr context = container.GetContext(); + + InsightsGetDetailsResponse outResult; + if (ValidateResult(outResult, container)) + { + std::shared_ptr internalPtr = container.successCallback; + if (internalPtr.get() != nullptr) + { + const auto& callback = *static_cast *>(internalPtr.get()); + callback(outResult, container.GetCustomData()); + } + } + } + + void PlayFabInsightsInstanceAPI::GetLimits( + InsightsEmptyRequest& request, + const ProcessApiCallback callback, + const ErrorCallback errorCallback, + void* customData + ) + { + std::shared_ptr context = request.authenticationContext != nullptr ? request.authenticationContext : this->m_context; + std::shared_ptr settings = this->m_settings != nullptr ? this->m_settings : PlayFabSettings::staticSettings; + + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + const Json::Value requestJson = request.ToJson(); + std::string jsonAsString = requestJson.toStyledString(); + + std::shared_ptr authenticationContext = request.authenticationContext == nullptr ? this->m_context : request.authenticationContext; + std::unordered_map headers; + headers.emplace("X-EntityToken", context->entityToken); + + auto reqContainer = std::unique_ptr(new CallRequestContainer( + "/Insights/GetLimits", + headers, + jsonAsString, + std::bind(&PlayFabInsightsInstanceAPI::OnGetLimitsResult, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), + settings, + context, + customData)); + + reqContainer->successCallback = std::shared_ptr((callback == nullptr) ? nullptr : new ProcessApiCallback(callback)); + reqContainer->errorCallback = errorCallback; + + http.MakePostRequest(std::unique_ptr(static_cast(reqContainer.release()))); + } + + void PlayFabInsightsInstanceAPI::OnGetLimitsResult(int /*httpCode*/, const std::string& /*result*/, const std::shared_ptr& reqContainer) + { + CallRequestContainer& container = static_cast(*reqContainer); + std::shared_ptr context = container.GetContext(); + + InsightsGetLimitsResponse outResult; + if (ValidateResult(outResult, container)) + { + std::shared_ptr internalPtr = container.successCallback; + if (internalPtr.get() != nullptr) + { + const auto& callback = *static_cast *>(internalPtr.get()); + callback(outResult, container.GetCustomData()); + } + } + } + + void PlayFabInsightsInstanceAPI::GetOperationStatus( + InsightsGetOperationStatusRequest& request, + const ProcessApiCallback callback, + const ErrorCallback errorCallback, + void* customData + ) + { + std::shared_ptr context = request.authenticationContext != nullptr ? request.authenticationContext : this->m_context; + std::shared_ptr settings = this->m_settings != nullptr ? this->m_settings : PlayFabSettings::staticSettings; + + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + const Json::Value requestJson = request.ToJson(); + std::string jsonAsString = requestJson.toStyledString(); + + std::shared_ptr authenticationContext = request.authenticationContext == nullptr ? this->m_context : request.authenticationContext; + std::unordered_map headers; + headers.emplace("X-EntityToken", context->entityToken); + + auto reqContainer = std::unique_ptr(new CallRequestContainer( + "/Insights/GetOperationStatus", + headers, + jsonAsString, + std::bind(&PlayFabInsightsInstanceAPI::OnGetOperationStatusResult, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), + settings, + context, + customData)); + + reqContainer->successCallback = std::shared_ptr((callback == nullptr) ? nullptr : new ProcessApiCallback(callback)); + reqContainer->errorCallback = errorCallback; + + http.MakePostRequest(std::unique_ptr(static_cast(reqContainer.release()))); + } + + void PlayFabInsightsInstanceAPI::OnGetOperationStatusResult(int /*httpCode*/, const std::string& /*result*/, const std::shared_ptr& reqContainer) + { + CallRequestContainer& container = static_cast(*reqContainer); + std::shared_ptr context = container.GetContext(); + + InsightsGetOperationStatusResponse outResult; + if (ValidateResult(outResult, container)) + { + std::shared_ptr internalPtr = container.successCallback; + if (internalPtr.get() != nullptr) + { + const auto& callback = *static_cast *>(internalPtr.get()); + callback(outResult, container.GetCustomData()); + } + } + } + + void PlayFabInsightsInstanceAPI::GetPendingOperations( + InsightsGetPendingOperationsRequest& request, + const ProcessApiCallback callback, + const ErrorCallback errorCallback, + void* customData + ) + { + std::shared_ptr context = request.authenticationContext != nullptr ? request.authenticationContext : this->m_context; + std::shared_ptr settings = this->m_settings != nullptr ? this->m_settings : PlayFabSettings::staticSettings; + + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + const Json::Value requestJson = request.ToJson(); + std::string jsonAsString = requestJson.toStyledString(); + + std::shared_ptr authenticationContext = request.authenticationContext == nullptr ? this->m_context : request.authenticationContext; + std::unordered_map headers; + headers.emplace("X-EntityToken", context->entityToken); + + auto reqContainer = std::unique_ptr(new CallRequestContainer( + "/Insights/GetPendingOperations", + headers, + jsonAsString, + std::bind(&PlayFabInsightsInstanceAPI::OnGetPendingOperationsResult, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), + settings, + context, + customData)); + + reqContainer->successCallback = std::shared_ptr((callback == nullptr) ? nullptr : new ProcessApiCallback(callback)); + reqContainer->errorCallback = errorCallback; + + http.MakePostRequest(std::unique_ptr(static_cast(reqContainer.release()))); + } + + void PlayFabInsightsInstanceAPI::OnGetPendingOperationsResult(int /*httpCode*/, const std::string& /*result*/, const std::shared_ptr& reqContainer) + { + CallRequestContainer& container = static_cast(*reqContainer); + std::shared_ptr context = container.GetContext(); + + InsightsGetPendingOperationsResponse outResult; + if (ValidateResult(outResult, container)) + { + std::shared_ptr internalPtr = container.successCallback; + if (internalPtr.get() != nullptr) + { + const auto& callback = *static_cast *>(internalPtr.get()); + callback(outResult, container.GetCustomData()); + } + } + } + + void PlayFabInsightsInstanceAPI::SetPerformance( + InsightsSetPerformanceRequest& request, + const ProcessApiCallback callback, + const ErrorCallback errorCallback, + void* customData + ) + { + std::shared_ptr context = request.authenticationContext != nullptr ? request.authenticationContext : this->m_context; + std::shared_ptr settings = this->m_settings != nullptr ? this->m_settings : PlayFabSettings::staticSettings; + + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + const Json::Value requestJson = request.ToJson(); + std::string jsonAsString = requestJson.toStyledString(); + + std::shared_ptr authenticationContext = request.authenticationContext == nullptr ? this->m_context : request.authenticationContext; + std::unordered_map headers; + headers.emplace("X-EntityToken", context->entityToken); + + auto reqContainer = std::unique_ptr(new CallRequestContainer( + "/Insights/SetPerformance", + headers, + jsonAsString, + std::bind(&PlayFabInsightsInstanceAPI::OnSetPerformanceResult, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), + settings, + context, + customData)); + + reqContainer->successCallback = std::shared_ptr((callback == nullptr) ? nullptr : new ProcessApiCallback(callback)); + reqContainer->errorCallback = errorCallback; + + http.MakePostRequest(std::unique_ptr(static_cast(reqContainer.release()))); + } + + void PlayFabInsightsInstanceAPI::OnSetPerformanceResult(int /*httpCode*/, const std::string& /*result*/, const std::shared_ptr& reqContainer) + { + CallRequestContainer& container = static_cast(*reqContainer); + std::shared_ptr context = container.GetContext(); + + InsightsOperationResponse outResult; + if (ValidateResult(outResult, container)) + { + std::shared_ptr internalPtr = container.successCallback; + if (internalPtr.get() != nullptr) + { + const auto& callback = *static_cast *>(internalPtr.get()); + callback(outResult, container.GetCustomData()); + } + } + } + + void PlayFabInsightsInstanceAPI::SetStorageRetention( + InsightsSetStorageRetentionRequest& request, + const ProcessApiCallback callback, + const ErrorCallback errorCallback, + void* customData + ) + { + std::shared_ptr context = request.authenticationContext != nullptr ? request.authenticationContext : this->m_context; + std::shared_ptr settings = this->m_settings != nullptr ? this->m_settings : PlayFabSettings::staticSettings; + + IPlayFabHttpPlugin& http = *PlayFabPluginManager::GetPlugin(PlayFabPluginContract::PlayFab_Transport); + const Json::Value requestJson = request.ToJson(); + std::string jsonAsString = requestJson.toStyledString(); + + std::shared_ptr authenticationContext = request.authenticationContext == nullptr ? this->m_context : request.authenticationContext; + std::unordered_map headers; + headers.emplace("X-EntityToken", context->entityToken); + + auto reqContainer = std::unique_ptr(new CallRequestContainer( + "/Insights/SetStorageRetention", + headers, + jsonAsString, + std::bind(&PlayFabInsightsInstanceAPI::OnSetStorageRetentionResult, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3), + settings, + context, + customData)); + + reqContainer->successCallback = std::shared_ptr((callback == nullptr) ? nullptr : new ProcessApiCallback(callback)); + reqContainer->errorCallback = errorCallback; + + http.MakePostRequest(std::unique_ptr(static_cast(reqContainer.release()))); + } + + void PlayFabInsightsInstanceAPI::OnSetStorageRetentionResult(int /*httpCode*/, const std::string& /*result*/, const std::shared_ptr& reqContainer) + { + CallRequestContainer& container = static_cast(*reqContainer); + std::shared_ptr context = container.GetContext(); + + InsightsOperationResponse outResult; + if (ValidateResult(outResult, container)) + { + std::shared_ptr internalPtr = container.successCallback; + if (internalPtr.get() != nullptr) + { + const auto& callback = *static_cast *>(internalPtr.get()); + callback(outResult, container.GetCustomData()); + } + } + } + + bool PlayFabInsightsInstanceAPI::ValidateResult(PlayFabResultCommon& resultCommon, const CallRequestContainer& container) + { + if (container.errorWrapper.HttpCode == 200) + { + resultCommon.FromJson(container.errorWrapper.Data); + resultCommon.Request = container.errorWrapper.Request; + return true; + } + else // Process the error case + { + if (PlayFabSettings::globalErrorHandler != nullptr) + { + PlayFabSettings::globalErrorHandler(container.errorWrapper, container.GetCustomData()); + } + + if (container.errorCallback != nullptr) + { + container.errorCallback(container.errorWrapper, container.GetCustomData()); + } + return false; + } + } +} + +#endif + +#if defined(PLAYFAB_PLATFORM_WINDOWS) +#pragma warning (default: 4100) // formal parameters are part of a public interface +#endif // defined(PLAYFAB_PLATFORM_WINDOWS) diff --git a/code/source/playfab/PlayFabSettings.cpp b/code/source/playfab/PlayFabSettings.cpp index 410a53d2..7adbabb6 100644 --- a/code/source/playfab/PlayFabSettings.cpp +++ b/code/source/playfab/PlayFabSettings.cpp @@ -6,9 +6,9 @@ namespace PlayFab { // Control whether all callbacks are threaded or whether the user manually controls callback timing from their main-thread bool PlayFabSettings::threadedCallbacks = false; - const std::string PlayFabSettings::sdkVersion = "3.26.200330"; - const std::string PlayFabSettings::buildIdentifier = "jbuild_xplatcppsdk__sdk-genericslave-2_0"; - const std::string PlayFabSettings::versionString = "XPlatCppSdk-3.26.200330"; + const std::string PlayFabSettings::sdkVersion = "3.27.200402"; + const std::string PlayFabSettings::buildIdentifier = "jbuild_xplatcppsdk__sdk-genericslave-3_2"; + const std::string PlayFabSettings::versionString = "XPlatCppSdk-3.27.200402"; std::string PlayFabSettings::productionEnvironmentURL = ".playfabapi.com"; ErrorCallback PlayFabSettings::globalErrorHandler = nullptr; diff --git a/com.playfab.xplatcppsdk.v141.autopkg b/com.playfab.xplatcppsdk.v141.autopkg index 2f3bfa84..fa0e91f9 100644 --- a/com.playfab.xplatcppsdk.v141.autopkg +++ b/com.playfab.xplatcppsdk.v141.autopkg @@ -8,7 +8,7 @@ configurations { nuget { nuspec { id = "com.playfab.xplatcppsdk.v141"; - version : 3.26.200330; + version : 3.27.200402; title: "PlayFab Cross Platform C++ Sdk for Visual Studio 2017"; summary: "PlayFab is the unified backend platform for games and 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."; authors: "PlayFab"; @@ -18,7 +18,7 @@ nuget { iconUrl: "https://playfab.com/assets/img/playfab-mark.png"; requireLicenseAcceptance: false; description: "Authentication, in-game commerce, player data, title data, inventory, characters, statistics, leaderboards, analytics and reporting, friends, multiplayer, matchmaking, tournaments, cloud script, trading, real-time event handling, player management, live ops, and server hosting for all major platforms/devices and games of any scale. This sdk gives your game the ability log into PlayFab and access cloud data and services."; - releaseNotes: "https://api.playfab.com/releaseNotes/#200330"; + releaseNotes: "https://api.playfab.com/releaseNotes/#200402"; copyright: "Copyright 2020"; language: "C++"; tags: { PlayFab, Baas, Paas, JSON, REST, HTTP, SSL, API, cloud, liveops, game, gamedev, native }; diff --git a/com.playfab.xplatxboxsdk.v141.autopkg b/com.playfab.xplatxboxsdk.v141.autopkg index c2eece0c..f4c848b0 100644 --- a/com.playfab.xplatxboxsdk.v141.autopkg +++ b/com.playfab.xplatxboxsdk.v141.autopkg @@ -18,7 +18,7 @@ configurations { nuget { nuspec { id = "com.playfab.xplatxboxsdk.v141"; - version : 3.26.200330; + version : 3.27.200402; title: "PlayFab Xbox Platform C++ Sdk for Visual Studio 2017"; summary: "PlayFab is the unified backend platform for games and 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."; authors: "PlayFab"; @@ -28,7 +28,7 @@ nuget { iconUrl: "https://playfab.com/assets/img/playfab-mark.png"; requireLicenseAcceptance: false; description: "Authentication, in-game commerce, player data, title data, inventory, characters, statistics, leaderboards, analytics and reporting, friends, multiplayer, matchmaking, tournaments, cloud script, trading, real-time event handling, player management, live ops, and server hosting for all major platforms/devices and games of any scale. This sdk gives your game the ability log into PlayFab and access cloud data and services."; - releaseNotes: "https://api.playfab.com/releaseNotes/#200330"; + releaseNotes: "https://api.playfab.com/releaseNotes/#200402"; copyright: "Copyright 2020"; language: "C++"; tags: { PlayFab, Baas, Paas, JSON, REST, HTTP, SSL, API, cloud, liveops, game, gamedev, native, xbox };