From 43d1c945b82e46de28569d5acece5e247e82502b Mon Sep 17 00:00:00 2001 From: sdk-team Date: Mon, 3 Jul 2023 03:49:28 +0000 Subject: [PATCH] Add The billingCount return value to the RunPreTrainService Api. --- VERSION | 2 +- nlp-automl/CMakeLists.txt | 8 ++- .../nlp-automl/Nlp_automlClient.h | 8 +++ .../model/RunPreTrainServiceNewRequest.h | 51 +++++++++++++++ .../model/RunPreTrainServiceNewResult.h | 53 ++++++++++++++++ nlp-automl/src/Nlp-automlClient.cc | 36 +++++++++++ .../src/model/RunPreTrainServiceNewRequest.cc | 63 +++++++++++++++++++ .../src/model/RunPreTrainServiceNewResult.cc | 58 +++++++++++++++++ 8 files changed, 276 insertions(+), 3 deletions(-) create mode 100644 nlp-automl/include/alibabacloud/nlp-automl/model/RunPreTrainServiceNewRequest.h create mode 100644 nlp-automl/include/alibabacloud/nlp-automl/model/RunPreTrainServiceNewResult.h create mode 100644 nlp-automl/src/model/RunPreTrainServiceNewRequest.cc create mode 100644 nlp-automl/src/model/RunPreTrainServiceNewResult.cc diff --git a/VERSION b/VERSION index fcf458d50..2b7067af6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1625 \ No newline at end of file +1.36.1626 \ No newline at end of file diff --git a/nlp-automl/CMakeLists.txt b/nlp-automl/CMakeLists.txt index d707942dc..c0019ba36 100644 --- a/nlp-automl/CMakeLists.txt +++ b/nlp-automl/CMakeLists.txt @@ -30,7 +30,9 @@ set(nlp-automl_public_header_model include/alibabacloud/nlp-automl/model/GetPredictResultRequest.h include/alibabacloud/nlp-automl/model/GetPredictResultResult.h include/alibabacloud/nlp-automl/model/RunPreTrainServiceRequest.h - include/alibabacloud/nlp-automl/model/RunPreTrainServiceResult.h ) + include/alibabacloud/nlp-automl/model/RunPreTrainServiceResult.h + include/alibabacloud/nlp-automl/model/RunPreTrainServiceNewRequest.h + include/alibabacloud/nlp-automl/model/RunPreTrainServiceNewResult.h ) set(nlp-automl_src src/Nlp-automlClient.cc @@ -43,7 +45,9 @@ set(nlp-automl_src src/model/GetPredictResultRequest.cc src/model/GetPredictResultResult.cc src/model/RunPreTrainServiceRequest.cc - src/model/RunPreTrainServiceResult.cc ) + src/model/RunPreTrainServiceResult.cc + src/model/RunPreTrainServiceNewRequest.cc + src/model/RunPreTrainServiceNewResult.cc ) add_library(nlp-automl ${LIB_TYPE} ${nlp-automl_public_header} diff --git a/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h b/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h index 40608c242..73d57de22 100644 --- a/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h +++ b/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h @@ -32,6 +32,8 @@ #include "model/GetPredictResultResult.h" #include "model/RunPreTrainServiceRequest.h" #include "model/RunPreTrainServiceResult.h" +#include "model/RunPreTrainServiceNewRequest.h" +#include "model/RunPreTrainServiceNewResult.h" namespace AlibabaCloud @@ -56,6 +58,9 @@ namespace AlibabaCloud typedef Outcome RunPreTrainServiceOutcome; typedef std::future RunPreTrainServiceOutcomeCallable; typedef std::function&)> RunPreTrainServiceAsyncHandler; + typedef Outcome RunPreTrainServiceNewOutcome; + typedef std::future RunPreTrainServiceNewOutcomeCallable; + typedef std::function&)> RunPreTrainServiceNewAsyncHandler; Nlp_automlClient(const Credentials &credentials, const ClientConfiguration &configuration); Nlp_automlClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); @@ -76,6 +81,9 @@ namespace AlibabaCloud RunPreTrainServiceOutcome runPreTrainService(const Model::RunPreTrainServiceRequest &request)const; void runPreTrainServiceAsync(const Model::RunPreTrainServiceRequest& request, const RunPreTrainServiceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; RunPreTrainServiceOutcomeCallable runPreTrainServiceCallable(const Model::RunPreTrainServiceRequest& request) const; + RunPreTrainServiceNewOutcome runPreTrainServiceNew(const Model::RunPreTrainServiceNewRequest &request)const; + void runPreTrainServiceNewAsync(const Model::RunPreTrainServiceNewRequest& request, const RunPreTrainServiceNewAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + RunPreTrainServiceNewOutcomeCallable runPreTrainServiceNewCallable(const Model::RunPreTrainServiceNewRequest& request) const; private: std::shared_ptr endpointProvider_; diff --git a/nlp-automl/include/alibabacloud/nlp-automl/model/RunPreTrainServiceNewRequest.h b/nlp-automl/include/alibabacloud/nlp-automl/model/RunPreTrainServiceNewRequest.h new file mode 100644 index 000000000..d73d4e4dc --- /dev/null +++ b/nlp-automl/include/alibabacloud/nlp-automl/model/RunPreTrainServiceNewRequest.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_NLP_AUTOML_MODEL_RUNPRETRAINSERVICENEWREQUEST_H_ +#define ALIBABACLOUD_NLP_AUTOML_MODEL_RUNPRETRAINSERVICENEWREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Nlp_automl { +namespace Model { +class ALIBABACLOUD_NLP_AUTOML_EXPORT RunPreTrainServiceNewRequest : public RpcServiceRequest { +public: + RunPreTrainServiceNewRequest(); + ~RunPreTrainServiceNewRequest(); + std::string getProduct() const; + void setProduct(const std::string &product); + std::string getPredictContent() const; + void setPredictContent(const std::string &predictContent); + std::string getServiceVersion() const; + void setServiceVersion(const std::string &serviceVersion); + std::string getServiceName() const; + void setServiceName(const std::string &serviceName); + +private: + std::string product_; + std::string predictContent_; + std::string serviceVersion_; + std::string serviceName_; +}; +} // namespace Model +} // namespace Nlp_automl +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_RUNPRETRAINSERVICENEWREQUEST_H_ diff --git a/nlp-automl/include/alibabacloud/nlp-automl/model/RunPreTrainServiceNewResult.h b/nlp-automl/include/alibabacloud/nlp-automl/model/RunPreTrainServiceNewResult.h new file mode 100644 index 000000000..2b16fba81 --- /dev/null +++ b/nlp-automl/include/alibabacloud/nlp-automl/model/RunPreTrainServiceNewResult.h @@ -0,0 +1,53 @@ +/* + * 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_NLP_AUTOML_MODEL_RUNPRETRAINSERVICENEWRESULT_H_ +#define ALIBABACLOUD_NLP_AUTOML_MODEL_RUNPRETRAINSERVICENEWRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Nlp_automl + { + namespace Model + { + class ALIBABACLOUD_NLP_AUTOML_EXPORT RunPreTrainServiceNewResult : public ServiceResult + { + public: + + + RunPreTrainServiceNewResult(); + explicit RunPreTrainServiceNewResult(const std::string &payload); + ~RunPreTrainServiceNewResult(); + int getBillingCount()const; + std::string getPredictResult()const; + + protected: + void parse(const std::string &payload); + private: + int billingCount_; + std::string predictResult_; + + }; + } + } +} +#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_RUNPRETRAINSERVICENEWRESULT_H_ \ No newline at end of file diff --git a/nlp-automl/src/Nlp-automlClient.cc b/nlp-automl/src/Nlp-automlClient.cc index 7d7e3f91b..962b61fca 100644 --- a/nlp-automl/src/Nlp-automlClient.cc +++ b/nlp-automl/src/Nlp-automlClient.cc @@ -231,3 +231,39 @@ Nlp_automlClient::RunPreTrainServiceOutcomeCallable Nlp_automlClient::runPreTrai return task->get_future(); } +Nlp_automlClient::RunPreTrainServiceNewOutcome Nlp_automlClient::runPreTrainServiceNew(const RunPreTrainServiceNewRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return RunPreTrainServiceNewOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return RunPreTrainServiceNewOutcome(RunPreTrainServiceNewResult(outcome.result())); + else + return RunPreTrainServiceNewOutcome(outcome.error()); +} + +void Nlp_automlClient::runPreTrainServiceNewAsync(const RunPreTrainServiceNewRequest& request, const RunPreTrainServiceNewAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, runPreTrainServiceNew(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +Nlp_automlClient::RunPreTrainServiceNewOutcomeCallable Nlp_automlClient::runPreTrainServiceNewCallable(const RunPreTrainServiceNewRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->runPreTrainServiceNew(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/nlp-automl/src/model/RunPreTrainServiceNewRequest.cc b/nlp-automl/src/model/RunPreTrainServiceNewRequest.cc new file mode 100644 index 000000000..af3973c58 --- /dev/null +++ b/nlp-automl/src/model/RunPreTrainServiceNewRequest.cc @@ -0,0 +1,63 @@ +/* + * 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 + +using AlibabaCloud::Nlp_automl::Model::RunPreTrainServiceNewRequest; + +RunPreTrainServiceNewRequest::RunPreTrainServiceNewRequest() + : RpcServiceRequest("nlp-automl", "2019-11-11", "RunPreTrainServiceNew") { + setMethod(HttpRequest::Method::Post); +} + +RunPreTrainServiceNewRequest::~RunPreTrainServiceNewRequest() {} + +std::string RunPreTrainServiceNewRequest::getProduct() const { + return product_; +} + +void RunPreTrainServiceNewRequest::setProduct(const std::string &product) { + product_ = product; + setBodyParameter(std::string("Product"), product); +} + +std::string RunPreTrainServiceNewRequest::getPredictContent() const { + return predictContent_; +} + +void RunPreTrainServiceNewRequest::setPredictContent(const std::string &predictContent) { + predictContent_ = predictContent; + setBodyParameter(std::string("PredictContent"), predictContent); +} + +std::string RunPreTrainServiceNewRequest::getServiceVersion() const { + return serviceVersion_; +} + +void RunPreTrainServiceNewRequest::setServiceVersion(const std::string &serviceVersion) { + serviceVersion_ = serviceVersion; + setBodyParameter(std::string("ServiceVersion"), serviceVersion); +} + +std::string RunPreTrainServiceNewRequest::getServiceName() const { + return serviceName_; +} + +void RunPreTrainServiceNewRequest::setServiceName(const std::string &serviceName) { + serviceName_ = serviceName; + setBodyParameter(std::string("ServiceName"), serviceName); +} + diff --git a/nlp-automl/src/model/RunPreTrainServiceNewResult.cc b/nlp-automl/src/model/RunPreTrainServiceNewResult.cc new file mode 100644 index 000000000..57c342952 --- /dev/null +++ b/nlp-automl/src/model/RunPreTrainServiceNewResult.cc @@ -0,0 +1,58 @@ +/* + * 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 +#include + +using namespace AlibabaCloud::Nlp_automl; +using namespace AlibabaCloud::Nlp_automl::Model; + +RunPreTrainServiceNewResult::RunPreTrainServiceNewResult() : + ServiceResult() +{} + +RunPreTrainServiceNewResult::RunPreTrainServiceNewResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +RunPreTrainServiceNewResult::~RunPreTrainServiceNewResult() +{} + +void RunPreTrainServiceNewResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["PredictResult"].isNull()) + predictResult_ = value["PredictResult"].asString(); + if(!value["BillingCount"].isNull()) + billingCount_ = std::stoi(value["BillingCount"].asString()); + +} + +int RunPreTrainServiceNewResult::getBillingCount()const +{ + return billingCount_; +} + +std::string RunPreTrainServiceNewResult::getPredictResult()const +{ + return predictResult_; +} +