QueryUserInfoByUserIdResult.cc 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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/quickbi-public/model/QueryUserInfoByUserIdResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Quickbi_public;
  19. using namespace AlibabaCloud::Quickbi_public::Model;
  20. QueryUserInfoByUserIdResult::QueryUserInfoByUserIdResult() :
  21. ServiceResult()
  22. {}
  23. QueryUserInfoByUserIdResult::QueryUserInfoByUserIdResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryUserInfoByUserIdResult::~QueryUserInfoByUserIdResult()
  29. {}
  30. void QueryUserInfoByUserIdResult::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 resultNode = value["Result"];
  37. if(!resultNode["AccountId"].isNull())
  38. result_.accountId = resultNode["AccountId"].asString();
  39. if(!resultNode["AccountName"].isNull())
  40. result_.accountName = resultNode["AccountName"].asString();
  41. if(!resultNode["AdminUser"].isNull())
  42. result_.adminUser = resultNode["AdminUser"].asString() == "true";
  43. if(!resultNode["AuthAdminUser"].isNull())
  44. result_.authAdminUser = resultNode["AuthAdminUser"].asString() == "true";
  45. if(!resultNode["Email"].isNull())
  46. result_.email = resultNode["Email"].asString();
  47. if(!resultNode["NickName"].isNull())
  48. result_.nickName = resultNode["NickName"].asString();
  49. if(!resultNode["Phone"].isNull())
  50. result_.phone = resultNode["Phone"].asString();
  51. if(!resultNode["UserId"].isNull())
  52. result_.userId = resultNode["UserId"].asString();
  53. if(!resultNode["UserType"].isNull())
  54. result_.userType = std::stoi(resultNode["UserType"].asString());
  55. auto allRoleIdList = resultNode["RoleIdList"]["RoleIdList"];
  56. for (auto value : allRoleIdList)
  57. result_.roleIdList.push_back(value.asString());
  58. if(!value["Success"].isNull())
  59. success_ = value["Success"].asString() == "true";
  60. }
  61. bool QueryUserInfoByUserIdResult::getSuccess()const
  62. {
  63. return success_;
  64. }
  65. QueryUserInfoByUserIdResult::Result QueryUserInfoByUserIdResult::getResult()const
  66. {
  67. return result_;
  68. }