DescribeCustomerFlowByLocationResult.cc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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/reid/model/DescribeCustomerFlowByLocationResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Reid;
  19. using namespace AlibabaCloud::Reid::Model;
  20. DescribeCustomerFlowByLocationResult::DescribeCustomerFlowByLocationResult() :
  21. ServiceResult()
  22. {}
  23. DescribeCustomerFlowByLocationResult::DescribeCustomerFlowByLocationResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeCustomerFlowByLocationResult::~DescribeCustomerFlowByLocationResult()
  29. {}
  30. void DescribeCustomerFlowByLocationResult::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 allCustomerFlowItemsNode = value["CustomerFlowItems"]["CustomerFlowItem"];
  37. for (auto valueCustomerFlowItemsCustomerFlowItem : allCustomerFlowItemsNode)
  38. {
  39. CustomerFlowItem customerFlowItemsObject;
  40. if(!valueCustomerFlowItemsCustomerFlowItem["Count"].isNull())
  41. customerFlowItemsObject.count = std::stol(valueCustomerFlowItemsCustomerFlowItem["Count"].asString());
  42. if(!valueCustomerFlowItemsCustomerFlowItem["StoreId"].isNull())
  43. customerFlowItemsObject.storeId = std::stol(valueCustomerFlowItemsCustomerFlowItem["StoreId"].asString());
  44. if(!valueCustomerFlowItemsCustomerFlowItem["Percent"].isNull())
  45. customerFlowItemsObject.percent = std::stof(valueCustomerFlowItemsCustomerFlowItem["Percent"].asString());
  46. if(!valueCustomerFlowItemsCustomerFlowItem["LocationName"].isNull())
  47. customerFlowItemsObject.locationName = valueCustomerFlowItemsCustomerFlowItem["LocationName"].asString();
  48. if(!valueCustomerFlowItemsCustomerFlowItem["ParentLocationIds"].isNull())
  49. customerFlowItemsObject.parentLocationIds = valueCustomerFlowItemsCustomerFlowItem["ParentLocationIds"].asString();
  50. if(!valueCustomerFlowItemsCustomerFlowItem["LocationId"].isNull())
  51. customerFlowItemsObject.locationId = std::stol(valueCustomerFlowItemsCustomerFlowItem["LocationId"].asString());
  52. customerFlowItems_.push_back(customerFlowItemsObject);
  53. }
  54. if(!value["LocationId"].isNull())
  55. locationId_ = std::stol(value["LocationId"].asString());
  56. if(!value["ParentLocationIds"].isNull())
  57. parentLocationIds_ = value["ParentLocationIds"].asString();
  58. if(!value["Success"].isNull())
  59. success_ = value["Success"].asString() == "true";
  60. if(!value["ErrorCode"].isNull())
  61. errorCode_ = value["ErrorCode"].asString();
  62. if(!value["ErrorMessage"].isNull())
  63. errorMessage_ = value["ErrorMessage"].asString();
  64. if(!value["LocationName"].isNull())
  65. locationName_ = value["LocationName"].asString();
  66. if(!value["Percent"].isNull())
  67. percent_ = std::stof(value["Percent"].asString());
  68. if(!value["StoreId"].isNull())
  69. storeId_ = std::stol(value["StoreId"].asString());
  70. if(!value["Count"].isNull())
  71. count_ = std::stol(value["Count"].asString());
  72. }
  73. std::vector<DescribeCustomerFlowByLocationResult::CustomerFlowItem> DescribeCustomerFlowByLocationResult::getCustomerFlowItems()const
  74. {
  75. return customerFlowItems_;
  76. }
  77. long DescribeCustomerFlowByLocationResult::getStoreId()const
  78. {
  79. return storeId_;
  80. }
  81. float DescribeCustomerFlowByLocationResult::getPercent()const
  82. {
  83. return percent_;
  84. }
  85. long DescribeCustomerFlowByLocationResult::getLocationId()const
  86. {
  87. return locationId_;
  88. }
  89. std::string DescribeCustomerFlowByLocationResult::getParentLocationIds()const
  90. {
  91. return parentLocationIds_;
  92. }
  93. std::string DescribeCustomerFlowByLocationResult::getErrorCode()const
  94. {
  95. return errorCode_;
  96. }
  97. long DescribeCustomerFlowByLocationResult::getCount()const
  98. {
  99. return count_;
  100. }
  101. std::string DescribeCustomerFlowByLocationResult::getErrorMessage()const
  102. {
  103. return errorMessage_;
  104. }
  105. bool DescribeCustomerFlowByLocationResult::getSuccess()const
  106. {
  107. return success_;
  108. }
  109. std::string DescribeCustomerFlowByLocationResult::getLocationName()const
  110. {
  111. return locationName_;
  112. }