QueryRegistrantProfilesResult.cc 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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/domain/model/QueryRegistrantProfilesResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Domain;
  19. using namespace AlibabaCloud::Domain::Model;
  20. QueryRegistrantProfilesResult::QueryRegistrantProfilesResult() :
  21. ServiceResult()
  22. {}
  23. QueryRegistrantProfilesResult::QueryRegistrantProfilesResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryRegistrantProfilesResult::~QueryRegistrantProfilesResult()
  29. {}
  30. void QueryRegistrantProfilesResult::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 allRegistrantProfiles = value["RegistrantProfiles"]["RegistrantProfile"];
  37. for (auto value : allRegistrantProfiles)
  38. {
  39. RegistrantProfile registrantProfilesObject;
  40. if(!value["RegistrantProfileId"].isNull())
  41. registrantProfilesObject.registrantProfileId = std::stol(value["RegistrantProfileId"].asString());
  42. if(!value["CreateTime"].isNull())
  43. registrantProfilesObject.createTime = value["CreateTime"].asString();
  44. if(!value["UpdateTime"].isNull())
  45. registrantProfilesObject.updateTime = value["UpdateTime"].asString();
  46. if(!value["DefaultRegistrantProfile"].isNull())
  47. registrantProfilesObject.defaultRegistrantProfile = value["DefaultRegistrantProfile"].asString() == "true";
  48. if(!value["RegistrantName"].isNull())
  49. registrantProfilesObject.registrantName = value["RegistrantName"].asString();
  50. if(!value["RegistrantOrganization"].isNull())
  51. registrantProfilesObject.registrantOrganization = value["RegistrantOrganization"].asString();
  52. if(!value["Country"].isNull())
  53. registrantProfilesObject.country = value["Country"].asString();
  54. if(!value["Province"].isNull())
  55. registrantProfilesObject.province = value["Province"].asString();
  56. if(!value["City"].isNull())
  57. registrantProfilesObject.city = value["City"].asString();
  58. if(!value["Address"].isNull())
  59. registrantProfilesObject.address = value["Address"].asString();
  60. if(!value["Email"].isNull())
  61. registrantProfilesObject.email = value["Email"].asString();
  62. if(!value["PostalCode"].isNull())
  63. registrantProfilesObject.postalCode = value["PostalCode"].asString();
  64. if(!value["TelArea"].isNull())
  65. registrantProfilesObject.telArea = value["TelArea"].asString();
  66. if(!value["Telephone"].isNull())
  67. registrantProfilesObject.telephone = value["Telephone"].asString();
  68. if(!value["TelExt"].isNull())
  69. registrantProfilesObject.telExt = value["TelExt"].asString();
  70. if(!value["EmailVerificationStatus"].isNull())
  71. registrantProfilesObject.emailVerificationStatus = std::stoi(value["EmailVerificationStatus"].asString());
  72. if(!value["ZhRegistrantName"].isNull())
  73. registrantProfilesObject.zhRegistrantName = value["ZhRegistrantName"].asString();
  74. if(!value["ZhRegistrantOrganization"].isNull())
  75. registrantProfilesObject.zhRegistrantOrganization = value["ZhRegistrantOrganization"].asString();
  76. if(!value["ZhProvince"].isNull())
  77. registrantProfilesObject.zhProvince = value["ZhProvince"].asString();
  78. if(!value["ZhCity"].isNull())
  79. registrantProfilesObject.zhCity = value["ZhCity"].asString();
  80. if(!value["ZhAddress"].isNull())
  81. registrantProfilesObject.zhAddress = value["ZhAddress"].asString();
  82. if(!value["RegistrantType"].isNull())
  83. registrantProfilesObject.registrantType = value["RegistrantType"].asString();
  84. if(!value["RealNameStatus"].isNull())
  85. registrantProfilesObject.realNameStatus = value["RealNameStatus"].asString();
  86. if(!value["RegistrantProfileType"].isNull())
  87. registrantProfilesObject.registrantProfileType = value["RegistrantProfileType"].asString();
  88. registrantProfiles_.push_back(registrantProfilesObject);
  89. }
  90. if(!value["TotalItemNum"].isNull())
  91. totalItemNum_ = std::stoi(value["TotalItemNum"].asString());
  92. if(!value["CurrentPageNum"].isNull())
  93. currentPageNum_ = std::stoi(value["CurrentPageNum"].asString());
  94. if(!value["TotalPageNum"].isNull())
  95. totalPageNum_ = std::stoi(value["TotalPageNum"].asString());
  96. if(!value["PageSize"].isNull())
  97. pageSize_ = std::stoi(value["PageSize"].asString());
  98. if(!value["PrePage"].isNull())
  99. prePage_ = value["PrePage"].asString() == "true";
  100. if(!value["NextPage"].isNull())
  101. nextPage_ = value["NextPage"].asString() == "true";
  102. }
  103. bool QueryRegistrantProfilesResult::getPrePage()const
  104. {
  105. return prePage_;
  106. }
  107. int QueryRegistrantProfilesResult::getCurrentPageNum()const
  108. {
  109. return currentPageNum_;
  110. }
  111. int QueryRegistrantProfilesResult::getPageSize()const
  112. {
  113. return pageSize_;
  114. }
  115. int QueryRegistrantProfilesResult::getTotalPageNum()const
  116. {
  117. return totalPageNum_;
  118. }
  119. std::vector<QueryRegistrantProfilesResult::RegistrantProfile> QueryRegistrantProfilesResult::getRegistrantProfiles()const
  120. {
  121. return registrantProfiles_;
  122. }
  123. int QueryRegistrantProfilesResult::getTotalItemNum()const
  124. {
  125. return totalItemNum_;
  126. }
  127. bool QueryRegistrantProfilesResult::getNextPage()const
  128. {
  129. return nextPage_;
  130. }