GetPersonListResult.cc 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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/vcs/model/GetPersonListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Vcs;
  19. using namespace AlibabaCloud::Vcs::Model;
  20. GetPersonListResult::GetPersonListResult() :
  21. ServiceResult()
  22. {}
  23. GetPersonListResult::GetPersonListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. GetPersonListResult::~GetPersonListResult()
  29. {}
  30. void GetPersonListResult::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 dataNode = value["Data"];
  37. if(!dataNode["PageNumber"].isNull())
  38. data_.pageNumber = std::stol(dataNode["PageNumber"].asString());
  39. if(!dataNode["PageSize"].isNull())
  40. data_.pageSize = std::stol(dataNode["PageSize"].asString());
  41. if(!dataNode["TotalCount"].isNull())
  42. data_.totalCount = std::stol(dataNode["TotalCount"].asString());
  43. auto allRecordsNode = dataNode["Records"]["RecordsItem"];
  44. for (auto dataNodeRecordsRecordsItem : allRecordsNode)
  45. {
  46. Data::RecordsItem recordsItemObject;
  47. if(!dataNodeRecordsRecordsItem["FaceUrl"].isNull())
  48. recordsItemObject.faceUrl = dataNodeRecordsRecordsItem["FaceUrl"].asString();
  49. if(!dataNodeRecordsRecordsItem["FirstShotTime"].isNull())
  50. recordsItemObject.firstShotTime = std::stol(dataNodeRecordsRecordsItem["FirstShotTime"].asString());
  51. if(!dataNodeRecordsRecordsItem["PersonId"].isNull())
  52. recordsItemObject.personId = dataNodeRecordsRecordsItem["PersonId"].asString();
  53. if(!dataNodeRecordsRecordsItem["SearchMatchingRate"].isNull())
  54. recordsItemObject.searchMatchingRate = dataNodeRecordsRecordsItem["SearchMatchingRate"].asString();
  55. auto allPropertyTagListNode = allRecordsNode["PropertyTagList"]["TagList"];
  56. for (auto allRecordsNodePropertyTagListTagList : allPropertyTagListNode)
  57. {
  58. Data::RecordsItem::TagList propertyTagListObject;
  59. if(!allRecordsNodePropertyTagListTagList["Code"].isNull())
  60. propertyTagListObject.code = allRecordsNodePropertyTagListTagList["Code"].asString();
  61. if(!allRecordsNodePropertyTagListTagList["TagCodeName"].isNull())
  62. propertyTagListObject.tagCodeName = allRecordsNodePropertyTagListTagList["TagCodeName"].asString();
  63. if(!allRecordsNodePropertyTagListTagList["TagName"].isNull())
  64. propertyTagListObject.tagName = allRecordsNodePropertyTagListTagList["TagName"].asString();
  65. if(!allRecordsNodePropertyTagListTagList["Value"].isNull())
  66. propertyTagListObject.value = allRecordsNodePropertyTagListTagList["Value"].asString();
  67. recordsItemObject.propertyTagList.push_back(propertyTagListObject);
  68. }
  69. data_.records.push_back(recordsItemObject);
  70. }
  71. if(!value["Code"].isNull())
  72. code_ = value["Code"].asString();
  73. if(!value["Message"].isNull())
  74. message_ = value["Message"].asString();
  75. }
  76. std::string GetPersonListResult::getMessage()const
  77. {
  78. return message_;
  79. }
  80. GetPersonListResult::Data GetPersonListResult::getData()const
  81. {
  82. return data_;
  83. }
  84. std::string GetPersonListResult::getCode()const
  85. {
  86. return code_;
  87. }