internal async Task <PNResult <PNHistoryResult> > History() { if (string.IsNullOrEmpty(this.channelName) || string.IsNullOrEmpty(this.channelName.Trim())) { throw new ArgumentException("Missing Channel"); } PNResult <PNHistoryResult> ret = new PNResult <PNHistoryResult>(); IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); Uri request = urlBuilder.BuildHistoryRequest("GET", "", this.channelName, this.startTimetoken, this.endTimetoken, this.historyCount, this.reverseOption, this.includeTimetokenOption, this.withMetaOption, this.queryParam); RequestState <PNHistoryResult> requestState = new RequestState <PNHistoryResult>(); requestState.Channels = new[] { this.channelName }; requestState.ResponseType = PNOperationType.PNHistoryOperation; 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); PNHistoryResult responseResult = responseBuilder.JsonToObject <PNHistoryResult>(resultList, true); if (responseResult != null) { ret.Result = responseResult; } } return(ret); }
internal async Task <PNResult <PNHistoryResult> > History(string channel, long start, long end, int count, bool reverse, bool includeToken, bool includeMeta, Dictionary <string, object> externalQueryParam) { if (string.IsNullOrEmpty(channel) || string.IsNullOrEmpty(channel.Trim())) { throw new ArgumentException("Missing Channel"); } PNResult <PNHistoryResult> ret = new PNResult <PNHistoryResult>(); IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); Uri request = urlBuilder.BuildHistoryRequest("GET", "", channel, start, end, count, reverse, includeToken, includeMeta, externalQueryParam); RequestState <PNHistoryResult> requestState = new RequestState <PNHistoryResult>(); requestState.Channels = new[] { channel }; requestState.ResponseType = PNOperationType.PNHistoryOperation; 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); PNHistoryResult responseResult = responseBuilder.JsonToObject <PNHistoryResult>(resultList, true); if (responseResult != null) { ret.Result = responseResult; } } return(ret); }