/// <summary> /// Update statistics on an entity profile, depending on the statistic definition may cause entity to be ranked on various /// leaderboards. /// </summary> public async Task <PlayFabResult <UpdateStatisticsResponse> > UpdateStatisticsAsync(UpdateStatisticsRequest request, object customData = null, Dictionary <string, string> extraHeaders = null) { if ((request?.AuthenticationContext?.EntityToken ?? PlayFabSettings.staticPlayer.EntityToken) == null) { throw new PlayFabException(PlayFabExceptionCode.EntityTokenNotSet, "Must call GetEntityToken before calling this method"); } var httpResult = await PlayFabHttp.DoPost("/Statistic/UpdateStatistics", request, "X-EntityToken", PlayFabSettings.staticPlayer.EntityToken, extraHeaders, apiSettings); if (httpResult is PlayFabError) { var error = (PlayFabError)httpResult; PlayFabSettings.GlobalErrorHandler?.Invoke(error); return(new PlayFabResult <UpdateStatisticsResponse> { Error = error, CustomData = customData }); } var resultRawJson = (string)httpResult; var resultData = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject <PlayFabJsonSuccess <UpdateStatisticsResponse> >(resultRawJson); var result = resultData.data; return(new PlayFabResult <UpdateStatisticsResponse> { Result = result, CustomData = customData }); }
/// <summary> /// Update statistics on an entity profile, depending on the statistic definition may cause entity to be ranked on various /// leaderboards. /// </summary> public static void UpdateStatistics(UpdateStatisticsRequest request, Action <UpdateStatisticsResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { PlayFabHttp.MakeApiCall("/Statistic/UpdateStatistics", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders); }