public static ListProductsResponse Unmarshall(UnmarshallerContext _ctx)
        {
            ListProductsResponse listProductsResponse = new ListProductsResponse();

            listProductsResponse.HttpResponse = _ctx.HttpResponse;
            listProductsResponse.TotalCount   = _ctx.IntegerValue("ListProducts.TotalCount");
            listProductsResponse.RequestId    = _ctx.StringValue("ListProducts.RequestId");
            listProductsResponse.NextToken    = _ctx.StringValue("ListProducts.NextToken");
            listProductsResponse.MaxResults   = _ctx.IntegerValue("ListProducts.MaxResults");

            List <ListProductsResponse.ListProducts_ProductInfos> listProductsResponse_productInfo = new List <ListProductsResponse.ListProducts_ProductInfos>();

            for (int i = 0; i < _ctx.Length("ListProducts.ProductInfo.Length"); i++)
            {
                ListProductsResponse.ListProducts_ProductInfos productInfos = new ListProductsResponse.ListProducts_ProductInfos();
                productInfos.SecondCategoryNameEn = _ctx.StringValue("ListProducts.ProductInfo[" + i + "].SecondCategoryNameEn");
                productInfos._Dynamic             = _ctx.BooleanValue("ListProducts.ProductInfo[" + i + "].Dynamic");
                productInfos.CommonQuotaSupport   = _ctx.StringValue("ListProducts.ProductInfo[" + i + "].CommonQuotaSupport");
                productInfos.ProductName          = _ctx.StringValue("ListProducts.ProductInfo[" + i + "].ProductName");
                productInfos.ProductCode          = _ctx.StringValue("ListProducts.ProductInfo[" + i + "].ProductCode");
                productInfos.SecondCategoryName   = _ctx.StringValue("ListProducts.ProductInfo[" + i + "].SecondCategoryName");
                productInfos.FlowControlSupport   = _ctx.StringValue("ListProducts.ProductInfo[" + i + "].FlowControlSupport");
                productInfos.SecondCategoryId     = _ctx.LongValue("ListProducts.ProductInfo[" + i + "].SecondCategoryId");
                productInfos.ProductNameEn        = _ctx.StringValue("ListProducts.ProductInfo[" + i + "].ProductNameEn");

                listProductsResponse_productInfo.Add(productInfos);
            }
            listProductsResponse.ProductInfo = listProductsResponse_productInfo;

            return(listProductsResponse);
        }
Пример #2
0
        public static ListProductsResponse Unmarshall(UnmarshallerContext _ctx)
        {
            ListProductsResponse listProductsResponse = new ListProductsResponse();

            listProductsResponse.HttpResponse = _ctx.HttpResponse;
            listProductsResponse.Code         = _ctx.IntegerValue("ListProducts.Code");
            listProductsResponse.RequestId    = _ctx.StringValue("ListProducts.RequestId");
            listProductsResponse.Message      = _ctx.StringValue("ListProducts.Message");
            listProductsResponse.Success      = _ctx.BooleanValue("ListProducts.Success");

            List <ListProductsResponse.ListProducts_DataItem> listProductsResponse_data = new List <ListProductsResponse.ListProducts_DataItem>();

            for (int i = 0; i < _ctx.Length("ListProducts.Data.Length"); i++)
            {
                ListProductsResponse.ListProducts_DataItem dataItem = new ListProductsResponse.ListProducts_DataItem();
                dataItem.DirectoryName = _ctx.StringValue("ListProducts.Data[" + i + "].DirectoryName");
                dataItem.DirectoryId   = _ctx.LongValue("ListProducts.Data[" + i + "].DirectoryId");

                List <ListProductsResponse.ListProducts_DataItem.ListProducts_ProductListItem> dataItem_productList = new List <ListProductsResponse.ListProducts_DataItem.ListProducts_ProductListItem>();
                for (int j = 0; j < _ctx.Length("ListProducts.Data[" + i + "].ProductList.Length"); j++)
                {
                    ListProductsResponse.ListProducts_DataItem.ListProducts_ProductListItem productListItem = new ListProductsResponse.ListProducts_DataItem.ListProducts_ProductListItem();
                    productListItem.ProductId   = _ctx.LongValue("ListProducts.Data[" + i + "].ProductList[" + j + "].ProductId");
                    productListItem.ProductName = _ctx.StringValue("ListProducts.Data[" + i + "].ProductList[" + j + "].ProductName");

                    dataItem_productList.Add(productListItem);
                }
                dataItem.ProductList = dataItem_productList;

                listProductsResponse_data.Add(dataItem);
            }
            listProductsResponse.Data = listProductsResponse_data;

            return(listProductsResponse);
        }
