private void GetSingleUuidMetadata(string uuid, bool includeCustom, Dictionary <string, object> externalQueryParam, PNCallback <PNGetUuidMetadataResult> callback) { if (callback == null) { throw new ArgumentException("Missing callback"); } if (string.IsNullOrEmpty(uuid)) { uuid = config.Uuid; } IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); Uri request = urlBuilder.BuildGetSingleUuidMetadataRequest("GET", "", uuid, includeCustom, externalQueryParam); RequestState <PNGetUuidMetadataResult> requestState = new RequestState <PNGetUuidMetadataResult>(); requestState.ResponseType = PNOperationType.PNGetUuidMetadataOperation; 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 <PNGetUuidMetadataResult> > GetSingleUuidMetadata(string uuid, bool includeCustom, Dictionary <string, object> externalQueryParam) { if (string.IsNullOrEmpty(uuid)) { uuid = config.Uuid; } PNResult <PNGetUuidMetadataResult> ret = new PNResult <PNGetUuidMetadataResult>(); IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null) ? PubnubInstance.InstanceId : ""); Uri request = urlBuilder.BuildGetSingleUuidMetadataRequest("GET", "", uuid, includeCustom, externalQueryParam); RequestState <PNGetUuidMetadataResult> requestState = new RequestState <PNGetUuidMetadataResult>(); requestState.ResponseType = PNOperationType.PNGetUuidMetadataOperation; 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); PNGetUuidMetadataResult responseResult = responseBuilder.JsonToObject <PNGetUuidMetadataResult>(resultList, true); if (responseResult != null) { ret.Result = responseResult; } } return(ret); }