Pārlūkot izejas kodu

LivenessFaceVerify ContrastFaceVerify CompareFaceVerify API Return CertifyId.

sdk-team 5 gadi atpakaļ
vecāks
revīzija
c2b59302fa

+ 3 - 0
CHANGELOG

@@ -1,3 +1,6 @@
+2021-04-20 Version: 1.36.689
+- LivenessFaceVerify ContrastFaceVerify CompareFaceVerify API Return CertifyId.
+
 2021-04-19 Version: 1.36.688
 - Export StartBack2BackCall API.
 

+ 1 - 1
VERSION

@@ -1 +1 @@
-1.36.688
+1.36.689

+ 4 - 0
cloudauth/CMakeLists.txt

@@ -97,6 +97,8 @@ set(cloudauth_public_header_model
 	include/alibabacloud/cloudauth/model/InitFaceVerifyResult.h
 	include/alibabacloud/cloudauth/model/InitSmartVerifyRequest.h
 	include/alibabacloud/cloudauth/model/InitSmartVerifyResult.h
+	include/alibabacloud/cloudauth/model/LivenessDetectRequest.h
+	include/alibabacloud/cloudauth/model/LivenessDetectResult.h
 	include/alibabacloud/cloudauth/model/LivenessFaceVerifyRequest.h
 	include/alibabacloud/cloudauth/model/LivenessFaceVerifyResult.h
 	include/alibabacloud/cloudauth/model/ModifyDeviceInfoRequest.h
@@ -196,6 +198,8 @@ set(cloudauth_src
 	src/model/InitFaceVerifyResult.cc
 	src/model/InitSmartVerifyRequest.cc
 	src/model/InitSmartVerifyResult.cc
+	src/model/LivenessDetectRequest.cc
+	src/model/LivenessDetectResult.cc
 	src/model/LivenessFaceVerifyRequest.cc
 	src/model/LivenessFaceVerifyResult.cc
 	src/model/ModifyDeviceInfoRequest.cc

+ 8 - 0
cloudauth/include/alibabacloud/cloudauth/CloudauthClient.h

@@ -98,6 +98,8 @@
 #include "model/InitFaceVerifyResult.h"
 #include "model/InitSmartVerifyRequest.h"
 #include "model/InitSmartVerifyResult.h"
+#include "model/LivenessDetectRequest.h"
+#include "model/LivenessDetectResult.h"
 #include "model/LivenessFaceVerifyRequest.h"
 #include "model/LivenessFaceVerifyResult.h"
 #include "model/ModifyDeviceInfoRequest.h"
@@ -241,6 +243,9 @@ namespace AlibabaCloud
 			typedef Outcome<Error, Model::InitSmartVerifyResult> InitSmartVerifyOutcome;
 			typedef std::future<InitSmartVerifyOutcome> InitSmartVerifyOutcomeCallable;
 			typedef std::function<void(const CloudauthClient*, const Model::InitSmartVerifyRequest&, const InitSmartVerifyOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> InitSmartVerifyAsyncHandler;
+			typedef Outcome<Error, Model::LivenessDetectResult> LivenessDetectOutcome;
+			typedef std::future<LivenessDetectOutcome> LivenessDetectOutcomeCallable;
+			typedef std::function<void(const CloudauthClient*, const Model::LivenessDetectRequest&, const LivenessDetectOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> LivenessDetectAsyncHandler;
 			typedef Outcome<Error, Model::LivenessFaceVerifyResult> LivenessFaceVerifyOutcome;
 			typedef std::future<LivenessFaceVerifyOutcome> LivenessFaceVerifyOutcomeCallable;
 			typedef std::function<void(const CloudauthClient*, const Model::LivenessFaceVerifyRequest&, const LivenessFaceVerifyOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> LivenessFaceVerifyAsyncHandler;
@@ -390,6 +395,9 @@ namespace AlibabaCloud
 			InitSmartVerifyOutcome initSmartVerify(const Model::InitSmartVerifyRequest &request)const;
 			void initSmartVerifyAsync(const Model::InitSmartVerifyRequest& request, const InitSmartVerifyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			InitSmartVerifyOutcomeCallable initSmartVerifyCallable(const Model::InitSmartVerifyRequest& request) const;
+			LivenessDetectOutcome livenessDetect(const Model::LivenessDetectRequest &request)const;
+			void livenessDetectAsync(const Model::LivenessDetectRequest& request, const LivenessDetectAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
+			LivenessDetectOutcomeCallable livenessDetectCallable(const Model::LivenessDetectRequest& request) const;
 			LivenessFaceVerifyOutcome livenessFaceVerify(const Model::LivenessFaceVerifyRequest &request)const;
 			void livenessFaceVerifyAsync(const Model::LivenessFaceVerifyRequest& request, const LivenessFaceVerifyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			LivenessFaceVerifyOutcomeCallable livenessFaceVerifyCallable(const Model::LivenessFaceVerifyRequest& request) const;

+ 1 - 0
cloudauth/include/alibabacloud/cloudauth/model/CompareFaceVerifyResult.h

@@ -36,6 +36,7 @@ namespace AlibabaCloud
 				{
 					std::string passed;
 					float verifyScore;
+					std::string certifyId;
 				};
 
 

+ 1 - 0
cloudauth/include/alibabacloud/cloudauth/model/ContrastFaceVerifyResult.h

@@ -35,6 +35,7 @@ namespace AlibabaCloud
 				struct ResultObject
 				{
 					std::string passed;
+					std::string certifyId;
 					std::string identityInfo;
 					std::string materialInfo;
 					std::string subCode;

+ 60 - 0
cloudauth/include/alibabacloud/cloudauth/model/LivenessDetectRequest.h

@@ -0,0 +1,60 @@
+/*
+ * 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_CLOUDAUTH_MODEL_LIVENESSDETECTREQUEST_H_
+#define ALIBABACLOUD_CLOUDAUTH_MODEL_LIVENESSDETECTREQUEST_H_
+
+#include <string>
+#include <vector>
+#include <alibabacloud/core/RpcServiceRequest.h>
+#include <alibabacloud/cloudauth/CloudauthExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Cloudauth
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_CLOUDAUTH_EXPORT LivenessDetectRequest : public RpcServiceRequest
+			{
+
+			public:
+				LivenessDetectRequest();
+				~LivenessDetectRequest();
+
+				std::string getMediaCategory()const;
+				void setMediaCategory(const std::string& mediaCategory);
+				std::string getMediaUrl()const;
+				void setMediaUrl(const std::string& mediaUrl);
+				std::string getBizType()const;
+				void setBizType(const std::string& bizType);
+				std::string getBizId()const;
+				void setBizId(const std::string& bizId);
+				std::string getMediaFile()const;
+				void setMediaFile(const std::string& mediaFile);
+
+            private:
+				std::string mediaCategory_;
+				std::string mediaUrl_;
+				std::string bizType_;
+				std::string bizId_;
+				std::string mediaFile_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_CLOUDAUTH_MODEL_LIVENESSDETECTREQUEST_H_

+ 61 - 0
cloudauth/include/alibabacloud/cloudauth/model/LivenessDetectResult.h

@@ -0,0 +1,61 @@
+/*
+ * 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_CLOUDAUTH_MODEL_LIVENESSDETECTRESULT_H_
+#define ALIBABACLOUD_CLOUDAUTH_MODEL_LIVENESSDETECTRESULT_H_
+
+#include <string>
+#include <vector>
+#include <utility>
+#include <alibabacloud/core/ServiceResult.h>
+#include <alibabacloud/cloudauth/CloudauthExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Cloudauth
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_CLOUDAUTH_EXPORT LivenessDetectResult : public ServiceResult
+			{
+			public:
+				struct ResultObject
+				{
+					std::string passed;
+					float score;
+					std::string frameUrl;
+				};
+
+
+				LivenessDetectResult();
+				explicit LivenessDetectResult(const std::string &payload);
+				~LivenessDetectResult();
+				ResultObject getResultObject()const;
+				std::string getMessage()const;
+				std::string getCode()const;
+
+			protected:
+				void parse(const std::string &payload);
+			private:
+				ResultObject resultObject_;
+				std::string message_;
+				std::string code_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_CLOUDAUTH_MODEL_LIVENESSDETECTRESULT_H_

+ 1 - 0
cloudauth/include/alibabacloud/cloudauth/model/LivenessFaceVerifyResult.h

@@ -35,6 +35,7 @@ namespace AlibabaCloud
 				struct ResultObject
 				{
 					std::string passed;
+					std::string certifyId;
 					std::string materialInfo;
 					std::string subCode;
 				};

+ 36 - 0
cloudauth/src/CloudauthClient.cc

@@ -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();

+ 2 - 0
cloudauth/src/model/CompareFaceVerifyResult.cc

@@ -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())

+ 2 - 0
cloudauth/src/model/ContrastFaceVerifyResult.cc

@@ -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())

+ 84 - 0
cloudauth/src/model/LivenessDetectRequest.cc

@@ -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);
+}
+

+ 70 - 0
cloudauth/src/model/LivenessDetectResult.cc

@@ -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_;
+}
+

+ 2 - 0
cloudauth/src/model/LivenessFaceVerifyResult.cc

@@ -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())