QueryMessageResult.cc 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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/dysmsapi/model/QueryMessageResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Dysmsapi;
  19. using namespace AlibabaCloud::Dysmsapi::Model;
  20. QueryMessageResult::QueryMessageResult() :
  21. ServiceResult()
  22. {}
  23. QueryMessageResult::QueryMessageResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryMessageResult::~QueryMessageResult()
  29. {}
  30. void QueryMessageResult::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 numberDetailNode = value["NumberDetail"];
  37. if(!numberDetailNode["Carrier"].isNull())
  38. numberDetail_.carrier = numberDetailNode["Carrier"].asString();
  39. if(!numberDetailNode["Region"].isNull())
  40. numberDetail_.region = numberDetailNode["Region"].asString();
  41. if(!numberDetailNode["Country"].isNull())
  42. numberDetail_.country = numberDetailNode["Country"].asString();
  43. if(!value["Status"].isNull())
  44. status_ = value["Status"].asString();
  45. if(!value["ErrorDescription"].isNull())
  46. errorDescription_ = value["ErrorDescription"].asString();
  47. if(!value["ResponseCode"].isNull())
  48. responseCode_ = value["ResponseCode"].asString();
  49. if(!value["ReceiveDate"].isNull())
  50. receiveDate_ = value["ReceiveDate"].asString();
  51. if(!value["Message"].isNull())
  52. message_ = value["Message"].asString();
  53. if(!value["ResponseDescription"].isNull())
  54. responseDescription_ = value["ResponseDescription"].asString();
  55. if(!value["ErrorCode"].isNull())
  56. errorCode_ = value["ErrorCode"].asString();
  57. if(!value["SendDate"].isNull())
  58. sendDate_ = value["SendDate"].asString();
  59. if(!value["To"].isNull())
  60. to_ = value["To"].asString();
  61. if(!value["MessageId"].isNull())
  62. messageId_ = value["MessageId"].asString();
  63. }
  64. std::string QueryMessageResult::getStatus()const
  65. {
  66. return status_;
  67. }
  68. std::string QueryMessageResult::getErrorDescription()const
  69. {
  70. return errorDescription_;
  71. }
  72. std::string QueryMessageResult::getResponseCode()const
  73. {
  74. return responseCode_;
  75. }
  76. QueryMessageResult::NumberDetail QueryMessageResult::getNumberDetail()const
  77. {
  78. return numberDetail_;
  79. }
  80. std::string QueryMessageResult::getReceiveDate()const
  81. {
  82. return receiveDate_;
  83. }
  84. std::string QueryMessageResult::getMessage()const
  85. {
  86. return message_;
  87. }
  88. std::string QueryMessageResult::getResponseDescription()const
  89. {
  90. return responseDescription_;
  91. }
  92. std::string QueryMessageResult::getErrorCode()const
  93. {
  94. return errorCode_;
  95. }
  96. std::string QueryMessageResult::getSendDate()const
  97. {
  98. return sendDate_;
  99. }
  100. std::string QueryMessageResult::getTo()const
  101. {
  102. return to_;
  103. }
  104. std::string QueryMessageResult::getMessageId()const
  105. {
  106. return messageId_;
  107. }