QueryHotlineRecordResult.cc 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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/ccs/model/QueryHotlineRecordResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Ccs;
  19. using namespace AlibabaCloud::Ccs::Model;
  20. QueryHotlineRecordResult::QueryHotlineRecordResult() :
  21. ServiceResult()
  22. {}
  23. QueryHotlineRecordResult::QueryHotlineRecordResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryHotlineRecordResult::~QueryHotlineRecordResult()
  29. {}
  30. void QueryHotlineRecordResult::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 allRecordsNode = value["Records"]["HotlineRecord"];
  37. for (auto valueRecordsHotlineRecord : allRecordsNode)
  38. {
  39. HotlineRecord recordsObject;
  40. if(!valueRecordsHotlineRecord["Id"].isNull())
  41. recordsObject.id = valueRecordsHotlineRecord["Id"].asString();
  42. if(!valueRecordsHotlineRecord["VisitorId"].isNull())
  43. recordsObject.visitorId = valueRecordsHotlineRecord["VisitorId"].asString();
  44. if(!valueRecordsHotlineRecord["VisitorPhone"].isNull())
  45. recordsObject.visitorPhone = valueRecordsHotlineRecord["VisitorPhone"].asString();
  46. if(!valueRecordsHotlineRecord["VisitorProvince"].isNull())
  47. recordsObject.visitorProvince = valueRecordsHotlineRecord["VisitorProvince"].asString();
  48. if(!valueRecordsHotlineRecord["CallType"].isNull())
  49. recordsObject.callType = valueRecordsHotlineRecord["CallType"].asString();
  50. if(!valueRecordsHotlineRecord["AgentId"].isNull())
  51. recordsObject.agentId = valueRecordsHotlineRecord["AgentId"].asString();
  52. if(!valueRecordsHotlineRecord["AgentName"].isNull())
  53. recordsObject.agentName = valueRecordsHotlineRecord["AgentName"].asString();
  54. if(!valueRecordsHotlineRecord["GroupId"].isNull())
  55. recordsObject.groupId = valueRecordsHotlineRecord["GroupId"].asString();
  56. if(!valueRecordsHotlineRecord["GroupName"].isNull())
  57. recordsObject.groupName = valueRecordsHotlineRecord["GroupName"].asString();
  58. if(!valueRecordsHotlineRecord["CreateTime"].isNull())
  59. recordsObject.createTime = valueRecordsHotlineRecord["CreateTime"].asString();
  60. if(!valueRecordsHotlineRecord["FinishTime"].isNull())
  61. recordsObject.finishTime = valueRecordsHotlineRecord["FinishTime"].asString();
  62. if(!valueRecordsHotlineRecord["Status"].isNull())
  63. recordsObject.status = valueRecordsHotlineRecord["Status"].asString();
  64. if(!valueRecordsHotlineRecord["Memo"].isNull())
  65. recordsObject.memo = valueRecordsHotlineRecord["Memo"].asString();
  66. if(!valueRecordsHotlineRecord["HangupType"].isNull())
  67. recordsObject.hangupType = valueRecordsHotlineRecord["HangupType"].asString();
  68. if(!valueRecordsHotlineRecord["Satisfaction"].isNull())
  69. recordsObject.satisfaction = valueRecordsHotlineRecord["Satisfaction"].asString();
  70. if(!valueRecordsHotlineRecord["OutboundTaskId"].isNull())
  71. recordsObject.outboundTaskId = valueRecordsHotlineRecord["OutboundTaskId"].asString();
  72. if(!valueRecordsHotlineRecord["Categories"].isNull())
  73. recordsObject.categories = valueRecordsHotlineRecord["Categories"].asString();
  74. if(!valueRecordsHotlineRecord["CcsInstanceId"].isNull())
  75. recordsObject.ccsInstanceId = valueRecordsHotlineRecord["CcsInstanceId"].asString();
  76. if(!valueRecordsHotlineRecord["TalkDuration"].isNull())
  77. recordsObject.talkDuration = std::stol(valueRecordsHotlineRecord["TalkDuration"].asString());
  78. records_.push_back(recordsObject);
  79. }
  80. if(!value["TotalCount"].isNull())
  81. totalCount_ = std::stol(value["TotalCount"].asString());
  82. if(!value["PageNum"].isNull())
  83. pageNum_ = std::stoi(value["PageNum"].asString());
  84. if(!value["PageSize"].isNull())
  85. pageSize_ = std::stoi(value["PageSize"].asString());
  86. }
  87. long QueryHotlineRecordResult::getTotalCount()const
  88. {
  89. return totalCount_;
  90. }
  91. int QueryHotlineRecordResult::getPageNum()const
  92. {
  93. return pageNum_;
  94. }
  95. int QueryHotlineRecordResult::getPageSize()const
  96. {
  97. return pageSize_;
  98. }
  99. std::vector<QueryHotlineRecordResult::HotlineRecord> QueryHotlineRecordResult::getRecords()const
  100. {
  101. return records_;
  102. }