public static ListProductByTagsResponse Unmarshall(UnmarshallerContext context) { ListProductByTagsResponse listProductByTagsResponse = new ListProductByTagsResponse(); listProductByTagsResponse.HttpResponse = context.HttpResponse; listProductByTagsResponse.RequestId = context.StringValue("ListProductByTags.RequestId"); listProductByTagsResponse.Success = context.BooleanValue("ListProductByTags.Success"); listProductByTagsResponse.ErrorMessage = context.StringValue("ListProductByTags.ErrorMessage"); listProductByTagsResponse.Code = context.StringValue("ListProductByTags.Code"); List <ListProductByTagsResponse.ListProductByTags_ProductInfo> listProductByTagsResponse_productInfos = new List <ListProductByTagsResponse.ListProductByTags_ProductInfo>(); for (int i = 0; i < context.Length("ListProductByTags.ProductInfos.Length"); i++) { ListProductByTagsResponse.ListProductByTags_ProductInfo productInfo = new ListProductByTagsResponse.ListProductByTags_ProductInfo(); productInfo.ProductName = context.StringValue("ListProductByTags.ProductInfos[" + i + "].ProductName"); productInfo.ProductKey = context.StringValue("ListProductByTags.ProductInfos[" + i + "].ProductKey"); productInfo.CreateTime = context.LongValue("ListProductByTags.ProductInfos[" + i + "].CreateTime"); productInfo.Description = context.StringValue("ListProductByTags.ProductInfos[" + i + "].Description"); productInfo.NodeType = context.IntegerValue("ListProductByTags.ProductInfos[" + i + "].NodeType"); listProductByTagsResponse_productInfos.Add(productInfo); } listProductByTagsResponse.ProductInfos = listProductByTagsResponse_productInfos; return(listProductByTagsResponse); }
//根据标签获取产品列表,标签之间是或的关系,只要产品的标签中存在之一,产品就会被检索出来 public void TestListProductByTags() { DefaultAcsClient acsClient = Demo.IotClient.GetClient(); ListProductByTagsRequest request = new ListProductByTagsRequest(); List <ListProductByTagsRequest.ProductTag> productTagList = new List <ListProductByTagsRequest.ProductTag>(); ListProductByTagsRequest.ProductTag tag1 = new ListProductByTagsRequest.ProductTag(); tag1.TagKey = "city"; tag1.TagValue = "shenzhen"; productTagList.Add(tag1); ListProductByTagsRequest.ProductTag tag2 = new ListProductByTagsRequest.ProductTag(); tag2.TagKey = "department"; tag2.TagValue = "aliyun"; productTagList.Add(tag2); request.ProductTags = productTagList; request.CurrentPage = 1; request.PageSize = 10; ListProductByTagsResponse response = acsClient.GetAcsResponse(request); Console.WriteLine(response.Success); Console.WriteLine(response.ErrorMessage); Console.WriteLine(response.Code); List <ListProductByTagsResponse.ListProductByTags_ProductInfo> productInfos = response.ProductInfos; for (int i = 0; i < productInfos.Count; i += 1) { ListProductByTagsResponse.ListProductByTags_ProductInfo productInfo = productInfos[i]; Console.WriteLine(productInfo.ProductName + ", " + productInfo.ProductKey + ", " + productInfo.CreateTime + ", " + productInfo.Description); } }