/// <summary>
        /// Sets the global title access policy
        /// </summary>
        public static void SetGlobalPolicy(SetGlobalPolicyRequest request, Action <SetGlobalPolicyResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;


            PlayFabHttp.MakeApiCall("/Profile/SetGlobalPolicy", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context);
        }
        /// <summary>
        /// Sets the global title access policy
        /// </summary>
        public void SetGlobalPolicy(SetGlobalPolicyRequest request, Action <SetGlobalPolicyResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            var context      = (request == null ? null : request.AuthenticationContext) ?? authenticationContext;
            var callSettings = apiSettings ?? PlayFabSettings.staticSettings;

            if (!context.IsEntityLoggedIn())
            {
                throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn, "Must be logged in to call this method");
            }
            PlayFabHttp.MakeApiCall("/Profile/SetGlobalPolicy", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
        }
Esempio n. 3
0
        /// <summary>
        /// Sets the global title access policy
        /// </summary>
        /// <param name="Permissions">The permissions that govern access to all entities under this title or namespace. (Optional)</param>
        public static Task <SetGlobalPolicyResponse> SetGlobalPolicy(List <EntityPermissionStatement> Permissions   = default,
                                                                     PlayFabAuthenticationContext customAuthContext = null, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            SetGlobalPolicyRequest request = new SetGlobalPolicyRequest()
            {
                Permissions = Permissions,
            };

            var context = GetContext(customAuthContext);

            return(PlayFabHttp.MakeApiCallAsync <SetGlobalPolicyResponse>("/Profile/SetGlobalPolicy", request,
                                                                          AuthType.EntityToken,
                                                                          customData, extraHeaders, context));
        }
        /// <summary>
        /// Sets the global title access policy
        /// </summary>

        public void SetGlobalPolicy(SetGlobalPolicyRequest request, Action <SetGlobalPolicyResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            PlayFabHttp.MakeApiCall("/Profile/SetGlobalPolicy", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, false, authenticationContext, ApiSettings);
        }
Esempio n. 5
0
        /// <summary>
        /// Sets the global title access policy
        /// </summary>
        public static async Task <PlayFabResult <SetGlobalPolicyResponse> > SetGlobalPolicyAsync(SetGlobalPolicyRequest 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("/Profile/SetGlobalPolicy", request, "X-EntityToken", PlayFabSettings.staticPlayer.EntityToken, extraHeaders);

            if (httpResult is PlayFabError)
            {
                var error = (PlayFabError)httpResult;
                PlayFabSettings.GlobalErrorHandler?.Invoke(error);
                return(new PlayFabResult <SetGlobalPolicyResponse> {
                    Error = error, CustomData = customData
                });
            }

            var resultRawJson = (string)httpResult;
            var resultData    = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject <PlayFabJsonSuccess <SetGlobalPolicyResponse> >(resultRawJson);
            var result        = resultData.data;

            return(new PlayFabResult <SetGlobalPolicyResponse> {
                Result = result, CustomData = customData
            });
        }