protected override void RunWebRequest(QueueManager qm)
        {
            RequestState requestState = new RequestState();

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

            var cub = new {
                add    = ObjectsHelpers.ConvertPNMembersInputForJSON(ManageMembershipsAdd),
                update = ObjectsHelpers.ConvertPNMembersInputForJSON(ManageMembershipsUpdate),
                remove = ObjectsHelpers.ConvertPNMembersRemoveForJSON(ManageMembershipsRemove),
            };

            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 = (ManagerMembershipsInclude == null) ? new string[] {} : ManagerMembershipsInclude.Select(a => a.GetDescription().ToString()).ToArray();

            Uri request = BuildRequests.BuildObjectsManageMembershipsRequest(
                ManageMembershipsUserID,
                ManageMembershipsLimit,
                ManageMembershipsStart,
                ManageMembershipsEnd,
                ManageMembershipsCount,
                string.Join(",", includeString),
                this.PubNubInstance,
                this.QueryParams
                );
            base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this);
        }
Esempio n. 2
0
        protected override void RunWebRequest(QueueManager qm)
        {
            RequestState requestState = new RequestState();

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

            var cub = new {
                set    = ObjectsHelpers.ConvertPNMembershipsInputForJSON(ManageMembershipsSet),
                delete = ObjectsHelpers.ConvertPNMembershipsRemoveForJSON(ManageMembershipsRemove),
            };

            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 = (ManagerMembershipsInclude == null) ? new string[] {} : ManagerMembershipsInclude.Select(a => a.GetDescription().ToString()).ToArray();
            List <string> sortFields    = SortBy ?? new List <string>();

            Uri request = BuildRequests.BuildObjectsManageMembershipsRequest(
                ManageMembershipsUUID,
                ManageMembershipsLimit,
                ManageMembershipsStart,
                ManageMembershipsEnd,
                ManageMembershipsCount,
                string.Join(",", includeString),
                this.PubNubInstance,
                this.QueryParams,
                string.Join(",", sortFields)
                );
            request = this.PubNubInstance.TokenMgr.AppendTokenToURL(request.OriginalString, ManageMembershipsUUID, PNResourceType.PNUUIDMetadata, OperationType);
            base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this);
        }