/// <summary> /// Registers an Azure function with a title. /// </summary> public async Task <PlayFabResult <EmptyResult> > RegisterFunctionAsync(RegisterFunctionRequest 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("/CloudScript/RegisterFunction", request, "X-EntityToken", PlayFabSettings.staticPlayer.EntityToken, extraHeaders, apiSettings); if (httpResult is PlayFabError) { var error = (PlayFabError)httpResult; PlayFabSettings.GlobalErrorHandler?.Invoke(error); return(new PlayFabResult <EmptyResult> { Error = error, CustomData = customData }); } var resultRawJson = (string)httpResult; var resultData = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject <PlayFabJsonSuccess <EmptyResult> >(resultRawJson); var result = resultData.data; return(new PlayFabResult <EmptyResult> { Result = result, CustomData = customData }); }
/// <summary> /// Registers an Azure function with a title. /// </summary> public static void RegisterFunction(RegisterFunctionRequest request, Action <EmptyResult> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { PlayFabHttp.MakeApiCall("/CloudScript/RegisterFunction", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders); }