Kaynağa Gözat

Update TaggingImage.

sdk-team 5 yıl önce
ebeveyn
işleme
1b54ddd725

+ 3 - 0
CHANGELOG

@@ -1,3 +1,6 @@
+2021-02-04 Version: patch
+- Update TaggingImage.
+
 2021-02-03 Version: patch
 - After normalizing the API group name, regenerate the SDK.
 

+ 4 - 0
imagerecog/CMakeLists.txt

@@ -29,6 +29,8 @@ set(imagerecog_public_header_model
 	include/alibabacloud/imagerecog/model/DetectImageElementsResult.h
 	include/alibabacloud/imagerecog/model/EvaluateCertificateQualityRequest.h
 	include/alibabacloud/imagerecog/model/EvaluateCertificateQualityResult.h
+	include/alibabacloud/imagerecog/model/GetAsyncJobResultRequest.h
+	include/alibabacloud/imagerecog/model/GetAsyncJobResultResult.h
 	include/alibabacloud/imagerecog/model/RecognizeFoodRequest.h
 	include/alibabacloud/imagerecog/model/RecognizeFoodResult.h
 	include/alibabacloud/imagerecog/model/RecognizeImageColorRequest.h
@@ -54,6 +56,8 @@ set(imagerecog_src
 	src/model/DetectImageElementsResult.cc
 	src/model/EvaluateCertificateQualityRequest.cc
 	src/model/EvaluateCertificateQualityResult.cc
+	src/model/GetAsyncJobResultRequest.cc
+	src/model/GetAsyncJobResultResult.cc
 	src/model/RecognizeFoodRequest.cc
 	src/model/RecognizeFoodResult.cc
 	src/model/RecognizeImageColorRequest.cc

+ 8 - 0
imagerecog/include/alibabacloud/imagerecog/ImagerecogClient.h

@@ -30,6 +30,8 @@
 #include "model/DetectImageElementsResult.h"
 #include "model/EvaluateCertificateQualityRequest.h"
 #include "model/EvaluateCertificateQualityResult.h"
+#include "model/GetAsyncJobResultRequest.h"
+#include "model/GetAsyncJobResultResult.h"
 #include "model/RecognizeFoodRequest.h"
 #include "model/RecognizeFoodResult.h"
 #include "model/RecognizeImageColorRequest.h"
@@ -65,6 +67,9 @@ namespace AlibabaCloud
 			typedef Outcome<Error, Model::EvaluateCertificateQualityResult> EvaluateCertificateQualityOutcome;
 			typedef std::future<EvaluateCertificateQualityOutcome> EvaluateCertificateQualityOutcomeCallable;
 			typedef std::function<void(const ImagerecogClient*, const Model::EvaluateCertificateQualityRequest&, const EvaluateCertificateQualityOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> EvaluateCertificateQualityAsyncHandler;
+			typedef Outcome<Error, Model::GetAsyncJobResultResult> GetAsyncJobResultOutcome;
+			typedef std::future<GetAsyncJobResultOutcome> GetAsyncJobResultOutcomeCallable;
+			typedef std::function<void(const ImagerecogClient*, const Model::GetAsyncJobResultRequest&, const GetAsyncJobResultOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetAsyncJobResultAsyncHandler;
 			typedef Outcome<Error, Model::RecognizeFoodResult> RecognizeFoodOutcome;
 			typedef std::future<RecognizeFoodOutcome> RecognizeFoodOutcomeCallable;
 			typedef std::function<void(const ImagerecogClient*, const Model::RecognizeFoodRequest&, const RecognizeFoodOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RecognizeFoodAsyncHandler;
@@ -103,6 +108,9 @@ namespace AlibabaCloud
 			EvaluateCertificateQualityOutcome evaluateCertificateQuality(const Model::EvaluateCertificateQualityRequest &request)const;
 			void evaluateCertificateQualityAsync(const Model::EvaluateCertificateQualityRequest& request, const EvaluateCertificateQualityAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			EvaluateCertificateQualityOutcomeCallable evaluateCertificateQualityCallable(const Model::EvaluateCertificateQualityRequest& request) const;
+			GetAsyncJobResultOutcome getAsyncJobResult(const Model::GetAsyncJobResultRequest &request)const;
+			void getAsyncJobResultAsync(const Model::GetAsyncJobResultRequest& request, const GetAsyncJobResultAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
+			GetAsyncJobResultOutcomeCallable getAsyncJobResultCallable(const Model::GetAsyncJobResultRequest& request) const;
 			RecognizeFoodOutcome recognizeFood(const Model::RecognizeFoodRequest &request)const;
 			void recognizeFoodAsync(const Model::RecognizeFoodRequest& request, const RecognizeFoodAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			RecognizeFoodOutcomeCallable recognizeFoodCallable(const Model::RecognizeFoodRequest& request) const;

+ 51 - 0
imagerecog/include/alibabacloud/imagerecog/model/GetAsyncJobResultRequest.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_IMAGERECOG_MODEL_GETASYNCJOBRESULTREQUEST_H_
+#define ALIBABACLOUD_IMAGERECOG_MODEL_GETASYNCJOBRESULTREQUEST_H_
+
+#include <string>
+#include <vector>
+#include <alibabacloud/core/RpcServiceRequest.h>
+#include <alibabacloud/imagerecog/ImagerecogExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Imagerecog
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_IMAGERECOG_EXPORT GetAsyncJobResultRequest : public RpcServiceRequest
+			{
+
+			public:
+				GetAsyncJobResultRequest();
+				~GetAsyncJobResultRequest();
+
+				std::string getJobId()const;
+				void setJobId(const std::string& jobId);
+				std::string getAsync()const;
+				void setAsync(const std::string& async);
+
+            private:
+				std::string jobId_;
+				std::string async_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_IMAGERECOG_MODEL_GETASYNCJOBRESULTREQUEST_H_

+ 59 - 0
imagerecog/include/alibabacloud/imagerecog/model/GetAsyncJobResultResult.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_IMAGERECOG_MODEL_GETASYNCJOBRESULTRESULT_H_
+#define ALIBABACLOUD_IMAGERECOG_MODEL_GETASYNCJOBRESULTRESULT_H_
+
+#include <string>
+#include <vector>
+#include <utility>
+#include <alibabacloud/core/ServiceResult.h>
+#include <alibabacloud/imagerecog/ImagerecogExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Imagerecog
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_IMAGERECOG_EXPORT GetAsyncJobResultResult : public ServiceResult
+			{
+			public:
+				struct Data
+				{
+					std::string status;
+					std::string errorCode;
+					std::string errorMessage;
+					std::string jobId;
+					std::string result;
+				};
+
+
+				GetAsyncJobResultResult();
+				explicit GetAsyncJobResultResult(const std::string &payload);
+				~GetAsyncJobResultResult();
+				Data getData()const;
+
+			protected:
+				void parse(const std::string &payload);
+			private:
+				Data data_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_IMAGERECOG_MODEL_GETASYNCJOBRESULTRESULT_H_

+ 3 - 0
imagerecog/include/alibabacloud/imagerecog/model/TaggingImageRequest.h

@@ -37,11 +37,14 @@ namespace AlibabaCloud
 
 				int getImageType()const;
 				void setImageType(int imageType);
+				bool getAsync()const;
+				void setAsync(bool async);
 				std::string getImageURL()const;
 				void setImageURL(const std::string& imageURL);
 
             private:
 				int imageType_;
+				bool async_;
 				std::string imageURL_;
 
 			};

+ 36 - 0
imagerecog/src/ImagerecogClient.cc

@@ -195,6 +195,42 @@ ImagerecogClient::EvaluateCertificateQualityOutcomeCallable ImagerecogClient::ev
 	return task->get_future();
 }
 
+ImagerecogClient::GetAsyncJobResultOutcome ImagerecogClient::getAsyncJobResult(const GetAsyncJobResultRequest &request) const
+{
+	auto endpointOutcome = endpointProvider_->getEndpoint();
+	if (!endpointOutcome.isSuccess())
+		return GetAsyncJobResultOutcome(endpointOutcome.error());
+
+	auto outcome = makeRequest(endpointOutcome.result(), request);
+
+	if (outcome.isSuccess())
+		return GetAsyncJobResultOutcome(GetAsyncJobResultResult(outcome.result()));
+	else
+		return GetAsyncJobResultOutcome(outcome.error());
+}
+
+void ImagerecogClient::getAsyncJobResultAsync(const GetAsyncJobResultRequest& request, const GetAsyncJobResultAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
+{
+	auto fn = [this, request, handler, context]()
+	{
+		handler(this, request, getAsyncJobResult(request), context);
+	};
+
+	asyncExecute(new Runnable(fn));
+}
+
+ImagerecogClient::GetAsyncJobResultOutcomeCallable ImagerecogClient::getAsyncJobResultCallable(const GetAsyncJobResultRequest &request) const
+{
+	auto task = std::make_shared<std::packaged_task<GetAsyncJobResultOutcome()>>(
+			[this, request]()
+			{
+			return this->getAsyncJobResult(request);
+			});
+
+	asyncExecute(new Runnable([task]() { (*task)(); }));
+	return task->get_future();
+}
+
 ImagerecogClient::RecognizeFoodOutcome ImagerecogClient::recognizeFood(const RecognizeFoodRequest &request) const
 {
 	auto endpointOutcome = endpointProvider_->getEndpoint();

+ 51 - 0
imagerecog/src/model/GetAsyncJobResultRequest.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/imagerecog/model/GetAsyncJobResultRequest.h>
+
+using AlibabaCloud::Imagerecog::Model::GetAsyncJobResultRequest;
+
+GetAsyncJobResultRequest::GetAsyncJobResultRequest() :
+	RpcServiceRequest("imagerecog", "2019-09-30", "GetAsyncJobResult")
+{
+	setMethod(HttpRequest::Method::Get);
+}
+
+GetAsyncJobResultRequest::~GetAsyncJobResultRequest()
+{}
+
+std::string GetAsyncJobResultRequest::getJobId()const
+{
+	return jobId_;
+}
+
+void GetAsyncJobResultRequest::setJobId(const std::string& jobId)
+{
+	jobId_ = jobId;
+	setParameter("JobId", jobId);
+}
+
+std::string GetAsyncJobResultRequest::getAsync()const
+{
+	return async_;
+}
+
+void GetAsyncJobResultRequest::setAsync(const std::string& async)
+{
+	async_ = async;
+	setParameter("Async", async);
+}
+

+ 60 - 0
imagerecog/src/model/GetAsyncJobResultResult.cc

@@ -0,0 +1,60 @@
+/*
+ * 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/imagerecog/model/GetAsyncJobResultResult.h>
+#include <json/json.h>
+
+using namespace AlibabaCloud::Imagerecog;
+using namespace AlibabaCloud::Imagerecog::Model;
+
+GetAsyncJobResultResult::GetAsyncJobResultResult() :
+	ServiceResult()
+{}
+
+GetAsyncJobResultResult::GetAsyncJobResultResult(const std::string &payload) :
+	ServiceResult()
+{
+	parse(payload);
+}
+
+GetAsyncJobResultResult::~GetAsyncJobResultResult()
+{}
+
+void GetAsyncJobResultResult::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["Status"].isNull())
+		data_.status = dataNode["Status"].asString();
+	if(!dataNode["ErrorCode"].isNull())
+		data_.errorCode = dataNode["ErrorCode"].asString();
+	if(!dataNode["ErrorMessage"].isNull())
+		data_.errorMessage = dataNode["ErrorMessage"].asString();
+	if(!dataNode["JobId"].isNull())
+		data_.jobId = dataNode["JobId"].asString();
+	if(!dataNode["Result"].isNull())
+		data_.result = dataNode["Result"].asString();
+
+}
+
+GetAsyncJobResultResult::Data GetAsyncJobResultResult::getData()const
+{
+	return data_;
+}
+

+ 11 - 0
imagerecog/src/model/TaggingImageRequest.cc

@@ -38,6 +38,17 @@ void TaggingImageRequest::setImageType(int imageType)
 	setBodyParameter("ImageType", std::to_string(imageType));
 }
 
+bool TaggingImageRequest::getAsync()const
+{
+	return async_;
+}
+
+void TaggingImageRequest::setAsync(bool async)
+{
+	async_ = async;
+	setBodyParameter("Async", async ? "true" : "false");
+}
+
 std::string TaggingImageRequest::getImageURL()const
 {
 	return imageURL_;