Compare commits

..

1 Commits

Author SHA1 Message Date
sdk-team
bd0d4f669a Add smartcall service api. 2020-05-26 17:42:13 +08:00
9 changed files with 304 additions and 3 deletions

View File

@@ -1,3 +1,6 @@
2020-05-26 Version: 1.36.436
- Add smartcall service api.
2020-05-26 Version: 1.36.435
- Add smartcall service api.

View File

@@ -1 +1 @@
1.36.435
1.36.436

View File

@@ -30,7 +30,9 @@ set(nlp-automl_public_header_model
include/alibabacloud/nlp-automl/model/RunContactReviewRequest.h
include/alibabacloud/nlp-automl/model/RunContactReviewResult.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/RunSmartCallServiceRequest.h
include/alibabacloud/nlp-automl/model/RunSmartCallServiceResult.h )
set(nlp-automl_src
src/Nlp-automlClient.cc
@@ -43,7 +45,9 @@ set(nlp-automl_src
src/model/RunContactReviewRequest.cc
src/model/RunContactReviewResult.cc
src/model/RunPreTrainServiceRequest.cc
src/model/RunPreTrainServiceResult.cc )
src/model/RunPreTrainServiceResult.cc
src/model/RunSmartCallServiceRequest.cc
src/model/RunSmartCallServiceResult.cc )
add_library(nlp-automl ${LIB_TYPE}
${nlp-automl_public_header}

View File

@@ -32,6 +32,8 @@
#include "model/RunContactReviewResult.h"
#include "model/RunPreTrainServiceRequest.h"
#include "model/RunPreTrainServiceResult.h"
#include "model/RunSmartCallServiceRequest.h"
#include "model/RunSmartCallServiceResult.h"
namespace AlibabaCloud
@@ -56,6 +58,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::RunPreTrainServiceResult> RunPreTrainServiceOutcome;
typedef std::future<RunPreTrainServiceOutcome> RunPreTrainServiceOutcomeCallable;
typedef std::function<void(const Nlp_automlClient*, const Model::RunPreTrainServiceRequest&, const RunPreTrainServiceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RunPreTrainServiceAsyncHandler;
typedef Outcome<Error, Model::RunSmartCallServiceResult> RunSmartCallServiceOutcome;
typedef std::future<RunSmartCallServiceOutcome> RunSmartCallServiceOutcomeCallable;
typedef std::function<void(const Nlp_automlClient*, const Model::RunSmartCallServiceRequest&, const RunSmartCallServiceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RunSmartCallServiceAsyncHandler;
Nlp_automlClient(const Credentials &credentials, const ClientConfiguration &configuration);
Nlp_automlClient(const std::shared_ptr<CredentialsProvider> &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<const AsyncCallerContext>& context = nullptr) const;
RunPreTrainServiceOutcomeCallable runPreTrainServiceCallable(const Model::RunPreTrainServiceRequest& request) const;
RunSmartCallServiceOutcome runSmartCallService(const Model::RunSmartCallServiceRequest &request)const;
void runSmartCallServiceAsync(const Model::RunSmartCallServiceRequest& request, const RunSmartCallServiceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
RunSmartCallServiceOutcomeCallable runSmartCallServiceCallable(const Model::RunSmartCallServiceRequest& request) const;
private:
std::shared_ptr<EndpointProvider> endpointProvider_;

View File

@@ -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_NLP_AUTOML_MODEL_RUNSMARTCALLSERVICEREQUEST_H_
#define ALIBABACLOUD_NLP_AUTOML_MODEL_RUNSMARTCALLSERVICEREQUEST_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 RunSmartCallServiceRequest : public RpcServiceRequest
{
public:
RunSmartCallServiceRequest();
~RunSmartCallServiceRequest();
std::string getSessionId()const;
void setSessionId(const std::string& sessionId);
long getRobotId()const;
void setRobotId(long robotId);
std::string getParamContent()const;
void setParamContent(const std::string& paramContent);
std::string getServiceName()const;
void setServiceName(const std::string& serviceName);
private:
std::string sessionId_;
long robotId_;
std::string paramContent_;
std::string serviceName_;
};
}
}
}
#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_RUNSMARTCALLSERVICEREQUEST_H_

View File

@@ -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_RUNSMARTCALLSERVICERESULT_H_
#define ALIBABACLOUD_NLP_AUTOML_MODEL_RUNSMARTCALLSERVICERESULT_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 RunSmartCallServiceResult : public ServiceResult
{
public:
RunSmartCallServiceResult();
explicit RunSmartCallServiceResult(const std::string &payload);
~RunSmartCallServiceResult();
std::string getMessage()const;
std::string getData()const;
int getCode()const;
protected:
void parse(const std::string &payload);
private:
std::string message_;
std::string data_;
int code_;
};
}
}
}
#endif // !ALIBABACLOUD_NLP_AUTOML_MODEL_RUNSMARTCALLSERVICERESULT_H_

