GetNodesAddingTaskResult.cc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <alibabacloud/iot/model/GetNodesAddingTaskResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Iot;
  19. using namespace AlibabaCloud::Iot::Model;
  20. GetNodesAddingTaskResult::GetNodesAddingTaskResult() :
  21. ServiceResult()
  22. {}
  23. GetNodesAddingTaskResult::GetNodesAddingTaskResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. GetNodesAddingTaskResult::~GetNodesAddingTaskResult()
  29. {}
  30. void GetNodesAddingTaskResult::parse(const std::string &payload)
  31. {
  32. Json::Reader reader;
  33. Json::Value value;
  34. reader.parse(payload, value);
  35. setRequestId(value["RequestId"].asString());
  36. auto allSuccessDevEuis = value["SuccessDevEuis"]["SuccessDevEui"];
  37. for (const auto &item : allSuccessDevEuis)
  38. successDevEuis_.push_back(item.asString());
  39. if(!value["Success"].isNull())
  40. success_ = value["Success"].asString() == "true";
  41. if(!value["Code"].isNull())
  42. code_ = value["Code"].asString();
  43. if(!value["ErrorMessage"].isNull())
  44. errorMessage_ = value["ErrorMessage"].asString();
  45. if(!value["TaskId"].isNull())
  46. taskId_ = value["TaskId"].asString();
  47. if(!value["TaskState"].isNull())
  48. taskState_ = value["TaskState"].asString();
  49. if(!value["TotalCount"].isNull())
  50. totalCount_ = std::stol(value["TotalCount"].asString());
  51. if(!value["SuccessCount"].isNull())
  52. successCount_ = std::stol(value["SuccessCount"].asString());
  53. }
  54. std::vector<std::string> GetNodesAddingTaskResult::getSuccessDevEuis()const
  55. {
  56. return successDevEuis_;
  57. }
  58. long GetNodesAddingTaskResult::getTotalCount()const
  59. {
  60. return totalCount_;
  61. }
  62. std::string GetNodesAddingTaskResult::getTaskId()const
  63. {
  64. return taskId_;
  65. }
  66. std::string GetNodesAddingTaskResult::getErrorMessage()const
  67. {
  68. return errorMessage_;
  69. }
  70. long GetNodesAddingTaskResult::getSuccessCount()const
  71. {
  72. return successCount_;
  73. }
  74. std::string GetNodesAddingTaskResult::getCode()const
  75. {
  76. return code_;
  77. }
  78. std::string GetNodesAddingTaskResult::getTaskState()const
  79. {
  80. return taskState_;
  81. }
  82. bool GetNodesAddingTaskResult::getSuccess()const
  83. {
  84. return success_;
  85. }