Пример #3
0
        public override Task <ListProductsResponse> ListProducts(ListProductsRequest request, ServerCallContext context)
        {
            var response = new ListProductsResponse();

            response.Products.Add(_products);

            return(Task.FromResult(response));
        }
        /// <summary>Gets and prints all products for the given manufacturer ID.</summary>
        /// <returns>The last page of retrieved products.</returns>
        private ListProductsResponse GetAllProducts(string manufacturerId)
        {
            Console.WriteLine("=================================================================");
            Console.WriteLine("Listing all Products");
            Console.WriteLine("=================================================================");

            // Retrieve account list in pages and display data as we receive it.
            string pageToken = null;
            ListProductsResponse productsResponse = null;

            do
            {
                AccountsResource.ProductsResource.ListRequest listRequest =
                    service.Accounts.Products.List(manufacturerId);
                listRequest.PageSize  = maxListPageSize;
                listRequest.PageToken = pageToken;

                productsResponse = listRequest.Execute();

                if (productsResponse.Products != null && productsResponse.Products.Count != 0)
                {
                    foreach (var product in productsResponse.Products)
                    {
                        Console.WriteLine(
                            "Product with ID \"{0}\" and title \"{1}\" was found.",
                            product.ProductId,
                            product.FinalAttributes.Title);
                        PrintIssues(product.Issues);
                    }
                }
                else
                {
                    Console.WriteLine("No accounts found.");
                }

                pageToken = productsResponse.NextPageToken;
            } while (pageToken != null);
            Console.WriteLine();

            // Return the last page of accounts.
            return(productsResponse);
        }
        public static ListProductsResponse Unmarshall(UnmarshallerContext context)
        {
            ListProductsResponse listProductsResponse = new ListProductsResponse();

            listProductsResponse.HttpResponse = context.HttpResponse;
            listProductsResponse.Code         = context.IntegerValue("ListProducts.Code");
            listProductsResponse.Success      = context.BooleanValue("ListProducts.Success");
            listProductsResponse.Message      = context.StringValue("ListProducts.Message");
            listProductsResponse.RequestId    = context.StringValue("ListProducts.RequestId");

            ListProductsResponse.ListProducts_Data data = new ListProductsResponse.ListProducts_Data();

            List <ListProductsResponse.ListProducts_Data.ListProducts_TechMoreItem> data_techMore = new List <ListProductsResponse.ListProducts_Data.ListProducts_TechMoreItem>();

            for (int i = 0; i < context.Length("ListProducts.Data.TechMore.Length"); i++)
            {
                ListProductsResponse.ListProducts_Data.ListProducts_TechMoreItem techMoreItem = new ListProductsResponse.ListProducts_Data.ListProducts_TechMoreItem();
                techMoreItem.GroupName = context.StringValue("ListProducts.Data.TechMore[" + i + "].GroupName");

                List <ListProductsResponse.ListProducts_Data.ListProducts_TechMoreItem.ListProducts_ProductListItem> techMoreItem_productList = new List <ListProductsResponse.ListProducts_Data.ListProducts_TechMoreItem.ListProducts_ProductListItem>();
                for (int j = 0; j < context.Length("ListProducts.Data.TechMore[" + i + "].ProductList.Length"); j++)
                {
                    ListProductsResponse.ListProducts_Data.ListProducts_TechMoreItem.ListProducts_ProductListItem productListItem = new ListProductsResponse.ListProducts_Data.ListProducts_TechMoreItem.ListProducts_ProductListItem();
                    productListItem.Name        = context.StringValue("ListProducts.Data.TechMore[" + i + "].ProductList[" + j + "].Name");
                    productListItem.ProductCode = context.StringValue("ListProducts.Data.TechMore[" + i + "].ProductList[" + j + "].ProductCode");
                    productListItem.Description = context.StringValue("ListProducts.Data.TechMore[" + i + "].ProductList[" + j + "].Description");

                    techMoreItem_productList.Add(productListItem);
                }
                techMoreItem.ProductList = techMoreItem_productList;

                data_techMore.Add(techMoreItem);
            }
            data.TechMore = data_techMore;

            List <ListProductsResponse.ListProducts_Data.ListProducts_HotConsultationItem> data_hotConsultation = new List <ListProductsResponse.ListProducts_Data.ListProducts_HotConsultationItem>();

            for (int i = 0; i < context.Length("ListProducts.Data.HotConsultation.Length"); i++)
            {
                ListProductsResponse.ListProducts_Data.ListProducts_HotConsultationItem hotConsultationItem = new ListProductsResponse.ListProducts_Data.ListProducts_HotConsultationItem();
                hotConsultationItem.Name        = context.StringValue("ListProducts.Data.HotConsultation[" + i + "].Name");
                hotConsultationItem.ProductCode = context.StringValue("ListProducts.Data.HotConsultation[" + i + "].ProductCode");
                hotConsultationItem.Description = context.StringValue("ListProducts.Data.HotConsultation[" + i + "].Description");

                data_hotConsultation.Add(hotConsultationItem);
            }
            data.HotConsultation = data_hotConsultation;

            List <ListProductsResponse.ListProducts_Data.ListProducts_ConsultationMoreItem> data_consultationMore = new List <ListProductsResponse.ListProducts_Data.ListProducts_ConsultationMoreItem>();

            for (int i = 0; i < context.Length("ListProducts.Data.ConsultationMore.Length"); i++)
            {
                ListProductsResponse.ListProducts_Data.ListProducts_ConsultationMoreItem consultationMoreItem = new ListProductsResponse.ListProducts_Data.ListProducts_ConsultationMoreItem();
                consultationMoreItem.Name        = context.StringValue("ListProducts.Data.ConsultationMore[" + i + "].Name");
                consultationMoreItem.ProductCode = context.StringValue("ListProducts.Data.ConsultationMore[" + i + "].ProductCode");
                consultationMoreItem.Description = context.StringValue("ListProducts.Data.ConsultationMore[" + i + "].Description");

                data_consultationMore.Add(consultationMoreItem);
            }
            data.ConsultationMore = data_consultationMore;

            List <ListProductsResponse.ListProducts_Data.ListProducts_HotTechItem> data_hotTech = new List <ListProductsResponse.ListProducts_Data.ListProducts_HotTechItem>();

            for (int i = 0; i < context.Length("ListProducts.Data.HotTech.Length"); i++)
            {
                ListProductsResponse.ListProducts_Data.ListProducts_HotTechItem hotTechItem = new ListProductsResponse.ListProducts_Data.ListProducts_HotTechItem();
                hotTechItem.Name        = context.StringValue("ListProducts.Data.HotTech[" + i + "].Name");
                hotTechItem.ProductCode = context.StringValue("ListProducts.Data.HotTech[" + i + "].ProductCode");
                hotTechItem.Description = context.StringValue("ListProducts.Data.HotTech[" + i + "].Description");

                data_hotTech.Add(hotTechItem);
            }
            data.HotTech = data_hotTech;
            listProductsResponse.Data = data;

            return(listProductsResponse);
        }