Explorar el Código

Release ErasePerson.

sdk-team hace 5 años
padre
commit
f3b00eade0

+ 3 - 0
CHANGELOG

@@ -1,3 +1,6 @@
+2020-11-13 Version: patch
+- Release ErasePerson.
+
 2020-11-13 Version: patch
 - Release DetectCardScreenshot RecognizePoiName.
 

+ 4 - 0
imageenhan/CMakeLists.txt

@@ -31,6 +31,8 @@ set(imageenhan_public_header_model
 	include/alibabacloud/imageenhan/model/ChangeImageSizeResult.h
 	include/alibabacloud/imageenhan/model/EnhanceImageColorRequest.h
 	include/alibabacloud/imageenhan/model/EnhanceImageColorResult.h
+	include/alibabacloud/imageenhan/model/ErasePersonRequest.h
+	include/alibabacloud/imageenhan/model/ErasePersonResult.h
 	include/alibabacloud/imageenhan/model/ExtendImageStyleRequest.h
 	include/alibabacloud/imageenhan/model/ExtendImageStyleResult.h
 	include/alibabacloud/imageenhan/model/GenerateDynamicImageRequest.h
@@ -68,6 +70,8 @@ set(imageenhan_src
 	src/model/ChangeImageSizeResult.cc
 	src/model/EnhanceImageColorRequest.cc
 	src/model/EnhanceImageColorResult.cc
+	src/model/ErasePersonRequest.cc
+	src/model/ErasePersonResult.cc
 	src/model/ExtendImageStyleRequest.cc
 	src/model/ExtendImageStyleResult.cc
 	src/model/GenerateDynamicImageRequest.cc

+ 8 - 0
imageenhan/include/alibabacloud/imageenhan/ImageenhanClient.h

@@ -32,6 +32,8 @@
 #include "model/ChangeImageSizeResult.h"
 #include "model/EnhanceImageColorRequest.h"
 #include "model/EnhanceImageColorResult.h"
+#include "model/ErasePersonRequest.h"
+#include "model/ErasePersonResult.h"
 #include "model/ExtendImageStyleRequest.h"
 #include "model/ExtendImageStyleResult.h"
 #include "model/GenerateDynamicImageRequest.h"
@@ -80,6 +82,9 @@ namespace AlibabaCloud
 			typedef Outcome<Error, Model::EnhanceImageColorResult> EnhanceImageColorOutcome;
 			typedef std::future<EnhanceImageColorOutcome> EnhanceImageColorOutcomeCallable;
 			typedef std::function<void(const ImageenhanClient*, const Model::EnhanceImageColorRequest&, const EnhanceImageColorOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> EnhanceImageColorAsyncHandler;
+			typedef Outcome<Error, Model::ErasePersonResult> ErasePersonOutcome;
+			typedef std::future<ErasePersonOutcome> ErasePersonOutcomeCallable;
+			typedef std::function<void(const ImageenhanClient*, const Model::ErasePersonRequest&, const ErasePersonOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ErasePersonAsyncHandler;
 			typedef Outcome<Error, Model::ExtendImageStyleResult> ExtendImageStyleOutcome;
 			typedef std::future<ExtendImageStyleOutcome> ExtendImageStyleOutcomeCallable;
 			typedef std::function<void(const ImageenhanClient*, const Model::ExtendImageStyleRequest&, const ExtendImageStyleOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ExtendImageStyleAsyncHandler;
@@ -136,6 +141,9 @@ namespace AlibabaCloud
 			EnhanceImageColorOutcome enhanceImageColor(const Model::EnhanceImageColorRequest &request)const;
 			void enhanceImageColorAsync(const Model::EnhanceImageColorRequest& request, const EnhanceImageColorAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			EnhanceImageColorOutcomeCallable enhanceImageColorCallable(const Model::EnhanceImageColorRequest& request) const;
+			ErasePersonOutcome erasePerson(const Model::ErasePersonRequest &request)const;
+			void erasePersonAsync(const Model::ErasePersonRequest& request, const ErasePersonAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
+			ErasePersonOutcomeCallable erasePersonCallable(const Model::ErasePersonRequest& request) const;
 			ExtendImageStyleOutcome extendImageStyle(const Model::ExtendImageStyleRequest &request)const;
 			void extendImageStyleAsync(const Model::ExtendImageStyleRequest& request, const ExtendImageStyleAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			ExtendImageStyleOutcomeCallable extendImageStyleCallable(const Model::ExtendImageStyleRequest& request) const;

+ 51 - 0
imageenhan/include/alibabacloud/imageenhan/model/ErasePersonRequest.h

@@ -0,0 +1,51 @@
+/*
+ * 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_IMAGEENHAN_MODEL_ERASEPERSONREQUEST_H_
+#define ALIBABACLOUD_IMAGEENHAN_MODEL_ERASEPERSONREQUEST_H_
+
+#include <string>
+#include <vector>
+#include <alibabacloud/core/RpcServiceRequest.h>
+#include <alibabacloud/imageenhan/ImageenhanExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Imageenhan
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_IMAGEENHAN_EXPORT ErasePersonRequest : public RpcServiceRequest
+			{
+
+			public:
+				ErasePersonRequest();
+				~ErasePersonRequest();
+
+				std::string getImageURL()const;
+				void setImageURL(const std::string& imageURL);
+				std::string getUserMask()const;
+				void setUserMask(const std::string& userMask);
+
+            private:
+				std::string imageURL_;
+				std::string userMask_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_IMAGEENHAN_MODEL_ERASEPERSONREQUEST_H_

+ 55 - 0
imageenhan/include/alibabacloud/imageenhan/model/ErasePersonResult.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_IMAGEENHAN_MODEL_ERASEPERSONRESULT_H_
+#define ALIBABACLOUD_IMAGEENHAN_MODEL_ERASEPERSONRESULT_H_
+
+#include <string>
+#include <vector>
+#include <utility>
+#include <alibabacloud/core/ServiceResult.h>
+#include <alibabacloud/imageenhan/ImageenhanExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Imageenhan
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_IMAGEENHAN_EXPORT ErasePersonResult : public ServiceResult
+			{
+			public:
+				struct Data
+				{
+					std::string imageUrl;
+				};
+
+
+				ErasePersonResult();
+				explicit ErasePersonResult(const std::string &payload);
+				~ErasePersonResult();
+				Data getData()const;
+
+			protected:
+				void parse(const std::string &payload);
+			private:
+				Data data_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_IMAGEENHAN_MODEL_ERASEPERSONRESULT_H_

+ 36 - 0
imageenhan/src/ImageenhanClient.cc

@@ -231,6 +231,42 @@ ImageenhanClient::EnhanceImageColorOutcomeCallable ImageenhanClient::enhanceImag
 	return task->get_future();
 }
 
+ImageenhanClient::ErasePersonOutcome ImageenhanClient::erasePerson(const ErasePersonRequest &request) const
+{
+	auto endpointOutcome = endpointProvider_->getEndpoint();
+	if (!endpointOutcome.isSuccess())
+		return ErasePersonOutcome(endpointOutcome.error());
+
+	auto outcome = makeRequest(endpointOutcome.result(), request);
+
+	if (outcome.isSuccess())
+		return ErasePersonOutcome(ErasePersonResult(outcome.result()));
+	else
+		return ErasePersonOutcome(outcome.error());
+}
+
+void ImageenhanClient::erasePersonAsync(const ErasePersonRequest& request, const ErasePersonAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
+{
+	auto fn = [this, request, handler, context]()
+	{
+		handler(this, request, erasePerson(request), context);
+	};
+
+	asyncExecute(new Runnable(fn));
+}
+
+ImageenhanClient::ErasePersonOutcomeCallable ImageenhanClient::erasePersonCallable(const ErasePersonRequest &request) const
+{
+	auto task = std::make_shared<std::packaged_task<ErasePersonOutcome()>>(
+			[this, request]()
+			{
+			return this->erasePerson(request);
+			});
+
+	asyncExecute(new Runnable([task]() { (*task)(); }));
+	return task->get_future();
+}
+
 ImageenhanClient::ExtendImageStyleOutcome ImageenhanClient::extendImageStyle(const ExtendImageStyleRequest &request) const
 {
 	auto endpointOutcome = endpointProvider_->getEndpoint();

+ 51 - 0
imageenhan/src/model/ErasePersonRequest.cc

@@ -0,0 +1,51 @@
+/*
+ * 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 <alibabacloud/imageenhan/model/ErasePersonRequest.h>
+
+using AlibabaCloud::Imageenhan::Model::ErasePersonRequest;
+
+ErasePersonRequest::ErasePersonRequest() :
+	RpcServiceRequest("imageenhan", "2019-09-30", "ErasePerson")
+{
+	setMethod(HttpRequest::Method::Post);
+}
+
+ErasePersonRequest::~ErasePersonRequest()
+{}
+
+std::string ErasePersonRequest::getImageURL()const
+{
+	return imageURL_;
+}
+
+void ErasePersonRequest::setImageURL(const std::string& imageURL)
+{
+	imageURL_ = imageURL;
+	setBodyParameter("ImageURL", imageURL);
+}
+
+std::string ErasePersonRequest::getUserMask()const
+{
+	return userMask_;
+}
+
+void ErasePersonRequest::setUserMask(const std::string& userMask)
+{
+	userMask_ = userMask;
+	setBodyParameter("UserMask", userMask);
+}
+

+ 52 - 0
imageenhan/src/model/ErasePersonResult.cc

@@ -0,0 +1,52 @@
+/*
+ * 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 <alibabacloud/imageenhan/model/ErasePersonResult.h>
+#include <json/json.h>
+
+using namespace AlibabaCloud::Imageenhan;
+using namespace AlibabaCloud::Imageenhan::Model;
+
+ErasePersonResult::ErasePersonResult() :
+	ServiceResult()
+{}
+
+ErasePersonResult::ErasePersonResult(const std::string &payload) :
+	ServiceResult()
+{
+	parse(payload);
+}
+
+ErasePersonResult::~ErasePersonResult()
+{}
+
+void ErasePersonResult::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();
+
+}
+
+ErasePersonResult::Data ErasePersonResult::getData()const
+{
+	return data_;
+}
+