private async Task <PNResult <PNRemoveChannelMetadataResult> > RemoveChannelMetadata(string spaceId, Dictionary <string, object> externalQueryParam)
        {
            PNResult <PNRemoveChannelMetadataResult> ret = new PNResult <PNRemoveChannelMetadataResult>();

            if (string.IsNullOrEmpty(this.chMetadataId) || string.IsNullOrEmpty(this.chMetadataId.Trim()))
            {
                PNStatus errStatus = new PNStatus {
                    Error = true, ErrorData = new PNErrorData("Missing Channel", new ArgumentException("Missing Channel"))
                };
                ret.Status = errStatus;
                return(ret);
            }

            if (string.IsNullOrEmpty(config.SubscribeKey) || string.IsNullOrEmpty(config.SubscribeKey.Trim()) || config.SubscribeKey.Length <= 0)
            {
                PNStatus errStatus = new PNStatus {
                    Error = true, ErrorData = new PNErrorData("Invalid Subscribe key", new ArgumentException("Invalid Subscribe key"))
                };
                ret.Status = errStatus;
                return(ret);
            }

            IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");

            Uri request = urlBuilder.BuildDeleteChannelMetadataRequest("DELETE", "", spaceId, externalQueryParam);

            RequestState <PNRemoveChannelMetadataResult> requestState = new RequestState <PNRemoveChannelMetadataResult>();

            requestState.ResponseType      = PNOperationType.PNDeleteChannelMetadataOperation;
            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);
                PNRemoveChannelMetadataResult responseResult = responseBuilder.JsonToObject <PNRemoveChannelMetadataResult>(resultList, true);
                if (responseResult != null)
                {
                    ret.Result = responseResult;
                }
            }

            return(ret);
        }
        private void RemoveChannelMetadata(string spaceId, Dictionary <string, object> externalQueryParam, PNCallback <PNRemoveChannelMetadataResult> callback)
        {
            IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");

            Uri request = urlBuilder.BuildDeleteChannelMetadataRequest("DELETE", "", spaceId, externalQueryParam);

            RequestState <PNRemoveChannelMetadataResult> requestState = new RequestState <PNRemoveChannelMetadataResult>();

            requestState.ResponseType      = PNOperationType.PNDeleteChannelMetadataOperation;
            requestState.PubnubCallback    = callback;
            requestState.Reconnect         = false;
            requestState.EndPointOperation = this;

            UrlProcessRequest(request, requestState, false).ContinueWith(r =>
            {
                string json = r.Result.Item1;
                if (!string.IsNullOrEmpty(json))
                {
                    List <object> result = ProcessJsonResponse(requestState, json);
                    ProcessResponseCallbacks(result, requestState);
                }
            }, TaskContinuationOptions.ExecuteSynchronously).Wait();
        }