From a4eea962f151455ccc006d17840ad832ad27b01b Mon Sep 17 00:00:00 2001 From: sdk-team Date: Tue, 24 Aug 2021 06:50:37 +0000 Subject: [PATCH] Release RetouchBody. --- CHANGELOG | 3 + VERSION | 2 +- facebody/CMakeLists.txt | 4 ++ .../alibabacloud/facebody/FacebodyClient.h | 8 +++ .../facebody/model/RetouchBodyRequest.h | 54 +++++++++++++++ .../facebody/model/RetouchBodyResult.h | 59 +++++++++++++++++ facebody/src/FacebodyClient.cc | 36 ++++++++++ facebody/src/model/RetouchBodyRequest.cc | 62 +++++++++++++++++ facebody/src/model/RetouchBodyResult.cc | 66 +++++++++++++++++++ 9 files changed, 293 insertions(+), 1 deletion(-) create mode 100644 facebody/include/alibabacloud/facebody/model/RetouchBodyRequest.h create mode 100644 facebody/include/alibabacloud/facebody/model/RetouchBodyResult.h create mode 100644 facebody/src/model/RetouchBodyRequest.cc create mode 100644 facebody/src/model/RetouchBodyResult.cc diff --git a/CHANGELOG b/CHANGELOG index 48a314886..e50fec391 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2021-08-24 Version: 1.36.859 +- Release RetouchBody. + 2021-08-20 Version: 1.36.858 - Update Dyvmsapi SDK. - Add GetCallInfo. diff --git a/VERSION b/VERSION index 58d15ab90..de6937c85 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.858 \ No newline at end of file +1.36.859 \ No newline at end of file diff --git a/facebody/CMakeLists.txt b/facebody/CMakeLists.txt index 0e88cb95c..d6dcbcf4a 100644 --- a/facebody/CMakeLists.txt +++ b/facebody/CMakeLists.txt @@ -133,6 +133,8 @@ set(facebody_public_header_model include/alibabacloud/facebody/model/RecognizeHandGestureResult.h include/alibabacloud/facebody/model/RecognizePublicFaceRequest.h include/alibabacloud/facebody/model/RecognizePublicFaceResult.h + include/alibabacloud/facebody/model/RetouchBodyRequest.h + include/alibabacloud/facebody/model/RetouchBodyResult.h include/alibabacloud/facebody/model/SearchBodyTraceRequest.h include/alibabacloud/facebody/model/SearchBodyTraceResult.h include/alibabacloud/facebody/model/SearchFaceRequest.h @@ -258,6 +260,8 @@ set(facebody_src src/model/RecognizeHandGestureResult.cc src/model/RecognizePublicFaceRequest.cc src/model/RecognizePublicFaceResult.cc + src/model/RetouchBodyRequest.cc + src/model/RetouchBodyResult.cc src/model/SearchBodyTraceRequest.cc src/model/SearchBodyTraceResult.cc src/model/SearchFaceRequest.cc diff --git a/facebody/include/alibabacloud/facebody/FacebodyClient.h b/facebody/include/alibabacloud/facebody/FacebodyClient.h index e8241b8cd..084ff6d9c 100644 --- a/facebody/include/alibabacloud/facebody/FacebodyClient.h +++ b/facebody/include/alibabacloud/facebody/FacebodyClient.h @@ -134,6 +134,8 @@ #include "model/RecognizeHandGestureResult.h" #include "model/RecognizePublicFaceRequest.h" #include "model/RecognizePublicFaceResult.h" +#include "model/RetouchBodyRequest.h" +#include "model/RetouchBodyResult.h" #include "model/SearchBodyTraceRequest.h" #include "model/SearchBodyTraceResult.h" #include "model/SearchFaceRequest.h" @@ -321,6 +323,9 @@ namespace AlibabaCloud typedef Outcome RecognizePublicFaceOutcome; typedef std::future RecognizePublicFaceOutcomeCallable; typedef std::function&)> RecognizePublicFaceAsyncHandler; + typedef Outcome RetouchBodyOutcome; + typedef std::future RetouchBodyOutcomeCallable; + typedef std::function&)> RetouchBodyAsyncHandler; typedef Outcome SearchBodyTraceOutcome; typedef std::future SearchBodyTraceOutcomeCallable; typedef std::function&)> SearchBodyTraceAsyncHandler; @@ -509,6 +514,9 @@ namespace AlibabaCloud RecognizePublicFaceOutcome recognizePublicFace(const Model::RecognizePublicFaceRequest &request)const; void recognizePublicFaceAsync(const Model::RecognizePublicFaceRequest& request, const RecognizePublicFaceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; RecognizePublicFaceOutcomeCallable recognizePublicFaceCallable(const Model::RecognizePublicFaceRequest& request) const; + RetouchBodyOutcome retouchBody(const Model::RetouchBodyRequest &request)const; + void retouchBodyAsync(const Model::RetouchBodyRequest& request, const RetouchBodyAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + RetouchBodyOutcomeCallable retouchBodyCallable(const Model::RetouchBodyRequest& request) const; SearchBodyTraceOutcome searchBodyTrace(const Model::SearchBodyTraceRequest &request)const; void searchBodyTraceAsync(const Model::SearchBodyTraceRequest& request, const SearchBodyTraceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; SearchBodyTraceOutcomeCallable searchBodyTraceCallable(const Model::SearchBodyTraceRequest& request) const; diff --git a/facebody/include/alibabacloud/facebody/model/RetouchBodyRequest.h b/facebody/include/alibabacloud/facebody/model/RetouchBodyRequest.h new file mode 100644 index 000000000..109fdf773 --- /dev/null +++ b/facebody/include/alibabacloud/facebody/model/RetouchBodyRequest.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_FACEBODY_MODEL_RETOUCHBODYREQUEST_H_ +#define ALIBABACLOUD_FACEBODY_MODEL_RETOUCHBODYREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Facebody + { + namespace Model + { + class ALIBABACLOUD_FACEBODY_EXPORT RetouchBodyRequest : public RpcServiceRequest + { + + public: + RetouchBodyRequest(); + ~RetouchBodyRequest(); + + float getLengthenDegree()const; + void setLengthenDegree(float lengthenDegree); + float getSlimDegree()const; + void setSlimDegree(float slimDegree); + std::string getImageURL()const; + void setImageURL(const std::string& imageURL); + + private: + float lengthenDegree_; + float slimDegree_; + std::string imageURL_; + + }; + } + } +} +#endif // !ALIBABACLOUD_FACEBODY_MODEL_RETOUCHBODYREQUEST_H_ \ No newline at end of file diff --git a/facebody/include/alibabacloud/facebody/model/RetouchBodyResult.h b/facebody/include/alibabacloud/facebody/model/RetouchBodyResult.h new file mode 100644 index 000000000..67745bdcb --- /dev/null +++ b/facebody/include/alibabacloud/facebody/model/RetouchBodyResult.h @@ -0,0 +1,59 @@ +/* + * 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_FACEBODY_MODEL_RETOUCHBODYRESULT_H_ +#define ALIBABACLOUD_FACEBODY_MODEL_RETOUCHBODYRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Facebody + { + namespace Model + { + class ALIBABACLOUD_FACEBODY_EXPORT RetouchBodyResult : public ServiceResult + { + public: + struct Data + { + std::string imageURL; + }; + + + RetouchBodyResult(); + explicit RetouchBodyResult(const std::string &payload); + ~RetouchBodyResult(); + std::string getMessage()const; + Data getData()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + Data data_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_FACEBODY_MODEL_RETOUCHBODYRESULT_H_ \ No newline at end of file diff --git a/facebody/src/FacebodyClient.cc b/facebody/src/FacebodyClient.cc index d8da368f2..a94353f36 100644 --- a/facebody/src/FacebodyClient.cc +++ b/facebody/src/FacebodyClient.cc @@ -2067,6 +2067,42 @@ FacebodyClient::RecognizePublicFaceOutcomeCallable FacebodyClient::recognizePubl return task->get_future(); } +FacebodyClient::RetouchBodyOutcome FacebodyClient::retouchBody(const RetouchBodyRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return RetouchBodyOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return RetouchBodyOutcome(RetouchBodyResult(outcome.result())); + else + return RetouchBodyOutcome(outcome.error()); +} + +void FacebodyClient::retouchBodyAsync(const RetouchBodyRequest& request, const RetouchBodyAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, retouchBody(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +FacebodyClient::RetouchBodyOutcomeCallable FacebodyClient::retouchBodyCallable(const RetouchBodyRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->retouchBody(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + FacebodyClient::SearchBodyTraceOutcome FacebodyClient::searchBodyTrace(const SearchBodyTraceRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/facebody/src/model/RetouchBodyRequest.cc b/facebody/src/model/RetouchBodyRequest.cc new file mode 100644 index 000000000..ec7d57ddd --- /dev/null +++ b/facebody/src/model/RetouchBodyRequest.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::Facebody::Model::RetouchBodyRequest; + +RetouchBodyRequest::RetouchBodyRequest() : + RpcServiceRequest("facebody", "2019-12-30", "RetouchBody") +{ + setMethod(HttpRequest::Method::Post); +} + +RetouchBodyRequest::~RetouchBodyRequest() +{} + +float RetouchBodyRequest::getLengthenDegree()const +{ + return lengthenDegree_; +} + +void RetouchBodyRequest::setLengthenDegree(float lengthenDegree) +{ + lengthenDegree_ = lengthenDegree; + setBodyParameter("LengthenDegree", std::to_string(lengthenDegree)); +} + +float RetouchBodyRequest::getSlimDegree()const +{ + return slimDegree_; +} + +void RetouchBodyRequest::setSlimDegree(float slimDegree) +{ + slimDegree_ = slimDegree; + setBodyParameter("SlimDegree", std::to_string(slimDegree)); +} + +std::string RetouchBodyRequest::getImageURL()const +{ + return imageURL_; +} + +void RetouchBodyRequest::setImageURL(const std::string& imageURL) +{ + imageURL_ = imageURL; + setBodyParameter("ImageURL", imageURL); +} + diff --git a/facebody/src/model/RetouchBodyResult.cc b/facebody/src/model/RetouchBodyResult.cc new file mode 100644 index 000000000..5930e92c3 --- /dev/null +++ b/facebody/src/model/RetouchBodyResult.cc @@ -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. + */ + +#include +#include + +using namespace AlibabaCloud::Facebody; +using namespace AlibabaCloud::Facebody::Model; + +RetouchBodyResult::RetouchBodyResult() : + ServiceResult() +{} + +RetouchBodyResult::RetouchBodyResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +RetouchBodyResult::~RetouchBodyResult() +{} + +void RetouchBodyResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + if(!dataNode["ImageURL"].isNull()) + data_.imageURL = dataNode["ImageURL"].asString(); + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string RetouchBodyResult::getMessage()const +{ + return message_; +} + +RetouchBodyResult::Data RetouchBodyResult::getData()const +{ + return data_; +} + +std::string RetouchBodyResult::getCode()const +{ + return code_; +} +