ListAppEnvironmentResult.cc 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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/retailcloud/model/ListAppEnvironmentResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Retailcloud;
  19. using namespace AlibabaCloud::Retailcloud::Model;
  20. ListAppEnvironmentResult::ListAppEnvironmentResult() :
  21. ServiceResult()
  22. {}
  23. ListAppEnvironmentResult::ListAppEnvironmentResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListAppEnvironmentResult::~ListAppEnvironmentResult()
  29. {}
  30. void ListAppEnvironmentResult::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 allDataNode = value["Data"]["AppEnvironmentResponse"];
  37. for (auto valueDataAppEnvironmentResponse : allDataNode)
  38. {
  39. AppEnvironmentResponse dataObject;
  40. if(!valueDataAppEnvironmentResponse["AppId"].isNull())
  41. dataObject.appId = std::stol(valueDataAppEnvironmentResponse["AppId"].asString());
  42. if(!valueDataAppEnvironmentResponse["EnvId"].isNull())
  43. dataObject.envId = std::stol(valueDataAppEnvironmentResponse["EnvId"].asString());
  44. if(!valueDataAppEnvironmentResponse["EnvName"].isNull())
  45. dataObject.envName = valueDataAppEnvironmentResponse["EnvName"].asString();
  46. if(!valueDataAppEnvironmentResponse["EnvType"].isNull())
  47. dataObject.envType = std::stoi(valueDataAppEnvironmentResponse["EnvType"].asString());
  48. if(!valueDataAppEnvironmentResponse["EnvTypeName"].isNull())
  49. dataObject.envTypeName = valueDataAppEnvironmentResponse["EnvTypeName"].asString();
  50. if(!valueDataAppEnvironmentResponse["AppSchemaId"].isNull())
  51. dataObject.appSchemaId = std::stol(valueDataAppEnvironmentResponse["AppSchemaId"].asString());
  52. if(!valueDataAppEnvironmentResponse["Region"].isNull())
  53. dataObject.region = valueDataAppEnvironmentResponse["Region"].asString();
  54. data_.push_back(dataObject);
  55. }
  56. if(!value["Code"].isNull())
  57. code_ = std::stoi(value["Code"].asString());
  58. if(!value["PageNumber"].isNull())
  59. pageNumber_ = std::stoi(value["PageNumber"].asString());
  60. if(!value["PageSize"].isNull())
  61. pageSize_ = std::stoi(value["PageSize"].asString());
  62. if(!value["TotalCount"].isNull())
  63. totalCount_ = std::stol(value["TotalCount"].asString());
  64. if(!value["ErrorMsg"].isNull())
  65. errorMsg_ = value["ErrorMsg"].asString();
  66. }
  67. long ListAppEnvironmentResult::getTotalCount()const
  68. {
  69. return totalCount_;
  70. }
  71. int ListAppEnvironmentResult::getPageSize()const
  72. {
  73. return pageSize_;
  74. }
  75. int ListAppEnvironmentResult::getPageNumber()const
  76. {
  77. return pageNumber_;
  78. }
  79. std::string ListAppEnvironmentResult::getErrorMsg()const
  80. {
  81. return errorMsg_;
  82. }
  83. std::vector<ListAppEnvironmentResult::AppEnvironmentResponse> ListAppEnvironmentResult::getData()const
  84. {
  85. return data_;
  86. }
  87. int ListAppEnvironmentResult::getCode()const
  88. {
  89. return code_;
  90. }