ListTicketNotesResult.cc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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/workorder/model/ListTicketNotesResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Workorder;
  19. using namespace AlibabaCloud::Workorder::Model;
  20. ListTicketNotesResult::ListTicketNotesResult() :
  21. ServiceResult()
  22. {}
  23. ListTicketNotesResult::ListTicketNotesResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListTicketNotesResult::~ListTicketNotesResult()
  29. {}
  30. void ListTicketNotesResult::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"]["DataItem"];
  37. for (auto valueDataDataItem : allDataNode)
  38. {
  39. DataItem dataObject;
  40. if(!valueDataDataItem["Status"].isNull())
  41. dataObject.status = std::stoi(valueDataDataItem["Status"].asString());
  42. if(!valueDataDataItem["CreateTime"].isNull())
  43. dataObject.createTime = std::stol(valueDataDataItem["CreateTime"].asString());
  44. if(!valueDataDataItem["Type"].isNull())
  45. dataObject.type = std::stoi(valueDataDataItem["Type"].asString());
  46. if(!valueDataDataItem["DialogId"].isNull())
  47. dataObject.dialogId = std::stol(valueDataDataItem["DialogId"].asString());
  48. if(!valueDataDataItem["Tip"].isNull())
  49. dataObject.tip = valueDataDataItem["Tip"].asString();
  50. auto dialogNode = value["Dialog"];
  51. if(!dialogNode["Content"].isNull())
  52. dataObject.dialog.content = dialogNode["Content"].asString();
  53. if(!dialogNode["Schema"].isNull())
  54. dataObject.dialog.schema = dialogNode["Schema"].asString();
  55. auto userNode = value["User"];
  56. if(!userNode["Name"].isNull())
  57. dataObject.user.name = userNode["Name"].asString();
  58. if(!userNode["Role"].isNull())
  59. dataObject.user.role = std::stoi(userNode["Role"].asString());
  60. data_.push_back(dataObject);
  61. }
  62. if(!value["Code"].isNull())
  63. code_ = std::stoi(value["Code"].asString());
  64. if(!value["Message"].isNull())
  65. message_ = value["Message"].asString();
  66. if(!value["Success"].isNull())
  67. success_ = value["Success"].asString() == "true";
  68. }
  69. std::string ListTicketNotesResult::getMessage()const
  70. {
  71. return message_;
  72. }
  73. std::vector<ListTicketNotesResult::DataItem> ListTicketNotesResult::getData()const
  74. {
  75. return data_;
  76. }
  77. int ListTicketNotesResult::getCode()const
  78. {
  79. return code_;
  80. }
  81. bool ListTicketNotesResult::getSuccess()const
  82. {
  83. return success_;
  84. }