private void GetSingleChannelMetadata(string spaceId, bool includeCustom, Dictionary <string, object> externalQueryParam, PNCallback <PNGetChannelMetadataResult> callback) { IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); Uri request = urlBuilder.BuildGetSingleChannelMetadataRequest("GET", "", spaceId, includeCustom, externalQueryParam); RequestState <PNGetChannelMetadataResult> requestState = new RequestState <PNGetChannelMetadataResult>(); requestState.ResponseType = PNOperationType.PNGetChannelMetadataOperation; requestState.PubnubCallback = callback; requestState.Reconnect = false; requestState.EndPointOperation = this; requestState.UsePostMethod = false; UrlProcessRequest(request, requestState, false).ContinueWith(r => { string json = r.Result.Item1; if (!string.IsNullOrEmpty(json)) { List <object> result = ProcessJsonResponse(requestState, json); ProcessResponseCallbacks(result, requestState); } else { if (r.Result.Item2 != null) { callback.OnResponse(null, r.Result.Item2); } } }, TaskContinuationOptions.ExecuteSynchronously).Wait(); }
private async Task <PNResult <PNGetChannelMetadataResult> > GetSingleChannelMetadata(string spaceId, bool includeCustom, Dictionary <string, object> externalQueryParam) { PNResult <PNGetChannelMetadataResult> ret = new PNResult <PNGetChannelMetadataResult>(); if (string.IsNullOrEmpty(this.chMetadataId)) { PNStatus errStatus = new PNStatus { Error = true, ErrorData = new PNErrorData("Missing Channel", new ArgumentException("Missing Channel")) }; ret.Status = errStatus; return(ret); } IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); Uri request = urlBuilder.BuildGetSingleChannelMetadataRequest("GET", "", spaceId, includeCustom, externalQueryParam); RequestState <PNGetChannelMetadataResult> requestState = new RequestState <PNGetChannelMetadataResult>(); requestState.ResponseType = PNOperationType.PNGetChannelMetadataOperation; requestState.Reconnect = false; requestState.EndPointOperation = this; requestState.UsePostMethod = false; 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); PNGetChannelMetadataResult responseResult = responseBuilder.JsonToObject <PNGetChannelMetadataResult>(resultList, true); if (responseResult != null) { ret.Result = responseResult; } } return(ret); }