From 812a50b07f6c1ad8c023fd624d897b54ce373925 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Wed, 22 Jul 2020 00:18:27 +0800 Subject: [PATCH] Add source id for file uploader. --- CHANGELOG | 3 + VERSION | 2 +- vcs/CMakeLists.txt | 4 ++ vcs/include/alibabacloud/vcs/VcsClient.h | 8 +++ .../vcs/model/AddDataSourceRequest.h | 3 + .../model/SaveVideoSummaryTaskVideoRequest.h | 54 +++++++++++++++ .../model/SaveVideoSummaryTaskVideoResult.h | 55 ++++++++++++++++ .../alibabacloud/vcs/model/UploadFileResult.h | 13 +++- vcs/src/VcsClient.cc | 36 ++++++++++ vcs/src/model/AddDataSourceRequest.cc | 11 ++++ .../model/SaveVideoSummaryTaskVideoRequest.cc | 62 ++++++++++++++++++ .../model/SaveVideoSummaryTaskVideoResult.cc | 65 +++++++++++++++++++ vcs/src/model/UploadFileResult.cc | 15 ++++- 13 files changed, 325 insertions(+), 6 deletions(-) create mode 100644 vcs/include/alibabacloud/vcs/model/SaveVideoSummaryTaskVideoRequest.h create mode 100644 vcs/include/alibabacloud/vcs/model/SaveVideoSummaryTaskVideoResult.h create mode 100644 vcs/src/model/SaveVideoSummaryTaskVideoRequest.cc create mode 100644 vcs/src/model/SaveVideoSummaryTaskVideoResult.cc diff --git a/CHANGELOG b/CHANGELOG index 54c741b10..5d7cfceb0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2020-07-22 Version: 1.36.525 +- Add source id for file uploader. + 2020-07-21 Version: 1.36.524 - Support Tag API. diff --git a/VERSION b/VERSION index 7cffea74b..fe329afd5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.524 \ No newline at end of file +1.36.525 \ No newline at end of file diff --git a/vcs/CMakeLists.txt b/vcs/CMakeLists.txt index 37775f857..a940bb2cf 100644 --- a/vcs/CMakeLists.txt +++ b/vcs/CMakeLists.txt @@ -79,6 +79,8 @@ set(vcs_public_header_model include/alibabacloud/vcs/model/RecognizeFaceQualityResult.h include/alibabacloud/vcs/model/RecognizeImageRequest.h include/alibabacloud/vcs/model/RecognizeImageResult.h + include/alibabacloud/vcs/model/SaveVideoSummaryTaskVideoRequest.h + include/alibabacloud/vcs/model/SaveVideoSummaryTaskVideoResult.h include/alibabacloud/vcs/model/SearchBodyRequest.h include/alibabacloud/vcs/model/SearchBodyResult.h include/alibabacloud/vcs/model/SearchFaceRequest.h @@ -154,6 +156,8 @@ set(vcs_src src/model/RecognizeFaceQualityResult.cc src/model/RecognizeImageRequest.cc src/model/RecognizeImageResult.cc + src/model/SaveVideoSummaryTaskVideoRequest.cc + src/model/SaveVideoSummaryTaskVideoResult.cc src/model/SearchBodyRequest.cc src/model/SearchBodyResult.cc src/model/SearchFaceRequest.cc diff --git a/vcs/include/alibabacloud/vcs/VcsClient.h b/vcs/include/alibabacloud/vcs/VcsClient.h index df056500b..dc79a35bc 100644 --- a/vcs/include/alibabacloud/vcs/VcsClient.h +++ b/vcs/include/alibabacloud/vcs/VcsClient.h @@ -80,6 +80,8 @@ #include "model/RecognizeFaceQualityResult.h" #include "model/RecognizeImageRequest.h" #include "model/RecognizeImageResult.h" +#include "model/SaveVideoSummaryTaskVideoRequest.h" +#include "model/SaveVideoSummaryTaskVideoResult.h" #include "model/SearchBodyRequest.h" #include "model/SearchBodyResult.h" #include "model/SearchFaceRequest.h" @@ -190,6 +192,9 @@ namespace AlibabaCloud typedef Outcome RecognizeImageOutcome; typedef std::future RecognizeImageOutcomeCallable; typedef std::function&)> RecognizeImageAsyncHandler; + typedef Outcome SaveVideoSummaryTaskVideoOutcome; + typedef std::future SaveVideoSummaryTaskVideoOutcomeCallable; + typedef std::function&)> SaveVideoSummaryTaskVideoAsyncHandler; typedef Outcome SearchBodyOutcome; typedef std::future SearchBodyOutcomeCallable; typedef std::function&)> SearchBodyAsyncHandler; @@ -303,6 +308,9 @@ namespace AlibabaCloud RecognizeImageOutcome recognizeImage(const Model::RecognizeImageRequest &request)const; void recognizeImageAsync(const Model::RecognizeImageRequest& request, const RecognizeImageAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; RecognizeImageOutcomeCallable recognizeImageCallable(const Model::RecognizeImageRequest& request) const; + SaveVideoSummaryTaskVideoOutcome saveVideoSummaryTaskVideo(const Model::SaveVideoSummaryTaskVideoRequest &request)const; + void saveVideoSummaryTaskVideoAsync(const Model::SaveVideoSummaryTaskVideoRequest& request, const SaveVideoSummaryTaskVideoAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + SaveVideoSummaryTaskVideoOutcomeCallable saveVideoSummaryTaskVideoCallable(const Model::SaveVideoSummaryTaskVideoRequest& request) const; SearchBodyOutcome searchBody(const Model::SearchBodyRequest &request)const; void searchBodyAsync(const Model::SearchBodyRequest& request, const SearchBodyAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; SearchBodyOutcomeCallable searchBodyCallable(const Model::SearchBodyRequest& request) const; diff --git a/vcs/include/alibabacloud/vcs/model/AddDataSourceRequest.h b/vcs/include/alibabacloud/vcs/model/AddDataSourceRequest.h index d0bb79f42..9dabdb12a 100644 --- a/vcs/include/alibabacloud/vcs/model/AddDataSourceRequest.h +++ b/vcs/include/alibabacloud/vcs/model/AddDataSourceRequest.h @@ -43,12 +43,15 @@ namespace AlibabaCloud void setDescription(const std::string& description); std::string getDataSourceName()const; void setDataSourceName(const std::string& dataSourceName); + int getFileRetentionDays()const; + void setFileRetentionDays(int fileRetentionDays); private: std::string dataSourceType_; std::string corpId_; std::string description_; std::string dataSourceName_; + int fileRetentionDays_; }; } diff --git a/vcs/include/alibabacloud/vcs/model/SaveVideoSummaryTaskVideoRequest.h b/vcs/include/alibabacloud/vcs/model/SaveVideoSummaryTaskVideoRequest.h new file mode 100644 index 000000000..e23839dae --- /dev/null +++ b/vcs/include/alibabacloud/vcs/model/SaveVideoSummaryTaskVideoRequest.h @@ -0,0 +1,54 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_VCS_MODEL_SAVEVIDEOSUMMARYTASKVIDEOREQUEST_H_ +#define ALIBABACLOUD_VCS_MODEL_SAVEVIDEOSUMMARYTASKVIDEOREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Vcs + { + namespace Model + { + class ALIBABACLOUD_VCS_EXPORT SaveVideoSummaryTaskVideoRequest : public RpcServiceRequest + { + + public: + SaveVideoSummaryTaskVideoRequest(); + ~SaveVideoSummaryTaskVideoRequest(); + + std::string getCorpId()const; + void setCorpId(const std::string& corpId); + bool getSaveVideo()const; + void setSaveVideo(bool saveVideo); + long getTaskId()const; + void setTaskId(long taskId); + + private: + std::string corpId_; + bool saveVideo_; + long taskId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_VCS_MODEL_SAVEVIDEOSUMMARYTASKVIDEOREQUEST_H_ \ No newline at end of file diff --git a/vcs/include/alibabacloud/vcs/model/SaveVideoSummaryTaskVideoResult.h b/vcs/include/alibabacloud/vcs/model/SaveVideoSummaryTaskVideoResult.h new file mode 100644 index 000000000..d164df835 --- /dev/null +++ b/vcs/include/alibabacloud/vcs/model/SaveVideoSummaryTaskVideoResult.h @@ -0,0 +1,55 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_VCS_MODEL_SAVEVIDEOSUMMARYTASKVIDEORESULT_H_ +#define ALIBABACLOUD_VCS_MODEL_SAVEVIDEOSUMMARYTASKVIDEORESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Vcs + { + namespace Model + { + class ALIBABACLOUD_VCS_EXPORT SaveVideoSummaryTaskVideoResult : public ServiceResult + { + public: + + + SaveVideoSummaryTaskVideoResult(); + explicit SaveVideoSummaryTaskVideoResult(const std::string &payload); + ~SaveVideoSummaryTaskVideoResult(); + std::string getMessage()const; + std::string getData()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + std::string data_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_VCS_MODEL_SAVEVIDEOSUMMARYTASKVIDEORESULT_H_ \ No newline at end of file diff --git a/vcs/include/alibabacloud/vcs/model/UploadFileResult.h b/vcs/include/alibabacloud/vcs/model/UploadFileResult.h index 037d01122..e64397cd3 100644 --- a/vcs/include/alibabacloud/vcs/model/UploadFileResult.h +++ b/vcs/include/alibabacloud/vcs/model/UploadFileResult.h @@ -32,20 +32,29 @@ namespace AlibabaCloud class ALIBABACLOUD_VCS_EXPORT UploadFileResult : public ServiceResult { public: + struct Data + { + struct OssPath + { + std::string ossPath; + std::string sourceId; + }; + std::vector records; + }; UploadFileResult(); explicit UploadFileResult(const std::string &payload); ~UploadFileResult(); std::string getMessage()const; - std::string getData()const; + Data getData()const; std::string getCode()const; protected: void parse(const std::string &payload); private: std::string message_; - std::string data_; + Data data_; std::string code_; }; diff --git a/vcs/src/VcsClient.cc b/vcs/src/VcsClient.cc index b9635bb56..83726ee0b 100644 --- a/vcs/src/VcsClient.cc +++ b/vcs/src/VcsClient.cc @@ -1095,6 +1095,42 @@ VcsClient::RecognizeImageOutcomeCallable VcsClient::recognizeImageCallable(const return task->get_future(); } +VcsClient::SaveVideoSummaryTaskVideoOutcome VcsClient::saveVideoSummaryTaskVideo(const SaveVideoSummaryTaskVideoRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return SaveVideoSummaryTaskVideoOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return SaveVideoSummaryTaskVideoOutcome(SaveVideoSummaryTaskVideoResult(outcome.result())); + else + return SaveVideoSummaryTaskVideoOutcome(outcome.error()); +} + +void VcsClient::saveVideoSummaryTaskVideoAsync(const SaveVideoSummaryTaskVideoRequest& request, const SaveVideoSummaryTaskVideoAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, saveVideoSummaryTaskVideo(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +VcsClient::SaveVideoSummaryTaskVideoOutcomeCallable VcsClient::saveVideoSummaryTaskVideoCallable(const SaveVideoSummaryTaskVideoRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->saveVideoSummaryTaskVideo(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + VcsClient::SearchBodyOutcome VcsClient::searchBody(const SearchBodyRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/vcs/src/model/AddDataSourceRequest.cc b/vcs/src/model/AddDataSourceRequest.cc index 0bacce9d6..1b7753c08 100644 --- a/vcs/src/model/AddDataSourceRequest.cc +++ b/vcs/src/model/AddDataSourceRequest.cc @@ -71,3 +71,14 @@ void AddDataSourceRequest::setDataSourceName(const std::string& dataSourceName) setBodyParameter("DataSourceName", dataSourceName); } +int AddDataSourceRequest::getFileRetentionDays()const +{ + return fileRetentionDays_; +} + +void AddDataSourceRequest::setFileRetentionDays(int fileRetentionDays) +{ + fileRetentionDays_ = fileRetentionDays; + setBodyParameter("FileRetentionDays", std::to_string(fileRetentionDays)); +} + diff --git a/vcs/src/model/SaveVideoSummaryTaskVideoRequest.cc b/vcs/src/model/SaveVideoSummaryTaskVideoRequest.cc new file mode 100644 index 000000000..83129cef0 --- /dev/null +++ b/vcs/src/model/SaveVideoSummaryTaskVideoRequest.cc @@ -0,0 +1,62 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include + +using AlibabaCloud::Vcs::Model::SaveVideoSummaryTaskVideoRequest; + +SaveVideoSummaryTaskVideoRequest::SaveVideoSummaryTaskVideoRequest() : + RpcServiceRequest("vcs", "2020-05-15", "SaveVideoSummaryTaskVideo") +{ + setMethod(HttpRequest::Method::Post); +} + +SaveVideoSummaryTaskVideoRequest::~SaveVideoSummaryTaskVideoRequest() +{} + +std::string SaveVideoSummaryTaskVideoRequest::getCorpId()const +{ + return corpId_; +} + +void SaveVideoSummaryTaskVideoRequest::setCorpId(const std::string& corpId) +{ + corpId_ = corpId; + setBodyParameter("CorpId", corpId); +} + +bool SaveVideoSummaryTaskVideoRequest::getSaveVideo()const +{ + return saveVideo_; +} + +void SaveVideoSummaryTaskVideoRequest::setSaveVideo(bool saveVideo) +{ + saveVideo_ = saveVideo; + setBodyParameter("SaveVideo", saveVideo ? "true" : "false"); +} + +long SaveVideoSummaryTaskVideoRequest::getTaskId()const +{ + return taskId_; +} + +void SaveVideoSummaryTaskVideoRequest::setTaskId(long taskId) +{ + taskId_ = taskId; + setBodyParameter("TaskId", std::to_string(taskId)); +} + diff --git a/vcs/src/model/SaveVideoSummaryTaskVideoResult.cc b/vcs/src/model/SaveVideoSummaryTaskVideoResult.cc new file mode 100644 index 000000000..146234a4f --- /dev/null +++ b/vcs/src/model/SaveVideoSummaryTaskVideoResult.cc @@ -0,0 +1,65 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::Vcs; +using namespace AlibabaCloud::Vcs::Model; + +SaveVideoSummaryTaskVideoResult::SaveVideoSummaryTaskVideoResult() : + ServiceResult() +{} + +SaveVideoSummaryTaskVideoResult::SaveVideoSummaryTaskVideoResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +SaveVideoSummaryTaskVideoResult::~SaveVideoSummaryTaskVideoResult() +{} + +void SaveVideoSummaryTaskVideoResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + if(!value["Data"].isNull()) + data_ = value["Data"].asString(); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string SaveVideoSummaryTaskVideoResult::getMessage()const +{ + return message_; +} + +std::string SaveVideoSummaryTaskVideoResult::getData()const +{ + return data_; +} + +std::string SaveVideoSummaryTaskVideoResult::getCode()const +{ + return code_; +} + diff --git a/vcs/src/model/UploadFileResult.cc b/vcs/src/model/UploadFileResult.cc index d54516ae8..8bb1fd0b1 100644 --- a/vcs/src/model/UploadFileResult.cc +++ b/vcs/src/model/UploadFileResult.cc @@ -39,10 +39,19 @@ void UploadFileResult::parse(const std::string &payload) Json::Value value; reader.parse(payload, value); setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + auto allRecordsNode = dataNode["Records"]["OssPath"]; + for (auto dataNodeRecordsOssPath : allRecordsNode) + { + Data::OssPath ossPathObject; + if(!dataNodeRecordsOssPath["OssPath"].isNull()) + ossPathObject.ossPath = dataNodeRecordsOssPath["OssPath"].asString(); + if(!dataNodeRecordsOssPath["SourceId"].isNull()) + ossPathObject.sourceId = dataNodeRecordsOssPath["SourceId"].asString(); + data_.records.push_back(ossPathObject); + } if(!value["Code"].isNull()) code_ = value["Code"].asString(); - if(!value["Data"].isNull()) - data_ = value["Data"].asString(); if(!value["Message"].isNull()) message_ = value["Message"].asString(); @@ -53,7 +62,7 @@ std::string UploadFileResult::getMessage()const return message_; } -std::string UploadFileResult::getData()const +UploadFileResult::Data UploadFileResult::getData()const { return data_; }