Browse Source

Release TaggingAdImage.

sdk-team 5 years ago
parent
commit
34a37c33b2

+ 3 - 0
CHANGELOG

@@ -1,3 +1,6 @@
+2021-08-04 Version: 1.36.840
+- Release TaggingAdImage.
+
 2021-08-04 Version: 1.36.839
 - Create Lindorm Open api.
 

+ 1 - 1
VERSION

@@ -1 +1 @@
-1.36.839
+1.36.840

+ 4 - 0
imagerecog/CMakeLists.txt

@@ -43,6 +43,8 @@ set(imagerecog_public_header_model
 	include/alibabacloud/imagerecog/model/RecognizeSceneResult.h
 	include/alibabacloud/imagerecog/model/RecognizeVehicleTypeRequest.h
 	include/alibabacloud/imagerecog/model/RecognizeVehicleTypeResult.h
+	include/alibabacloud/imagerecog/model/TaggingAdImageRequest.h
+	include/alibabacloud/imagerecog/model/TaggingAdImageResult.h
 	include/alibabacloud/imagerecog/model/TaggingImageRequest.h
 	include/alibabacloud/imagerecog/model/TaggingImageResult.h )
 
@@ -70,6 +72,8 @@ set(imagerecog_src
 	src/model/RecognizeSceneResult.cc
 	src/model/RecognizeVehicleTypeRequest.cc
 	src/model/RecognizeVehicleTypeResult.cc
+	src/model/TaggingAdImageRequest.cc
+	src/model/TaggingAdImageResult.cc
 	src/model/TaggingImageRequest.cc
 	src/model/TaggingImageResult.cc )
 

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

@@ -44,6 +44,8 @@
 #include "model/RecognizeSceneResult.h"
 #include "model/RecognizeVehicleTypeRequest.h"
 #include "model/RecognizeVehicleTypeResult.h"
+#include "model/TaggingAdImageRequest.h"
+#include "model/TaggingAdImageResult.h"
 #include "model/TaggingImageRequest.h"
 #include "model/TaggingImageResult.h"
 
