/// <summary>
        /// Removes members from a group.
        /// </summary>
        public static async Task <PlayFabResult <EmptyResponse> > RemoveMembersAsync(RemoveMembersRequest 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("/Group/RemoveMembers", request, "X-EntityToken", PlayFabSettings.staticPlayer.EntityToken, extraHeaders);

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

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

            return(new PlayFabResult <EmptyResponse> {
                Result = result, CustomData = customData
            });
        }
        /// <summary>
        /// Removes members from a group.
        /// </summary>
        public static void RemoveMembers(RemoveMembersRequest request, Action <EmptyResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer;


            PlayFabHttp.MakeApiCall("/Group/RemoveMembers", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context);
        }
Пример #3
0
        public void KickMember(string groupId, EntityKey entityKey)
        {
            var request = new RemoveMembersRequest {
                Group = EntityKeyMaker(groupId), Members = new List <EntityKey> {
                    entityKey
                }
            };

            PlayFabGroupsAPI.RemoveMembers(request, OnKickMembers, OnSharedError);
        }
        /// <summary>
        /// Removes members from a group.
        /// </summary>
        public void RemoveMembers(RemoveMembersRequest request, Action <EmptyResponse> 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/RemoveMembers", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this);
        }
Пример #5
0
        /// <summary>
        /// Removes members from a group.
        /// </summary>
        /// <param name="Group">The identifier of the group (Required)</param>
        /// <param name="Members">List of entities to remove (Required)</param>
        /// <param name="RoleId">The ID of the role to remove the entities from. (Optional)</param>
        public static Task <EmptyResponse> RemoveMembers(EntityKey Group, List <EntityKey> Members, string RoleId = default,
                                                         PlayFabAuthenticationContext customAuthContext           = null, object customData = null, Dictionary <string, string> extraHeaders = null)
        {
            RemoveMembersRequest request = new RemoveMembersRequest()
            {
                Group   = Group,
                Members = Members,
                RoleId  = RoleId,
            };

            var context = GetContext(customAuthContext);

            return(PlayFabHttp.MakeApiCallAsync <EmptyResponse>("/Group/RemoveMembers", request,
                                                                AuthType.EntityToken,
                                                                customData, extraHeaders, context));
        }
Пример #6
0
 /// <summary>
 /// Removes members from a group.
 /// </summary>
 public static void RemoveMembers(RemoveMembersRequest request, Action <EmptyResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null)
 {
     PlayFabHttp.MakeApiCall("/Group/RemoveMembers", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders);
 }