View File

@@ -231,3 +231,39 @@ Nlp_automlClient::RunPreTrainServiceOutcomeCallable Nlp_automlClient::runPreTrai
return task->get_future();
}
Nlp_automlClient::RunSmartCallServiceOutcome Nlp_automlClient::runSmartCallService(const RunSmartCallServiceRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return RunSmartCallServiceOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return RunSmartCallServiceOutcome(RunSmartCallServiceResult(outcome.result()));
else
return RunSmartCallServiceOutcome(outcome.error());
}
void Nlp_automlClient::runSmartCallServiceAsync(const RunSmartCallServiceRequest& request, const RunSmartCallServiceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, runSmartCallService(request), context);
};
asyncExecute(new Runnable(fn));
}
Nlp_automlClient::RunSmartCallServiceOutcomeCallable Nlp_automlClient::runSmartCallServiceCallable(const RunSmartCallServiceRequest &request) const
{
auto task = std::make_shared<std::packaged_task<RunSmartCallServiceOutcome()>>(
[this, request]()
{
return this->runSmartCallService(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -0,0 +1,73 @@
/*
* 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/RunSmartCallServiceRequest.h>
using AlibabaCloud::Nlp_automl::Model::RunSmartCallServiceRequest;
RunSmartCallServiceRequest::RunSmartCallServiceRequest() :
RpcServiceRequest("nlp-automl", "2019-11-11", "RunSmartCallService")
{
setMethod(HttpRequest::Method::Post);
}
RunSmartCallServiceRequest::~RunSmartCallServiceRequest()
{}
std::string RunSmartCallServiceRequest::getSessionId()const
{
return sessionId_;
}
void RunSmartCallServiceRequest::setSessionId(const std::string& sessionId)
{
sessionId_ = sessionId;
setBodyParameter("SessionId", sessionId);
}
long RunSmartCallServiceRequest::getRobotId()const
{
return robotId_;
}
void RunSmartCallServiceRequest::setRobotId(long robotId)
{
robotId_ = robotId;
setBodyParameter("RobotId", std::to_string(robotId));
}
std::string RunSmartCallServiceRequest::getParamContent()const
{
return paramContent_;
}
void RunSmartCallServiceRequest::setParamContent(const std::string& paramContent)
{
paramContent_ = paramContent;
setBodyParameter("ParamContent", paramContent);
}
std::string RunSmartCallServiceRequest::getServiceName()const
{
return serviceName_;
}
void RunSmartCallServiceRequest::setServiceName(const std::string& serviceName)
{
serviceName_ = serviceName;
setBodyParameter("ServiceName", serviceName);
}

View 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/RunSmartCallServiceResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Nlp_automl;
using namespace AlibabaCloud::Nlp_automl::Model;
RunSmartCallServiceResult::RunSmartCallServiceResult() :
ServiceResult()
{}
RunSmartCallServiceResult::RunSmartCallServiceResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
RunSmartCallServiceResult::~RunSmartCallServiceResult()
{}
void RunSmartCallServiceResult::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());
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Data"].isNull())
data_ = value["Data"].asString();
}
std::string RunSmartCallServiceResult::getMessage()const
{
return message_;
}
std::string RunSmartCallServiceResult::getData()const
{
return data_;
}
int RunSmartCallServiceResult::getCode()const
{
return code_;
}