DescribeChannelUsersResult.cc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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/rtc/model/DescribeChannelUsersResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Rtc;
  19. using namespace AlibabaCloud::Rtc::Model;
  20. DescribeChannelUsersResult::DescribeChannelUsersResult() :
  21. ServiceResult()
  22. {}
  23. DescribeChannelUsersResult::DescribeChannelUsersResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeChannelUsersResult::~DescribeChannelUsersResult()
  29. {}
  30. void DescribeChannelUsersResult::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 allUserList = value["UserList"]["User"];
  37. for (const auto &item : allUserList)
  38. userList_.push_back(item.asString());
  39. auto allInteractiveUserList = value["InteractiveUserList"]["InteractiveUser"];
  40. for (const auto &item : allInteractiveUserList)
  41. interactiveUserList_.push_back(item.asString());
  42. auto allLiveUserList = value["LiveUserList"]["LiveUser"];
  43. for (const auto &item : allLiveUserList)
  44. liveUserList_.push_back(item.asString());
  45. if(!value["Timestamp"].isNull())
  46. timestamp_ = std::stoi(value["Timestamp"].asString());
  47. if(!value["IsChannelExist"].isNull())
  48. isChannelExist_ = value["IsChannelExist"].asString() == "true";
  49. if(!value["ChannelProfile"].isNull())
  50. channelProfile_ = std::stoi(value["ChannelProfile"].asString());
  51. if(!value["CommTotalNum"].isNull())
  52. commTotalNum_ = std::stoi(value["CommTotalNum"].asString());
  53. if(!value["InteractiveUserNum"].isNull())
  54. interactiveUserNum_ = std::stoi(value["InteractiveUserNum"].asString());
  55. if(!value["LiveUserNum"].isNull())
  56. liveUserNum_ = std::stoi(value["LiveUserNum"].asString());
  57. }
  58. std::vector<std::string> DescribeChannelUsersResult::getInteractiveUserList()const
  59. {
  60. return interactiveUserList_;
  61. }
  62. int DescribeChannelUsersResult::getLiveUserNum()const
  63. {
  64. return liveUserNum_;
  65. }
  66. int DescribeChannelUsersResult::getChannelProfile()const
  67. {
  68. return channelProfile_;
  69. }
  70. int DescribeChannelUsersResult::getInteractiveUserNum()const
  71. {
  72. return interactiveUserNum_;
  73. }
  74. std::vector<std::string> DescribeChannelUsersResult::getUserList()const
  75. {
  76. return userList_;
  77. }
  78. std::vector<std::string> DescribeChannelUsersResult::getLiveUserList()const
  79. {
  80. return liveUserList_;
  81. }
  82. int DescribeChannelUsersResult::getTimestamp()const
  83. {
  84. return timestamp_;
  85. }
  86. bool DescribeChannelUsersResult::getIsChannelExist()const
  87. {
  88. return isChannelExist_;
  89. }
  90. int DescribeChannelUsersResult::getCommTotalNum()const
  91. {
  92. return commTotalNum_;
  93. }