Add LivenessFaceVerify API.
This commit is contained in:
@@ -1167,6 +1167,42 @@ CloudauthClient::InitSmartVerifyOutcomeCallable CloudauthClient::initSmartVerify
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
CloudauthClient::LivenessFaceVerifyOutcome CloudauthClient::livenessFaceVerify(const LivenessFaceVerifyRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return LivenessFaceVerifyOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return LivenessFaceVerifyOutcome(LivenessFaceVerifyResult(outcome.result()));
|
||||
else
|
||||
return LivenessFaceVerifyOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void CloudauthClient::livenessFaceVerifyAsync(const LivenessFaceVerifyRequest& request, const LivenessFaceVerifyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, livenessFaceVerify(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
CloudauthClient::LivenessFaceVerifyOutcomeCallable CloudauthClient::livenessFaceVerifyCallable(const LivenessFaceVerifyRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<LivenessFaceVerifyOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->livenessFaceVerify(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
CloudauthClient::ModifyDeviceInfoOutcome CloudauthClient::modifyDeviceInfo(const ModifyDeviceInfoRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
@@ -203,6 +203,17 @@ void InitFaceVerifyRequest::setOssBucketName(const std::string& ossBucketName)
|
||||
setParameter("OssBucketName", ossBucketName);
|
||||
}
|
||||
|
||||
std::string InitFaceVerifyRequest::getCallbackToken()const
|
||||
{
|
||||
return callbackToken_;
|
||||
}
|
||||
|
||||
void InitFaceVerifyRequest::setCallbackToken(const std::string& callbackToken)
|
||||
{
|
||||
callbackToken_ = callbackToken;
|
||||
setParameter("CallbackToken", callbackToken);
|
||||
}
|
||||
|
||||
std::string InitFaceVerifyRequest::getReturnUrl()const
|
||||
{
|
||||
return returnUrl_;
|
||||
@@ -214,3 +225,14 @@ void InitFaceVerifyRequest::setReturnUrl(const std::string& returnUrl)
|
||||
setParameter("ReturnUrl", returnUrl);
|
||||
}
|
||||
|
||||
std::string InitFaceVerifyRequest::getCallbackUrl()const
|
||||
{
|
||||
return callbackUrl_;
|
||||
}
|
||||
|
||||
void InitFaceVerifyRequest::setCallbackUrl(const std::string& callbackUrl)
|
||||
{
|
||||
callbackUrl_ = callbackUrl;
|
||||
setParameter("CallbackUrl", callbackUrl);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,39 +27,6 @@ InitSmartVerifyRequest::InitSmartVerifyRequest() :
|
||||
InitSmartVerifyRequest::~InitSmartVerifyRequest()
|
||||
{}
|
||||
|
||||
std::string InitSmartVerifyRequest::getIp()const
|
||||
{
|
||||
return ip_;
|
||||
}
|
||||
|
||||
void InitSmartVerifyRequest::setIp(const std::string& ip)
|
||||
{
|
||||
ip_ = ip;
|
||||
setBodyParameter("Ip", ip);
|
||||
}
|
||||
|
||||
std::string InitSmartVerifyRequest::getCertName()const
|
||||
{
|
||||
return certName_;
|
||||
}
|
||||
|
||||
void InitSmartVerifyRequest::setCertName(const std::string& certName)
|
||||
{
|
||||
certName_ = certName;
|
||||
setBodyParameter("CertName", certName);
|
||||
}
|
||||
|
||||
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_;
|
||||
@@ -71,6 +38,28 @@ void InitSmartVerifyRequest::setUserId(const std::string& userId)
|
||||
setBodyParameter("UserId", userId);
|
||||
}
|
||||
|
||||
std::string InitSmartVerifyRequest::getCertifyId()const
|
||||
{
|
||||
return certifyId_;
|
||||
}
|
||||
|
||||
void InitSmartVerifyRequest::setCertifyId(const std::string& certifyId)
|
||||
{
|
||||
certifyId_ = certifyId;
|
||||
setBodyParameter("CertifyId", certifyId);
|
||||
}
|
||||
|
||||
std::string InitSmartVerifyRequest::getFacePictureBase64()const
|
||||
{
|
||||
return facePictureBase64_;
|
||||
}
|
||||
|
||||
void InitSmartVerifyRequest::setFacePictureBase64(const std::string& facePictureBase64)
|
||||
{
|
||||
facePictureBase64_ = facePictureBase64;
|
||||
setBodyParameter("FacePictureBase64", facePictureBase64);
|
||||
}
|
||||
|
||||
std::string InitSmartVerifyRequest::getMode()const
|
||||
{
|
||||
return mode_;
|
||||
@@ -115,17 +104,6 @@ void InitSmartVerifyRequest::setCertType(const std::string& 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_;
|
||||
@@ -148,3 +126,102 @@ void InitSmartVerifyRequest::setOcr(const std::string& ocr)
|
||||
setBodyParameter("Ocr", ocr);
|
||||
}
|
||||
|
||||
std::string InitSmartVerifyRequest::getOssObjectName()const
|
||||
{
|
||||
return ossObjectName_;
|
||||
}
|
||||
|
||||
void InitSmartVerifyRequest::setOssObjectName(const std::string& ossObjectName)
|
||||
{
|
||||
ossObjectName_ = ossObjectName;
|
||||
setBodyParameter("OssObjectName", ossObjectName);
|
||||
}
|
||||
|
||||
std::string InitSmartVerifyRequest::getFacePictureUrl()const
|
||||
{
|
||||
return facePictureUrl_;
|
||||
}
|
||||
|
||||
void InitSmartVerifyRequest::setFacePictureUrl(const std::string& facePictureUrl)
|
||||
{
|
||||
facePictureUrl_ = facePictureUrl;
|
||||
setBodyParameter("FacePictureUrl", facePictureUrl);
|
||||
}
|
||||
|
||||
std::string InitSmartVerifyRequest::getIp()const
|
||||
{
|
||||
return ip_;
|
||||
}
|
||||
|
||||
void InitSmartVerifyRequest::setIp(const std::string& ip)
|
||||
{
|
||||
ip_ = ip;
|
||||
setBodyParameter("Ip", ip);
|
||||
}
|
||||
|
||||
std::string InitSmartVerifyRequest::getCertName()const
|
||||
{
|
||||
return certName_;
|
||||
}
|
||||
|
||||
void InitSmartVerifyRequest::setCertName(const std::string& certName)
|
||||
{
|
||||
certName_ = certName;
|
||||
setBodyParameter("CertName", certName);
|
||||
}
|
||||
|
||||
std::string InitSmartVerifyRequest::getMobile()const
|
||||
{
|
||||
return mobile_;
|
||||
}
|
||||
|
||||
void InitSmartVerifyRequest::setMobile(const std::string& mobile)
|
||||
{
|
||||
mobile_ = mobile;
|
||||
setBodyParameter("Mobile", mobile);
|
||||
}
|
||||
|
||||
long InitSmartVerifyRequest::getSceneId()const
|
||||
{
|
||||
return sceneId_;
|
||||
}
|
||||
|
||||
void InitSmartVerifyRequest::setSceneId(long sceneId)
|
||||
{
|
||||
sceneId_ = sceneId;
|
||||
setBodyParameter("SceneId", std::to_string(sceneId));
|
||||
}
|
||||
|
||||
std::string InitSmartVerifyRequest::getCallbackToken()const
|
||||
{
|
||||
return callbackToken_;
|
||||
}
|
||||
|
||||
void InitSmartVerifyRequest::setCallbackToken(const std::string& callbackToken)
|
||||
{
|
||||
callbackToken_ = callbackToken;
|
||||
setBodyParameter("CallbackToken", callbackToken);
|
||||
}
|
||||
|
||||
std::string InitSmartVerifyRequest::getOssBucketName()const
|
||||
{
|
||||
return ossBucketName_;
|
||||
}
|
||||
|
||||
void InitSmartVerifyRequest::setOssBucketName(const std::string& ossBucketName)
|
||||
{
|
||||
ossBucketName_ = ossBucketName;
|
||||
setBodyParameter("OssBucketName", ossBucketName);
|
||||
}
|
||||
|
||||
std::string InitSmartVerifyRequest::getCallbackUrl()const
|
||||
{
|
||||
return callbackUrl_;
|
||||
}
|
||||
|
||||
void InitSmartVerifyRequest::setCallbackUrl(const std::string& callbackUrl)
|
||||
{
|
||||
callbackUrl_ = callbackUrl;
|
||||
setBodyParameter("CallbackUrl", callbackUrl);
|
||||
}
|
||||
|
||||
|
||||
172
cloudauth/src/model/LivenessFaceVerifyRequest.cc
Normal file
172
cloudauth/src/model/LivenessFaceVerifyRequest.cc
Normal file
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* 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/LivenessFaceVerifyRequest.h>
|
||||
|
||||
using AlibabaCloud::Cloudauth::Model::LivenessFaceVerifyRequest;
|
||||
|
||||
LivenessFaceVerifyRequest::LivenessFaceVerifyRequest() :
|
||||
RpcServiceRequest("cloudauth", "2019-03-07", "LivenessFaceVerify")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
LivenessFaceVerifyRequest::~LivenessFaceVerifyRequest()
|
||||
{}
|
||||
|
||||
std::string LivenessFaceVerifyRequest::getProductCode()const
|
||||
{
|
||||
return productCode_;
|
||||
}
|
||||
|
||||
void LivenessFaceVerifyRequest::setProductCode(const std::string& productCode)
|
||||
{
|
||||
productCode_ = productCode;
|
||||
setBodyParameter("ProductCode", productCode);
|
||||
}
|
||||
|
||||
std::string LivenessFaceVerifyRequest::getOssObjectName()const
|
||||
{
|
||||
return ossObjectName_;
|
||||
}
|
||||
|
||||
void LivenessFaceVerifyRequest::setOssObjectName(const std::string& ossObjectName)
|
||||
{
|
||||
ossObjectName_ = ossObjectName;
|
||||
setBodyParameter("OssObjectName", ossObjectName);
|
||||
}
|
||||
|
||||
std::string LivenessFaceVerifyRequest::getFaceContrastPicture()const
|
||||
{
|
||||
return faceContrastPicture_;
|
||||
}
|
||||
|
||||
void LivenessFaceVerifyRequest::setFaceContrastPicture(const std::string& faceContrastPicture)
|
||||
{
|
||||
faceContrastPicture_ = faceContrastPicture;
|
||||
setBodyParameter("FaceContrastPicture", faceContrastPicture);
|
||||
}
|
||||
|
||||
std::string LivenessFaceVerifyRequest::getIp()const
|
||||
{
|
||||
return ip_;
|
||||
}
|
||||
|
||||
void LivenessFaceVerifyRequest::setIp(const std::string& ip)
|
||||
{
|
||||
ip_ = ip;
|
||||
setBodyParameter("Ip", ip);
|
||||
}
|
||||
|
||||
std::string LivenessFaceVerifyRequest::getMobile()const
|
||||
{
|
||||
return mobile_;
|
||||
}
|
||||
|
||||
void LivenessFaceVerifyRequest::setMobile(const std::string& mobile)
|
||||
{
|
||||
mobile_ = mobile;
|
||||
setBodyParameter("Mobile", mobile);
|
||||
}
|
||||
|
||||
std::string LivenessFaceVerifyRequest::getDeviceToken()const
|
||||
{
|
||||
return deviceToken_;
|
||||
}
|
||||
|
||||
void LivenessFaceVerifyRequest::setDeviceToken(const std::string& deviceToken)
|
||||
{
|
||||
deviceToken_ = deviceToken;
|
||||
setBodyParameter("DeviceToken", deviceToken);
|
||||
}
|
||||
|
||||
std::string LivenessFaceVerifyRequest::getUserId()const
|
||||
{
|
||||
return userId_;
|
||||
}
|
||||
|
||||
void LivenessFaceVerifyRequest::setUserId(const std::string& userId)
|
||||
{
|
||||
userId_ = userId;
|
||||
setBodyParameter("UserId", userId);
|
||||
}
|
||||
|
||||
std::string LivenessFaceVerifyRequest::getCertifyId()const
|
||||
{
|
||||
return certifyId_;
|
||||
}
|
||||
|
||||
void LivenessFaceVerifyRequest::setCertifyId(const std::string& certifyId)
|
||||
{
|
||||
certifyId_ = certifyId;
|
||||
setBodyParameter("CertifyId", certifyId);
|
||||
}
|
||||
|
||||
std::string LivenessFaceVerifyRequest::getOuterOrderNo()const
|
||||
{
|
||||
return outerOrderNo_;
|
||||
}
|
||||
|
||||
void LivenessFaceVerifyRequest::setOuterOrderNo(const std::string& outerOrderNo)
|
||||
{
|
||||
outerOrderNo_ = outerOrderNo;
|
||||
setBodyParameter("OuterOrderNo", outerOrderNo);
|
||||
}
|
||||
|
||||
std::string LivenessFaceVerifyRequest::getFaceContrastPictureUrl()const
|
||||
{
|
||||
return faceContrastPictureUrl_;
|
||||
}
|
||||
|
||||
void LivenessFaceVerifyRequest::setFaceContrastPictureUrl(const std::string& faceContrastPictureUrl)
|
||||
{
|
||||
faceContrastPictureUrl_ = faceContrastPictureUrl;
|
||||
setBodyParameter("FaceContrastPictureUrl", faceContrastPictureUrl);
|
||||
}
|
||||
|
||||
long LivenessFaceVerifyRequest::getSceneId()const
|
||||
{
|
||||
return sceneId_;
|
||||
}
|
||||
|
||||
void LivenessFaceVerifyRequest::setSceneId(long sceneId)
|
||||
{
|
||||
sceneId_ = sceneId;
|
||||
setBodyParameter("SceneId", std::to_string(sceneId));
|
||||
}
|
||||
|
||||
std::string LivenessFaceVerifyRequest::getOssBucketName()const
|
||||
{
|
||||
return ossBucketName_;
|
||||
}
|
||||
|
||||
void LivenessFaceVerifyRequest::setOssBucketName(const std::string& ossBucketName)
|
||||
{
|
||||
ossBucketName_ = ossBucketName;
|
||||
setBodyParameter("OssBucketName", ossBucketName);
|
||||
}
|
||||
|
||||
std::string LivenessFaceVerifyRequest::getModel()const
|
||||
{
|
||||
return model_;
|
||||
}
|
||||
|
||||
void LivenessFaceVerifyRequest::setModel(const std::string& model)
|
||||
{
|
||||
model_ = model;
|
||||
setParameter("Model", model);
|
||||
}
|
||||
|
||||
70
cloudauth/src/model/LivenessFaceVerifyResult.cc
Normal file
70
cloudauth/src/model/LivenessFaceVerifyResult.cc
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
* 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/LivenessFaceVerifyResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Cloudauth;
|
||||
using namespace AlibabaCloud::Cloudauth::Model;
|
||||
|
||||
LivenessFaceVerifyResult::LivenessFaceVerifyResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
LivenessFaceVerifyResult::LivenessFaceVerifyResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
LivenessFaceVerifyResult::~LivenessFaceVerifyResult()
|
||||
{}
|
||||
|
||||
void LivenessFaceVerifyResult::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["MaterialInfo"].isNull())
|
||||
resultObject_.materialInfo = resultObjectNode["MaterialInfo"].asString();
|
||||
if(!resultObjectNode["SubCode"].isNull())
|
||||
resultObject_.subCode = resultObjectNode["SubCode"].asString();
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
if(!value["Code"].isNull())
|
||||
code_ = value["Code"].asString();
|
||||
|
||||
}
|
||||
|
||||
LivenessFaceVerifyResult::ResultObject LivenessFaceVerifyResult::getResultObject()const
|
||||
{
|
||||
return resultObject_;
|
||||
}
|
||||
|
||||
std::string LivenessFaceVerifyResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
std::string LivenessFaceVerifyResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user