QueryCoverJobListResult.cc 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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/QueryCoverJobListResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Mts;
  19. using namespace AlibabaCloud::Mts::Model;
  20. QueryCoverJobListResult::QueryCoverJobListResult() :
  21. ServiceResult()
  22. {}
  23. QueryCoverJobListResult::QueryCoverJobListResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. QueryCoverJobListResult::~QueryCoverJobListResult()
  29. {}
  30. void QueryCoverJobListResult::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 allCoverJobList = value["CoverJobList"]["CoverJob"];
  37. for (auto value : allCoverJobList)
  38. {
  39. CoverJob coverJobListObject;
  40. if(!value["Id"].isNull())
  41. coverJobListObject.id = value["Id"].asString();
  42. if(!value["UserData"].isNull())
  43. coverJobListObject.userData = value["UserData"].asString();
  44. if(!value["PipelineId"].isNull())
  45. coverJobListObject.pipelineId = value["PipelineId"].asString();
  46. if(!value["State"].isNull())
  47. coverJobListObject.state = value["State"].asString();
  48. if(!value["Code"].isNull())
  49. coverJobListObject.code = value["Code"].asString();
  50. if(!value["Message"].isNull())
  51. coverJobListObject.message = value["Message"].asString();
  52. if(!value["CreationTime"].isNull())
  53. coverJobListObject.creationTime = value["CreationTime"].asString();
  54. auto allCoverImageList = value["CoverImageList"]["CoverImage"];
  55. for (auto value : allCoverImageList)
  56. {
  57. CoverJob::CoverImage coverImageListObject;
  58. if(!value["Score"].isNull())
  59. coverImageListObject.score = value["Score"].asString();
  60. if(!value["Url"].isNull())
  61. coverImageListObject.url = value["Url"].asString();
  62. if(!value["Time"].isNull())
  63. coverImageListObject.time = value["Time"].asString();
  64. coverJobListObject.coverImageList.push_back(coverImageListObject);
  65. }
  66. auto inputNode = value["Input"];
  67. if(!inputNode["Bucket"].isNull())
  68. coverJobListObject.input.bucket = inputNode["Bucket"].asString();
  69. if(!inputNode["Location"].isNull())
  70. coverJobListObject.input.location = inputNode["Location"].asString();
  71. if(!inputNode["Object"].isNull())
  72. coverJobListObject.input.object = inputNode["Object"].asString();
  73. auto coverConfigNode = value["CoverConfig"];
  74. auto outputFileNode = coverConfigNode["OutputFile"];
  75. if(!outputFileNode["Bucket"].isNull())
  76. coverJobListObject.coverConfig.outputFile.bucket = outputFileNode["Bucket"].asString();
  77. if(!outputFileNode["Location"].isNull())
  78. coverJobListObject.coverConfig.outputFile.location = outputFileNode["Location"].asString();
  79. if(!outputFileNode["Object"].isNull())
  80. coverJobListObject.coverConfig.outputFile.object = outputFileNode["Object"].asString();
  81. coverJobList_.push_back(coverJobListObject);
  82. }
  83. auto allNonExistIds = value["NonExistIds"]["String"];
  84. for (const auto &item : allNonExistIds)
  85. nonExistIds_.push_back(item.asString());
  86. }
  87. std::vector<QueryCoverJobListResult::CoverJob> QueryCoverJobListResult::getCoverJobList()const
  88. {
  89. return coverJobList_;
  90. }
  91. std::vector<std::string> QueryCoverJobListResult::getNonExistIds()const
  92. {
  93. return nonExistIds_;
  94. }