QueryAddUserInfoResult.cc 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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/QueryAddUserInfoResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::LinkFace;
  19. using namespace AlibabaCloud::LinkFace::Model;
  20. QueryAddUserInfoResult::QueryAddUserInfoResult() :
  21. ServiceResult()
  22. {}
  23. QueryAddUserInfoResult::QueryAddUserInfoResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryAddUserInfoResult::~QueryAddUserInfoResult()
  29. {}
  30. void QueryAddUserInfoResult::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. auto allCurrentFaceInfosNode = dataNode["CurrentFaceInfos"]["CurrentFaceInfosItem"];
  38. for (auto dataNodeCurrentFaceInfosCurrentFaceInfosItem : allCurrentFaceInfosNode)
  39. {
  40. Data::CurrentFaceInfosItem currentFaceInfosItemObject;
  41. if(!dataNodeCurrentFaceInfosCurrentFaceInfosItem["UserId"].isNull())
  42. currentFaceInfosItemObject.userId = dataNodeCurrentFaceInfosCurrentFaceInfosItem["UserId"].asString();
  43. if(!dataNodeCurrentFaceInfosCurrentFaceInfosItem["ClientTag"].isNull())
  44. currentFaceInfosItemObject.clientTag = dataNodeCurrentFaceInfosCurrentFaceInfosItem["ClientTag"].asString();
  45. if(!dataNodeCurrentFaceInfosCurrentFaceInfosItem["Index"].isNull())
  46. currentFaceInfosItemObject.index = std::stoi(dataNodeCurrentFaceInfosCurrentFaceInfosItem["Index"].asString());
  47. data_.currentFaceInfos.push_back(currentFaceInfosItemObject);
  48. }
  49. auto allFailedFaceInfosNode = dataNode["FailedFaceInfos"]["FailedFaceInfosItem"];
  50. for (auto dataNodeFailedFaceInfosFailedFaceInfosItem : allFailedFaceInfosNode)
  51. {
  52. Data::FailedFaceInfosItem failedFaceInfosItemObject;
  53. if(!dataNodeFailedFaceInfosFailedFaceInfosItem["UserId"].isNull())
  54. failedFaceInfosItemObject.userId = dataNodeFailedFaceInfosFailedFaceInfosItem["UserId"].asString();
  55. if(!dataNodeFailedFaceInfosFailedFaceInfosItem["ClientTag"].isNull())
  56. failedFaceInfosItemObject.clientTag = dataNodeFailedFaceInfosFailedFaceInfosItem["ClientTag"].asString();
  57. if(!dataNodeFailedFaceInfosFailedFaceInfosItem["Index"].isNull())
  58. failedFaceInfosItemObject.index = std::stoi(dataNodeFailedFaceInfosFailedFaceInfosItem["Index"].asString());
  59. data_.failedFaceInfos.push_back(failedFaceInfosItemObject);
  60. }
  61. if(!value["Code"].isNull())
  62. code_ = std::stoi(value["Code"].asString());
  63. if(!value["Message"].isNull())
  64. message_ = value["Message"].asString();
  65. if(!value["Success"].isNull())
  66. success_ = value["Success"].asString() == "true";
  67. }
  68. std::string QueryAddUserInfoResult::getMessage()const
  69. {
  70. return message_;
  71. }
  72. QueryAddUserInfoResult::Data QueryAddUserInfoResult::getData()const
  73. {
  74. return data_;
  75. }
  76. int QueryAddUserInfoResult::getCode()const
  77. {
  78. return code_;
  79. }
  80. bool QueryAddUserInfoResult::getSuccess()const
  81. {
  82. return success_;
  83. }