Add Smart Cloudauth API.

This commit is contained in:
sdk-team
2020-07-30 17:10:00 +08:00
parent 9d57625a58
commit 8520626698
23 changed files with 693 additions and 10 deletions

View File

@@ -555,6 +555,42 @@ CloudauthClient::DescribeSdkUrlOutcomeCallable CloudauthClient::describeSdkUrlCa
return task->get_future();
}
CloudauthClient::DescribeSmartVerifyOutcome CloudauthClient::describeSmartVerify(const DescribeSmartVerifyRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DescribeSmartVerifyOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DescribeSmartVerifyOutcome(DescribeSmartVerifyResult(outcome.result()));
else
return DescribeSmartVerifyOutcome(outcome.error());
}
void CloudauthClient::describeSmartVerifyAsync(const DescribeSmartVerifyRequest& request, const DescribeSmartVerifyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, describeSmartVerify(request), context);
};
asyncExecute(new Runnable(fn));
}
CloudauthClient::DescribeSmartVerifyOutcomeCallable CloudauthClient::describeSmartVerifyCallable(const DescribeSmartVerifyRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DescribeSmartVerifyOutcome()>>(
[this, request]()
{
return this->describeSmartVerify(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CloudauthClient::DescribeUpdatePackageResultOutcome CloudauthClient::describeUpdatePackageResult(const DescribeUpdatePackageResultRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -1095,6 +1131,42 @@ CloudauthClient::InitFaceVerifyOutcomeCallable CloudauthClient::initFaceVerifyCa
return task->get_future();
}
CloudauthClient::InitSmartVerifyOutcome CloudauthClient::initSmartVerify(const InitSmartVerifyRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return InitSmartVerifyOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return InitSmartVerifyOutcome(InitSmartVerifyResult(outcome.result()));
else
return InitSmartVerifyOutcome(outcome.error());
}
void CloudauthClient::initSmartVerifyAsync(const InitSmartVerifyRequest& request, const InitSmartVerifyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, initSmartVerify(request), context);
};
asyncExecute(new Runnable(fn));
}
CloudauthClient::InitSmartVerifyOutcomeCallable CloudauthClient::initSmartVerifyCallable(const InitSmartVerifyRequest &request) const
{
auto task = std::make_shared<std::packaged_task<InitSmartVerifyOutcome()>>(
[this, request]()
{
return this->initSmartVerify(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CloudauthClient::ModifyDeviceInfoOutcome CloudauthClient::modifyDeviceInfo(const ModifyDeviceInfoRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View 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/cloudauth/model/DescribeSmartVerifyRequest.h>
using AlibabaCloud::Cloudauth::Model::DescribeSmartVerifyRequest;
DescribeSmartVerifyRequest::DescribeSmartVerifyRequest() :
RpcServiceRequest("cloudauth", "2020-06-18", "DescribeSmartVerify")
{
setMethod(HttpRequest::Method::Post);
}
DescribeSmartVerifyRequest::~DescribeSmartVerifyRequest()
{}
long DescribeSmartVerifyRequest::getSceneId()const
{
return sceneId_;
}
void DescribeSmartVerifyRequest::setSceneId(long sceneId)
{
sceneId_ = sceneId;
setBodyParameter("SceneId", std::to_string(sceneId));
}
std::string DescribeSmartVerifyRequest::getCertifyId()const
{
return certifyId_;
}
void DescribeSmartVerifyRequest::setCertifyId(const std::string& certifyId)
{
certifyId_ = certifyId;
setBodyParameter("CertifyId", certifyId);
}

View File

@@ -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 <alibabacloud/cloudauth/model/DescribeSmartVerifyResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Cloudauth;
using namespace AlibabaCloud::Cloudauth::Model;
DescribeSmartVerifyResult::DescribeSmartVerifyResult() :
ServiceResult()
{}
DescribeSmartVerifyResult::DescribeSmartVerifyResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
DescribeSmartVerifyResult::~DescribeSmartVerifyResult()
{}
void DescribeSmartVerifyResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto resultObjectNode = value["ResultObject"];
if(!resultObjectNode["Passed"].isNull())
resultObject_.passed = resultObjectNode["Passed"].asString();
if(!resultObjectNode["SubCode"].isNull())
resultObject_.subCode = resultObjectNode["SubCode"].asString();
if(!resultObjectNode["MaterialInfo"].isNull())
resultObject_.materialInfo = resultObjectNode["MaterialInfo"].asString();
if(!resultObjectNode["DeviceToken"].isNull())
resultObject_.deviceToken = resultObjectNode["DeviceToken"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Code"].isNull())
code_ = value["Code"].asString();
}
DescribeSmartVerifyResult::ResultObject DescribeSmartVerifyResult::getResultObject()const
{
return resultObject_;
}
std::string DescribeSmartVerifyResult::getMessage()const
{
return message_;
}
std::string DescribeSmartVerifyResult::getCode()const
{
return code_;
}

View File

@@ -46,6 +46,12 @@ void DescribeVerifyResultResult::parse(const std::string &payload)
material_.idCardName = materialNode["IdCardName"].asString();
if(!materialNode["IdCardNumber"].isNull())
material_.idCardNumber = materialNode["IdCardNumber"].asString();
if(!materialNode["FaceQuality"].isNull())
material_.faceQuality = materialNode["FaceQuality"].asString();
if(!materialNode["FaceGlobalUrl"].isNull())
material_.faceGlobalUrl = materialNode["FaceGlobalUrl"].asString();
if(!materialNode["FaceMask"].isNull())
material_.faceMask = materialNode["FaceMask"].asString() == "true";
auto idCardInfoNode = materialNode["IdCardInfo"];
if(!idCardInfoNode["Number"].isNull())
material_.idCardInfo.number = idCardInfoNode["Number"].asString();

View File

@@ -93,6 +93,17 @@ void InitDeviceRequest::setCertifyId(const std::string& certifyId)
setParameter("CertifyId", certifyId);
}
std::string InitDeviceRequest::getWebUmidToken()const
{
return webUmidToken_;
}
void InitDeviceRequest::setWebUmidToken(const std::string& webUmidToken)
{
webUmidToken_ = webUmidToken;
setBodyParameter("WebUmidToken", webUmidToken);
}
std::string InitDeviceRequest::getOuterOrderNo()const
{
return outerOrderNo_;
@@ -115,6 +126,17 @@ void InitDeviceRequest::setProduceNode(const std::string& produceNode)
setParameter("ProduceNode", produceNode);
}
std::string InitDeviceRequest::getUaToken()const
{
return uaToken_;
}
void InitDeviceRequest::setUaToken(const std::string& uaToken)
{
uaToken_ = uaToken;
setBodyParameter("UaToken", uaToken);
}
std::string InitDeviceRequest::getProductName()const
{
return productName_;

View File

@@ -66,6 +66,10 @@ void InitDeviceResult::parse(const std::string &payload)
resultObject_.bucketName = resultObjectNode["BucketName"].asString();
if(!resultObjectNode["FileNamePrefix"].isNull())
resultObject_.fileNamePrefix = resultObjectNode["FileNamePrefix"].asString();
if(!resultObjectNode["FileName"].isNull())
resultObject_.fileName = resultObjectNode["FileName"].asString();
if(!resultObjectNode["PresignedUrl"].isNull())
resultObject_.presignedUrl = resultObjectNode["PresignedUrl"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Code"].isNull())

View File

@@ -42,6 +42,8 @@ void InitFaceVerifyResult::parse(const std::string &payload)
auto resultObjectNode = value["ResultObject"];
if(!resultObjectNode["CertifyId"].isNull())
resultObject_.certifyId = resultObjectNode["CertifyId"].asString();
if(!resultObjectNode["CertifyUrl"].isNull())
resultObject_.certifyUrl = resultObjectNode["CertifyUrl"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Code"].isNull())

View 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/cloudauth/model/InitSmartVerifyRequest.h>
using AlibabaCloud::Cloudauth::Model::InitSmartVerifyRequest;
InitSmartVerifyRequest::InitSmartVerifyRequest() :
RpcServiceRequest("cloudauth", "2020-06-18", "InitSmartVerify")
{
setMethod(HttpRequest::Method::Post);
}
InitSmartVerifyRequest::~InitSmartVerifyRequest()
{}
std::string InitSmartVerifyRequest::getIp()const
{
return ip_;
}
void InitSmartVerifyRequest::setIp(const std::string& ip)
{
ip_ = ip;
setBodyParameter("Ip", ip);
}
std::string InitSmartVerifyRequest::getMobile()const
{
return mobile_;
}
void InitSmartVerifyRequest::setMobile(const std::string& mobile)
{
mobile_ = mobile;
setBodyParameter("Mobile", mobile);
}
std::string InitSmartVerifyRequest::getUserId()const
{
return userId_;
}
void InitSmartVerifyRequest::setUserId(const std::string& userId)
{
userId_ = userId;
setBodyParameter("UserId", userId);
}
std::string InitSmartVerifyRequest::getMode()const
{
return mode_;
}
void InitSmartVerifyRequest::setMode(const std::string& mode)
{
mode_ = mode;
setBodyParameter("Mode", mode);
}
std::string InitSmartVerifyRequest::getOuterOrderNo()const
{
return outerOrderNo_;
}
void InitSmartVerifyRequest::setOuterOrderNo(const std::string& outerOrderNo)
{
outerOrderNo_ = outerOrderNo;
setBodyParameter("OuterOrderNo", outerOrderNo);
}
std::string InitSmartVerifyRequest::getCertType()const
{
return certType_;
}
void InitSmartVerifyRequest::setCertType(const std::string& certType)
{
certType_ = certType;
setBodyParameter("CertType", certType);
}
long InitSmartVerifyRequest::getSceneId()const
{
return sceneId_;
}
void InitSmartVerifyRequest::setSceneId(long sceneId)
{
sceneId_ = sceneId;
setBodyParameter("SceneId", std::to_string(sceneId));
}
std::string InitSmartVerifyRequest::getMetaInfo()const
{
return metaInfo_;
}
void InitSmartVerifyRequest::setMetaInfo(const std::string& metaInfo)
{
metaInfo_ = metaInfo;
setBodyParameter("MetaInfo", metaInfo);
}

View File

@@ -0,0 +1,66 @@
/*
* 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/cloudauth/model/InitSmartVerifyResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Cloudauth;
using namespace AlibabaCloud::Cloudauth::Model;
InitSmartVerifyResult::InitSmartVerifyResult() :
ServiceResult()
{}
InitSmartVerifyResult::InitSmartVerifyResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
InitSmartVerifyResult::~InitSmartVerifyResult()
{}
void InitSmartVerifyResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto resultObjectNode = value["ResultObject"];
if(!resultObjectNode["CertifyId"].isNull())
resultObject_.certifyId = resultObjectNode["CertifyId"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Code"].isNull())
code_ = value["Code"].asString();
}
InitSmartVerifyResult::ResultObject InitSmartVerifyResult::getResultObject()const
{
return resultObject_;
}
std::string InitSmartVerifyResult::getMessage()const
{
return message_;
}
std::string InitSmartVerifyResult::getCode()const
{
return code_;
}

View File

@@ -75,8 +75,6 @@ void VerifyMaterialResult::parse(const std::string &payload)
verifyStatus_ = std::stoi(value["VerifyStatus"].asString());
if(!value["AuthorityComparisionScore"].isNull())
authorityComparisionScore_ = std::stof(value["AuthorityComparisionScore"].asString());
if(!value["FaceComparisonScore"].isNull())
faceComparisonScore_ = std::stof(value["FaceComparisonScore"].asString());
if(!value["IdCardFaceComparisonScore"].isNull())
idCardFaceComparisonScore_ = std::stof(value["IdCardFaceComparisonScore"].asString());
@@ -102,11 +100,6 @@ std::string VerifyMaterialResult::getVerifyToken()const
return verifyToken_;
}
float VerifyMaterialResult::getFaceComparisonScore()const
{
return faceComparisonScore_;
}
float VerifyMaterialResult::getIdCardFaceComparisonScore()const
{
return idCardFaceComparisonScore_;