/// <summary>
        /// Updates metadata about a role.
        /// </summary>
        public async Task <PlayFabResult <UpdateGroupRoleResponse> > UpdateRoleAsync(UpdateGroupRoleRequest request, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            var requestSettings = apiSettings ?? PlayFabSettings.staticSettings;

            if ((request?.AuthenticationContext?.EntityToken ?? authenticationContext.EntityToken) == null)
            {
                throw new PlayFabException(PlayFabExceptionCode.EntityTokenNotSet, "Must call GetEntityToken before calling this method");
            }

            var httpResult = await PlayFabHttp.DoPost("/Group/UpdateRole", request, "X-EntityToken", authenticationContext.EntityToken, extraHeaders, requestSettings);

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

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

            return(new PlayFabResult <UpdateGroupRoleResponse> {
                Result = result, CustomData = customData
            });
        }
        /// <summary>
        /// Updates metadata about a role.
        /// </summary>
        public static void UpdateRole(UpdateGroupRoleRequest request, Action <UpdateGroupRoleResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;


            PlayFabHttp.MakeApiCall("/Group/UpdateRole", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context);
        }
        /// <summary>
        /// Updates metadata about a role.
        /// </summary>
        public void UpdateRole(UpdateGroupRoleRequest request, Action <UpdateGroupRoleResponse> 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("/Group/UpdateRole", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
        }
Beispiel #4
0
        /// <summary>
        /// Updates metadata about a role.
        /// </summary>
        /// <param name="ExpectedProfileVersion">Optional field used for concurrency control. By specifying the previously returned value of ProfileVersion from the GetGroup API, you can ensure that the group data update will only be performed if the group has not been updated by any other clients since the version you last loaded. (Optional)</param>
        /// <param name="Group">The identifier of the group (Required)</param>
        /// <param name="RoleId">ID of the role to update. Role IDs must be between 1 and 64 characters long. (Optional)</param>
        /// <param name="RoleName">The new name of the role (Required)</param>
        public static Task <UpdateGroupRoleResponse> UpdateRole(EntityKey Group, string RoleName, int?ExpectedProfileVersion = default, string RoleId = default,
                                                                PlayFabAuthenticationContext customAuthContext = null, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            UpdateGroupRoleRequest request = new UpdateGroupRoleRequest()
            {
                Group    = Group,
                RoleName = RoleName,
                ExpectedProfileVersion = ExpectedProfileVersion,
                RoleId = RoleId,
            };

            var context = GetContext(customAuthContext);

            return(PlayFabHttp.MakeApiCallAsync <UpdateGroupRoleResponse>("/Group/UpdateRole", request,
                                                                          AuthType.EntityToken,
                                                                          customData, extraHeaders, context));
        }
Beispiel #5
0
 /// <summary>
 /// Updates metadata about a role.
 /// </summary>
 public static void UpdateRole(UpdateGroupRoleRequest request, Action <UpdateGroupRoleResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
 {
     PlayFabHttp.MakeApiCall("/Group/UpdateRole", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders);
 }