/// <summary>
        /// Unmarshaller the response from the service to the response class.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context)
        {
            ListPackagingGroupsResponse response = new ListPackagingGroupsResponse();

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

            while (context.ReadAtDepth(targetDepth))
            {
                if (context.TestExpression("nextToken", targetDepth))
                {
                    var unmarshaller = StringUnmarshaller.Instance;
                    response.NextToken = unmarshaller.Unmarshall(context);
                    continue;
                }
                if (context.TestExpression("packagingGroups", targetDepth))
                {
                    var unmarshaller = new ListUnmarshaller <PackagingGroup, PackagingGroupUnmarshaller>(PackagingGroupUnmarshaller.Instance);
                    response.PackagingGroups = unmarshaller.Unmarshall(context);
                    continue;
                }
            }

            return(response);
        }
Пример #2
0
        public override void Invoke(AWSCredentials creds, RegionEndpoint region, int maxItems)
        {
            AmazonMediaPackageVodConfig config = new AmazonMediaPackageVodConfig();

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

            ListPackagingGroupsResponse resp = new ListPackagingGroupsResponse();

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

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

                foreach (var obj in resp.PackagingGroups)
                {
                    AddObject(obj);
                }
            }while (!string.IsNullOrEmpty(resp.NextToken));
        }