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

            requestState.OperationType = OperationType;
            requestState.httpMethod    = HTTPMethod.Post;

            var cub = new {
                id          = CreateSpaceID,
                name        = CreateSpaceName,
                description = CreateSpaceDescription,
                custom      = CreateSpaceCustom,
            };

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

            Uri request = BuildRequests.BuildObjectsCreateSpaceRequest(
                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;

            string jsonMessage  = (publishAsIs) ? PublishMessage.ToString() : Helpers.JsonEncodePublishMsg(PublishMessage, this.PubNubInstance.PNConfig.CipherKey, this.PubNubInstance.JsonLibrary, this.PubNubInstance.PNLog);
            string jsonMetadata = string.Empty;

            if (this.Metadata != null)
            {
                jsonMetadata = Helpers.JsonEncodePublishMsg(this.Metadata, "", this.PubNubInstance.JsonLibrary, this.PubNubInstance.PNLog);
            }

            if (UsePostMethod)
            {
                requestState.httpMethod = HTTPMethod.Post;
                requestState.POSTData   = jsonMessage;
            }
            Uri request = BuildRequests.BuildPublishRequest(
                this.PublishChannel,
                jsonMessage,
                this.ShouldStoreInHistory,
                jsonMetadata,
                publishCounter,
                this.PublishTtl,
                UsePostMethod,
                this.ReplicateMessage,
                this.PubNubInstance
                );

            base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this);
        }
Exemple #3
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);
        }
Exemple #4
0
        protected override void RunWebRequest(QueueManager qm)
        {
            RequestState requestState = new RequestState();

            requestState.OperationType = OperationType;

            string jsonMessage = Helpers.JsonEncodePublishMsg(SignalMessage, "", this.PubNubInstance.JsonLibrary, this.PubNubInstance.PNLog);
            Uri    request     = BuildRequests.BuildSignalRequest(
                this.SignalChannel,
                jsonMessage,
                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.Post;
            var cub = new {
                name = SendFileName,
            };
            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;

            Uri request = BuildRequests.BuildSendFileRequest(
                SendFileChannel,
                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);
        }