QueryTicketInfoResult.cc 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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/quickbi-public/model/QueryTicketInfoResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Quickbi_public;
  19. using namespace AlibabaCloud::Quickbi_public::Model;
  20. QueryTicketInfoResult::QueryTicketInfoResult() :
  21. ServiceResult()
  22. {}
  23. QueryTicketInfoResult::QueryTicketInfoResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryTicketInfoResult::~QueryTicketInfoResult()
  29. {}
  30. void QueryTicketInfoResult::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 resultNode = value["Result"];
  37. if(!resultNode["AccessTicket"].isNull())
  38. result_.accessTicket = resultNode["AccessTicket"].asString();
  39. if(!resultNode["OrganizationId"].isNull())
  40. result_.organizationId = resultNode["OrganizationId"].asString();
  41. if(!resultNode["UserId"].isNull())
  42. result_.userId = resultNode["UserId"].asString();
  43. if(!resultNode["UsedTicketNum"].isNull())
  44. result_.usedTicketNum = std::stoi(resultNode["UsedTicketNum"].asString());
  45. if(!resultNode["MaxTicketNum"].isNull())
  46. result_.maxTicketNum = std::stoi(resultNode["MaxTicketNum"].asString());
  47. if(!resultNode["RegisterTime"].isNull())
  48. result_.registerTime = resultNode["RegisterTime"].asString();
  49. if(!resultNode["InvalidTime"].isNull())
  50. result_.invalidTime = resultNode["InvalidTime"].asString();
  51. if(!resultNode["WorksId"].isNull())
  52. result_.worksId = resultNode["WorksId"].asString();
  53. if(!resultNode["CmptId"].isNull())
  54. result_.cmptId = resultNode["CmptId"].asString();
  55. if(!resultNode["GlobalParam"].isNull())
  56. result_.globalParam = resultNode["GlobalParam"].asString();
  57. if(!resultNode["WatermarkParam"].isNull())
  58. result_.watermarkParam = resultNode["WatermarkParam"].asString();
  59. if(!value["Success"].isNull())
  60. success_ = value["Success"].asString() == "true";
  61. }
  62. bool QueryTicketInfoResult::getSuccess()const
  63. {
  64. return success_;
  65. }
  66. QueryTicketInfoResult::Result QueryTicketInfoResult::getResult()const
  67. {
  68. return result_;
  69. }