示例#1
0
        //创建Topic类
        public void TestCreateProductTopic()
        {
            DefaultAcsClient acsClient  = Demo.IotClient.GetClient();
            String           productKey = "<productKey>";

            CreateProductTopicRequest request = new CreateProductTopicRequest();

            request.ProductKey     = productKey;
            request.TopicShortName = "device0826/user/logout";
            request.Operation      = "PUB";
            request.Desc           = "device offline";


            CreateProductTopicResponse response = acsClient.GetAcsResponse(request);

            Console.WriteLine("Create Product Topic: " + response.Success);
            if (!(bool)response.Success)
            {
                Console.WriteLine(response.Code + ", " + response.ErrorMessage);
                Console.ReadKey();
                return;
            }
            long topicId = (long)response.TopicId;

            Console.WriteLine("Create Product Topic Id: " + topicId);
        }
        public static CreateProductTopicResponse Unmarshall(UnmarshallerContext context)
        {
            CreateProductTopicResponse createProductTopicResponse = new CreateProductTopicResponse();

            createProductTopicResponse.HttpResponse = context.HttpResponse;
            createProductTopicResponse.RequestId    = context.StringValue("CreateProductTopic.RequestId");
            createProductTopicResponse.Success      = context.BooleanValue("CreateProductTopic.Success");
            createProductTopicResponse.ErrorMessage = context.StringValue("CreateProductTopic.ErrorMessage");
            createProductTopicResponse.TopicId      = context.LongValue("CreateProductTopic.TopicId");

            return(createProductTopicResponse);
        }