@@ -88,6 +90,9 @@ namespace AlibabaCloud
 			typedef Outcome<Error, Model::RecognizeVehicleTypeResult> RecognizeVehicleTypeOutcome;
 			typedef std::future<RecognizeVehicleTypeOutcome> RecognizeVehicleTypeOutcomeCallable;
 			typedef std::function<void(const ImagerecogClient*, const Model::RecognizeVehicleTypeRequest&, const RecognizeVehicleTypeOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RecognizeVehicleTypeAsyncHandler;
+			typedef Outcome<Error, Model::TaggingAdImageResult> TaggingAdImageOutcome;
+			typedef std::future<TaggingAdImageOutcome> TaggingAdImageOutcomeCallable;
+			typedef std::function<void(const ImagerecogClient*, const Model::TaggingAdImageRequest&, const TaggingAdImageOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TaggingAdImageAsyncHandler;
 			typedef Outcome<Error, Model::TaggingImageResult> TaggingImageOutcome;
 			typedef std::future<TaggingImageOutcome> TaggingImageOutcomeCallable;
 			typedef std::function<void(const ImagerecogClient*, const Model::TaggingImageRequest&, const TaggingImageOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TaggingImageAsyncHandler;
@@ -129,6 +134,9 @@ namespace AlibabaCloud
 			RecognizeVehicleTypeOutcome recognizeVehicleType(const Model::RecognizeVehicleTypeRequest &request)const;
 			void recognizeVehicleTypeAsync(const Model::RecognizeVehicleTypeRequest& request, const RecognizeVehicleTypeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			RecognizeVehicleTypeOutcomeCallable recognizeVehicleTypeCallable(const Model::RecognizeVehicleTypeRequest& request) const;
+			TaggingAdImageOutcome taggingAdImage(const Model::TaggingAdImageRequest &request)const;
+			void taggingAdImageAsync(const Model::TaggingAdImageRequest& request, const TaggingAdImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
+			TaggingAdImageOutcomeCallable taggingAdImageCallable(const Model::TaggingAdImageRequest& request) const;
 			TaggingImageOutcome taggingImage(const Model::TaggingImageRequest &request)const;
 			void taggingImageAsync(const Model::TaggingImageRequest& request, const TaggingImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			TaggingImageOutcomeCallable taggingImageCallable(const Model::TaggingImageRequest& request) const;

+ 54 - 0
imagerecog/include/alibabacloud/imagerecog/model/TaggingAdImageRequest.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_IMAGERECOG_MODEL_TAGGINGADIMAGEREQUEST_H_
+#define ALIBABACLOUD_IMAGERECOG_MODEL_TAGGINGADIMAGEREQUEST_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 TaggingAdImageRequest : public RpcServiceRequest
+			{
+
+			public:
+				TaggingAdImageRequest();
+				~TaggingAdImageRequest();
+
+				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_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_IMAGERECOG_MODEL_TAGGINGADIMAGEREQUEST_H_

+ 64 - 0
imagerecog/include/alibabacloud/imagerecog/model/TaggingAdImageResult.h

@@ -0,0 +1,64 @@
+/*
+ * 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_TAGGINGADIMAGERESULT_H_
+#define ALIBABACLOUD_IMAGERECOG_MODEL_TAGGINGADIMAGERESULT_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 TaggingAdImageResult : public ServiceResult
+			{
+			public:
+				struct Data
+				{
+					struct Tag
+					{
+						float confidence;
+						std::string value;
+					};
+					std::vector<Tag> tags;
+				};
+
+
+				TaggingAdImageResult();
+				explicit TaggingAdImageResult(const std::string &payload);
+				~TaggingAdImageResult();
+				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_IMAGERECOG_MODEL_TAGGINGADIMAGERESULT_H_

+ 36 - 0
imagerecog/src/ImagerecogClient.cc

@@ -447,6 +447,42 @@ ImagerecogClient::RecognizeVehicleTypeOutcomeCallable ImagerecogClient::recogniz
 	return task->get_future();
 }
 
+ImagerecogClient::TaggingAdImageOutcome ImagerecogClient::taggingAdImage(const TaggingAdImageRequest &request) const
+{
+	auto endpointOutcome = endpointProvider_->getEndpoint();
+	if (!endpointOutcome.isSuccess())
+		return TaggingAdImageOutcome(endpointOutcome.error());
+
+	auto outcome = makeRequest(endpointOutcome.result(), request);
+
+	if (outcome.isSuccess())
+		return TaggingAdImageOutcome(TaggingAdImageResult(outcome.result()));
+	else
+		return TaggingAdImageOutcome(outcome.error());
+}
+
+void ImagerecogClient::taggingAdImageAsync(const TaggingAdImageRequest& request, const TaggingAdImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
+{
+	auto fn = [this, request, handler, context]()
+	{
+		handler(this, request, taggingAdImage(request), context);
+	};
+
+	asyncExecute(new Runnable(fn));
+}
+
+ImagerecogClient::TaggingAdImageOutcomeCallable ImagerecogClient::taggingAdImageCallable(const TaggingAdImageRequest &request) const
+{
+	auto task = std::make_shared<std::packaged_task<TaggingAdImageOutcome()>>(
+			[this, request]()
+			{
+			return this->taggingAdImage(request);
+			});
+
+	asyncExecute(new Runnable([task]() { (*task)(); }));
+	return task->get_future();
+}
+
 ImagerecogClient::TaggingImageOutcome ImagerecogClient::taggingImage(const TaggingImageRequest &request) const
 {
 	auto endpointOutcome = endpointProvider_->getEndpoint();

+ 62 - 0
imagerecog/src/model/TaggingAdImageRequest.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 <alibabacloud/imagerecog/model/TaggingAdImageRequest.h>
+
+using AlibabaCloud::Imagerecog::Model::TaggingAdImageRequest;
+
+TaggingAdImageRequest::TaggingAdImageRequest() :
+	RpcServiceRequest("imagerecog", "2019-09-30", "TaggingAdImage")
+{
+	setMethod(HttpRequest::Method::Post);
+}
+
+TaggingAdImageRequest::~TaggingAdImageRequest()
+{}
+
+int TaggingAdImageRequest::getImageType()const
+{
+	return imageType_;
+}
+
+void TaggingAdImageRequest::setImageType(int imageType)
+{
+	imageType_ = imageType;
+	setBodyParameter("ImageType", std::to_string(imageType));
+}
+
+bool TaggingAdImageRequest::getAsync()const
+{
+	return async_;
+}
+
+void TaggingAdImageRequest::setAsync(bool async)
+{
+	async_ = async;
+	setBodyParameter("Async", async ? "true" : "false");
+}
+
+std::string TaggingAdImageRequest::getImageURL()const
+{
+	return imageURL_;
+}
+
+void TaggingAdImageRequest::setImageURL(const std::string& imageURL)
+{
+	imageURL_ = imageURL;
+	setBodyParameter("ImageURL", imageURL);
+}
+

+ 74 - 0
imagerecog/src/model/TaggingAdImageResult.cc

@@ -0,0 +1,74 @@
+/*
+ * 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/TaggingAdImageResult.h>
+#include <json/json.h>
+
+using namespace AlibabaCloud::Imagerecog;
+using namespace AlibabaCloud::Imagerecog::Model;
+
+TaggingAdImageResult::TaggingAdImageResult() :
+	ServiceResult()
+{}
+
+TaggingAdImageResult::TaggingAdImageResult(const std::string &payload) :
+	ServiceResult()
+{
+	parse(payload);
+}
+
+TaggingAdImageResult::~TaggingAdImageResult()
+{}
+
+void TaggingAdImageResult::parse(const std::string &payload)
+{
+	Json::Reader reader;
+	Json::Value value;
+	reader.parse(payload, value);
+	setRequestId(value["RequestId"].asString());
+	auto dataNode = value["Data"];
+	auto allTagsNode = dataNode["Tags"]["Tag"];
+	for (auto dataNodeTagsTag : allTagsNode)
+	{
+		Data::Tag tagObject;
+		if(!dataNodeTagsTag["Value"].isNull())
+			tagObject.value = dataNodeTagsTag["Value"].asString();
+		if(!dataNodeTagsTag["Confidence"].isNull())
+			tagObject.confidence = std::stof(dataNodeTagsTag["Confidence"].asString());
+		data_.tags.push_back(tagObject);
+	}
+	if(!value["Code"].isNull())
+		code_ = value["Code"].asString();
+	if(!value["Message"].isNull())
+		message_ = value["Message"].asString();
+
+}
+
+std::string TaggingAdImageResult::getMessage()const
+{
+	return message_;
+}
+
+TaggingAdImageResult::Data TaggingAdImageResult::getData()const
+{
+	return data_;
+}
+
+std::string TaggingAdImageResult::getCode()const
+{
+	return code_;
+}
+