public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonStepFunctionsConfig config = new AmazonStepFunctionsConfig();

            config.RegionEndpoint = region;
            ConfigureClient(config);
            AmazonStepFunctionsClient client = new AmazonStepFunctionsClient(creds, config);

            GetExecutionHistoryResponse resp = new GetExecutionHistoryResponse();

            do
            {
                GetExecutionHistoryRequest req = new GetExecutionHistoryRequest
                {
                    NextToken = resp.NextToken
                    ,
                    MaxResults = maxItems
                };

                resp = client.GetExecutionHistory(req);
                CheckError(resp.HttpStatusCode, "200");

                foreach (var obj in resp.Events)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }
        /// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            GetExecutionHistoryResponse response = new GetExecutionHistoryResponse();

            context.Read();
            int targetDepth = context.CurrentDepth;

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("events", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <HistoryEvent, HistoryEventUnmarshaller>(HistoryEventUnmarshaller.Instance);
                    response.Events = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("nextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
        public static GetExecutionHistoryResponse Unmarshall(UnmarshallerContext context)
        {
            GetExecutionHistoryResponse getExecutionHistoryResponse = new GetExecutionHistoryResponse();

            getExecutionHistoryResponse.HttpResponse = context.HttpResponse;
            getExecutionHistoryResponse.RequestId    = context.StringValue("GetExecutionHistory.RequestId");
            getExecutionHistoryResponse.NextToken    = context.StringValue("GetExecutionHistory.NextToken");

            List <GetExecutionHistoryResponse.GetExecutionHistory_EventsItem> getExecutionHistoryResponse_events = new List <GetExecutionHistoryResponse.GetExecutionHistory_EventsItem>();

            for (int i = 0; i < context.Length("GetExecutionHistory.Events.Length"); i++)
            {
                GetExecutionHistoryResponse.GetExecutionHistory_EventsItem eventsItem = new GetExecutionHistoryResponse.GetExecutionHistory_EventsItem();
                eventsItem.StepName        = context.StringValue("GetExecutionHistory.Events[" + i + "].StepName");
                eventsItem.Type            = context.StringValue("GetExecutionHistory.Events[" + i + "].Type");
                eventsItem.EventId         = context.LongValue("GetExecutionHistory.Events[" + i + "].EventId");
                eventsItem.ScheduleEventId = context.LongValue("GetExecutionHistory.Events[" + i + "].ScheduleEventId");
                eventsItem.EventDetail     = context.StringValue("GetExecutionHistory.Events[" + i + "].EventDetail");
                eventsItem.Time            = context.StringValue("GetExecutionHistory.Events[" + i + "].Time");

                getExecutionHistoryResponse_events.Add(eventsItem);
            }
            getExecutionHistoryResponse.Events = getExecutionHistoryResponse_events;

            return(getExecutionHistoryResponse);
        }