Przeglądaj źródła

Release SegmentSkin.

sdk-team 6 lat temu
rodzic
commit
2f33b44e80

+ 3 - 0
CHANGELOG

@@ -1,3 +1,6 @@
+2020-10-13 Version: patch
+- Release SegmentSkin.
+
 2020-10-12 Version: patch
 - Support add webhook, get repository info via id or path.
 

+ 4 - 0
imageseg/CMakeLists.txt

@@ -55,6 +55,8 @@ set(imageseg_public_header_model
 	include/alibabacloud/imageseg/model/SegmentLogoResult.h
 	include/alibabacloud/imageseg/model/SegmentSceneRequest.h
 	include/alibabacloud/imageseg/model/SegmentSceneResult.h
+	include/alibabacloud/imageseg/model/SegmentSkinRequest.h
+	include/alibabacloud/imageseg/model/SegmentSkinResult.h
 	include/alibabacloud/imageseg/model/SegmentSkyRequest.h
 	include/alibabacloud/imageseg/model/SegmentSkyResult.h
 	include/alibabacloud/imageseg/model/SegmentVehicleRequest.h
@@ -96,6 +98,8 @@ set(imageseg_src
 	src/model/SegmentLogoResult.cc
 	src/model/SegmentSceneRequest.cc
 	src/model/SegmentSceneResult.cc
+	src/model/SegmentSkinRequest.cc
+	src/model/SegmentSkinResult.cc
 	src/model/SegmentSkyRequest.cc
 	src/model/SegmentSkyResult.cc
 	src/model/SegmentVehicleRequest.cc

+ 8 - 0
imageseg/include/alibabacloud/imageseg/ImagesegClient.h

@@ -56,6 +56,8 @@
 #include "model/SegmentLogoResult.h"
 #include "model/SegmentSceneRequest.h"
 #include "model/SegmentSceneResult.h"
+#include "model/SegmentSkinRequest.h"
+#include "model/SegmentSkinResult.h"
 #include "model/SegmentSkyRequest.h"
 #include "model/SegmentSkyResult.h"
 #include "model/SegmentVehicleRequest.h"
@@ -120,6 +122,9 @@ namespace AlibabaCloud
 			typedef Outcome<Error, Model::SegmentSceneResult> SegmentSceneOutcome;
 			typedef std::future<SegmentSceneOutcome> SegmentSceneOutcomeCallable;
 			typedef std::function<void(const ImagesegClient*, const Model::SegmentSceneRequest&, const SegmentSceneOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SegmentSceneAsyncHandler;
+			typedef Outcome<Error, Model::SegmentSkinResult> SegmentSkinOutcome;
+			typedef std::future<SegmentSkinOutcome> SegmentSkinOutcomeCallable;
+			typedef std::function<void(const ImagesegClient*, const Model::SegmentSkinRequest&, const SegmentSkinOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SegmentSkinAsyncHandler;
 			typedef Outcome<Error, Model::SegmentSkyResult> SegmentSkyOutcome;
 			typedef std::future<SegmentSkyOutcome> SegmentSkyOutcomeCallable;
 			typedef std::function<void(const ImagesegClient*, const Model::SegmentSkyRequest&, const SegmentSkyOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SegmentSkyAsyncHandler;
@@ -182,6 +187,9 @@ namespace AlibabaCloud
 			SegmentSceneOutcome segmentScene(const Model::SegmentSceneRequest &request)const;
 			void segmentSceneAsync(const Model::SegmentSceneRequest& request, const SegmentSceneAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			SegmentSceneOutcomeCallable segmentSceneCallable(const Model::SegmentSceneRequest& request) const;
+			SegmentSkinOutcome segmentSkin(const Model::SegmentSkinRequest &request)const;
+			void segmentSkinAsync(const Model::SegmentSkinRequest& request, const SegmentSkinAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
+			SegmentSkinOutcomeCallable segmentSkinCallable(const Model::SegmentSkinRequest& request) const;
 			SegmentSkyOutcome segmentSky(const Model::SegmentSkyRequest &request)const;
 			void segmentSkyAsync(const Model::SegmentSkyRequest& request, const SegmentSkyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			SegmentSkyOutcomeCallable segmentSkyCallable(const Model::SegmentSkyRequest& request) const;

+ 48 - 0
imageseg/include/alibabacloud/imageseg/model/SegmentSkinRequest.h

@@ -0,0 +1,48 @@
+/*
+ * 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_IMAGESEG_MODEL_SEGMENTSKINREQUEST_H_
+#define ALIBABACLOUD_IMAGESEG_MODEL_SEGMENTSKINREQUEST_H_
+
+#include <string>
+#include <vector>
+#include <alibabacloud/core/RpcServiceRequest.h>
+#include <alibabacloud/imageseg/ImagesegExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Imageseg
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_IMAGESEG_EXPORT SegmentSkinRequest : public RpcServiceRequest
+			{
+
+			public:
+				SegmentSkinRequest();
+				~SegmentSkinRequest();
+
+				std::string getURL()const;
+				void setURL(const std::string& uRL);
+
+            private:
+				std::string uRL_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_IMAGESEG_MODEL_SEGMENTSKINREQUEST_H_

+ 55 - 0
imageseg/include/alibabacloud/imageseg/model/SegmentSkinResult.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_IMAGESEG_MODEL_SEGMENTSKINRESULT_H_
+#define ALIBABACLOUD_IMAGESEG_MODEL_SEGMENTSKINRESULT_H_
+
+#include <string>
+#include <vector>
+#include <utility>
+#include <alibabacloud/core/ServiceResult.h>
+#include <alibabacloud/imageseg/ImagesegExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Imageseg
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_IMAGESEG_EXPORT SegmentSkinResult : public ServiceResult
+			{
+			public:
+				struct Data
+				{
+					std::string uRL;
+				};
+
+
+				SegmentSkinResult();
+				explicit SegmentSkinResult(const std::string &payload);
+				~SegmentSkinResult();
+				Data getData()const;
+
+			protected:
+				void parse(const std::string &payload);
+			private:
+				Data data_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_IMAGESEG_MODEL_SEGMENTSKINRESULT_H_

+ 36 - 0
imageseg/src/ImagesegClient.cc

@@ -663,6 +663,42 @@ ImagesegClient::SegmentSceneOutcomeCallable ImagesegClient::segmentSceneCallable
 	return task->get_future();
 }
 
+ImagesegClient::SegmentSkinOutcome ImagesegClient::segmentSkin(const SegmentSkinRequest &request) const
+{
+	auto endpointOutcome = endpointProvider_->getEndpoint();
+	if (!endpointOutcome.isSuccess())
+		return SegmentSkinOutcome(endpointOutcome.error());
+
+	auto outcome = makeRequest(endpointOutcome.result(), request);
+
+	if (outcome.isSuccess())
+		return SegmentSkinOutcome(SegmentSkinResult(outcome.result()));
+	else
+		return SegmentSkinOutcome(outcome.error());
+}
+
+void ImagesegClient::segmentSkinAsync(const SegmentSkinRequest& request, const SegmentSkinAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
+{
+	auto fn = [this, request, handler, context]()
+	{
+		handler(this, request, segmentSkin(request), context);
+	};
+
+	asyncExecute(new Runnable(fn));
+}
+
+ImagesegClient::SegmentSkinOutcomeCallable ImagesegClient::segmentSkinCallable(const SegmentSkinRequest &request) const
+{
+	auto task = std::make_shared<std::packaged_task<SegmentSkinOutcome()>>(
+			[this, request]()
+			{
+			return this->segmentSkin(request);
+			});
+
+	asyncExecute(new Runnable([task]() { (*task)(); }));
+	return task->get_future();
+}
+
 ImagesegClient::SegmentSkyOutcome ImagesegClient::segmentSky(const SegmentSkyRequest &request) const
 {
 	auto endpointOutcome = endpointProvider_->getEndpoint();

+ 40 - 0
imageseg/src/model/SegmentSkinRequest.cc

@@ -0,0 +1,40 @@
+/*
+ * 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/imageseg/model/SegmentSkinRequest.h>
+
+using AlibabaCloud::Imageseg::Model::SegmentSkinRequest;
+
+SegmentSkinRequest::SegmentSkinRequest() :
+	RpcServiceRequest("imageseg", "2019-12-30", "SegmentSkin")
+{
+	setMethod(HttpRequest::Method::Post);
+}
+
+SegmentSkinRequest::~SegmentSkinRequest()
+{}
+
+std::string SegmentSkinRequest::getURL()const
+{
+	return uRL_;
+}
+
+void SegmentSkinRequest::setURL(const std::string& uRL)
+{
+	uRL_ = uRL;
+	setBodyParameter("URL", uRL);
+}
+

+ 52 - 0
imageseg/src/model/SegmentSkinResult.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/imageseg/model/SegmentSkinResult.h>
+#include <json/json.h>
+
+using namespace AlibabaCloud::Imageseg;
+using namespace AlibabaCloud::Imageseg::Model;
+
+SegmentSkinResult::SegmentSkinResult() :
+	ServiceResult()
+{}
+
+SegmentSkinResult::SegmentSkinResult(const std::string &payload) :
+	ServiceResult()
+{
+	parse(payload);
+}
+
+SegmentSkinResult::~SegmentSkinResult()
+{}
+
+void SegmentSkinResult::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["URL"].isNull())
+		data_.uRL = dataNode["URL"].asString();
+
+}
+
+SegmentSkinResult::Data SegmentSkinResult::getData()const
+{
+	return data_;
+}
+