Пример #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);
        }
Пример #2
0
 /// <summary>
 ///  新建产品Topic
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public async Task <CreateProductTopicResponse> CreateProductTopic(CreateProductTopicRequest request)
 {
     return(await new CreateProductTopicExecutor().Client(this).Execute <CreateProductTopicResponse, CreateProductTopicResult, CreateProductTopicRequest>(request).ConfigureAwait(false));
 }
Пример #3
0
 /// <summary>
 ///  新建产品Topic
 /// </summary>
 /// <param name="request">请求参数信息</param>
 /// <returns>请求结果信息</returns>
 public CreateProductTopicResponse CreateProductTopic(CreateProductTopicRequest request)
 {
     return(new CreateProductTopicExecutor().Client(this).Execute <CreateProductTopicResponse, CreateProductTopicResult, CreateProductTopicRequest>(request));
 }