QueryFpShotJobListResult.cc 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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/mts/model/QueryFpShotJobListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Mts;
  19. using namespace AlibabaCloud::Mts::Model;
  20. QueryFpShotJobListResult::QueryFpShotJobListResult() :
  21. ServiceResult()
  22. {}
  23. QueryFpShotJobListResult::QueryFpShotJobListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryFpShotJobListResult::~QueryFpShotJobListResult()
  29. {}
  30. void QueryFpShotJobListResult::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 allFpShotJobList = value["FpShotJobList"]["FpShotJob"];
  37. for (auto value : allFpShotJobList)
  38. {
  39. FpShotJob fpShotJobListObject;
  40. if(!value["Id"].isNull())
  41. fpShotJobListObject.id = value["Id"].asString();
  42. if(!value["UserData"].isNull())
  43. fpShotJobListObject.userData = value["UserData"].asString();
  44. if(!value["PipelineId"].isNull())
  45. fpShotJobListObject.pipelineId = value["PipelineId"].asString();
  46. if(!value["FileId"].isNull())
  47. fpShotJobListObject.fileId = value["FileId"].asString();
  48. if(!value["State"].isNull())
  49. fpShotJobListObject.state = value["State"].asString();
  50. if(!value["Code"].isNull())
  51. fpShotJobListObject.code = value["Code"].asString();
  52. if(!value["Message"].isNull())
  53. fpShotJobListObject.message = value["Message"].asString();
  54. if(!value["CreationTime"].isNull())
  55. fpShotJobListObject.creationTime = value["CreationTime"].asString();
  56. if(!value["FinishTime"].isNull())
  57. fpShotJobListObject.finishTime = value["FinishTime"].asString();
  58. auto inputFileNode = value["InputFile"];
  59. if(!inputFileNode["Bucket"].isNull())
  60. fpShotJobListObject.inputFile.bucket = inputFileNode["Bucket"].asString();
  61. if(!inputFileNode["Location"].isNull())
  62. fpShotJobListObject.inputFile.location = inputFileNode["Location"].asString();
  63. if(!inputFileNode["Object"].isNull())
  64. fpShotJobListObject.inputFile.object = inputFileNode["Object"].asString();
  65. auto fpShotConfigNode = value["FpShotConfig"];
  66. if(!fpShotConfigNode["PrimaryKey"].isNull())
  67. fpShotJobListObject.fpShotConfig.primaryKey = fpShotConfigNode["PrimaryKey"].asString();
  68. if(!fpShotConfigNode["SaveType"].isNull())
  69. fpShotJobListObject.fpShotConfig.saveType = fpShotConfigNode["SaveType"].asString();
  70. auto fpShotResultNode = value["FpShotResult"];
  71. auto allFpShots = value["FpShots"]["FpShot"];
  72. for (auto value : allFpShots)
  73. {
  74. FpShotJob::FpShotResult::FpShot fpShotObject;
  75. if(!value["PrimaryKey"].isNull())
  76. fpShotObject.primaryKey = value["PrimaryKey"].asString();
  77. if(!value["Similarity"].isNull())
  78. fpShotObject.similarity = value["Similarity"].asString();
  79. auto allFpShotSlices = value["FpShotSlices"]["FpShotSlice"];
  80. for (auto value : allFpShotSlices)
  81. {
  82. FpShotJob::FpShotResult::FpShot::FpShotSlice fpShotSlicesObject;
  83. auto inputNode = value["Input"];
  84. if(!inputNode["Start"].isNull())
  85. fpShotSlicesObject.input.start = inputNode["Start"].asString();
  86. if(!inputNode["Duration"].isNull())
  87. fpShotSlicesObject.input.duration = inputNode["Duration"].asString();
  88. auto duplicationNode = value["Duplication"];
  89. if(!duplicationNode["Start"].isNull())
  90. fpShotSlicesObject.duplication.start = duplicationNode["Start"].asString();
  91. if(!duplicationNode["Duration"].isNull())
  92. fpShotSlicesObject.duplication.duration = duplicationNode["Duration"].asString();
  93. fpShotObject.fpShotSlices.push_back(fpShotSlicesObject);
  94. }
  95. fpShotJobListObject.fpShotResult.fpShots.push_back(fpShotObject);
  96. }
  97. auto allAudioFpShots = value["AudioFpShots"]["FpShot"];
  98. for (auto value : allAudioFpShots)
  99. {
  100. FpShotJob::FpShotResult::FpShot fpShotObject;
  101. if(!value["PrimaryKey"].isNull())
  102. fpShotObject.primaryKey = value["PrimaryKey"].asString();
  103. if(!value["Similarity"].isNull())
  104. fpShotObject.similarity = value["Similarity"].asString();
  105. auto allFpShotSlices = value["FpShotSlices"]["FpShotSlice"];
  106. for (auto value : allFpShotSlices)
  107. {
  108. FpShotJob::FpShotResult::FpShot::FpShotSlice fpShotSlicesObject;
  109. auto inputNode = value["Input"];
  110. if(!inputNode["Start"].isNull())
  111. fpShotSlicesObject.input.start = inputNode["Start"].asString();
  112. if(!inputNode["Duration"].isNull())
  113. fpShotSlicesObject.input.duration = inputNode["Duration"].asString();
  114. auto duplicationNode = value["Duplication"];
  115. if(!duplicationNode["Start"].isNull())
  116. fpShotSlicesObject.duplication.start = duplicationNode["Start"].asString();
  117. if(!duplicationNode["Duration"].isNull())
  118. fpShotSlicesObject.duplication.duration = duplicationNode["Duration"].asString();
  119. fpShotObject.fpShotSlices.push_back(fpShotSlicesObject);
  120. }
  121. fpShotJobListObject.fpShotResult.audioFpShots.push_back(fpShotObject);
  122. }
  123. fpShotJobList_.push_back(fpShotJobListObject);
  124. }
  125. auto allNonExistIds = value["NonExistIds"]["String"];
  126. for (const auto &item : allNonExistIds)
  127. nonExistIds_.push_back(item.asString());
  128. auto allNonExistPrimaryKeys = value["NonExistPrimaryKeys"]["String"];
  129. for (const auto &item : allNonExistPrimaryKeys)
  130. nonExistPrimaryKeys_.push_back(item.asString());
  131. if(!value["NextPageToken"].isNull())
  132. nextPageToken_ = value["NextPageToken"].asString();
  133. }
  134. std::string QueryFpShotJobListResult::getNextPageToken()const
  135. {
  136. return nextPageToken_;
  137. }
  138. std::vector<std::string> QueryFpShotJobListResult::getNonExistPrimaryKeys()const
  139. {
  140. return nonExistPrimaryKeys_;
  141. }
  142. std::vector<QueryFpShotJobListResult::FpShotJob> QueryFpShotJobListResult::getFpShotJobList()const
  143. {
  144. return fpShotJobList_;
  145. }
  146. std::vector<std::string> QueryFpShotJobListResult::getNonExistIds()const
  147. {
  148. return nonExistIds_;
  149. }