LivenessFaceVerify ContrastFaceVerify CompareFaceVerify API Return CertifyId.

This commit is contained in:
sdk-team
2021-04-20 02:25:27 +00:00
parent 742ad5f67c
commit c2b59302fa
15 changed files with 336 additions and 1 deletions

View File

@@ -1419,6 +1419,42 @@ CloudauthClient::InitSmartVerifyOutcomeCallable CloudauthClient::initSmartVerify
return task->get_future();
}
CloudauthClient::LivenessDetectOutcome CloudauthClient::livenessDetect(const LivenessDetectRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return LivenessDetectOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return LivenessDetectOutcome(LivenessDetectResult(outcome.result()));
else
return LivenessDetectOutcome(outcome.error());
}
void CloudauthClient::livenessDetectAsync(const LivenessDetectRequest& request, const LivenessDetectAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, livenessDetect(request), context);
};
asyncExecute(new Runnable(fn));
}
CloudauthClient::LivenessDetectOutcomeCallable CloudauthClient::livenessDetectCallable(const LivenessDetectRequest &request) const
{
auto task = std::make_shared<std::packaged_task<LivenessDetectOutcome()>>(
[this, request]()
{
return this->livenessDetect(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CloudauthClient::LivenessFaceVerifyOutcome CloudauthClient::livenessFaceVerify(const LivenessFaceVerifyRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -44,6 +44,8 @@ void CompareFaceVerifyResult::parse(const std::string &payload)
resultObject_.passed = resultObjectNode["Passed"].asString();
if(!resultObjectNode["VerifyScore"].isNull())
resultObject_.verifyScore = std::stof(resultObjectNode["VerifyScore"].asString());
if(!resultObjectNode["CertifyId"].isNull())
resultObject_.certifyId = resultObjectNode["CertifyId"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Code"].isNull())

View File

@@ -48,6 +48,8 @@ void ContrastFaceVerifyResult::parse(const std::string &payload)
resultObject_.materialInfo = resultObjectNode["MaterialInfo"].asString();
if(!resultObjectNode["SubCode"].isNull())
resultObject_.subCode = resultObjectNode["SubCode"].asString();
if(!resultObjectNode["CertifyId"].isNull())
resultObject_.certifyId = resultObjectNode["CertifyId"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Code"].isNull())

View File

@@ -0,0 +1,84 @@
/*
* 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/LivenessDetectRequest.h>
using AlibabaCloud::Cloudauth::Model::LivenessDetectRequest;
LivenessDetectRequest::LivenessDetectRequest() :
RpcServiceRequest("cloudauth", "2020-11-12", "LivenessDetect")
{
setMethod(HttpRequest::Method::Post);
}
LivenessDetectRequest::~LivenessDetectRequest()
{}
std::string LivenessDetectRequest::getMediaCategory()const
{
return mediaCategory_;
}
void LivenessDetectRequest::setMediaCategory(const std::string& mediaCategory)
{
mediaCategory_ = mediaCategory;
setBodyParameter("MediaCategory", mediaCategory);
}
std::string LivenessDetectRequest::getMediaUrl()const
{
return mediaUrl_;
}
void LivenessDetectRequest::setMediaUrl(const std::string& mediaUrl)
{
mediaUrl_ = mediaUrl;
setBodyParameter("MediaUrl", mediaUrl);
}
std::string LivenessDetectRequest::getBizType()const
{
return bizType_;
}
void LivenessDetectRequest::setBizType(const std::string& bizType)
{
bizType_ = bizType;
setBodyParameter("BizType", bizType);
}
std::string LivenessDetectRequest::getBizId()const
{
return bizId_;
}
void LivenessDetectRequest::setBizId(const std::string& bizId)
{
bizId_ = bizId;
setBodyParameter("BizId", bizId);
}
std::string LivenessDetectRequest::getMediaFile()const
{
return mediaFile_;
}
void LivenessDetectRequest::setMediaFile(const std::string& mediaFile)
{
mediaFile_ = mediaFile;
setBodyParameter("MediaFile", mediaFile);
}

View 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/LivenessDetectResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Cloudauth;
using namespace AlibabaCloud::Cloudauth::Model;
LivenessDetectResult::LivenessDetectResult() :
ServiceResult()
{}
LivenessDetectResult::LivenessDetectResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
LivenessDetectResult::~LivenessDetectResult()
{}
void LivenessDetectResult::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["Score"].isNull())
resultObject_.score = std::stof(resultObjectNode["Score"].asString());
if(!resultObjectNode["FrameUrl"].isNull())
resultObject_.frameUrl = resultObjectNode["FrameUrl"].asString();
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
}
LivenessDetectResult::ResultObject LivenessDetectResult::getResultObject()const
{
return resultObject_;
}
std::string LivenessDetectResult::getMessage()const
{
return message_;
}
std::string LivenessDetectResult::getCode()const
{
return code_;
}

View File

@@ -46,6 +46,8 @@ void LivenessFaceVerifyResult::parse(const std::string &payload)
resultObject_.materialInfo = resultObjectNode["MaterialInfo"].asString();
if(!resultObjectNode["SubCode"].isNull())
resultObject_.subCode = resultObjectNode["SubCode"].asString();
if(!resultObjectNode["CertifyId"].isNull())
resultObject_.certifyId = resultObjectNode["CertifyId"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Code"].isNull())