QueryCustomerAddressListResult.cc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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/bssopenapi/model/QueryCustomerAddressListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::BssOpenApi;
  19. using namespace AlibabaCloud::BssOpenApi::Model;
  20. QueryCustomerAddressListResult::QueryCustomerAddressListResult() :
  21. ServiceResult()
  22. {}
  23. QueryCustomerAddressListResult::QueryCustomerAddressListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryCustomerAddressListResult::~QueryCustomerAddressListResult()
  29. {}
  30. void QueryCustomerAddressListResult::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 dataNode = value["Data"];
  37. auto allCustomerInvoiceAddressListNode = dataNode["CustomerInvoiceAddressList"]["CustomerInvoiceAddress"];
  38. for (auto dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress : allCustomerInvoiceAddressListNode)
  39. {
  40. Data::CustomerInvoiceAddress customerInvoiceAddressObject;
  41. if(!dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["Id"].isNull())
  42. customerInvoiceAddressObject.id = std::stol(dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["Id"].asString());
  43. if(!dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["UserId"].isNull())
  44. customerInvoiceAddressObject.userId = std::stol(dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["UserId"].asString());
  45. if(!dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["UserNick"].isNull())
  46. customerInvoiceAddressObject.userNick = dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["UserNick"].asString();
  47. if(!dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["Addressee"].isNull())
  48. customerInvoiceAddressObject.addressee = dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["Addressee"].asString();
  49. if(!dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["Province"].isNull())
  50. customerInvoiceAddressObject.province = dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["Province"].asString();
  51. if(!dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["City"].isNull())
  52. customerInvoiceAddressObject.city = dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["City"].asString();
  53. if(!dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["County"].isNull())
  54. customerInvoiceAddressObject.county = dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["County"].asString();
  55. if(!dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["Street"].isNull())
  56. customerInvoiceAddressObject.street = dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["Street"].asString();
  57. if(!dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["PostalCode"].isNull())
  58. customerInvoiceAddressObject.postalCode = dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["PostalCode"].asString();
  59. if(!dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["Phone"].isNull())
  60. customerInvoiceAddressObject.phone = dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["Phone"].asString();
  61. if(!dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["BizType"].isNull())
  62. customerInvoiceAddressObject.bizType = dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["BizType"].asString();
  63. if(!dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["DeliveryAddress"].isNull())
  64. customerInvoiceAddressObject.deliveryAddress = dataNodeCustomerInvoiceAddressListCustomerInvoiceAddress["DeliveryAddress"].asString();
  65. data_.customerInvoiceAddressList.push_back(customerInvoiceAddressObject);
  66. }
  67. if(!value["Success"].isNull())
  68. success_ = value["Success"].asString() == "true";
  69. if(!value["Code"].isNull())
  70. code_ = value["Code"].asString();
  71. if(!value["Message"].isNull())
  72. message_ = value["Message"].asString();
  73. }
  74. std::string QueryCustomerAddressListResult::getMessage()const
  75. {
  76. return message_;
  77. }
  78. QueryCustomerAddressListResult::Data QueryCustomerAddressListResult::getData()const
  79. {
  80. return data_;
  81. }
  82. std::string QueryCustomerAddressListResult::getCode()const
  83. {
  84. return code_;
  85. }
  86. bool QueryCustomerAddressListResult::getSuccess()const
  87. {
  88. return success_;
  89. }