ListRecentCallRecordsResult.cc 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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/ListRecentCallRecordsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::CCC;
  19. using namespace AlibabaCloud::CCC::Model;
  20. ListRecentCallRecordsResult::ListRecentCallRecordsResult() :
  21. ServiceResult()
  22. {}
  23. ListRecentCallRecordsResult::ListRecentCallRecordsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListRecentCallRecordsResult::~ListRecentCallRecordsResult()
  29. {}
  30. void ListRecentCallRecordsResult::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 callDetailRecordsNode = value["CallDetailRecords"];
  37. if(!callDetailRecordsNode["TotalCount"].isNull())
  38. callDetailRecords_.totalCount = std::stoi(callDetailRecordsNode["TotalCount"].asString());
  39. if(!callDetailRecordsNode["PageNumber"].isNull())
  40. callDetailRecords_.pageNumber = std::stoi(callDetailRecordsNode["PageNumber"].asString());
  41. if(!callDetailRecordsNode["PageSize"].isNull())
  42. callDetailRecords_.pageSize = std::stoi(callDetailRecordsNode["PageSize"].asString());
  43. auto allListNode = callDetailRecordsNode["List"]["CallDetailRecord"];
  44. for (auto callDetailRecordsNodeListCallDetailRecord : allListNode)
  45. {
  46. CallDetailRecords::CallDetailRecord callDetailRecordObject;
  47. if(!callDetailRecordsNodeListCallDetailRecord["ContactId"].isNull())
  48. callDetailRecordObject.contactId = callDetailRecordsNodeListCallDetailRecord["ContactId"].asString();
  49. if(!callDetailRecordsNodeListCallDetailRecord["StartTime"].isNull())
  50. callDetailRecordObject.startTime = std::stol(callDetailRecordsNodeListCallDetailRecord["StartTime"].asString());
  51. if(!callDetailRecordsNodeListCallDetailRecord["Duration"].isNull())
  52. callDetailRecordObject.duration = std::stoi(callDetailRecordsNodeListCallDetailRecord["Duration"].asString());
  53. if(!callDetailRecordsNodeListCallDetailRecord["Satisfaction"].isNull())
  54. callDetailRecordObject.satisfaction = std::stoi(callDetailRecordsNodeListCallDetailRecord["Satisfaction"].asString());
  55. if(!callDetailRecordsNodeListCallDetailRecord["ContactType"].isNull())
  56. callDetailRecordObject.contactType = callDetailRecordsNodeListCallDetailRecord["ContactType"].asString();
  57. if(!callDetailRecordsNodeListCallDetailRecord["ContactDisposition"].isNull())
  58. callDetailRecordObject.contactDisposition = callDetailRecordsNodeListCallDetailRecord["ContactDisposition"].asString();
  59. if(!callDetailRecordsNodeListCallDetailRecord["CallingNumber"].isNull())
  60. callDetailRecordObject.callingNumber = callDetailRecordsNodeListCallDetailRecord["CallingNumber"].asString();
  61. if(!callDetailRecordsNodeListCallDetailRecord["CalledNumber"].isNull())
  62. callDetailRecordObject.calledNumber = callDetailRecordsNodeListCallDetailRecord["CalledNumber"].asString();
  63. if(!callDetailRecordsNodeListCallDetailRecord["AgentNames"].isNull())
  64. callDetailRecordObject.agentNames = callDetailRecordsNodeListCallDetailRecord["AgentNames"].asString();
  65. if(!callDetailRecordsNodeListCallDetailRecord["SkillGroupNames"].isNull())
  66. callDetailRecordObject.skillGroupNames = callDetailRecordsNodeListCallDetailRecord["SkillGroupNames"].asString();
  67. if(!callDetailRecordsNodeListCallDetailRecord["InstanceId"].isNull())
  68. callDetailRecordObject.instanceId = callDetailRecordsNodeListCallDetailRecord["InstanceId"].asString();
  69. if(!callDetailRecordsNodeListCallDetailRecord["ExtraAttr"].isNull())
  70. callDetailRecordObject.extraAttr = callDetailRecordsNodeListCallDetailRecord["ExtraAttr"].asString();
  71. if(!callDetailRecordsNodeListCallDetailRecord["ExtraAttr"].isNull())
  72. callDetailRecordObject.extraAttr1 = callDetailRecordsNodeListCallDetailRecord["ExtraAttr"].asString();
  73. if(!callDetailRecordsNodeListCallDetailRecord["SatisfactionDesc"].isNull())
  74. callDetailRecordObject.satisfactionDesc = callDetailRecordsNodeListCallDetailRecord["SatisfactionDesc"].asString();
  75. if(!callDetailRecordsNodeListCallDetailRecord["Feedback"].isNull())
  76. callDetailRecordObject.feedback = callDetailRecordsNodeListCallDetailRecord["Feedback"].asString();
  77. auto allAgentsNode = allListNode["Agents"]["CallDetailAgent"];
  78. for (auto allListNodeAgentsCallDetailAgent : allAgentsNode)
  79. {
  80. CallDetailRecords::CallDetailRecord::CallDetailAgent agentsObject;
  81. if(!allListNodeAgentsCallDetailAgent["ContactId"].isNull())
  82. agentsObject.contactId = allListNodeAgentsCallDetailAgent["ContactId"].asString();
  83. if(!allListNodeAgentsCallDetailAgent["AgentId"].isNull())
  84. agentsObject.agentId = allListNodeAgentsCallDetailAgent["AgentId"].asString();
  85. if(!allListNodeAgentsCallDetailAgent["AgentName"].isNull())
  86. agentsObject.agentName = allListNodeAgentsCallDetailAgent["AgentName"].asString();
  87. if(!allListNodeAgentsCallDetailAgent["SkillGroupName"].isNull())
  88. agentsObject.skillGroupName = allListNodeAgentsCallDetailAgent["SkillGroupName"].asString();
  89. if(!allListNodeAgentsCallDetailAgent["QueueTime"].isNull())
  90. agentsObject.queueTime = std::stoi(allListNodeAgentsCallDetailAgent["QueueTime"].asString());
  91. if(!allListNodeAgentsCallDetailAgent["RingTime"].isNull())
  92. agentsObject.ringTime = std::stoi(allListNodeAgentsCallDetailAgent["RingTime"].asString());
  93. if(!allListNodeAgentsCallDetailAgent["StartTime"].isNull())
  94. agentsObject.startTime = std::stol(allListNodeAgentsCallDetailAgent["StartTime"].asString());
  95. if(!allListNodeAgentsCallDetailAgent["TalkTime"].isNull())
  96. agentsObject.talkTime = std::stoi(allListNodeAgentsCallDetailAgent["TalkTime"].asString());
  97. if(!allListNodeAgentsCallDetailAgent["HoldTime"].isNull())
  98. agentsObject.holdTime = std::stoi(allListNodeAgentsCallDetailAgent["HoldTime"].asString());
  99. if(!allListNodeAgentsCallDetailAgent["WorkTime"].isNull())
  100. agentsObject.workTime = std::stoi(allListNodeAgentsCallDetailAgent["WorkTime"].asString());
  101. if(!allListNodeAgentsCallDetailAgent["Satisfaction"].isNull())
  102. agentsObject.satisfaction = allListNodeAgentsCallDetailAgent["Satisfaction"].asString();
  103. if(!allListNodeAgentsCallDetailAgent["Feedback"].isNull())
  104. agentsObject.feedback = allListNodeAgentsCallDetailAgent["Feedback"].asString();
  105. callDetailRecordObject.agents.push_back(agentsObject);
  106. }
  107. auto allRecordingsNode = allListNode["Recordings"]["Recording"];
  108. for (auto allListNodeRecordingsRecording : allRecordingsNode)
  109. {
  110. CallDetailRecords::CallDetailRecord::Recording recordingsObject;
  111. if(!allListNodeRecordingsRecording["ContactId"].isNull())
  112. recordingsObject.contactId = allListNodeRecordingsRecording["ContactId"].asString();
  113. if(!allListNodeRecordingsRecording["ContactType"].isNull())
  114. recordingsObject.contactType = allListNodeRecordingsRecording["ContactType"].asString();
  115. if(!allListNodeRecordingsRecording["AgentId"].isNull())
  116. recordingsObject.agentId = allListNodeRecordingsRecording["AgentId"].asString();
  117. if(!allListNodeRecordingsRecording["AgentName"].isNull())
  118. recordingsObject.agentName = allListNodeRecordingsRecording["AgentName"].asString();
  119. if(!allListNodeRecordingsRecording["CallingNumber"].isNull())
  120. recordingsObject.callingNumber = allListNodeRecordingsRecording["CallingNumber"].asString();
  121. if(!allListNodeRecordingsRecording["CalledNumber"].isNull())
  122. recordingsObject.calledNumber = allListNodeRecordingsRecording["CalledNumber"].asString();
  123. if(!allListNodeRecordingsRecording["StartTime"].isNull())
  124. recordingsObject.startTime = std::stol(allListNodeRecordingsRecording["StartTime"].asString());
  125. if(!allListNodeRecordingsRecording["Duration"].isNull())
  126. recordingsObject.duration = std::stoi(allListNodeRecordingsRecording["Duration"].asString());
  127. if(!allListNodeRecordingsRecording["FileName"].isNull())
  128. recordingsObject.fileName = allListNodeRecordingsRecording["FileName"].asString();
  129. if(!allListNodeRecordingsRecording["FilePath"].isNull())
  130. recordingsObject.filePath = allListNodeRecordingsRecording["FilePath"].asString();
  131. if(!allListNodeRecordingsRecording["FileDescription"].isNull())
  132. recordingsObject.fileDescription = allListNodeRecordingsRecording["FileDescription"].asString();
  133. if(!allListNodeRecordingsRecording["Channel"].isNull())
  134. recordingsObject.channel = allListNodeRecordingsRecording["Channel"].asString();
  135. if(!allListNodeRecordingsRecording["InstanceId"].isNull())
  136. recordingsObject.instanceId = allListNodeRecordingsRecording["InstanceId"].asString();
  137. callDetailRecordObject.recordings.push_back(recordingsObject);
  138. }
  139. callDetailRecords_.list.push_back(callDetailRecordObject);
  140. }
  141. if(!value["Success"].isNull())
  142. success_ = value["Success"].asString() == "true";
  143. if(!value["Code"].isNull())
  144. code_ = value["Code"].asString();
  145. if(!value["Message"].isNull())
  146. message_ = value["Message"].asString();
  147. if(!value["HttpStatusCode"].isNull())
  148. httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
  149. }
  150. std::string ListRecentCallRecordsResult::getMessage()const
  151. {
  152. return message_;
  153. }
  154. ListRecentCallRecordsResult::CallDetailRecords ListRecentCallRecordsResult::getCallDetailRecords()const
  155. {
  156. return callDetailRecords_;
  157. }
  158. int ListRecentCallRecordsResult::getHttpStatusCode()const
  159. {
  160. return httpStatusCode_;
  161. }
  162. std::string ListRecentCallRecordsResult::getCode()const
  163. {
  164. return code_;
  165. }
  166. bool ListRecentCallRecordsResult::getSuccess()const
  167. {
  168. return success_;
  169. }