CLOUDAUTH SDK Auto Released By zhongdong.pzd,Version:1.19.2

Signed-off-by: haowei.yao <haowei.yao@alibaba-inc.com>
This commit is contained in:
haowei.yao
2018-07-11 13:24:34 +08:00
parent 62484954fe
commit a9f8d260ed
18 changed files with 466 additions and 12 deletions

View File

@@ -123,6 +123,42 @@ CloudauthClient::GetVerifyTokenOutcomeCallable CloudauthClient::getVerifyTokenCa
return task->get_future();
}
CloudauthClient::DetectFaceAttributesOutcome CloudauthClient::detectFaceAttributes(const DetectFaceAttributesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DetectFaceAttributesOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DetectFaceAttributesOutcome(DetectFaceAttributesResult(outcome.result()));
else
return DetectFaceAttributesOutcome(outcome.error());
}
void CloudauthClient::detectFaceAttributesAsync(const DetectFaceAttributesRequest& request, const DetectFaceAttributesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, detectFaceAttributes(request), context);
};
asyncExecute(new Runnable(fn));
}
CloudauthClient::DetectFaceAttributesOutcomeCallable CloudauthClient::detectFaceAttributesCallable(const DetectFaceAttributesRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DetectFaceAttributesOutcome()>>(
[this, request]()
{
return this->detectFaceAttributes(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CloudauthClient::CompareFacesOutcome CloudauthClient::compareFaces(const CompareFacesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -19,7 +19,7 @@
using AlibabaCloud::Cloudauth::Model::CompareFacesRequest;
CompareFacesRequest::CompareFacesRequest() :
RpcServiceRequest("cloudauth", "2018-05-04", "CompareFaces")
RpcServiceRequest("cloudauth", "2018-07-03", "CompareFaces")
{}
CompareFacesRequest::~CompareFacesRequest()

View File

@@ -0,0 +1,115 @@
/*
* 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/DetectFaceAttributesRequest.h>
using AlibabaCloud::Cloudauth::Model::DetectFaceAttributesRequest;
DetectFaceAttributesRequest::DetectFaceAttributesRequest() :
RpcServiceRequest("cloudauth", "2018-07-03", "DetectFaceAttributes")
{}
DetectFaceAttributesRequest::~DetectFaceAttributesRequest()
{}
int DetectFaceAttributesRequest::getMaxNumPhotosPerCategory()const
{
return maxNumPhotosPerCategory_;
}
void DetectFaceAttributesRequest::setMaxNumPhotosPerCategory(int maxNumPhotosPerCategory)
{
maxNumPhotosPerCategory_ = maxNumPhotosPerCategory;
setParameter("MaxNumPhotosPerCategory", std::to_string(maxNumPhotosPerCategory));
}
int DetectFaceAttributesRequest::getMaxFaceNum()const
{
return maxFaceNum_;
}
void DetectFaceAttributesRequest::setMaxFaceNum(int maxFaceNum)
{
maxFaceNum_ = maxFaceNum;
setParameter("MaxFaceNum", std::to_string(maxFaceNum));
}
long DetectFaceAttributesRequest::getResourceOwnerId()const
{
return resourceOwnerId_;
}
void DetectFaceAttributesRequest::setResourceOwnerId(long resourceOwnerId)
{
resourceOwnerId_ = resourceOwnerId;
setParameter("ResourceOwnerId", std::to_string(resourceOwnerId));
}
std::string DetectFaceAttributesRequest::getSourceIp()const
{
return sourceIp_;
}
void DetectFaceAttributesRequest::setSourceIp(const std::string& sourceIp)
{
sourceIp_ = sourceIp;
setParameter("SourceIp", sourceIp);
}
std::string DetectFaceAttributesRequest::getRetAttributes()const
{
return retAttributes_;
}
void DetectFaceAttributesRequest::setRetAttributes(const std::string& retAttributes)
{
retAttributes_ = retAttributes;
setParameter("RetAttributes", retAttributes);
}
std::string DetectFaceAttributesRequest::getMaterialValue()const
{
return materialValue_;
}
void DetectFaceAttributesRequest::setMaterialValue(const std::string& materialValue)
{
materialValue_ = materialValue;
setParameter("MaterialValue", materialValue);
}
bool DetectFaceAttributesRequest::getDontSaveDB()const
{
return dontSaveDB_;
}
void DetectFaceAttributesRequest::setDontSaveDB(bool dontSaveDB)
{
dontSaveDB_ = dontSaveDB;
setParameter("DontSaveDB", std::to_string(dontSaveDB));
}
std::string DetectFaceAttributesRequest::getClientTag()const
{
return clientTag_;
}
void DetectFaceAttributesRequest::setClientTag(const std::string& clientTag)
{
clientTag_ = clientTag;
setParameter("ClientTag", clientTag);
}

View File

@@ -0,0 +1,119 @@
/*
* 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/DetectFaceAttributesResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Cloudauth;
using namespace AlibabaCloud::Cloudauth::Model;
DetectFaceAttributesResult::DetectFaceAttributesResult() :
ServiceResult()
{}
DetectFaceAttributesResult::DetectFaceAttributesResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
DetectFaceAttributesResult::~DetectFaceAttributesResult()
{}
void DetectFaceAttributesResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
if(!dataNode["ImgWidth"].isNull())
data_.imgWidth = std::stoi(dataNode["ImgWidth"].asString());
if(!dataNode["ImgHeight"].isNull())
data_.imgHeight = std::stoi(dataNode["ImgHeight"].asString());
auto allFaceInfos = value["FaceInfos"]["FaceAttributesDetectInfo"];
for (auto value : allFaceInfos)
{
Data::FaceAttributesDetectInfo faceAttributesDetectInfoObject;
auto faceRectNode = value["FaceRect"];
if(!faceRectNode["Top"].isNull())
faceAttributesDetectInfoObject.faceRect.top = std::stoi(faceRectNode["Top"].asString());
if(!faceRectNode["Left"].isNull())
faceAttributesDetectInfoObject.faceRect.left = std::stoi(faceRectNode["Left"].asString());
if(!faceRectNode["Width"].isNull())
faceAttributesDetectInfoObject.faceRect.width = std::stoi(faceRectNode["Width"].asString());
if(!faceRectNode["Height"].isNull())
faceAttributesDetectInfoObject.faceRect.height = std::stoi(faceRectNode["Height"].asString());
auto faceAttributesNode = value["FaceAttributes"];
if(!faceAttributesNode["Age"].isNull())
faceAttributesDetectInfoObject.faceAttributes.age = std::stoi(faceAttributesNode["Age"].asString());
if(!faceAttributesNode["Glasses"].isNull())
faceAttributesDetectInfoObject.faceAttributes.glasses = faceAttributesNode["Glasses"].asString();
if(!faceAttributesNode["Facetype"].isNull())
faceAttributesDetectInfoObject.faceAttributes.facetype = faceAttributesNode["Facetype"].asString();
if(!faceAttributesNode["Blur"].isNull())
faceAttributesDetectInfoObject.faceAttributes.blur = std::stof(faceAttributesNode["Blur"].asString());
if(!faceAttributesNode["Ethnicity"].isNull())
faceAttributesDetectInfoObject.faceAttributes.ethnicity = faceAttributesNode["Ethnicity"].asString();
auto genderNode = faceAttributesNode["Gender"];
if(!genderNode["Score"].isNull())
faceAttributesDetectInfoObject.faceAttributes.gender.score = std::stof(genderNode["Score"].asString());
if(!genderNode["Value"].isNull())
faceAttributesDetectInfoObject.faceAttributes.gender.value = genderNode["Value"].asString();
auto smilingNode = faceAttributesNode["Smiling"];
if(!smilingNode["Value"].isNull())
faceAttributesDetectInfoObject.faceAttributes.smiling.value = std::stof(smilingNode["Value"].asString());
if(!smilingNode["Threshold"].isNull())
faceAttributesDetectInfoObject.faceAttributes.smiling.threshold = std::stof(smilingNode["Threshold"].asString());
auto headposeNode = faceAttributesNode["Headpose"];
if(!headposeNode["PitchAngle"].isNull())
faceAttributesDetectInfoObject.faceAttributes.headpose.pitchAngle = std::stof(headposeNode["PitchAngle"].asString());
if(!headposeNode["RollAngle"].isNull())
faceAttributesDetectInfoObject.faceAttributes.headpose.rollAngle = std::stof(headposeNode["RollAngle"].asString());
if(!headposeNode["YawAngle"].isNull())
faceAttributesDetectInfoObject.faceAttributes.headpose.yawAngle = std::stof(headposeNode["YawAngle"].asString());
data_.faceInfos.push_back(faceAttributesDetectInfoObject);
}
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
}
std::string DetectFaceAttributesResult::getMessage()const
{
return message_;
}
DetectFaceAttributesResult::Data DetectFaceAttributesResult::getData()const
{
return data_;
}
std::string DetectFaceAttributesResult::getCode()const
{
return code_;
}
bool DetectFaceAttributesResult::getSuccess()const
{
return success_;
}

View File

@@ -19,7 +19,7 @@
using AlibabaCloud::Cloudauth::Model::GetMaterialsRequest;
GetMaterialsRequest::GetMaterialsRequest() :
RpcServiceRequest("cloudauth", "2018-05-04", "GetMaterials")
RpcServiceRequest("cloudauth", "2018-07-03", "GetMaterials")
{}
GetMaterialsRequest::~GetMaterialsRequest()

View File

@@ -47,8 +47,6 @@ void GetMaterialsResult::parse(const std::string &payload)
data_.identificationNumber = dataNode["IdentificationNumber"].asString();
if(!dataNode["IdCardType"].isNull())
data_.idCardType = dataNode["IdCardType"].asString();
if(!dataNode["IdCardStartDate"].isNull())
data_.idCardStartDate = dataNode["IdCardStartDate"].asString();
if(!dataNode["IdCardExpiry"].isNull())
data_.idCardExpiry = dataNode["IdCardExpiry"].asString();
if(!dataNode["Address"].isNull())
@@ -61,8 +59,6 @@ void GetMaterialsResult::parse(const std::string &payload)
data_.idCardBackPic = dataNode["IdCardBackPic"].asString();
if(!dataNode["FacePic"].isNull())
data_.facePic = dataNode["FacePic"].asString();
if(!dataNode["EthnicGroup"].isNull())
data_.ethnicGroup = dataNode["EthnicGroup"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["Code"].isNull())

View File

@@ -19,7 +19,7 @@
using AlibabaCloud::Cloudauth::Model::GetStatusRequest;
GetStatusRequest::GetStatusRequest() :
RpcServiceRequest("cloudauth", "2018-05-04", "GetStatus")
RpcServiceRequest("cloudauth", "2018-07-03", "GetStatus")
{}
GetStatusRequest::~GetStatusRequest()

View File

@@ -19,7 +19,7 @@
using AlibabaCloud::Cloudauth::Model::GetVerifyTokenRequest;
GetVerifyTokenRequest::GetVerifyTokenRequest() :
RpcServiceRequest("cloudauth", "2018-05-04", "GetVerifyToken")
RpcServiceRequest("cloudauth", "2018-07-03", "GetVerifyToken")
{}
GetVerifyTokenRequest::~GetVerifyTokenRequest()

View File

@@ -41,6 +41,8 @@ void GetVerifyTokenResult::parse(const std::string &payload)
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
if(!dataNode["CloudauthPageUrl"].isNull())
data_.cloudauthPageUrl = dataNode["CloudauthPageUrl"].asString();
auto verifyTokenNode = dataNode["VerifyToken"];
if(!verifyTokenNode["Token"].isNull())
data_.verifyToken.token = verifyTokenNode["Token"].asString();

View File

@@ -19,7 +19,7 @@
using AlibabaCloud::Cloudauth::Model::SubmitMaterialsRequest;
SubmitMaterialsRequest::SubmitMaterialsRequest() :
RpcServiceRequest("cloudauth", "2018-05-04", "SubmitMaterials")
RpcServiceRequest("cloudauth", "2018-07-03", "SubmitMaterials")
{}
SubmitMaterialsRequest::~SubmitMaterialsRequest()