NlpAutoml add async api.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
2019-12-26 Version 1.36.222
|
||||
- NlpAutoml add async api.
|
||||
|
||||
2019-12-26 Version 1.36.221
|
||||
- Modify CreateRestoreTask.
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ set(nlp-automl_public_header
|
||||
include/alibabacloud/nlp-automl/Nlp_automlExport.h )
|
||||
|
||||
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/GetAsyncPredictRequest.h
|
||||
include/alibabacloud/nlp-automl/model/GetAsyncPredictResult.h
|
||||
include/alibabacloud/nlp-automl/model/GetPredictResultRequest.h
|
||||
include/alibabacloud/nlp-automl/model/GetPredictResultResult.h
|
||||
include/alibabacloud/nlp-automl/model/RunContactReviewRequest.h
|
||||
@@ -28,6 +32,10 @@ set(nlp-automl_public_header_model
|
||||
|
||||
set(nlp-automl_src
|
||||
src/Nlp-automlClient.cc
|
||||
src/model/CreateAsyncPredictRequest.cc
|
||||
src/model/CreateAsyncPredictResult.cc
|
||||
src/model/GetAsyncPredictRequest.cc
|
||||
src/model/GetAsyncPredictResult.cc
|
||||
src/model/GetPredictResultRequest.cc
|
||||
src/model/GetPredictResultResult.cc
|
||||
src/model/RunContactReviewRequest.cc
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
#include <alibabacloud/core/EndpointProvider.h>
|
||||
#include <alibabacloud/core/RpcServiceClient.h>
|
||||
#include "Nlp_automlExport.h"
|
||||
#include "model/CreateAsyncPredictRequest.h"
|
||||
#include "model/CreateAsyncPredictResult.h"
|
||||
#include "model/GetAsyncPredictRequest.h"
|
||||
#include "model/GetAsyncPredictResult.h"
|
||||
#include "model/GetPredictResultRequest.h"
|
||||
#include "model/GetPredictResultResult.h"
|
||||
#include "model/RunContactReviewRequest.h"
|
||||
@@ -35,6 +39,12 @@ namespace AlibabaCloud
|
||||
class ALIBABACLOUD_NLP_AUTOML_EXPORT Nlp_automlClient : public RpcServiceClient
|
||||
{
|
||||
public:
|
||||
typedef Outcome<Error, Model::CreateAsyncPredictResult> CreateAsyncPredictOutcome;
|
||||
typedef std::future<CreateAsyncPredictOutcome> CreateAsyncPredictOutcomeCallable;
|
||||
typedef std::function<void(const Nlp_automlClient*, const Model::CreateAsyncPredictRequest&, const CreateAsyncPredictOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CreateAsyncPredictAsyncHandler;
|
||||
typedef Outcome<Error, Model::GetAsyncPredictResult> GetAsyncPredictOutcome;
|
||||
typedef std::future<GetAsyncPredictOutcome> GetAsyncPredictOutcomeCallable;
|
||||
typedef std::function<void(const Nlp_automlClient*, const Model::GetAsyncPredictRequest&, const GetAsyncPredictOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetAsyncPredictAsyncHandler;
|
||||
typedef Outcome<Error, Model::GetPredictResultResult> GetPredictResultOutcome;
|
||||
typedef std::future<GetPredictResultOutcome> GetPredictResultOutcomeCallable;
|
||||
typedef std::function<void(const Nlp_automlClient*, const Model::GetPredictResultRequest&, const GetPredictResultOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetPredictResultAsyncHandler;
|
||||
@@ -46,6 +56,12 @@ namespace AlibabaCloud
|
||||
Nlp_automlClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
|
||||
Nlp_automlClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
|
||||
~Nlp_automlClient();
|
||||
CreateAsyncPredictOutcome createAsyncPredict(const Model::CreateAsyncPredictRequest &request)const;
|
||||
void createAsyncPredictAsync(const Model::CreateAsyncPredictRequest& request, const CreateAsyncPredictAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
CreateAsyncPredictOutcomeCallable createAsyncPredictCallable(const Model::CreateAsyncPredictRequest& request) const;
|
||||
GetAsyncPredictOutcome getAsyncPredict(const Model::GetAsyncPredictRequest &request)const;
|
||||
void getAsyncPredictAsync(const Model::GetAsyncPredictRequest& request, const GetAsyncPredictAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
GetAsyncPredictOutcomeCallable getAsyncPredictCallable(const Model::GetAsyncPredictRequest& request) const;
|
||||
GetPredictResultOutcome getPredictResult(const Model::GetPredictResultRequest &request)const;
|
||||
void getPredictResultAsync(const Model::GetPredictResultRequest& request, const GetPredictResultAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
GetPredictResultOutcomeCallable getPredictResultCallable(const Model::GetPredictResultRequest& request) const;
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* 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_CREATEASYNCPREDICTREQUEST_H_
|
||||
#define ALIBABACLOUD_NLP_AUTOML_MODEL_CREATEASYNCPREDICTREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <alibabacloud/nlp-automl/Nlp_automlExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Nlp_automl
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_NLP_AUTOML_EXPORT CreateAsyncPredictRequest : public RpcServiceRequest
|
||||
{
|
||||
|
||||
public:
|
||||
CreateAsyncPredictRequest();
|
||||
~CreateAsyncPredictRequest();
|
||||
|
||||
int getTopK()const;
|
||||
void setTopK(int topK);
|
||||
std::string getFileType()const;
|
||||
void setFileType(const std::string& fileType);
|
||||
std::string getDetailTag()const;
|
||||
void setDetailTag(const std::string& detailTag);
|
||||
std::string getContent()const;
|
||||
void setContent(const std::string& content);
|
||||
std::string getFileContent()const;
|
||||
void setFileContent(const std::string& fileContent);
|
||||
int getModelId()const;
|
||||
void setModelId(int modelId);
|
||||
std::string getFileUrl()const;
|
||||
void setFileUrl(const std::string& fileUrl);
|
||||
std::string getModelVersion()const;
|
||||
void setModelVersion(const std::string& modelVersion);
|
||||
|
||||
private:
|
||||
int topK_;
|
||||
std::string fileType_;
|
||||
std::string detailTag_;
|
||||
std::string content_;
|
||||
std::string fileContent_;
|
||||
int modelId_;
|
||||
std::string fileUrl_;
|
||||
std::string modelVersion_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_CREATEASYNCPREDICTREQUEST_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_CREATEASYNCPREDICTRESULT_H_
|
||||
#define ALIBABACLOUD_NLP_AUTOML_MODEL_CREATEASYNCPREDICTRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/nlp-automl/Nlp_automlExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Nlp_automl
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_NLP_AUTOML_EXPORT CreateAsyncPredictResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
CreateAsyncPredictResult();
|
||||
explicit CreateAsyncPredictResult(const std::string &payload);
|
||||
~CreateAsyncPredictResult();
|
||||
long getAsyncPredictId()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
long asyncPredictId_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_CREATEASYNCPREDICTRESULT_H_
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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_GETASYNCPREDICTREQUEST_H_
|
||||
#define ALIBABACLOUD_NLP_AUTOML_MODEL_GETASYNCPREDICTREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <alibabacloud/nlp-automl/Nlp_automlExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Nlp_automl
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_NLP_AUTOML_EXPORT GetAsyncPredictRequest : public RpcServiceRequest
|
||||
{
|
||||
|
||||
public:
|
||||
GetAsyncPredictRequest();
|
||||
~GetAsyncPredictRequest();
|
||||
|
||||
int getAsyncPredictId()const;
|
||||
void setAsyncPredictId(int asyncPredictId);
|
||||
|
||||
private:
|
||||
int asyncPredictId_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_GETASYNCPREDICTREQUEST_H_
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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_GETASYNCPREDICTRESULT_H_
|
||||
#define ALIBABACLOUD_NLP_AUTOML_MODEL_GETASYNCPREDICTRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/nlp-automl/Nlp_automlExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Nlp_automl
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_NLP_AUTOML_EXPORT GetAsyncPredictResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
GetAsyncPredictResult();
|
||||
explicit GetAsyncPredictResult(const std::string &payload);
|
||||
~GetAsyncPredictResult();
|
||||
int getStatus()const;
|
||||
std::string getContent()const;
|
||||
int getAsyncPredictId()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
int status_;
|
||||
std::string content_;
|
||||
int asyncPredictId_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_GETASYNCPREDICTRESULT_H_
|
||||
@@ -51,6 +51,78 @@ Nlp_automlClient::Nlp_automlClient(const std::string & accessKeyId, const std::s
|
||||
Nlp_automlClient::~Nlp_automlClient()
|
||||
{}
|
||||
|
||||
Nlp_automlClient::CreateAsyncPredictOutcome Nlp_automlClient::createAsyncPredict(const CreateAsyncPredictRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return CreateAsyncPredictOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return CreateAsyncPredictOutcome(CreateAsyncPredictResult(outcome.result()));
|
||||
else
|
||||
return CreateAsyncPredictOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void Nlp_automlClient::createAsyncPredictAsync(const CreateAsyncPredictRequest& request, const CreateAsyncPredictAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, createAsyncPredict(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
Nlp_automlClient::CreateAsyncPredictOutcomeCallable Nlp_automlClient::createAsyncPredictCallable(const CreateAsyncPredictRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<CreateAsyncPredictOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->createAsyncPredict(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
Nlp_automlClient::GetAsyncPredictOutcome Nlp_automlClient::getAsyncPredict(const GetAsyncPredictRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetAsyncPredictOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetAsyncPredictOutcome(GetAsyncPredictResult(outcome.result()));
|
||||
else
|
||||
return GetAsyncPredictOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void Nlp_automlClient::getAsyncPredictAsync(const GetAsyncPredictRequest& request, const GetAsyncPredictAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getAsyncPredict(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
Nlp_automlClient::GetAsyncPredictOutcomeCallable Nlp_automlClient::getAsyncPredictCallable(const GetAsyncPredictRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetAsyncPredictOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getAsyncPredict(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
Nlp_automlClient::GetPredictResultOutcome Nlp_automlClient::getPredictResult(const GetPredictResultRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
117
nlp-automl/src/model/CreateAsyncPredictRequest.cc
Normal file
117
nlp-automl/src/model/CreateAsyncPredictRequest.cc
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* 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/nlp-automl/model/CreateAsyncPredictRequest.h>
|
||||
|
||||
using AlibabaCloud::Nlp_automl::Model::CreateAsyncPredictRequest;
|
||||
|
||||
CreateAsyncPredictRequest::CreateAsyncPredictRequest() :
|
||||
RpcServiceRequest("nlp-automl", "2019-11-11", "CreateAsyncPredict")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
CreateAsyncPredictRequest::~CreateAsyncPredictRequest()
|
||||
{}
|
||||
|
||||
int CreateAsyncPredictRequest::getTopK()const
|
||||
{
|
||||
return topK_;
|
||||
}
|
||||
|
||||
void CreateAsyncPredictRequest::setTopK(int topK)
|
||||
{
|
||||
topK_ = topK;
|
||||
setCoreParameter("TopK", std::to_string(topK));
|
||||
}
|
||||
|
||||
std::string CreateAsyncPredictRequest::getFileType()const
|
||||
{
|
||||
return fileType_;
|
||||
}
|
||||
|
||||
void CreateAsyncPredictRequest::setFileType(const std::string& fileType)
|
||||
{
|
||||
fileType_ = fileType;
|
||||
setCoreParameter("FileType", fileType);
|
||||
}
|
||||
|
||||
std::string CreateAsyncPredictRequest::getDetailTag()const
|
||||
{
|
||||
return detailTag_;
|
||||
}
|
||||
|
||||
void CreateAsyncPredictRequest::setDetailTag(const std::string& detailTag)
|
||||
{
|
||||
detailTag_ = detailTag;
|
||||
setCoreParameter("DetailTag", detailTag);
|
||||
}
|
||||
|
||||
std::string CreateAsyncPredictRequest::getContent()const
|
||||
{
|
||||
return content_;
|
||||
}
|
||||
|
||||
void CreateAsyncPredictRequest::setContent(const std::string& content)
|
||||
{
|
||||
content_ = content;
|
||||
setCoreParameter("Content", content);
|
||||
}
|
||||
|
||||
std::string CreateAsyncPredictRequest::getFileContent()const
|
||||
{
|
||||
return fileContent_;
|
||||
}
|
||||
|
||||
void CreateAsyncPredictRequest::setFileContent(const std::string& fileContent)
|
||||
{
|
||||
fileContent_ = fileContent;
|
||||
setCoreParameter("FileContent", fileContent);
|
||||
}
|
||||
|
||||
int CreateAsyncPredictRequest::getModelId()const
|
||||
{
|
||||
return modelId_;
|
||||
}
|
||||
|
||||
void CreateAsyncPredictRequest::setModelId(int modelId)
|
||||
{
|
||||
modelId_ = modelId;
|
||||
setCoreParameter("ModelId", std::to_string(modelId));
|
||||
}
|
||||
|
||||
std::string CreateAsyncPredictRequest::getFileUrl()const
|
||||
{
|
||||
return fileUrl_;
|
||||
}
|
||||
|
||||
void CreateAsyncPredictRequest::setFileUrl(const std::string& fileUrl)
|
||||
{
|
||||
fileUrl_ = fileUrl;
|
||||
setCoreParameter("FileUrl", fileUrl);
|
||||
}
|
||||
|
||||
std::string CreateAsyncPredictRequest::getModelVersion()const
|
||||
{
|
||||
return modelVersion_;
|
||||
}
|
||||
|
||||
void CreateAsyncPredictRequest::setModelVersion(const std::string& modelVersion)
|
||||
{
|
||||
modelVersion_ = modelVersion;
|
||||
setCoreParameter("ModelVersion", modelVersion);
|
||||
}
|
||||
|
||||
51
nlp-automl/src/model/CreateAsyncPredictResult.cc
Normal file
51
nlp-automl/src/model/CreateAsyncPredictResult.cc
Normal file
@@ -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.
|
||||
*/
|
||||
|
||||
#include <alibabacloud/nlp-automl/model/CreateAsyncPredictResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Nlp_automl;
|
||||
using namespace AlibabaCloud::Nlp_automl::Model;
|
||||
|
||||
CreateAsyncPredictResult::CreateAsyncPredictResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
CreateAsyncPredictResult::CreateAsyncPredictResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
CreateAsyncPredictResult::~CreateAsyncPredictResult()
|
||||
{}
|
||||
|
||||
void CreateAsyncPredictResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
if(!value["AsyncPredictId"].isNull())
|
||||
asyncPredictId_ = std::stol(value["AsyncPredictId"].asString());
|
||||
|
||||
}
|
||||
|
||||
long CreateAsyncPredictResult::getAsyncPredictId()const
|
||||
{
|
||||
return asyncPredictId_;
|
||||
}
|
||||
|
||||
40
nlp-automl/src/model/GetAsyncPredictRequest.cc
Normal file
40
nlp-automl/src/model/GetAsyncPredictRequest.cc
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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/nlp-automl/model/GetAsyncPredictRequest.h>
|
||||
|
||||
using AlibabaCloud::Nlp_automl::Model::GetAsyncPredictRequest;
|
||||
|
||||
GetAsyncPredictRequest::GetAsyncPredictRequest() :
|
||||
RpcServiceRequest("nlp-automl", "2019-11-11", "GetAsyncPredict")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Get);
|
||||
}
|
||||
|
||||
GetAsyncPredictRequest::~GetAsyncPredictRequest()
|
||||
{}
|
||||
|
||||
int GetAsyncPredictRequest::getAsyncPredictId()const
|
||||
{
|
||||
return asyncPredictId_;
|
||||
}
|
||||
|
||||
void GetAsyncPredictRequest::setAsyncPredictId(int asyncPredictId)
|
||||
{
|
||||
asyncPredictId_ = asyncPredictId;
|
||||
setCoreParameter("AsyncPredictId", std::to_string(asyncPredictId));
|
||||
}
|
||||
|
||||
65
nlp-automl/src/model/GetAsyncPredictResult.cc
Normal file
65
nlp-automl/src/model/GetAsyncPredictResult.cc
Normal file
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* 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/nlp-automl/model/GetAsyncPredictResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Nlp_automl;
|
||||
using namespace AlibabaCloud::Nlp_automl::Model;
|
||||
|
||||
GetAsyncPredictResult::GetAsyncPredictResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
GetAsyncPredictResult::GetAsyncPredictResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
GetAsyncPredictResult::~GetAsyncPredictResult()
|
||||
{}
|
||||
|
||||
void GetAsyncPredictResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
if(!value["AsyncPredictId"].isNull())
|
||||
asyncPredictId_ = std::stoi(value["AsyncPredictId"].asString());
|
||||
if(!value["Status"].isNull())
|
||||
status_ = std::stoi(value["Status"].asString());
|
||||
if(!value["Content"].isNull())
|
||||
content_ = value["Content"].asString();
|
||||
|
||||
}
|
||||
|
||||
int GetAsyncPredictResult::getStatus()const
|
||||
{
|
||||
return status_;
|
||||
}
|
||||
|
||||
std::string GetAsyncPredictResult::getContent()const
|
||||
{
|
||||
return content_;
|
||||
}
|
||||
|
||||
int GetAsyncPredictResult::getAsyncPredictId()const
|
||||
{
|
||||
return asyncPredictId_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user