internal void DeleteMessage(string channel, long start, long end, Dictionary <string, object> externalQueryParam, PNCallback <PNDeleteMessageResult> callback) { if (string.IsNullOrEmpty(channel) || string.IsNullOrEmpty(channel.Trim())) { throw new ArgumentException("Missing Channel"); } IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr); urlBuilder.PubnubInstanceId = (PubnubInstance != null) ? PubnubInstance.InstanceId : ""; Uri request = urlBuilder.BuildDeleteMessageRequest(channel, start, end, externalQueryParam); RequestState <PNDeleteMessageResult> requestState = new RequestState <PNDeleteMessageResult>(); requestState.Channels = new [] { channel }; requestState.ResponseType = PNOperationType.PNDeleteMessageOperation; requestState.PubnubCallback = callback; requestState.Reconnect = false; requestState.EndPointOperation = this; string json = UrlProcessRequest <PNDeleteMessageResult>(request, requestState, false); if (!string.IsNullOrEmpty(json)) { List <object> result = ProcessJsonResponse <PNDeleteMessageResult>(requestState, json); ProcessResponseCallbacks(result, requestState); } }
internal void DeleteMessage(string channel, long start, long end, PNCallback <PNDeleteMessageResult> callback) { if (string.IsNullOrEmpty(channel) || string.IsNullOrEmpty(channel.Trim())) { throw new ArgumentException("Missing Channel"); } IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog); urlBuilder.PubnubInstanceId = (PubnubInstance != null) ? PubnubInstance.InstanceId : ""; Uri request = urlBuilder.BuildDeleteMessageRequest(channel, start, end); RequestState <PNDeleteMessageResult> requestState = new RequestState <PNDeleteMessageResult>(); requestState.Channels = new string[] { channel }; requestState.ResponseType = PNOperationType.PNDeleteMessageOperation; requestState.PubnubCallback = callback; requestState.Reconnect = false; requestState.EndPointOperation = this; string json = UrlProcessRequest <PNDeleteMessageResult>(request, requestState, false); if (!string.IsNullOrEmpty(json)) { //json = json.Replace("\"error\": False", "\"error\": false"); //THIS IS A HACK UNTIL IT IS FIXED AT SERVER List <object> result = ProcessJsonResponse <PNDeleteMessageResult>(requestState, json); ProcessResponseCallbacks(result, requestState); } }
internal async Task <PNResult <PNDeleteMessageResult> > DeleteMessage(string channel, long start, long end, Dictionary <string, object> externalQueryParam) { if (string.IsNullOrEmpty(channel) || string.IsNullOrEmpty(channel.Trim())) { throw new ArgumentException("Missing Channel"); } PNResult <PNDeleteMessageResult> ret = new PNResult <PNDeleteMessageResult>(); IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); Uri request = urlBuilder.BuildDeleteMessageRequest("DELETE", "", channel, start, end, externalQueryParam); RequestState <PNDeleteMessageResult> requestState = new RequestState <PNDeleteMessageResult>(); requestState.Channels = new[] { channel }; requestState.ResponseType = PNOperationType.PNDeleteMessageOperation; requestState.Reconnect = false; requestState.EndPointOperation = this; Tuple <string, PNStatus> JsonAndStatusTuple = await UrlProcessRequest(request, requestState, false).ConfigureAwait(false); ret.Status = JsonAndStatusTuple.Item2; string json = JsonAndStatusTuple.Item1; if (!string.IsNullOrEmpty(json)) { List <object> resultList = ProcessJsonResponse(requestState, json); ResponseBuilder responseBuilder = new ResponseBuilder(config, jsonLibrary, pubnubLog); PNDeleteMessageResult responseResult = responseBuilder.JsonToObject <PNDeleteMessageResult>(resultList, true); if (responseResult != null) { ret.Result = responseResult; } } return(ret); }