protected override void RunWebRequest(QueueManager qm) { RequestState requestState = new RequestState(); requestState.OperationType = PNOperationType.PNWhereNowOperation; string channels = ""; if ((ChannelsToUse != null) && (ChannelsToUse.Count > 0)) { channels = String.Join(",", ChannelsToUse.ToArray()); } string channelGroups = ""; if ((ChannelGroupsToUse != null) && (ChannelGroupsToUse.Count > 0)) { channelGroups = String.Join(",", ChannelGroupsToUse.ToArray()); } if (string.IsNullOrEmpty(uuid)) { uuid = this.PubNubInstance.PNConfig.UUID; } Uri request = BuildRequests.BuildSetStateRequest( channels, channelGroups, Helpers.BuildJsonUserState(ChannelEntities), uuid, 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 { id = UUIDToUse, email = UUIDEmail, name = UUIDName, profileUrl = UUIDProfileURL, externalId = UUIDExternalID, custom = UUIDCustom, }; string jsonUUIDBody = Helpers.JsonEncodePublishMsg(cub, "", this.PubNubInstance.JsonLibrary, this.PubNubInstance.PNLog); #if (ENABLE_PUBNUB_LOGGING) this.PubNubInstance.PNLog.WriteToLog(string.Format("jsonUUIDBody: {0}", jsonUUIDBody), PNLoggingMethod.LevelInfo); #endif requestState.POSTData = jsonUUIDBody; string[] includeString = (UUIDInclude == null) ? new string[] {} : UUIDInclude.Select(a => a.GetDescription().ToString()).ToArray(); Uri request = BuildRequests.BuildObjectsSetUUIDMetadataRequest( UUIDToUse, string.Join(",", includeString), this.PubNubInstance, this.QueryParams ); request = this.PubNubInstance.TokenMgr.AppendTokenToURL(request.OriginalString, UUIDToUse, PNResourceType.PNUUIDMetadata, OperationType); 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 { 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 ); request = this.PubNubInstance.TokenMgr.AppendTokenToURL(request.OriginalString, CreateSpaceID, PNResourceType.PNSpaces, OperationType); base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this); }
protected override void RunWebRequest(QueueManager qm) { RequestState requestState = new RequestState(); requestState.OperationType = OperationType; Uri request; if (PushType.Equals(PNPushType.APNS2)) { request = BuildRequests.BuildRegisterDevicePushRequest( string.Join(",", ChannelsToUse.ToArray()), PushType, DeviceIDForPush, this.PubNubInstance, this.QueryParams, TopicForPush, EnvironmentForPush ); } else { request = BuildRequests.BuildRegisterDevicePushRequest( string.Join(",", ChannelsToUse.ToArray()), PushType, DeviceIDForPush, 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 = base.OperationType; #if (ENABLE_PUBNUB_LOGGING) this.PubNubInstance.PNLog.WriteToLog(string.Format("FetchMessagesRequestBuilder: \nChannel {0} \nStartTime: {1} \nthis.EndTime:{2} \nthis.HistoryCount:{3} \nthis.ReverseHistory:{4}", string.Join(",", this.ChannelsToUse.ToArray()), this.StartTime, this.EndTime, this.HistoryCount, this.ReverseHistory), PNLoggingMethod.LevelInfo); #endif if (IncludeMessageActionsInHistory || ChannelsToUse.Count > 1) { this.HistoryCount = 25; } Uri request = BuildRequests.BuildFetchRequest( ChannelsToUse.ToArray(), this.StartTime, this.EndTime, this.HistoryCount, this.ReverseHistory, this.IncludeTimetokenInHistory, this.PubNubInstance, this.QueryParams, this.IncludeMetaInHistory, this.IncludeMessageActionsInHistory, this.IncludeMessageTypeInHistory, this.IncludeUUIDInHistory ); 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 { id = CreateUserID, email = CreateUserEmail, name = CreateUserName, profileUrl = CreateUserProfileURL, externalId = CreateUserExternalID, custom = CreateUserCustom, }; 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 = (CreateUserInclude == null) ? new string[] {} : CreateUserInclude.Select(a => a.GetDescription().ToString()).ToArray(); Uri request = BuildRequests.BuildObjectsCreateUserRequest( 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[] includeString = (GetChannelMembersInclude == null) ? new string[] {} : GetChannelMembersInclude.Select(a => a.GetDescription().ToString()).ToArray(); List <string> sortFields = SortBy ?? new List <string>(); Uri request = BuildRequests.BuildObjectsGetChannelMembersRequest( GetChannelMembersChannelID, GetChannelMembersLimit, GetChannelMembersStart, GetChannelMembersEnd, GetChannelMembersCount, string.Join(",", includeString), this.PubNubInstance, this.QueryParams, GetChannelMembersFilter, string.Join(",", sortFields) ); request = this.PubNubInstance.TokenMgr.AppendTokenToURL(request.OriginalString, GetChannelMembersChannelID, PNResourceType.PNChannelMetadata, OperationType); base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this); }
IEnumerator DownloadFile() { Uri request = BuildRequests.BuildDownloadFileRequest( DownloadFileChannel, DownloadFileID.ToString(), DownloadFileName.ToString(), this.PubNubInstance, null ); downloadWWW = new UnityWebRequest(request.OriginalString); #if (ENABLE_PUBNUB_LOGGING) this.PubNubInstance.PNLog.WriteToLog(string.Format("Download URL: {0}", request.OriginalString), PNLoggingMethod.LevelInfo); #endif downloadWWW.method = UnityWebRequest.kHttpVerbGET; var dh = new DownloadHandlerFile(DownloadFileSavePath); dh.removeFileOnAbort = true; downloadWWW.downloadHandler = dh; yield return(downloadWWW.SendWebRequest()); DownloadCallback(CreatePNStatus(downloadWWW)); }
protected override void RunWebRequest(QueueManager qm) { RequestState requestState = new RequestState(); requestState.OperationType = OperationType; requestState.httpMethod = HTTPMethod.Post; var cub = new { type = MessageActionAdd.ActionType, value = MessageActionAdd.ActionValue, }; 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.BuildAddMessageActionsRequest( AddMessageActionsChannel, AddMessageActionsMessageTimetoken.ToString(), 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 channels = ""; if ((ChannelsToUse != null) && (ChannelsToUse.Count > 0)) { channels = String.Join(",", ChannelsToUse.ToArray()); } string channelGroups = ""; if ((ChannelGroupsToUse != null) && (ChannelGroupsToUse.Count > 0)) { channelGroups = String.Join(",", ChannelGroupsToUse.ToArray()); } Uri request = BuildRequests.BuildHereNowRequest( channels, channelGroups, IncludeUUIDsInHereNow, IncludeStateInHereNow, 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, this.QueryParams ); base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this); }
void StartHeartbeat(bool pause, int pauseTime) { try { if (!this.PubNubInstance.PNConfig.ReconnectionPolicy.Equals(PNReconnectionPolicy.NONE)) { isHearbeatRunning = true; Uri request = BuildRequests.BuildTimeRequest( this.PubNubInstance ); RequestState requestState = new RequestState(); requestState.OperationType = PNOperationType.PNHeartbeatOperation; requestState.URL = request.OriginalString; requestState.Timeout = PubNubInstance.PNConfig.NonSubscribeTimeout; requestState.Pause = pauseTime; requestState.Reconnect = pause; #if (ENABLE_PUBNUB_LOGGING) this.PubNubInstance.PNLog.WriteToLog(string.Format("heartbeat: request.OriginalString {0} ", request.OriginalString), PNLoggingMethod.LevelInfo); #endif webRequestId = webRequest.Run(requestState); #if (ENABLE_PUBNUB_LOGGING) this.PubNubInstance.PNLog.WriteToLog(string.Format("StartHeartbeat: Heartbeat running"), PNLoggingMethod.LevelInfo); #endif } } catch (Exception ex) { #if (ENABLE_PUBNUB_LOGGING) this.PubNubInstance.PNLog.WriteToLog(string.Format("StartHeartbeat: Heartbeat exception {0}", ex.ToString()), PNLoggingMethod.LevelError); #endif } }
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); }
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); }
protected override void RunWebRequest(QueueManager qm) { RequestState requestState = new RequestState(); requestState.OperationType = OperationType; Uri request = BuildRequests.BuildRemoveAllDevicePushRequest( PushType, DeviceIDForPush, this.PubNubInstance ); base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this); }
protected override void RunWebRequest(QueueManager qm) { RequestState requestState = new RequestState(); requestState.OperationType = base.OperationType; Uri request = BuildRequests.BuildRemoveChannelsFromChannelGroupRequest( null, "", ChannelGroupToDelete, this.PubNubInstance ); 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.Delete; Uri request = BuildRequests.BuildObjectsDeleteSpaceRequest( DeleteSpaceID, 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; Uri request = BuildRequests.BuildTimeRequest( this.PubNubInstance ); #if (ENABLE_PUBNUB_LOGGING) this.PubNubInstance.PNLog.WriteToLog(string.Format("RunTimeRequest {0}", request.OriginalString), PNLoggingMethod.LevelInfo); #endif base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this); }
protected override void RunWebRequest(QueueManager qm) { RequestState requestState = new RequestState(); requestState.OperationType = OperationType; Uri request = BuildRequests.BuildRemoveChannelPushRequest( string.Join(",", ChannelsToUse.ToArray()), PushType, DeviceIDForPush, this.PubNubInstance ); base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this); }
protected override void RunWebRequest(QueueManager qm) { RequestState requestState = new RequestState(); requestState.OperationType = base.OperationType; Uri request = BuildRequests.BuildGetChannelsForChannelGroupRequest( "", ChannelGroupToList, false, 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.Delete; Uri request = BuildRequests.BuildObjectsDeleteSpaceRequest( DeleteSpaceID, this.PubNubInstance, this.QueryParams ); request = this.PubNubInstance.TokenMgr.AppendTokenToURL(request.OriginalString, DeleteSpaceID, PNResourceType.PNSpaces, OperationType); 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 = 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.Get; Uri request = BuildRequests.BuildListFilesRequest( ListFilesChannel, ListFilesLimit, ListFilesNext, 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.Delete; Uri request = BuildRequests.BuildRemoveMessageActionsRequest( RemoveMessageActionsChannel, RemoveMessageActionsMessageTimetoken.ToString(), RemoveMessageActionsActionTimetoken.ToString(), 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.Delete; Uri request = BuildRequests.BuildDeleteFileRequest( DeleteFileChannel, DeleteFileID.ToString(), DeleteFileName.ToString(), 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; Uri request = BuildRequests.BuildGetMessageActionsRequest( GetMessageActionsChannel, GetMessageActionsStart, GetMessageActionsEnd, GetMessageActionsLimit, 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[] includeString = (GetUserInclude == null) ? new string[] {} : GetUserInclude.Select(a => a.GetDescription().ToString()).ToArray(); Uri request = BuildRequests.BuildObjectsGetUserRequest( GetUserID, 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[] includeString = (GetUUIDMetadataInclude == null) ? new string[] {} : GetUUIDMetadataInclude.Select(a => a.GetDescription().ToString()).ToArray(); Uri request = BuildRequests.BuildObjectsGetUUIDMetadataRequest( GetUUIDMetadataID, string.Join(",", includeString), this.PubNubInstance, this.QueryParams ); request = this.PubNubInstance.TokenMgr.AppendTokenToURL(request.OriginalString, GetUUIDMetadataID, PNResourceType.PNUUIDMetadata, OperationType); base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this); }
protected override void RunWebRequest(QueueManager qm) { RequestState requestState = new RequestState(); requestState.OperationType = base.OperationType; requestState.httpMethod = HTTPMethod.Delete; #if (ENABLE_PUBNUB_LOGGING) this.PubNubInstance.PNLog.WriteToLog(string.Format("DeleteRequestBuilder: \nChannel {0} \nStartTime: {1} \nthis.EndTime:{2}", this.HistoryChannel, this.StartTime, this.EndTime), PNLoggingMethod.LevelInfo); #endif Uri request = BuildRequests.BuildDeleteMessagesRequest( this.HistoryChannel, this.StartTime, this.EndTime, this.PubNubInstance ); base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this); }
protected override void RunWebRequest(QueueManager qm) { RequestState requestState = new RequestState(); requestState.OperationType = base.OperationType; Uri request = BuildRequests.BuildAddChannelsToChannelGroupRequest( ChannelsToUse.ToArray(), "", ChannelGroupToAdd, this.PubNubInstance, this.QueryParams ); #if (ENABLE_PUBNUB_LOGGING) this.PubNubInstance.PNLog.WriteToLog(string.Format("RunPNChannelGroupsAddChannel {0}", request.OriginalString), PNLoggingMethod.LevelInfo); #endif base.RunWebRequest(qm, request, requestState, this.PubNubInstance.PNConfig.NonSubscribeTimeout, 0, this); }