ListOutboundCallNumbersResult.cc 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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/outboundbot/model/ListOutboundCallNumbersResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::OutboundBot;
  19. using namespace AlibabaCloud::OutboundBot::Model;
  20. ListOutboundCallNumbersResult::ListOutboundCallNumbersResult() :
  21. ServiceResult()
  22. {}
  23. ListOutboundCallNumbersResult::ListOutboundCallNumbersResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListOutboundCallNumbersResult::~ListOutboundCallNumbersResult()
  29. {}
  30. void ListOutboundCallNumbersResult::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 outboundCallNumbersNode = value["OutboundCallNumbers"];
  37. if(!outboundCallNumbersNode["PageNumber"].isNull())
  38. outboundCallNumbers_.pageNumber = std::stoi(outboundCallNumbersNode["PageNumber"].asString());
  39. if(!outboundCallNumbersNode["PageSize"].isNull())
  40. outboundCallNumbers_.pageSize = std::stoi(outboundCallNumbersNode["PageSize"].asString());
  41. if(!outboundCallNumbersNode["TotalCount"].isNull())
  42. outboundCallNumbers_.totalCount = std::stoi(outboundCallNumbersNode["TotalCount"].asString());
  43. auto allListNode = outboundCallNumbersNode["List"]["OutboundCallNumber"];
  44. for (auto outboundCallNumbersNodeListOutboundCallNumber : allListNode)
  45. {
  46. OutboundCallNumbers::OutboundCallNumber outboundCallNumberObject;
  47. if(!outboundCallNumbersNodeListOutboundCallNumber["Number"].isNull())
  48. outboundCallNumberObject.number = outboundCallNumbersNodeListOutboundCallNumber["Number"].asString();
  49. if(!outboundCallNumbersNodeListOutboundCallNumber["OutboundCallNumberId"].isNull())
  50. outboundCallNumberObject.outboundCallNumberId = outboundCallNumbersNodeListOutboundCallNumber["OutboundCallNumberId"].asString();
  51. if(!outboundCallNumbersNodeListOutboundCallNumber["RateLimitCount"].isNull())
  52. outboundCallNumberObject.rateLimitCount = outboundCallNumbersNodeListOutboundCallNumber["RateLimitCount"].asString();
  53. if(!outboundCallNumbersNodeListOutboundCallNumber["RateLimitPeriod"].isNull())
  54. outboundCallNumberObject.rateLimitPeriod = outboundCallNumbersNodeListOutboundCallNumber["RateLimitPeriod"].asString();
  55. outboundCallNumbers_.list.push_back(outboundCallNumberObject);
  56. }
  57. if(!value["Code"].isNull())
  58. code_ = value["Code"].asString();
  59. if(!value["HttpStatusCode"].isNull())
  60. httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
  61. if(!value["Message"].isNull())
  62. message_ = value["Message"].asString();
  63. if(!value["Success"].isNull())
  64. success_ = value["Success"].asString() == "true";
  65. }
  66. std::string ListOutboundCallNumbersResult::getMessage()const
  67. {
  68. return message_;
  69. }
  70. ListOutboundCallNumbersResult::OutboundCallNumbers ListOutboundCallNumbersResult::getOutboundCallNumbers()const
  71. {
  72. return outboundCallNumbers_;
  73. }
  74. int ListOutboundCallNumbersResult::getHttpStatusCode()const
  75. {
  76. return httpStatusCode_;
  77. }
  78. std::string ListOutboundCallNumbersResult::getCode()const
  79. {
  80. return code_;
  81. }
  82. bool ListOutboundCallNumbersResult::getSuccess()const
  83. {
  84. return success_;
  85. }