Ver Fonte

Release GenerateSuperResolutionImage.

sdk-team há 3 anos atrás
pai
commit
ecf1fc42a2

+ 1 - 1
VERSION

@@ -1 +1 @@
-1.36.1454
+1.36.1455

+ 4 - 0
imageenhan/CMakeLists.txt

@@ -45,6 +45,8 @@ set(imageenhan_public_header_model
 	include/alibabacloud/imageenhan/model/GenerateImageWithTextResult.h
 	include/alibabacloud/imageenhan/model/GenerateImageWithTextAndImageRequest.h
 	include/alibabacloud/imageenhan/model/GenerateImageWithTextAndImageResult.h
+	include/alibabacloud/imageenhan/model/GenerateSuperResolutionImageRequest.h
+	include/alibabacloud/imageenhan/model/GenerateSuperResolutionImageResult.h
 	include/alibabacloud/imageenhan/model/GetAsyncJobResultRequest.h
 	include/alibabacloud/imageenhan/model/GetAsyncJobResultResult.h
 	include/alibabacloud/imageenhan/model/ImageBlindCharacterWatermarkRequest.h
@@ -92,6 +94,8 @@ set(imageenhan_src
 	src/model/GenerateImageWithTextResult.cc
 	src/model/GenerateImageWithTextAndImageRequest.cc
 	src/model/GenerateImageWithTextAndImageResult.cc
+	src/model/GenerateSuperResolutionImageRequest.cc
+	src/model/GenerateSuperResolutionImageResult.cc
 	src/model/GetAsyncJobResultRequest.cc
 	src/model/GetAsyncJobResultResult.cc
 	src/model/ImageBlindCharacterWatermarkRequest.cc

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

@@ -46,6 +46,8 @@
 #include "model/GenerateImageWithTextResult.h"
 #include "model/GenerateImageWithTextAndImageRequest.h"
 #include "model/GenerateImageWithTextAndImageResult.h"
+#include "model/GenerateSuperResolutionImageRequest.h"
+#include "model/GenerateSuperResolutionImageResult.h"
 #include "model/GetAsyncJobResultRequest.h"
 #include "model/GetAsyncJobResultResult.h"
 #include "model/ImageBlindCharacterWatermarkRequest.h"
@@ -111,6 +113,9 @@ namespace AlibabaCloud
 			typedef Outcome<Error, Model::GenerateImageWithTextAndImageResult> GenerateImageWithTextAndImageOutcome;
 			typedef std::future<GenerateImageWithTextAndImageOutcome> GenerateImageWithTextAndImageOutcomeCallable;
 			typedef std::function<void(const ImageenhanClient*, const Model::GenerateImageWithTextAndImageRequest&, const GenerateImageWithTextAndImageOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GenerateImageWithTextAndImageAsyncHandler;
+			typedef Outcome<Error, Model::GenerateSuperResolutionImageResult> GenerateSuperResolutionImageOutcome;
+			typedef std::future<GenerateSuperResolutionImageOutcome> GenerateSuperResolutionImageOutcomeCallable;
+			typedef std::function<void(const ImageenhanClient*, const Model::GenerateSuperResolutionImageRequest&, const GenerateSuperResolutionImageOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GenerateSuperResolutionImageAsyncHandler;
 			typedef Outcome<Error, Model::GetAsyncJobResultResult> GetAsyncJobResultOutcome;
 			typedef std::future<GetAsyncJobResultOutcome> GetAsyncJobResultOutcomeCallable;
 			typedef std::function<void(const ImageenhanClient*, const Model::GetAsyncJobResultRequest&, const GetAsyncJobResultOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetAsyncJobResultAsyncHandler;
@@ -182,6 +187,9 @@ namespace AlibabaCloud
 			GenerateImageWithTextAndImageOutcome generateImageWithTextAndImage(const Model::GenerateImageWithTextAndImageRequest &request)const;
 			void generateImageWithTextAndImageAsync(const Model::GenerateImageWithTextAndImageRequest& request, const GenerateImageWithTextAndImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			GenerateImageWithTextAndImageOutcomeCallable generateImageWithTextAndImageCallable(const Model::GenerateImageWithTextAndImageRequest& request) const;
+			GenerateSuperResolutionImageOutcome generateSuperResolutionImage(const Model::GenerateSuperResolutionImageRequest &request)const;
+			void generateSuperResolutionImageAsync(const Model::GenerateSuperResolutionImageRequest& request, const GenerateSuperResolutionImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
+			GenerateSuperResolutionImageOutcomeCallable generateSuperResolutionImageCallable(const Model::GenerateSuperResolutionImageRequest& 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;

+ 57 - 0
imageenhan/include/alibabacloud/imageenhan/model/GenerateSuperResolutionImageRequest.h

@@ -0,0 +1,57 @@
+/*
+ * 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_GENERATESUPERRESOLUTIONIMAGEREQUEST_H_
+#define ALIBABACLOUD_IMAGEENHAN_MODEL_GENERATESUPERRESOLUTIONIMAGEREQUEST_H_
+
+#include <alibabacloud/imageenhan/ImageenhanExport.h>
+#include <alibabacloud/core/RpcServiceRequest.h>
+#include <string>
+#include <vector>
+#include <map>
+
+namespace AlibabaCloud {
+namespace Imageenhan {
+namespace Model {
+class ALIBABACLOUD_IMAGEENHAN_EXPORT GenerateSuperResolutionImageRequest : public RpcServiceRequest {
+public:
+	GenerateSuperResolutionImageRequest();
+	~GenerateSuperResolutionImageRequest();
+	int getScale() const;
+	void setScale(int scale);
+	std::string getUserData() const;
+	void setUserData(const std::string &userData);
+	std::string getOutputFormat() const;
+	void setOutputFormat(const std::string &outputFormat);
+	bool getAsync() const;
+	void setAsync(bool async);
+	std::string getImageUrl() const;
+	void setImageUrl(const std::string &imageUrl);
+	int getOutputQuality() const;
+	void setOutputQuality(int outputQuality);
+
+private:
+	int scale_;
+	std::string userData_;
+	std::string outputFormat_;
+	bool async_;
+	std::string imageUrl_;
+	int outputQuality_;
+};
+} // namespace Model
+} // namespace Imageenhan
+} // namespace AlibabaCloud
+#endif // !ALIBABACLOUD_IMAGEENHAN_MODEL_GENERATESUPERRESOLUTIONIMAGEREQUEST_H_

+ 59 - 0
imageenhan/include/alibabacloud/imageenhan/model/GenerateSuperResolutionImageResult.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_IMAGEENHAN_MODEL_GENERATESUPERRESOLUTIONIMAGERESULT_H_
+#define ALIBABACLOUD_IMAGEENHAN_MODEL_GENERATESUPERRESOLUTIONIMAGERESULT_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 GenerateSuperResolutionImageResult : public ServiceResult
+			{
+			public:
+				struct Data
+				{
+					std::string resultUrl;
+				};
+
+
+				GenerateSuperResolutionImageResult();
+				explicit GenerateSuperResolutionImageResult(const std::string &payload);
+				~GenerateSuperResolutionImageResult();
+				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_IMAGEENHAN_MODEL_GENERATESUPERRESOLUTIONIMAGERESULT_H_

+ 36 - 0
imageenhan/src/ImageenhanClient.cc

@@ -483,6 +483,42 @@ ImageenhanClient::GenerateImageWithTextAndImageOutcomeCallable ImageenhanClient:
 	return task->get_future();
 }
 
+ImageenhanClient::GenerateSuperResolutionImageOutcome ImageenhanClient::generateSuperResolutionImage(const GenerateSuperResolutionImageRequest &request) const
+{
+	auto endpointOutcome = endpointProvider_->getEndpoint();
+	if (!endpointOutcome.isSuccess())
+		return GenerateSuperResolutionImageOutcome(endpointOutcome.error());
+
+	auto outcome = makeRequest(endpointOutcome.result(), request);
+
+	if (outcome.isSuccess())
+		return GenerateSuperResolutionImageOutcome(GenerateSuperResolutionImageResult(outcome.result()));
+	else
+		return GenerateSuperResolutionImageOutcome(outcome.error());
+}
+
+void ImageenhanClient::generateSuperResolutionImageAsync(const GenerateSuperResolutionImageRequest& request, const GenerateSuperResolutionImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
+{
+	auto fn = [this, request, handler, context]()
+	{
+		handler(this, request, generateSuperResolutionImage(request), context);
+	};
+
+	asyncExecute(new Runnable(fn));
+}
+
+ImageenhanClient::GenerateSuperResolutionImageOutcomeCallable ImageenhanClient::generateSuperResolutionImageCallable(const GenerateSuperResolutionImageRequest &request) const
+{
+	auto task = std::make_shared<std::packaged_task<GenerateSuperResolutionImageOutcome()>>(
+			[this, request]()
+			{
+			return this->generateSuperResolutionImage(request);
+			});
+
+	asyncExecute(new Runnable([task]() { (*task)(); }));
+	return task->get_future();
+}
+
 ImageenhanClient::GetAsyncJobResultOutcome ImageenhanClient::getAsyncJobResult(const GetAsyncJobResultRequest &request) const
 {
 	auto endpointOutcome = endpointProvider_->getEndpoint();

+ 81 - 0
imageenhan/src/model/GenerateSuperResolutionImageRequest.cc

@@ -0,0 +1,81 @@
+/*
+ * 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/GenerateSuperResolutionImageRequest.h>
+
+using AlibabaCloud::Imageenhan::Model::GenerateSuperResolutionImageRequest;
+
+GenerateSuperResolutionImageRequest::GenerateSuperResolutionImageRequest()
+    : RpcServiceRequest("imageenhan", "2019-09-30", "GenerateSuperResolutionImage") {
+  setMethod(HttpRequest::Method::Post);
+}
+
+GenerateSuperResolutionImageRequest::~GenerateSuperResolutionImageRequest() {}
+
+int GenerateSuperResolutionImageRequest::getScale() const {
+  return scale_;
+}
+
+void GenerateSuperResolutionImageRequest::setScale(int scale) {
+  scale_ = scale;
+  setBodyParameter(std::string("Scale"), std::to_string(scale));
+}
+
+std::string GenerateSuperResolutionImageRequest::getUserData() const {
+  return userData_;
+}
+
+void GenerateSuperResolutionImageRequest::setUserData(const std::string &userData) {
+  userData_ = userData;
+  setBodyParameter(std::string("UserData"), userData);
+}
+
+std::string GenerateSuperResolutionImageRequest::getOutputFormat() const {
+  return outputFormat_;
+}
+
+void GenerateSuperResolutionImageRequest::setOutputFormat(const std::string &outputFormat) {
+  outputFormat_ = outputFormat;
+  setBodyParameter(std::string("OutputFormat"), outputFormat);
+}
+
+bool GenerateSuperResolutionImageRequest::getAsync() const {
+  return async_;
+}
+
+void GenerateSuperResolutionImageRequest::setAsync(bool async) {
+  async_ = async;
+  setBodyParameter(std::string("Async"), async ? "true" : "false");
+}
+
+std::string GenerateSuperResolutionImageRequest::getImageUrl() const {
+  return imageUrl_;
+}
+
+void GenerateSuperResolutionImageRequest::setImageUrl(const std::string &imageUrl) {
+  imageUrl_ = imageUrl;
+  setBodyParameter(std::string("ImageUrl"), imageUrl);
+}
+
+int GenerateSuperResolutionImageRequest::getOutputQuality() const {
+  return outputQuality_;
+}
+
+void GenerateSuperResolutionImageRequest::setOutputQuality(int outputQuality) {
+  outputQuality_ = outputQuality;
+  setBodyParameter(std::string("OutputQuality"), std::to_string(outputQuality));
+}
+

+ 66 - 0
imageenhan/src/model/GenerateSuperResolutionImageResult.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 <alibabacloud/imageenhan/model/GenerateSuperResolutionImageResult.h>
+#include <json/json.h>
+
+using namespace AlibabaCloud::Imageenhan;
+using namespace AlibabaCloud::Imageenhan::Model;
+
+GenerateSuperResolutionImageResult::GenerateSuperResolutionImageResult() :
+	ServiceResult()
+{}
+
+GenerateSuperResolutionImageResult::GenerateSuperResolutionImageResult(const std::string &payload) :
+	ServiceResult()
+{
+	parse(payload);
+}
+
+GenerateSuperResolutionImageResult::~GenerateSuperResolutionImageResult()
+{}
+
+void GenerateSuperResolutionImageResult::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["ResultUrl"].isNull())
+		data_.resultUrl = dataNode["ResultUrl"].asString();
+	if(!value["Code"].isNull())
+		code_ = value["Code"].asString();
+	if(!value["Message"].isNull())
+		message_ = value["Message"].asString();
+
+}
+
+std::string GenerateSuperResolutionImageResult::getMessage()const
+{
+	return message_;
+}
+
+GenerateSuperResolutionImageResult::Data GenerateSuperResolutionImageResult::getData()const
+{
+	return data_;
+}
+
+std::string GenerateSuperResolutionImageResult::getCode()const
+{
+	return code_;
+}
+