Add image batch translate API.
This commit is contained in:
@@ -43,10 +43,10 @@ set(alimt_public_header_model
|
||||
include/alibabacloud/alimt/model/GetTitleGenerateResult.h
|
||||
include/alibabacloud/alimt/model/GetTitleIntelligenceRequest.h
|
||||
include/alibabacloud/alimt/model/GetTitleIntelligenceResult.h
|
||||
include/alibabacloud/alimt/model/GetTranslateImageBatchResultRequest.h
|
||||
include/alibabacloud/alimt/model/GetTranslateImageBatchResultResult.h
|
||||
include/alibabacloud/alimt/model/GetTranslateReportRequest.h
|
||||
include/alibabacloud/alimt/model/GetTranslateReportResult.h
|
||||
include/alibabacloud/alimt/model/GetUserRequest.h
|
||||
include/alibabacloud/alimt/model/GetUserResult.h
|
||||
include/alibabacloud/alimt/model/OpenAlimtServiceRequest.h
|
||||
include/alibabacloud/alimt/model/OpenAlimtServiceResult.h
|
||||
include/alibabacloud/alimt/model/TranslateRequest.h
|
||||
@@ -58,7 +58,9 @@ set(alimt_public_header_model
|
||||
include/alibabacloud/alimt/model/TranslateGeneralRequest.h
|
||||
include/alibabacloud/alimt/model/TranslateGeneralResult.h
|
||||
include/alibabacloud/alimt/model/TranslateImageRequest.h
|
||||
include/alibabacloud/alimt/model/TranslateImageResult.h )
|
||||
include/alibabacloud/alimt/model/TranslateImageResult.h
|
||||
include/alibabacloud/alimt/model/TranslateImageBatchRequest.h
|
||||
include/alibabacloud/alimt/model/TranslateImageBatchResult.h )
|
||||
|
||||
set(alimt_src
|
||||
src/AlimtClient.cc
|
||||
@@ -84,10 +86,10 @@ set(alimt_src
|
||||
src/model/GetTitleGenerateResult.cc
|
||||
src/model/GetTitleIntelligenceRequest.cc
|
||||
src/model/GetTitleIntelligenceResult.cc
|
||||
src/model/GetTranslateImageBatchResultRequest.cc
|
||||
src/model/GetTranslateImageBatchResultResult.cc
|
||||
src/model/GetTranslateReportRequest.cc
|
||||
src/model/GetTranslateReportResult.cc
|
||||
src/model/GetUserRequest.cc
|
||||
src/model/GetUserResult.cc
|
||||
src/model/OpenAlimtServiceRequest.cc
|
||||
src/model/OpenAlimtServiceResult.cc
|
||||
src/model/TranslateRequest.cc
|
||||
@@ -99,7 +101,9 @@ set(alimt_src
|
||||
src/model/TranslateGeneralRequest.cc
|
||||
src/model/TranslateGeneralResult.cc
|
||||
src/model/TranslateImageRequest.cc
|
||||
src/model/TranslateImageResult.cc )
|
||||
src/model/TranslateImageResult.cc
|
||||
src/model/TranslateImageBatchRequest.cc
|
||||
src/model/TranslateImageBatchResult.cc )
|
||||
|
||||
add_library(alimt ${LIB_TYPE}
|
||||
${alimt_public_header}
|
||||
|
||||
@@ -44,10 +44,10 @@
|
||||
#include "model/GetTitleGenerateResult.h"
|
||||
#include "model/GetTitleIntelligenceRequest.h"
|
||||
#include "model/GetTitleIntelligenceResult.h"
|
||||
#include "model/GetTranslateImageBatchResultRequest.h"
|
||||
#include "model/GetTranslateImageBatchResultResult.h"
|
||||
#include "model/GetTranslateReportRequest.h"
|
||||
#include "model/GetTranslateReportResult.h"
|
||||
#include "model/GetUserRequest.h"
|
||||
#include "model/GetUserResult.h"
|
||||
#include "model/OpenAlimtServiceRequest.h"
|
||||
#include "model/OpenAlimtServiceResult.h"
|
||||
#include "model/TranslateRequest.h"
|
||||
@@ -60,6 +60,8 @@
|
||||
#include "model/TranslateGeneralResult.h"
|
||||
#include "model/TranslateImageRequest.h"
|
||||
#include "model/TranslateImageResult.h"
|
||||
#include "model/TranslateImageBatchRequest.h"
|
||||
#include "model/TranslateImageBatchResult.h"
|
||||
|
||||
|
||||
namespace AlibabaCloud
|
||||
@@ -102,12 +104,12 @@ namespace AlibabaCloud
|
||||
typedef Outcome<Error, Model::GetTitleIntelligenceResult> GetTitleIntelligenceOutcome;
|
||||
typedef std::future<GetTitleIntelligenceOutcome> GetTitleIntelligenceOutcomeCallable;
|
||||
typedef std::function<void(const AlimtClient*, const Model::GetTitleIntelligenceRequest&, const GetTitleIntelligenceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetTitleIntelligenceAsyncHandler;
|
||||
typedef Outcome<Error, Model::GetTranslateImageBatchResultResult> GetTranslateImageBatchResultOutcome;
|
||||
typedef std::future<GetTranslateImageBatchResultOutcome> GetTranslateImageBatchResultOutcomeCallable;
|
||||
typedef std::function<void(const AlimtClient*, const Model::GetTranslateImageBatchResultRequest&, const GetTranslateImageBatchResultOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetTranslateImageBatchResultAsyncHandler;
|
||||
typedef Outcome<Error, Model::GetTranslateReportResult> GetTranslateReportOutcome;
|
||||
typedef std::future<GetTranslateReportOutcome> GetTranslateReportOutcomeCallable;
|
||||
typedef std::function<void(const AlimtClient*, const Model::GetTranslateReportRequest&, const GetTranslateReportOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetTranslateReportAsyncHandler;
|
||||
typedef Outcome<Error, Model::GetUserResult> GetUserOutcome;
|
||||
typedef std::future<GetUserOutcome> GetUserOutcomeCallable;
|
||||
typedef std::function<void(const AlimtClient*, const Model::GetUserRequest&, const GetUserOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetUserAsyncHandler;
|
||||
typedef Outcome<Error, Model::OpenAlimtServiceResult> OpenAlimtServiceOutcome;
|
||||
typedef std::future<OpenAlimtServiceOutcome> OpenAlimtServiceOutcomeCallable;
|
||||
typedef std::function<void(const AlimtClient*, const Model::OpenAlimtServiceRequest&, const OpenAlimtServiceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> OpenAlimtServiceAsyncHandler;
|
||||
@@ -126,6 +128,9 @@ namespace AlibabaCloud
|
||||
typedef Outcome<Error, Model::TranslateImageResult> TranslateImageOutcome;
|
||||
typedef std::future<TranslateImageOutcome> TranslateImageOutcomeCallable;
|
||||
typedef std::function<void(const AlimtClient*, const Model::TranslateImageRequest&, const TranslateImageOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TranslateImageAsyncHandler;
|
||||
typedef Outcome<Error, Model::TranslateImageBatchResult> TranslateImageBatchOutcome;
|
||||
typedef std::future<TranslateImageBatchOutcome> TranslateImageBatchOutcomeCallable;
|
||||
typedef std::function<void(const AlimtClient*, const Model::TranslateImageBatchRequest&, const TranslateImageBatchOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> TranslateImageBatchAsyncHandler;
|
||||
|
||||
AlimtClient(const Credentials &credentials, const ClientConfiguration &configuration);
|
||||
AlimtClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
|
||||
@@ -164,12 +169,12 @@ namespace AlibabaCloud
|
||||
GetTitleIntelligenceOutcome getTitleIntelligence(const Model::GetTitleIntelligenceRequest &request)const;
|
||||
void getTitleIntelligenceAsync(const Model::GetTitleIntelligenceRequest& request, const GetTitleIntelligenceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
GetTitleIntelligenceOutcomeCallable getTitleIntelligenceCallable(const Model::GetTitleIntelligenceRequest& request) const;
|
||||
GetTranslateImageBatchResultOutcome getTranslateImageBatchResult(const Model::GetTranslateImageBatchResultRequest &request)const;
|
||||
void getTranslateImageBatchResultAsync(const Model::GetTranslateImageBatchResultRequest& request, const GetTranslateImageBatchResultAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
GetTranslateImageBatchResultOutcomeCallable getTranslateImageBatchResultCallable(const Model::GetTranslateImageBatchResultRequest& request) const;
|
||||
GetTranslateReportOutcome getTranslateReport(const Model::GetTranslateReportRequest &request)const;
|
||||
void getTranslateReportAsync(const Model::GetTranslateReportRequest& request, const GetTranslateReportAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
GetTranslateReportOutcomeCallable getTranslateReportCallable(const Model::GetTranslateReportRequest& request) const;
|
||||
GetUserOutcome getUser(const Model::GetUserRequest &request)const;
|
||||
void getUserAsync(const Model::GetUserRequest& request, const GetUserAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
GetUserOutcomeCallable getUserCallable(const Model::GetUserRequest& request) const;
|
||||
OpenAlimtServiceOutcome openAlimtService(const Model::OpenAlimtServiceRequest &request)const;
|
||||
void openAlimtServiceAsync(const Model::OpenAlimtServiceRequest& request, const OpenAlimtServiceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
OpenAlimtServiceOutcomeCallable openAlimtServiceCallable(const Model::OpenAlimtServiceRequest& request) const;
|
||||
@@ -188,6 +193,9 @@ namespace AlibabaCloud
|
||||
TranslateImageOutcome translateImage(const Model::TranslateImageRequest &request)const;
|
||||
void translateImageAsync(const Model::TranslateImageRequest& request, const TranslateImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
TranslateImageOutcomeCallable translateImageCallable(const Model::TranslateImageRequest& request) const;
|
||||
TranslateImageBatchOutcome translateImageBatch(const Model::TranslateImageBatchRequest &request)const;
|
||||
void translateImageBatchAsync(const Model::TranslateImageBatchRequest& request, const TranslateImageBatchAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
TranslateImageBatchOutcomeCallable translateImageBatchCallable(const Model::TranslateImageBatchRequest& request) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<EndpointProvider> endpointProvider_;
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_ALIMT_MODEL_GETUSERREQUEST_H_
|
||||
#define ALIBABACLOUD_ALIMT_MODEL_GETUSERREQUEST_H_
|
||||
#ifndef ALIBABACLOUD_ALIMT_MODEL_GETTRANSLATEIMAGEBATCHRESULTREQUEST_H_
|
||||
#define ALIBABACLOUD_ALIMT_MODEL_GETTRANSLATEIMAGEBATCHRESULTREQUEST_H_
|
||||
|
||||
#include <alibabacloud/alimt/AlimtExport.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
@@ -26,14 +26,17 @@
|
||||
namespace AlibabaCloud {
|
||||
namespace Alimt {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_ALIMT_EXPORT GetUserRequest : public RpcServiceRequest {
|
||||
class ALIBABACLOUD_ALIMT_EXPORT GetTranslateImageBatchResultRequest : public RpcServiceRequest {
|
||||
public:
|
||||
GetUserRequest();
|
||||
~GetUserRequest();
|
||||
GetTranslateImageBatchResultRequest();
|
||||
~GetTranslateImageBatchResultRequest();
|
||||
std::string getTaskId() const;
|
||||
void setTaskId(const std::string &taskId);
|
||||
|
||||
private:
|
||||
std::string taskId_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace Alimt
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_ALIMT_MODEL_GETUSERREQUEST_H_
|
||||
#endif // !ALIBABACLOUD_ALIMT_MODEL_GETTRANSLATEIMAGEBATCHRESULTREQUEST_H_
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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_ALIMT_MODEL_GETTRANSLATEIMAGEBATCHRESULTRESULT_H_
|
||||
#define ALIBABACLOUD_ALIMT_MODEL_GETTRANSLATEIMAGEBATCHRESULTRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/alimt/AlimtExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Alimt
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_ALIMT_EXPORT GetTranslateImageBatchResultResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
struct Data
|
||||
{
|
||||
struct CertificateImageTranslateResult
|
||||
{
|
||||
std::string message;
|
||||
std::string inPaintingUrl;
|
||||
std::string templateJson;
|
||||
std::string sourceImageUrl;
|
||||
int code;
|
||||
bool success;
|
||||
std::string finalImageUrl;
|
||||
};
|
||||
std::string status;
|
||||
std::vector<CertificateImageTranslateResult> result;
|
||||
};
|
||||
|
||||
|
||||
GetTranslateImageBatchResultResult();
|
||||
explicit GetTranslateImageBatchResultResult(const std::string &payload);
|
||||
~GetTranslateImageBatchResultResult();
|
||||
std::string getMessage()const;
|
||||
Data getData()const;
|
||||
int getCode()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::string message_;
|
||||
Data data_;
|
||||
int code_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_ALIMT_MODEL_GETTRANSLATEIMAGEBATCHRESULTRESULT_H_
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
void setFormatType(const std::string &formatType);
|
||||
std::string getScene() const;
|
||||
void setScene(const std::string &scene);
|
||||
std::string getContext() const;
|
||||
void setContext(const std::string &context);
|
||||
std::string getTargetLanguage() const;
|
||||
void setTargetLanguage(const std::string &targetLanguage);
|
||||
|
||||
@@ -46,6 +48,7 @@ private:
|
||||
std::string sourceText_;
|
||||
std::string formatType_;
|
||||
std::string scene_;
|
||||
std::string context_;
|
||||
std::string targetLanguage_;
|
||||
};
|
||||
} // namespace Model
|
||||
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
void setFormatType(const std::string &formatType);
|
||||
std::string getScene() const;
|
||||
void setScene(const std::string &scene);
|
||||
std::string getContext() const;
|
||||
void setContext(const std::string &context);
|
||||
std::string getTargetLanguage() const;
|
||||
void setTargetLanguage(const std::string &targetLanguage);
|
||||
|
||||
@@ -46,6 +48,7 @@ private:
|
||||
std::string sourceText_;
|
||||
std::string formatType_;
|
||||
std::string scene_;
|
||||
std::string context_;
|
||||
std::string targetLanguage_;
|
||||
};
|
||||
} // namespace Model
|
||||
|
||||
@@ -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_ALIMT_MODEL_TRANSLATEIMAGEBATCHREQUEST_H_
|
||||
#define ALIBABACLOUD_ALIMT_MODEL_TRANSLATEIMAGEBATCHREQUEST_H_
|
||||
|
||||
#include <alibabacloud/alimt/AlimtExport.h>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace AlibabaCloud {
|
||||
namespace Alimt {
|
||||
namespace Model {
|
||||
class ALIBABACLOUD_ALIMT_EXPORT TranslateImageBatchRequest : public RpcServiceRequest {
|
||||
public:
|
||||
TranslateImageBatchRequest();
|
||||
~TranslateImageBatchRequest();
|
||||
std::string getExt() const;
|
||||
void setExt(const std::string &ext);
|
||||
std::string getSourceLanguage() const;
|
||||
void setSourceLanguage(const std::string &sourceLanguage);
|
||||
std::string getImageUrls() const;
|
||||
void setImageUrls(const std::string &imageUrls);
|
||||
std::string getCustomTaskId() const;
|
||||
void setCustomTaskId(const std::string &customTaskId);
|
||||
std::string getField() const;
|
||||
void setField(const std::string &field);
|
||||
std::string getTargetLanguage() const;
|
||||
void setTargetLanguage(const std::string &targetLanguage);
|
||||
|
||||
private:
|
||||
std::string ext_;
|
||||
std::string sourceLanguage_;
|
||||
std::string imageUrls_;
|
||||
std::string customTaskId_;
|
||||
std::string field_;
|
||||
std::string targetLanguage_;
|
||||
};
|
||||
} // namespace Model
|
||||
} // namespace Alimt
|
||||
} // namespace AlibabaCloud
|
||||
#endif // !ALIBABACLOUD_ALIMT_MODEL_TRANSLATEIMAGEBATCHREQUEST_H_
|
||||
@@ -14,8 +14,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_ALIMT_MODEL_GETUSERRESULT_H_
|
||||
#define ALIBABACLOUD_ALIMT_MODEL_GETUSERRESULT_H_
|
||||
#ifndef ALIBABACLOUD_ALIMT_MODEL_TRANSLATEIMAGEBATCHRESULT_H_
|
||||
#define ALIBABACLOUD_ALIMT_MODEL_TRANSLATEIMAGEBATCHRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -29,27 +29,31 @@ namespace AlibabaCloud
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_ALIMT_EXPORT GetUserResult : public ServiceResult
|
||||
class ALIBABACLOUD_ALIMT_EXPORT TranslateImageBatchResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
struct Data
|
||||
{
|
||||
std::string taskId;
|
||||
};
|
||||
|
||||
|
||||
GetUserResult();
|
||||
explicit GetUserResult(const std::string &payload);
|
||||
~GetUserResult();
|
||||
TranslateImageBatchResult();
|
||||
explicit TranslateImageBatchResult(const std::string &payload);
|
||||
~TranslateImageBatchResult();
|
||||
std::string getMessage()const;
|
||||
std::string getData()const;
|
||||
Data getData()const;
|
||||
int getCode()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::string message_;
|
||||
std::string data_;
|
||||
Data data_;
|
||||
int code_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_ALIMT_MODEL_GETUSERRESULT_H_
|
||||
#endif // !ALIBABACLOUD_ALIMT_MODEL_TRANSLATEIMAGEBATCHRESULT_H_
|
||||
@@ -38,6 +38,8 @@ public:
|
||||
void setFormatType(const std::string &formatType);
|
||||
std::string getScene() const;
|
||||
void setScene(const std::string &scene);
|
||||
std::string getContext() const;
|
||||
void setContext(const std::string &context);
|
||||
std::string getTargetLanguage() const;
|
||||
void setTargetLanguage(const std::string &targetLanguage);
|
||||
|
||||
@@ -46,6 +48,7 @@ private:
|
||||
std::string sourceText_;
|
||||
std::string formatType_;
|
||||
std::string scene_;
|
||||
std::string context_;
|
||||
std::string targetLanguage_;
|
||||
};
|
||||
} // namespace Model
|
||||
|
||||
@@ -447,6 +447,42 @@ AlimtClient::GetTitleIntelligenceOutcomeCallable AlimtClient::getTitleIntelligen
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
AlimtClient::GetTranslateImageBatchResultOutcome AlimtClient::getTranslateImageBatchResult(const GetTranslateImageBatchResultRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetTranslateImageBatchResultOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetTranslateImageBatchResultOutcome(GetTranslateImageBatchResultResult(outcome.result()));
|
||||
else
|
||||
return GetTranslateImageBatchResultOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void AlimtClient::getTranslateImageBatchResultAsync(const GetTranslateImageBatchResultRequest& request, const GetTranslateImageBatchResultAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getTranslateImageBatchResult(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
AlimtClient::GetTranslateImageBatchResultOutcomeCallable AlimtClient::getTranslateImageBatchResultCallable(const GetTranslateImageBatchResultRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetTranslateImageBatchResultOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getTranslateImageBatchResult(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
AlimtClient::GetTranslateReportOutcome AlimtClient::getTranslateReport(const GetTranslateReportRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
@@ -483,42 +519,6 @@ AlimtClient::GetTranslateReportOutcomeCallable AlimtClient::getTranslateReportCa
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
AlimtClient::GetUserOutcome AlimtClient::getUser(const GetUserRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetUserOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetUserOutcome(GetUserResult(outcome.result()));
|
||||
else
|
||||
return GetUserOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void AlimtClient::getUserAsync(const GetUserRequest& request, const GetUserAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getUser(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
AlimtClient::GetUserOutcomeCallable AlimtClient::getUserCallable(const GetUserRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetUserOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getUser(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
AlimtClient::OpenAlimtServiceOutcome AlimtClient::openAlimtService(const OpenAlimtServiceRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
@@ -735,3 +735,39 @@ AlimtClient::TranslateImageOutcomeCallable AlimtClient::translateImageCallable(c
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
AlimtClient::TranslateImageBatchOutcome AlimtClient::translateImageBatch(const TranslateImageBatchRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return TranslateImageBatchOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return TranslateImageBatchOutcome(TranslateImageBatchResult(outcome.result()));
|
||||
else
|
||||
return TranslateImageBatchOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void AlimtClient::translateImageBatchAsync(const TranslateImageBatchRequest& request, const TranslateImageBatchAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, translateImageBatch(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
AlimtClient::TranslateImageBatchOutcomeCallable AlimtClient::translateImageBatchCallable(const TranslateImageBatchRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<TranslateImageBatchOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->translateImageBatch(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,14 +14,23 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <alibabacloud/alimt/model/GetUserRequest.h>
|
||||
#include <alibabacloud/alimt/model/GetTranslateImageBatchResultRequest.h>
|
||||
|
||||
using AlibabaCloud::Alimt::Model::GetUserRequest;
|
||||
using AlibabaCloud::Alimt::Model::GetTranslateImageBatchResultRequest;
|
||||
|
||||
GetUserRequest::GetUserRequest()
|
||||
: RpcServiceRequest("alimt", "2018-10-12", "GetUser") {
|
||||
GetTranslateImageBatchResultRequest::GetTranslateImageBatchResultRequest()
|
||||
: RpcServiceRequest("alimt", "2018-10-12", "GetTranslateImageBatchResult") {
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
GetUserRequest::~GetUserRequest() {}
|
||||
GetTranslateImageBatchResultRequest::~GetTranslateImageBatchResultRequest() {}
|
||||
|
||||
std::string GetTranslateImageBatchResultRequest::getTaskId() const {
|
||||
return taskId_;
|
||||
}
|
||||
|
||||
void GetTranslateImageBatchResultRequest::setTaskId(const std::string &taskId) {
|
||||
taskId_ = taskId;
|
||||
setBodyParameter(std::string("TaskId"), taskId);
|
||||
}
|
||||
|
||||
86
alimt/src/model/GetTranslateImageBatchResultResult.cc
Normal file
86
alimt/src/model/GetTranslateImageBatchResultResult.cc
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* 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/alimt/model/GetTranslateImageBatchResultResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Alimt;
|
||||
using namespace AlibabaCloud::Alimt::Model;
|
||||
|
||||
GetTranslateImageBatchResultResult::GetTranslateImageBatchResultResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
GetTranslateImageBatchResultResult::GetTranslateImageBatchResultResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
GetTranslateImageBatchResultResult::~GetTranslateImageBatchResultResult()
|
||||
{}
|
||||
|
||||
void GetTranslateImageBatchResultResult::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();
|
||||
auto allResultNode = dataNode["Result"]["CertificateImageTranslateResult"];
|
||||
for (auto dataNodeResultCertificateImageTranslateResult : allResultNode)
|
||||
{
|
||||
Data::CertificateImageTranslateResult certificateImageTranslateResultObject;
|
||||
if(!dataNodeResultCertificateImageTranslateResult["InPaintingUrl"].isNull())
|
||||
certificateImageTranslateResultObject.inPaintingUrl = dataNodeResultCertificateImageTranslateResult["InPaintingUrl"].asString();
|
||||
if(!dataNodeResultCertificateImageTranslateResult["FinalImageUrl"].isNull())
|
||||
certificateImageTranslateResultObject.finalImageUrl = dataNodeResultCertificateImageTranslateResult["FinalImageUrl"].asString();
|
||||
if(!dataNodeResultCertificateImageTranslateResult["TemplateJson"].isNull())
|
||||
certificateImageTranslateResultObject.templateJson = dataNodeResultCertificateImageTranslateResult["TemplateJson"].asString();
|
||||
if(!dataNodeResultCertificateImageTranslateResult["SourceImageUrl"].isNull())
|
||||
certificateImageTranslateResultObject.sourceImageUrl = dataNodeResultCertificateImageTranslateResult["SourceImageUrl"].asString();
|
||||
if(!dataNodeResultCertificateImageTranslateResult["Code"].isNull())
|
||||
certificateImageTranslateResultObject.code = std::stoi(dataNodeResultCertificateImageTranslateResult["Code"].asString());
|
||||
if(!dataNodeResultCertificateImageTranslateResult["Message"].isNull())
|
||||
certificateImageTranslateResultObject.message = dataNodeResultCertificateImageTranslateResult["Message"].asString();
|
||||
if(!dataNodeResultCertificateImageTranslateResult["Success"].isNull())
|
||||
certificateImageTranslateResultObject.success = dataNodeResultCertificateImageTranslateResult["Success"].asString() == "true";
|
||||
data_.result.push_back(certificateImageTranslateResultObject);
|
||||
}
|
||||
if(!value["Code"].isNull())
|
||||
code_ = std::stoi(value["Code"].asString());
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string GetTranslateImageBatchResultResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
GetTranslateImageBatchResultResult::Data GetTranslateImageBatchResultResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
int GetTranslateImageBatchResultResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,15 @@ void TranslateECommerceRequest::setScene(const std::string &scene) {
|
||||
setBodyParameter(std::string("Scene"), scene);
|
||||
}
|
||||
|
||||
std::string TranslateECommerceRequest::getContext() const {
|
||||
return context_;
|
||||
}
|
||||
|
||||
void TranslateECommerceRequest::setContext(const std::string &context) {
|
||||
context_ = context;
|
||||
setParameter(std::string("Context"), context);
|
||||
}
|
||||
|
||||
std::string TranslateECommerceRequest::getTargetLanguage() const {
|
||||
return targetLanguage_;
|
||||
}
|
||||
|
||||
@@ -61,6 +61,15 @@ void TranslateGeneralRequest::setScene(const std::string &scene) {
|
||||
setBodyParameter(std::string("Scene"), scene);
|
||||
}
|
||||
|
||||
std::string TranslateGeneralRequest::getContext() const {
|
||||
return context_;
|
||||
}
|
||||
|
||||
void TranslateGeneralRequest::setContext(const std::string &context) {
|
||||
context_ = context;
|
||||
setParameter(std::string("Context"), context);
|
||||
}
|
||||
|
||||
std::string TranslateGeneralRequest::getTargetLanguage() const {
|
||||
return targetLanguage_;
|
||||
}
|
||||
|
||||
81
alimt/src/model/TranslateImageBatchRequest.cc
Normal file
81
alimt/src/model/TranslateImageBatchRequest.cc
Normal file
@@ -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/alimt/model/TranslateImageBatchRequest.h>
|
||||
|
||||
using AlibabaCloud::Alimt::Model::TranslateImageBatchRequest;
|
||||
|
||||
TranslateImageBatchRequest::TranslateImageBatchRequest()
|
||||
: RpcServiceRequest("alimt", "2018-10-12", "TranslateImageBatch") {
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
TranslateImageBatchRequest::~TranslateImageBatchRequest() {}
|
||||
|
||||
std::string TranslateImageBatchRequest::getExt() const {
|
||||
return ext_;
|
||||
}
|
||||
|
||||
void TranslateImageBatchRequest::setExt(const std::string &ext) {
|
||||
ext_ = ext;
|
||||
setBodyParameter(std::string("Ext"), ext);
|
||||
}
|
||||
|
||||
std::string TranslateImageBatchRequest::getSourceLanguage() const {
|
||||
return sourceLanguage_;
|
||||
}
|
||||
|
||||
void TranslateImageBatchRequest::setSourceLanguage(const std::string &sourceLanguage) {
|
||||
sourceLanguage_ = sourceLanguage;
|
||||
setBodyParameter(std::string("SourceLanguage"), sourceLanguage);
|
||||
}
|
||||
|
||||
std::string TranslateImageBatchRequest::getImageUrls() const {
|
||||
return imageUrls_;
|
||||
}
|
||||
|
||||
void TranslateImageBatchRequest::setImageUrls(const std::string &imageUrls) {
|
||||
imageUrls_ = imageUrls;
|
||||
setBodyParameter(std::string("ImageUrls"), imageUrls);
|
||||
}
|
||||
|
||||
std::string TranslateImageBatchRequest::getCustomTaskId() const {
|
||||
return customTaskId_;
|
||||
}
|
||||
|
||||
void TranslateImageBatchRequest::setCustomTaskId(const std::string &customTaskId) {
|
||||
customTaskId_ = customTaskId;
|
||||
setBodyParameter(std::string("CustomTaskId"), customTaskId);
|
||||
}
|
||||
|
||||
std::string TranslateImageBatchRequest::getField() const {
|
||||
return field_;
|
||||
}
|
||||
|
||||
void TranslateImageBatchRequest::setField(const std::string &field) {
|
||||
field_ = field;
|
||||
setBodyParameter(std::string("Field"), field);
|
||||
}
|
||||
|
||||
std::string TranslateImageBatchRequest::getTargetLanguage() const {
|
||||
return targetLanguage_;
|
||||
}
|
||||
|
||||
void TranslateImageBatchRequest::setTargetLanguage(const std::string &targetLanguage) {
|
||||
targetLanguage_ = targetLanguage;
|
||||
setBodyParameter(std::string("TargetLanguage"), targetLanguage);
|
||||
}
|
||||
|
||||
@@ -14,51 +14,52 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <alibabacloud/alimt/model/GetUserResult.h>
|
||||
#include <alibabacloud/alimt/model/TranslateImageBatchResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Alimt;
|
||||
using namespace AlibabaCloud::Alimt::Model;
|
||||
|
||||
GetUserResult::GetUserResult() :
|
||||
TranslateImageBatchResult::TranslateImageBatchResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
GetUserResult::GetUserResult(const std::string &payload) :
|
||||
TranslateImageBatchResult::TranslateImageBatchResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
GetUserResult::~GetUserResult()
|
||||
TranslateImageBatchResult::~TranslateImageBatchResult()
|
||||
{}
|
||||
|
||||
void GetUserResult::parse(const std::string &payload)
|
||||
void TranslateImageBatchResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
if(!value["Code"].isNull())
|
||||
code_ = std::stoi(value["Code"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
if(!dataNode["TaskId"].isNull())
|
||||
data_.taskId = dataNode["TaskId"].asString();
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
if(!value["Data"].isNull())
|
||||
data_ = value["Data"].asString();
|
||||
if(!value["Code"].isNull())
|
||||
code_ = std::stoi(value["Code"].asString());
|
||||
|
||||
}
|
||||
|
||||
std::string GetUserResult::getMessage()const
|
||||
std::string TranslateImageBatchResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
std::string GetUserResult::getData()const
|
||||
TranslateImageBatchResult::Data TranslateImageBatchResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
int GetUserResult::getCode()const
|
||||
int TranslateImageBatchResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
@@ -61,6 +61,15 @@ void TranslateRequest::setScene(const std::string &scene) {
|
||||
setBodyParameter(std::string("Scene"), scene);
|
||||
}
|
||||
|
||||
std::string TranslateRequest::getContext() const {
|
||||
return context_;
|
||||
}
|
||||
|
||||
void TranslateRequest::setContext(const std::string &context) {
|
||||
context_ = context;
|
||||
setParameter(std::string("Context"), context);
|
||||
}
|
||||
|
||||
std::string TranslateRequest::getTargetLanguage() const {
|
||||
return targetLanguage_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user