ListCallDetailRecordsResult.cc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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/ListCallDetailRecordsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::CCC;
  19. using namespace AlibabaCloud::CCC::Model;
  20. ListCallDetailRecordsResult::ListCallDetailRecordsResult() :
  21. ServiceResult()
  22. {}
  23. ListCallDetailRecordsResult::ListCallDetailRecordsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListCallDetailRecordsResult::~ListCallDetailRecordsResult()
  29. {}
  30. void ListCallDetailRecordsResult::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 dataNode = value["Data"];
  37. if(!dataNode["PageNumber"].isNull())
  38. data_.pageNumber = std::stoi(dataNode["PageNumber"].asString());
  39. if(!dataNode["PageSize"].isNull())
  40. data_.pageSize = std::stoi(dataNode["PageSize"].asString());
  41. if(!dataNode["TotalCount"].isNull())
  42. data_.totalCount = std::stoi(dataNode["TotalCount"].asString());
  43. auto allListNode = dataNode["List"]["CallDetailRecord"];
  44. for (auto dataNodeListCallDetailRecord : allListNode)
  45. {
  46. Data::CallDetailRecord callDetailRecordObject;
  47. if(!dataNodeListCallDetailRecord["AgentIds"].isNull())
  48. callDetailRecordObject.agentIds = dataNodeListCallDetailRecord["AgentIds"].asString();
  49. if(!dataNodeListCallDetailRecord["AgentNames"].isNull())
  50. callDetailRecordObject.agentNames = dataNodeListCallDetailRecord["AgentNames"].asString();
  51. if(!dataNodeListCallDetailRecord["CallDuration"].isNull())
  52. callDetailRecordObject.callDuration = dataNodeListCallDetailRecord["CallDuration"].asString();
  53. if(!dataNodeListCallDetailRecord["CalledNumber"].isNull())
  54. callDetailRecordObject.calledNumber = dataNodeListCallDetailRecord["CalledNumber"].asString();
  55. if(!dataNodeListCallDetailRecord["CallingNumber"].isNull())
  56. callDetailRecordObject.callingNumber = dataNodeListCallDetailRecord["CallingNumber"].asString();
  57. if(!dataNodeListCallDetailRecord["ContactDisposition"].isNull())
  58. callDetailRecordObject.contactDisposition = dataNodeListCallDetailRecord["ContactDisposition"].asString();
  59. if(!dataNodeListCallDetailRecord["ContactId"].isNull())
  60. callDetailRecordObject.contactId = dataNodeListCallDetailRecord["ContactId"].asString();
  61. if(!dataNodeListCallDetailRecord["ContactType"].isNull())
  62. callDetailRecordObject.contactType = dataNodeListCallDetailRecord["ContactType"].asString();
  63. if(!dataNodeListCallDetailRecord["EstablishedTime"].isNull())
  64. callDetailRecordObject.establishedTime = std::stol(dataNodeListCallDetailRecord["EstablishedTime"].asString());
  65. if(!dataNodeListCallDetailRecord["InstanceId"].isNull())
  66. callDetailRecordObject.instanceId = dataNodeListCallDetailRecord["InstanceId"].asString();
  67. if(!dataNodeListCallDetailRecord["SkillGroupIds"].isNull())
  68. callDetailRecordObject.skillGroupIds = dataNodeListCallDetailRecord["SkillGroupIds"].asString();
  69. if(!dataNodeListCallDetailRecord["SkillGroupNames"].isNull())
  70. callDetailRecordObject.skillGroupNames = dataNodeListCallDetailRecord["SkillGroupNames"].asString();
  71. if(!dataNodeListCallDetailRecord["StartTime"].isNull())
  72. callDetailRecordObject.startTime = std::stol(dataNodeListCallDetailRecord["StartTime"].asString());
  73. data_.list.push_back(callDetailRecordObject);
  74. }
  75. if(!value["Code"].isNull())
  76. code_ = value["Code"].asString();
  77. if(!value["HttpStatusCode"].isNull())
  78. httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
  79. if(!value["Message"].isNull())
  80. message_ = value["Message"].asString();
  81. }
  82. std::string ListCallDetailRecordsResult::getMessage()const
  83. {
  84. return message_;
  85. }
  86. int ListCallDetailRecordsResult::getHttpStatusCode()const
  87. {
  88. return httpStatusCode_;
  89. }
  90. ListCallDetailRecordsResult::Data ListCallDetailRecordsResult::getData()const
  91. {
  92. return data_;
  93. }
  94. std::string ListCallDetailRecordsResult::getCode()const
  95. {
  96. return code_;
  97. }