예제 #1
0
        protected override void RunWebRequest(QueueManager qm)
        {
            RequestState requestState = new RequestState();

            requestState.OperationType = OperationType;
            requestState.httpMethod    = HTTPMethod.Patch;

            var cub = new {
                add    = ObjectsHelpers.ConvertPNMembersInputForJSON(ManageMembersAdd),
                update = ObjectsHelpers.ConvertPNMembersInputForJSON(ManageMembersUpdate),
                remove = ObjectsHelpers.ConvertPNMembersRemoveForJSON(ManageMembersRemove),
            };

            string jsonUserBody = Helpers.JsonEncodePublishMsg(cub, "", this.PubNubInstance.JsonLibrary, this.PubNubInstance.PNLog);

            #if (ENABLE_PUBNUB_LOGGING)
            this.PubNubInstance.PNLog.WriteToLog(string.Format("jsonUserBody: {0}", jsonUserBody), PNLoggingMethod.LevelInfo);
            #endif
            requestState.POSTData = jsonUserBody;

            string[] includeString = (ManageMembersInclude == null) ? new string[] {} : ManageMembersInclude.Select(a => a.GetDescription().ToString()).ToArray();

            Uri request = BuildRequests.BuildObjectsManageMembersRequest(
                ManageMembersSpaceID,
                ManageMembersLimit,
                ManageMembersStart,
                ManageMembersEnd,
                ManageMembersCount,
                string.Join(",", includeString),
                this.PubNubInstance,
                this.QueryParams
                );
            base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this);
        }
        protected override void RunWebRequest(QueueManager qm)
        {
            RequestState requestState = new RequestState();

            requestState.OperationType = OperationType;
            requestState.httpMethod    = HTTPMethod.Patch;

            var cub = new {
                set    = ObjectsHelpers.ConvertPNMembersInputForJSON(ManageMembersSet),
                delete = ObjectsHelpers.ConvertPNMembersRemoveForJSON(ManageMembersRemove),
            };

            string jsonUserBody = Helpers.JsonEncodePublishMsg(cub, "", this.PubNubInstance.JsonLibrary, this.PubNubInstance.PNLog);

            #if (ENABLE_PUBNUB_LOGGING)
            this.PubNubInstance.PNLog.WriteToLog(string.Format("jsonUserBody: {0}", jsonUserBody), PNLoggingMethod.LevelInfo);
            #endif
            requestState.POSTData = jsonUserBody;

            string[]      includeString = (ManageMembersInclude == null) ? new string[] {} : ManageMembersInclude.Select(a => a.GetDescription().ToString()).ToArray();
            List <string> sortFields    = SortBy ?? new List <string>();

            Uri request = BuildRequests.BuildObjectsManageChannelMembersRequest(
                ManageMembersChannel,
                ManageMembersLimit,
                ManageMembersStart,
                ManageMembersEnd,
                ManageMembersCount,
                string.Join(",", includeString),
                this.PubNubInstance,
                this.QueryParams,
                string.Join(",", sortFields)
                );
            request = this.PubNubInstance.TokenMgr.AppendTokenToURL(request.OriginalString, ManageMembersChannel, PNResourceType.PNChannelMetadata, OperationType);
            base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this);
        }