From 2f207f22485758743b2e80eef66bce5052c374aa Mon Sep 17 00:00:00 2001 From: sdk-team Date: Thu, 9 Mar 2023 06:08:48 +0000 Subject: [PATCH] add FindUserReport4Alinlp Api. --- VERSION | 2 +- nlp-automl/CMakeLists.txt | 4 ++ .../nlp-automl/Nlp_automlClient.h | 8 +++ .../model/FindUserReport4AlinlpRequest.h | 54 ++++++++++++++ .../model/FindUserReport4AlinlpResult.h | 61 ++++++++++++++++ nlp-automl/src/Nlp-automlClient.cc | 36 ++++++++++ .../src/model/FindUserReport4AlinlpRequest.cc | 72 +++++++++++++++++++ .../src/model/FindUserReport4AlinlpResult.cc | 72 +++++++++++++++++++ 8 files changed, 308 insertions(+), 1 deletion(-) create mode 100644 nlp-automl/include/alibabacloud/nlp-automl/model/FindUserReport4AlinlpRequest.h create mode 100644 nlp-automl/include/alibabacloud/nlp-automl/model/FindUserReport4AlinlpResult.h create mode 100644 nlp-automl/src/model/FindUserReport4AlinlpRequest.cc create mode 100644 nlp-automl/src/model/FindUserReport4AlinlpResult.cc diff --git a/VERSION b/VERSION index 3a53ddf27..499388727 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1495 \ No newline at end of file +1.36.1496 \ No newline at end of file diff --git a/nlp-automl/CMakeLists.txt b/nlp-automl/CMakeLists.txt index 775f28788..d707942dc 100644 --- a/nlp-automl/CMakeLists.txt +++ b/nlp-automl/CMakeLists.txt @@ -23,6 +23,8 @@ set(nlp-automl_public_header set(nlp-automl_public_header_model include/alibabacloud/nlp-automl/model/CreateAsyncPredictRequest.h include/alibabacloud/nlp-automl/model/CreateAsyncPredictResult.h + include/alibabacloud/nlp-automl/model/FindUserReport4AlinlpRequest.h + include/alibabacloud/nlp-automl/model/FindUserReport4AlinlpResult.h include/alibabacloud/nlp-automl/model/GetAsyncPredictRequest.h include/alibabacloud/nlp-automl/model/GetAsyncPredictResult.h include/alibabacloud/nlp-automl/model/GetPredictResultRequest.h @@ -34,6 +36,8 @@ set(nlp-automl_src src/Nlp-automlClient.cc src/model/CreateAsyncPredictRequest.cc src/model/CreateAsyncPredictResult.cc + src/model/FindUserReport4AlinlpRequest.cc + src/model/FindUserReport4AlinlpResult.cc src/model/GetAsyncPredictRequest.cc src/model/GetAsyncPredictResult.cc src/model/GetPredictResultRequest.cc diff --git a/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h b/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h index 98ec15dbe..40608c242 100644 --- a/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h +++ b/nlp-automl/include/alibabacloud/nlp-automl/Nlp_automlClient.h @@ -24,6 +24,8 @@ #include "Nlp_automlExport.h" #include "model/CreateAsyncPredictRequest.h" #include "model/CreateAsyncPredictResult.h" +#include "model/FindUserReport4AlinlpRequest.h" +#include "model/FindUserReport4AlinlpResult.h" #include "model/GetAsyncPredictRequest.h" #include "model/GetAsyncPredictResult.h" #include "model/GetPredictResultRequest.h" @@ -42,6 +44,9 @@ namespace AlibabaCloud typedef Outcome CreateAsyncPredictOutcome; typedef std::future CreateAsyncPredictOutcomeCallable; typedef std::function&)> CreateAsyncPredictAsyncHandler; + typedef Outcome FindUserReport4AlinlpOutcome; + typedef std::future FindUserReport4AlinlpOutcomeCallable; + typedef std::function&)> FindUserReport4AlinlpAsyncHandler; typedef Outcome GetAsyncPredictOutcome; typedef std::future GetAsyncPredictOutcomeCallable; typedef std::function&)> GetAsyncPredictAsyncHandler; @@ -59,6 +64,9 @@ namespace AlibabaCloud CreateAsyncPredictOutcome createAsyncPredict(const Model::CreateAsyncPredictRequest &request)const; void createAsyncPredictAsync(const Model::CreateAsyncPredictRequest& request, const CreateAsyncPredictAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; CreateAsyncPredictOutcomeCallable createAsyncPredictCallable(const Model::CreateAsyncPredictRequest& request) const; + FindUserReport4AlinlpOutcome findUserReport4Alinlp(const Model::FindUserReport4AlinlpRequest &request)const; + void findUserReport4AlinlpAsync(const Model::FindUserReport4AlinlpRequest& request, const FindUserReport4AlinlpAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + FindUserReport4AlinlpOutcomeCallable findUserReport4AlinlpCallable(const Model::FindUserReport4AlinlpRequest& request) const; GetAsyncPredictOutcome getAsyncPredict(const Model::GetAsyncPredictRequest &request)const; void getAsyncPredictAsync(const Model::GetAsyncPredictRequest& request, const GetAsyncPredictAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GetAsyncPredictOutcomeCallable getAsyncPredictCallable(const Model::GetAsyncPredictRequest& request) const; diff --git a/nlp-automl/include/alibabacloud/nlp-automl/model/FindUserReport4AlinlpRequest.h b/nlp-automl/include/alibabacloud/nlp-automl/model/FindUserReport4AlinlpRequest.h new file mode 100644 index 000000000..bd58613c0 --- /dev/null +++ b/nlp-automl/include/alibabacloud/nlp-automl/model/FindUserReport4AlinlpRequest.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_NLP_AUTOML_MODEL_FINDUSERREPORT4ALINLPREQUEST_H_ +#define ALIBABACLOUD_NLP_AUTOML_MODEL_FINDUSERREPORT4ALINLPREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Nlp_automl { +namespace Model { +class ALIBABACLOUD_NLP_AUTOML_EXPORT FindUserReport4AlinlpRequest : public RpcServiceRequest { +public: + FindUserReport4AlinlpRequest(); + ~FindUserReport4AlinlpRequest(); + long getCustomerUserParentId() const; + void setCustomerUserParentId(long customerUserParentId); + std::string getEndTime() const; + void setEndTime(const std::string &endTime); + std::string getBeginTime() const; + void setBeginTime(const std::string &beginTime); + std::string getType() const; + void setType(const std::string &type); + std::string getModelType() const; + void setModelType(const std::string &modelType); + +private: + long customerUserParentId_; + std::string endTime_; + std::string beginTime_; + std::string type_; + std::string modelType_; +}; +} // namespace Model +} // namespace Nlp_automl +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_FINDUSERREPORT4ALINLPREQUEST_H_ diff --git a/nlp-automl/include/alibabacloud/nlp-automl/model/FindUserReport4AlinlpResult.h b/nlp-automl/include/alibabacloud/nlp-automl/model/FindUserReport4AlinlpResult.h new file mode 100644 index 000000000..371906919 --- /dev/null +++ b/nlp-automl/include/alibabacloud/nlp-automl/model/FindUserReport4AlinlpResult.h @@ -0,0 +1,61 @@ +/* + * 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_FINDUSERREPORT4ALINLPRESULT_H_ +#define ALIBABACLOUD_NLP_AUTOML_MODEL_FINDUSERREPORT4ALINLPRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Nlp_automl + { + namespace Model + { + class ALIBABACLOUD_NLP_AUTOML_EXPORT FindUserReport4AlinlpResult : public ServiceResult + { + public: + struct Report + { + long totalCount; + long failCount; + int qpsMax; + std::string rptTime; + long successCount; + }; + + + FindUserReport4AlinlpResult(); + explicit FindUserReport4AlinlpResult(const std::string &payload); + ~FindUserReport4AlinlpResult(); + std::vector getData()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::vector data_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_FINDUSERREPORT4ALINLPRESULT_H_ \ No newline at end of file diff --git a/nlp-automl/src/Nlp-automlClient.cc b/nlp-automl/src/Nlp-automlClient.cc index 1a3c50a98..7d7e3f91b 100644 --- a/nlp-automl/src/Nlp-automlClient.cc +++ b/nlp-automl/src/Nlp-automlClient.cc @@ -87,6 +87,42 @@ Nlp_automlClient::CreateAsyncPredictOutcomeCallable Nlp_automlClient::createAsyn return task->get_future(); } +Nlp_automlClient::FindUserReport4AlinlpOutcome Nlp_automlClient::findUserReport4Alinlp(const FindUserReport4AlinlpRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return FindUserReport4AlinlpOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return FindUserReport4AlinlpOutcome(FindUserReport4AlinlpResult(outcome.result())); + else + return FindUserReport4AlinlpOutcome(outcome.error()); +} + +void Nlp_automlClient::findUserReport4AlinlpAsync(const FindUserReport4AlinlpRequest& request, const FindUserReport4AlinlpAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, findUserReport4Alinlp(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +Nlp_automlClient::FindUserReport4AlinlpOutcomeCallable Nlp_automlClient::findUserReport4AlinlpCallable(const FindUserReport4AlinlpRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->findUserReport4Alinlp(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + Nlp_automlClient::GetAsyncPredictOutcome Nlp_automlClient::getAsyncPredict(const GetAsyncPredictRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/nlp-automl/src/model/FindUserReport4AlinlpRequest.cc b/nlp-automl/src/model/FindUserReport4AlinlpRequest.cc new file mode 100644 index 000000000..8c2e3b47f --- /dev/null +++ b/nlp-automl/src/model/FindUserReport4AlinlpRequest.cc @@ -0,0 +1,72 @@ +/* + * 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::FindUserReport4AlinlpRequest; + +FindUserReport4AlinlpRequest::FindUserReport4AlinlpRequest() + : RpcServiceRequest("nlp-automl", "2019-11-11", "FindUserReport4Alinlp") { + setMethod(HttpRequest::Method::Post); +} + +FindUserReport4AlinlpRequest::~FindUserReport4AlinlpRequest() {} + +long FindUserReport4AlinlpRequest::getCustomerUserParentId() const { + return customerUserParentId_; +} + +void FindUserReport4AlinlpRequest::setCustomerUserParentId(long customerUserParentId) { + customerUserParentId_ = customerUserParentId; + setBodyParameter(std::string("CustomerUserParentId"), std::to_string(customerUserParentId)); +} + +std::string FindUserReport4AlinlpRequest::getEndTime() const { + return endTime_; +} + +void FindUserReport4AlinlpRequest::setEndTime(const std::string &endTime) { + endTime_ = endTime; + setBodyParameter(std::string("EndTime"), endTime); +} + +std::string FindUserReport4AlinlpRequest::getBeginTime() const { + return beginTime_; +} + +void FindUserReport4AlinlpRequest::setBeginTime(const std::string &beginTime) { + beginTime_ = beginTime; + setBodyParameter(std::string("BeginTime"), beginTime); +} + +std::string FindUserReport4AlinlpRequest::getType() const { + return type_; +} + +void FindUserReport4AlinlpRequest::setType(const std::string &type) { + type_ = type; + setBodyParameter(std::string("Type"), type); +} + +std::string FindUserReport4AlinlpRequest::getModelType() const { + return modelType_; +} + +void FindUserReport4AlinlpRequest::setModelType(const std::string &modelType) { + modelType_ = modelType; + setBodyParameter(std::string("ModelType"), modelType); +} + diff --git a/nlp-automl/src/model/FindUserReport4AlinlpResult.cc b/nlp-automl/src/model/FindUserReport4AlinlpResult.cc new file mode 100644 index 000000000..a1ef5a4b5 --- /dev/null +++ b/nlp-automl/src/model/FindUserReport4AlinlpResult.cc @@ -0,0 +1,72 @@ +/* + * 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; + +FindUserReport4AlinlpResult::FindUserReport4AlinlpResult() : + ServiceResult() +{} + +FindUserReport4AlinlpResult::FindUserReport4AlinlpResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +FindUserReport4AlinlpResult::~FindUserReport4AlinlpResult() +{} + +void FindUserReport4AlinlpResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allDataNode = value["Data"]["report"]; + for (auto valueDatareport : allDataNode) + { + Report dataObject; + if(!valueDatareport["TotalCount"].isNull()) + dataObject.totalCount = std::stol(valueDatareport["TotalCount"].asString()); + if(!valueDatareport["SuccessCount"].isNull()) + dataObject.successCount = std::stol(valueDatareport["SuccessCount"].asString()); + if(!valueDatareport["FailCount"].isNull()) + dataObject.failCount = std::stol(valueDatareport["FailCount"].asString()); + if(!valueDatareport["QpsMax"].isNull()) + dataObject.qpsMax = std::stoi(valueDatareport["QpsMax"].asString()); + if(!valueDatareport["RptTime"].isNull()) + dataObject.rptTime = valueDatareport["RptTime"].asString(); + data_.push_back(dataObject); + } + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + +} + +std::vector FindUserReport4AlinlpResult::getData()const +{ + return data_; +} + +std::string FindUserReport4AlinlpResult::getCode()const +{ + return code_; +} +