QueryAuthenticationResult.cc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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/linkface/model/QueryAuthenticationResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::LinkFace;
  19. using namespace AlibabaCloud::LinkFace::Model;
  20. QueryAuthenticationResult::QueryAuthenticationResult() :
  21. ServiceResult()
  22. {}
  23. QueryAuthenticationResult::QueryAuthenticationResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryAuthenticationResult::~QueryAuthenticationResult()
  29. {}
  30. void QueryAuthenticationResult::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 allData = value["Data"]["DataItem"];
  37. for (auto value : allData)
  38. {
  39. DataItem dataObject;
  40. if(!value["LicenseType"].isNull())
  41. dataObject.licenseType = std::stoi(value["LicenseType"].asString());
  42. if(!value["IotId"].isNull())
  43. dataObject.iotId = value["IotId"].asString();
  44. if(!value["BeginTime"].isNull())
  45. dataObject.beginTime = value["BeginTime"].asString();
  46. if(!value["ExpiredTime"].isNull())
  47. dataObject.expiredTime = value["ExpiredTime"].asString();
  48. if(!value["ApkPubkey"].isNull())
  49. dataObject.apkPubkey = value["ApkPubkey"].asString();
  50. if(!value["PackageName"].isNull())
  51. dataObject.packageName = value["PackageName"].asString();
  52. if(!value["ClientId"].isNull())
  53. dataObject.clientId = value["ClientId"].asString();
  54. if(!value["ProductKey"].isNull())
  55. dataObject.productKey = value["ProductKey"].asString();
  56. if(!value["DeviceName"].isNull())
  57. dataObject.deviceName = value["DeviceName"].asString();
  58. data_.push_back(dataObject);
  59. }
  60. if(!value["Code"].isNull())
  61. code_ = std::stoi(value["Code"].asString());
  62. if(!value["Message"].isNull())
  63. message_ = value["Message"].asString();
  64. if(!value["PageCount"].isNull())
  65. pageCount_ = std::stoi(value["PageCount"].asString());
  66. if(!value["PageSize"].isNull())
  67. pageSize_ = std::stoi(value["PageSize"].asString());
  68. if(!value["Page"].isNull())
  69. page_ = std::stoi(value["Page"].asString());
  70. if(!value["Total"].isNull())
  71. total_ = std::stoi(value["Total"].asString());
  72. if(!value["Success"].isNull())
  73. success_ = value["Success"].asString() == "true";
  74. }
  75. std::string QueryAuthenticationResult::getMessage()const
  76. {
  77. return message_;
  78. }
  79. int QueryAuthenticationResult::getPageCount()const
  80. {
  81. return pageCount_;
  82. }
  83. int QueryAuthenticationResult::getPageSize()const
  84. {
  85. return pageSize_;
  86. }
  87. int QueryAuthenticationResult::getTotal()const
  88. {
  89. return total_;
  90. }
  91. std::vector<QueryAuthenticationResult::DataItem> QueryAuthenticationResult::getData()const
  92. {
  93. return data_;
  94. }
  95. int QueryAuthenticationResult::getPage()const
  96. {
  97. return page_;
  98. }
  99. int QueryAuthenticationResult::getCode()const
  100. {
  101. return code_;
  102. }
  103. bool QueryAuthenticationResult::getSuccess()const
  104. {
  105. return success_;
  106. }