GetConversationListResult.cc 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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/ccc/model/GetConversationListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::CCC;
  19. using namespace AlibabaCloud::CCC::Model;
  20. GetConversationListResult::GetConversationListResult() :
  21. ServiceResult()
  22. {}
  23. GetConversationListResult::GetConversationListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. GetConversationListResult::~GetConversationListResult()
  29. {}
  30. void GetConversationListResult::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 allConversations = value["Conversations"]["ConversationDetail"];
  37. for (auto value : allConversations)
  38. {
  39. ConversationDetail conversationsObject;
  40. if(!value["Timestamp"].isNull())
  41. conversationsObject.timestamp = std::stol(value["Timestamp"].asString());
  42. if(!value["Speaker"].isNull())
  43. conversationsObject.speaker = value["Speaker"].asString();
  44. if(!value["Script"].isNull())
  45. conversationsObject.script = value["Script"].asString();
  46. auto allSummary = value["Summary"]["SummaryItem"];
  47. for (auto value : allSummary)
  48. {
  49. ConversationDetail::SummaryItem summaryObject;
  50. if(!value["Category"].isNull())
  51. summaryObject.category = value["Category"].asString();
  52. if(!value["SummaryName"].isNull())
  53. summaryObject.summaryName = value["SummaryName"].asString();
  54. if(!value["Content"].isNull())
  55. summaryObject.content = value["Content"].asString();
  56. conversationsObject.summary.push_back(summaryObject);
  57. }
  58. conversations_.push_back(conversationsObject);
  59. }
  60. if(!value["Success"].isNull())
  61. success_ = value["Success"].asString() == "true";
  62. if(!value["Code"].isNull())
  63. code_ = value["Code"].asString();
  64. if(!value["Message"].isNull())
  65. message_ = value["Message"].asString();
  66. if(!value["HttpStatusCode"].isNull())
  67. httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
  68. }
  69. std::string GetConversationListResult::getMessage()const
  70. {
  71. return message_;
  72. }
  73. int GetConversationListResult::getHttpStatusCode()const
  74. {
  75. return httpStatusCode_;
  76. }
  77. std::vector<GetConversationListResult::ConversationDetail> GetConversationListResult::getConversations()const
  78. {
  79. return conversations_;
  80. }
  81. std::string GetConversationListResult::getCode()const
  82. {
  83. return code_;
  84. }
  85. bool GetConversationListResult::getSuccess()const
  86. {
  87. return success_;
  88. }