private async Task <PNResult <PNGetMessageActionsResult> > GetMessageActions(string channel, long start, long end, int limit, Dictionary <string, object> externalQueryParam)
        {
            PNResult <PNGetMessageActionsResult> ret = new PNResult <PNGetMessageActionsResult>();

            if (string.IsNullOrEmpty(channel) || string.IsNullOrEmpty(channel.Trim()))
            {
                PNStatus status = new PNStatus();
                status.Error     = true;
                status.ErrorData = new PNErrorData("Missing Channel or MessageAction", new ArgumentException("Missing Channel or MessageAction"));
                ret.Status       = status;
                return(ret);
            }

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

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

            Uri request = urlBuilder.BuildGetMessageActionsRequest("GET", "", channel, start, end, limit, externalQueryParam);

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

            requestState.Channels          = new[] { channel };
            requestState.ResponseType      = PNOperationType.PNGetMessageActionsOperation;
            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);
                PNGetMessageActionsResult responseResult  = responseBuilder.JsonToObject <PNGetMessageActionsResult>(resultList, true);
                if (responseResult != null)
                {
                    ret.Result = responseResult;
                }
            }

            return(ret);
        }
        private void GetMessageActions(string channel, long start, long end, int limit, Dictionary <string, object> externalQueryParam, PNCallback <PNGetMessageActionsResult> callback)
        {
            if (string.IsNullOrEmpty(channel) || string.IsNullOrEmpty(channel.Trim()))
            {
                PNStatus status = new PNStatus();
                status.Error     = true;
                status.ErrorData = new PNErrorData("Missing Channel or MessageAction", new ArgumentException("Missing Channel or MessageAction"));
                callback.OnResponse(null, status);
                return;
            }

            if (string.IsNullOrEmpty(config.SubscribeKey) || string.IsNullOrEmpty(config.SubscribeKey.Trim()) || config.SubscribeKey.Length <= 0)
            {
                PNStatus status = new PNStatus();
                status.Error     = true;
                status.ErrorData = new PNErrorData("Invalid subscribe key", new MissingMemberException("Invalid publish key"));
                callback.OnResponse(null, status);
                return;
            }

            if (callback == null)
            {
                return;
            }

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

            Uri request = urlBuilder.BuildGetMessageActionsRequest("GET", "", channel, start, end, limit, externalQueryParam);

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

            requestState.Channels          = new[] { channel };
            requestState.ResponseType      = PNOperationType.PNGetMessageActionsOperation;
            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);
                }

                CleanUp();
            }, TaskContinuationOptions.ExecuteSynchronously).Wait();
        }