From 82ba7e55bbfb3a75e2dfcfcb24252e0964059e63 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Tue, 8 Oct 2019 16:50:20 +0800 Subject: [PATCH] Supported Grab Frame IMM. --- CHANGELOG | 3 + VERSION | 2 +- imm/CMakeLists.txt | 4 + imm/include/alibabacloud/imm/ImmClient.h | 8 ++ .../imm/model/CreateGrabFrameTaskRequest.h | 66 +++++++++++ .../imm/model/CreateGrabFrameTaskResult.h | 53 +++++++++ .../model/CreateVideoCompressTaskRequest.h | 3 + imm/src/ImmClient.cc | 36 ++++++ imm/src/model/CreateGrabFrameTaskRequest.cc | 104 ++++++++++++++++++ imm/src/model/CreateGrabFrameTaskResult.cc | 58 ++++++++++ .../model/CreateVideoCompressTaskRequest.cc | 11 ++ 11 files changed, 347 insertions(+), 1 deletion(-) create mode 100644 imm/include/alibabacloud/imm/model/CreateGrabFrameTaskRequest.h create mode 100644 imm/include/alibabacloud/imm/model/CreateGrabFrameTaskResult.h create mode 100644 imm/src/model/CreateGrabFrameTaskRequest.cc create mode 100644 imm/src/model/CreateGrabFrameTaskResult.cc diff --git a/CHANGELOG b/CHANGELOG index 99831d2b5..ac7938aa8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2019-10-08 Version 1.36.146 +- Supported Grab Frame IMM. + 2019-10-08 Version 1.36.145 - Supported API MassPush for Push Message or Notice. diff --git a/VERSION b/VERSION index 356f08520..7f1285b36 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.145 \ No newline at end of file +1.36.146 \ No newline at end of file diff --git a/imm/CMakeLists.txt b/imm/CMakeLists.txt index 60bae372f..6557fa830 100644 --- a/imm/CMakeLists.txt +++ b/imm/CMakeLists.txt @@ -33,6 +33,8 @@ set(imm_public_header_model include/alibabacloud/imm/model/CreateDocIndexTaskResult.h include/alibabacloud/imm/model/CreateFaceSetRequest.h include/alibabacloud/imm/model/CreateFaceSetResult.h + include/alibabacloud/imm/model/CreateGrabFrameTaskRequest.h + include/alibabacloud/imm/model/CreateGrabFrameTaskResult.h include/alibabacloud/imm/model/CreateGroupFacesJobRequest.h include/alibabacloud/imm/model/CreateGroupFacesJobResult.h include/alibabacloud/imm/model/CreateMediaComplexTaskRequest.h @@ -240,6 +242,8 @@ set(imm_src src/model/CreateDocIndexTaskResult.cc src/model/CreateFaceSetRequest.cc src/model/CreateFaceSetResult.cc + src/model/CreateGrabFrameTaskRequest.cc + src/model/CreateGrabFrameTaskResult.cc src/model/CreateGroupFacesJobRequest.cc src/model/CreateGroupFacesJobResult.cc src/model/CreateMediaComplexTaskRequest.cc diff --git a/imm/include/alibabacloud/imm/ImmClient.h b/imm/include/alibabacloud/imm/ImmClient.h index 6c430f53d..d079cfdff 100644 --- a/imm/include/alibabacloud/imm/ImmClient.h +++ b/imm/include/alibabacloud/imm/ImmClient.h @@ -34,6 +34,8 @@ #include "model/CreateDocIndexTaskResult.h" #include "model/CreateFaceSetRequest.h" #include "model/CreateFaceSetResult.h" +#include "model/CreateGrabFrameTaskRequest.h" +#include "model/CreateGrabFrameTaskResult.h" #include "model/CreateGroupFacesJobRequest.h" #include "model/CreateGroupFacesJobResult.h" #include "model/CreateMediaComplexTaskRequest.h" @@ -253,6 +255,9 @@ namespace AlibabaCloud typedef Outcome CreateFaceSetOutcome; typedef std::future CreateFaceSetOutcomeCallable; typedef std::function&)> CreateFaceSetAsyncHandler; + typedef Outcome CreateGrabFrameTaskOutcome; + typedef std::future CreateGrabFrameTaskOutcomeCallable; + typedef std::function&)> CreateGrabFrameTaskAsyncHandler; typedef Outcome CreateGroupFacesJobOutcome; typedef std::future CreateGroupFacesJobOutcomeCallable; typedef std::function&)> CreateGroupFacesJobAsyncHandler; @@ -564,6 +569,9 @@ namespace AlibabaCloud CreateFaceSetOutcome createFaceSet(const Model::CreateFaceSetRequest &request)const; void createFaceSetAsync(const Model::CreateFaceSetRequest& request, const CreateFaceSetAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; CreateFaceSetOutcomeCallable createFaceSetCallable(const Model::CreateFaceSetRequest& request) const; + CreateGrabFrameTaskOutcome createGrabFrameTask(const Model::CreateGrabFrameTaskRequest &request)const; + void createGrabFrameTaskAsync(const Model::CreateGrabFrameTaskRequest& request, const CreateGrabFrameTaskAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + CreateGrabFrameTaskOutcomeCallable createGrabFrameTaskCallable(const Model::CreateGrabFrameTaskRequest& request) const; CreateGroupFacesJobOutcome createGroupFacesJob(const Model::CreateGroupFacesJobRequest &request)const; void createGroupFacesJobAsync(const Model::CreateGroupFacesJobRequest& request, const CreateGroupFacesJobAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; CreateGroupFacesJobOutcomeCallable createGroupFacesJobCallable(const Model::CreateGroupFacesJobRequest& request) const; diff --git a/imm/include/alibabacloud/imm/model/CreateGrabFrameTaskRequest.h b/imm/include/alibabacloud/imm/model/CreateGrabFrameTaskRequest.h new file mode 100644 index 000000000..65ffe8ac6 --- /dev/null +++ b/imm/include/alibabacloud/imm/model/CreateGrabFrameTaskRequest.h @@ -0,0 +1,66 @@ +/* + * 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_IMM_MODEL_CREATEGRABFRAMETASKREQUEST_H_ +#define ALIBABACLOUD_IMM_MODEL_CREATEGRABFRAMETASKREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Imm + { + namespace Model + { + class ALIBABACLOUD_IMM_EXPORT CreateGrabFrameTaskRequest : public RpcServiceRequest + { + + public: + CreateGrabFrameTaskRequest(); + ~CreateGrabFrameTaskRequest(); + + std::string getProject()const; + void setProject(const std::string& project); + std::string getAccessKeyId()const; + void setAccessKeyId(const std::string& accessKeyId); + std::string getNotifyEndpoint()const; + void setNotifyEndpoint(const std::string& notifyEndpoint); + std::string getCustomMessage()const; + void setCustomMessage(const std::string& customMessage); + std::string getNotifyTopicName()const; + void setNotifyTopicName(const std::string& notifyTopicName); + std::string getTargetList()const; + void setTargetList(const std::string& targetList); + std::string getVideoUri()const; + void setVideoUri(const std::string& videoUri); + + private: + std::string project_; + std::string accessKeyId_; + std::string notifyEndpoint_; + std::string customMessage_; + std::string notifyTopicName_; + std::string targetList_; + std::string videoUri_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IMM_MODEL_CREATEGRABFRAMETASKREQUEST_H_ \ No newline at end of file diff --git a/imm/include/alibabacloud/imm/model/CreateGrabFrameTaskResult.h b/imm/include/alibabacloud/imm/model/CreateGrabFrameTaskResult.h new file mode 100644 index 000000000..e9f3b9b90 --- /dev/null +++ b/imm/include/alibabacloud/imm/model/CreateGrabFrameTaskResult.h @@ -0,0 +1,53 @@ +/* + * 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_IMM_MODEL_CREATEGRABFRAMETASKRESULT_H_ +#define ALIBABACLOUD_IMM_MODEL_CREATEGRABFRAMETASKRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Imm + { + namespace Model + { + class ALIBABACLOUD_IMM_EXPORT CreateGrabFrameTaskResult : public ServiceResult + { + public: + + + CreateGrabFrameTaskResult(); + explicit CreateGrabFrameTaskResult(const std::string &payload); + ~CreateGrabFrameTaskResult(); + std::string getTaskId()const; + std::string getTaskType()const; + + protected: + void parse(const std::string &payload); + private: + std::string taskId_; + std::string taskType_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IMM_MODEL_CREATEGRABFRAMETASKRESULT_H_ \ No newline at end of file diff --git a/imm/include/alibabacloud/imm/model/CreateVideoCompressTaskRequest.h b/imm/include/alibabacloud/imm/model/CreateVideoCompressTaskRequest.h index afc511562..ccf64d93a 100644 --- a/imm/include/alibabacloud/imm/model/CreateVideoCompressTaskRequest.h +++ b/imm/include/alibabacloud/imm/model/CreateVideoCompressTaskRequest.h @@ -41,6 +41,8 @@ namespace AlibabaCloud void setAccessKeyId(const std::string& accessKeyId); std::string getNotifyEndpoint()const; void setNotifyEndpoint(const std::string& notifyEndpoint); + std::string getCustomMessage()const; + void setCustomMessage(const std::string& customMessage); std::string getNotifyTopicName()const; void setNotifyTopicName(const std::string& notifyTopicName); std::string getTargetList()const; @@ -52,6 +54,7 @@ namespace AlibabaCloud std::string project_; std::string accessKeyId_; std::string notifyEndpoint_; + std::string customMessage_; std::string notifyTopicName_; std::string targetList_; std::string videoUri_; diff --git a/imm/src/ImmClient.cc b/imm/src/ImmClient.cc index 766fb4c44..a2936b17b 100644 --- a/imm/src/ImmClient.cc +++ b/imm/src/ImmClient.cc @@ -267,6 +267,42 @@ ImmClient::CreateFaceSetOutcomeCallable ImmClient::createFaceSetCallable(const C return task->get_future(); } +ImmClient::CreateGrabFrameTaskOutcome ImmClient::createGrabFrameTask(const CreateGrabFrameTaskRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return CreateGrabFrameTaskOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return CreateGrabFrameTaskOutcome(CreateGrabFrameTaskResult(outcome.result())); + else + return CreateGrabFrameTaskOutcome(outcome.error()); +} + +void ImmClient::createGrabFrameTaskAsync(const CreateGrabFrameTaskRequest& request, const CreateGrabFrameTaskAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, createGrabFrameTask(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ImmClient::CreateGrabFrameTaskOutcomeCallable ImmClient::createGrabFrameTaskCallable(const CreateGrabFrameTaskRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->createGrabFrameTask(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + ImmClient::CreateGroupFacesJobOutcome ImmClient::createGroupFacesJob(const CreateGroupFacesJobRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/imm/src/model/CreateGrabFrameTaskRequest.cc b/imm/src/model/CreateGrabFrameTaskRequest.cc new file mode 100644 index 000000000..a07236ba8 --- /dev/null +++ b/imm/src/model/CreateGrabFrameTaskRequest.cc @@ -0,0 +1,104 @@ +/* + * 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::Imm::Model::CreateGrabFrameTaskRequest; + +CreateGrabFrameTaskRequest::CreateGrabFrameTaskRequest() : + RpcServiceRequest("imm", "2017-09-06", "CreateGrabFrameTask") +{} + +CreateGrabFrameTaskRequest::~CreateGrabFrameTaskRequest() +{} + +std::string CreateGrabFrameTaskRequest::getProject()const +{ + return project_; +} + +void CreateGrabFrameTaskRequest::setProject(const std::string& project) +{ + project_ = project; + setCoreParameter("Project", project); +} + +std::string CreateGrabFrameTaskRequest::getAccessKeyId()const +{ + return accessKeyId_; +} + +void CreateGrabFrameTaskRequest::setAccessKeyId(const std::string& accessKeyId) +{ + accessKeyId_ = accessKeyId; + setCoreParameter("AccessKeyId", accessKeyId); +} + +std::string CreateGrabFrameTaskRequest::getNotifyEndpoint()const +{ + return notifyEndpoint_; +} + +void CreateGrabFrameTaskRequest::setNotifyEndpoint(const std::string& notifyEndpoint) +{ + notifyEndpoint_ = notifyEndpoint; + setCoreParameter("NotifyEndpoint", notifyEndpoint); +} + +std::string CreateGrabFrameTaskRequest::getCustomMessage()const +{ + return customMessage_; +} + +void CreateGrabFrameTaskRequest::setCustomMessage(const std::string& customMessage) +{ + customMessage_ = customMessage; + setCoreParameter("CustomMessage", customMessage); +} + +std::string CreateGrabFrameTaskRequest::getNotifyTopicName()const +{ + return notifyTopicName_; +} + +void CreateGrabFrameTaskRequest::setNotifyTopicName(const std::string& notifyTopicName) +{ + notifyTopicName_ = notifyTopicName; + setCoreParameter("NotifyTopicName", notifyTopicName); +} + +std::string CreateGrabFrameTaskRequest::getTargetList()const +{ + return targetList_; +} + +void CreateGrabFrameTaskRequest::setTargetList(const std::string& targetList) +{ + targetList_ = targetList; + setCoreParameter("TargetList", targetList); +} + +std::string CreateGrabFrameTaskRequest::getVideoUri()const +{ + return videoUri_; +} + +void CreateGrabFrameTaskRequest::setVideoUri(const std::string& videoUri) +{ + videoUri_ = videoUri; + setCoreParameter("VideoUri", videoUri); +} + diff --git a/imm/src/model/CreateGrabFrameTaskResult.cc b/imm/src/model/CreateGrabFrameTaskResult.cc new file mode 100644 index 000000000..227d5b31d --- /dev/null +++ b/imm/src/model/CreateGrabFrameTaskResult.cc @@ -0,0 +1,58 @@ +/* + * 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::Imm; +using namespace AlibabaCloud::Imm::Model; + +CreateGrabFrameTaskResult::CreateGrabFrameTaskResult() : + ServiceResult() +{} + +CreateGrabFrameTaskResult::CreateGrabFrameTaskResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +CreateGrabFrameTaskResult::~CreateGrabFrameTaskResult() +{} + +void CreateGrabFrameTaskResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["TaskId"].isNull()) + taskId_ = value["TaskId"].asString(); + if(!value["TaskType"].isNull()) + taskType_ = value["TaskType"].asString(); + +} + +std::string CreateGrabFrameTaskResult::getTaskId()const +{ + return taskId_; +} + +std::string CreateGrabFrameTaskResult::getTaskType()const +{ + return taskType_; +} + diff --git a/imm/src/model/CreateVideoCompressTaskRequest.cc b/imm/src/model/CreateVideoCompressTaskRequest.cc index 07bb2acef..c31d5efd5 100644 --- a/imm/src/model/CreateVideoCompressTaskRequest.cc +++ b/imm/src/model/CreateVideoCompressTaskRequest.cc @@ -58,6 +58,17 @@ void CreateVideoCompressTaskRequest::setNotifyEndpoint(const std::string& notify setCoreParameter("NotifyEndpoint", notifyEndpoint); } +std::string CreateVideoCompressTaskRequest::getCustomMessage()const +{ + return customMessage_; +} + +void CreateVideoCompressTaskRequest::setCustomMessage(const std::string& customMessage) +{ + customMessage_ = customMessage; + setCoreParameter("CustomMessage", customMessage); +} + std::string CreateVideoCompressTaskRequest::getNotifyTopicName()const { return notifyTopicName_;