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

@@ -1,3 +1,7 @@
2018-07-11 Version: 1.19.2
1, Add DetectFaceAttributesService.
2, Add cloudauthPageUrl to GetVerifyTokenResponse.
2018-07-05 Version: 1.19.1
1, new function, attach/detach load balancer of scalingGroup

View File

@@ -1 +1 @@
1.19.1
1.19.2

View File

@@ -25,6 +25,8 @@ set(cloudauth_public_header_model
include/alibabacloud/cloudauth/model/GetMaterialsResult.h
include/alibabacloud/cloudauth/model/GetVerifyTokenRequest.h
include/alibabacloud/cloudauth/model/GetVerifyTokenResult.h
include/alibabacloud/cloudauth/model/DetectFaceAttributesRequest.h
include/alibabacloud/cloudauth/model/DetectFaceAttributesResult.h
include/alibabacloud/cloudauth/model/CompareFacesRequest.h
include/alibabacloud/cloudauth/model/CompareFacesResult.h
include/alibabacloud/cloudauth/model/SubmitMaterialsRequest.h
@@ -38,6 +40,8 @@ set(cloudauth_src
src/model/GetMaterialsResult.cc
src/model/GetVerifyTokenRequest.cc
src/model/GetVerifyTokenResult.cc
src/model/DetectFaceAttributesRequest.cc
src/model/DetectFaceAttributesResult.cc
src/model/CompareFacesRequest.cc
src/model/CompareFacesResult.cc
src/model/SubmitMaterialsRequest.cc

View File

@@ -26,6 +26,8 @@
#include "model/GetMaterialsResult.h"
#include "model/GetVerifyTokenRequest.h"
#include "model/GetVerifyTokenResult.h"
#include "model/DetectFaceAttributesRequest.h"
#include "model/DetectFaceAttributesResult.h"
#include "model/CompareFacesRequest.h"
#include "model/CompareFacesResult.h"
#include "model/SubmitMaterialsRequest.h"
@@ -47,6 +49,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::GetVerifyTokenResult> GetVerifyTokenOutcome;
typedef std::future<GetVerifyTokenOutcome> GetVerifyTokenOutcomeCallable;
typedef std::function<void(const CloudauthClient*, const Model::GetVerifyTokenRequest&, const GetVerifyTokenOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetVerifyTokenAsyncHandler;
typedef Outcome<Error, Model::DetectFaceAttributesResult> DetectFaceAttributesOutcome;
typedef std::future<DetectFaceAttributesOutcome> DetectFaceAttributesOutcomeCallable;
typedef std::function<void(const CloudauthClient*, const Model::DetectFaceAttributesRequest&, const DetectFaceAttributesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DetectFaceAttributesAsyncHandler;
typedef Outcome<Error, Model::CompareFacesResult> CompareFacesOutcome;
typedef std::future<CompareFacesOutcome> CompareFacesOutcomeCallable;
typedef std::function<void(const CloudauthClient*, const Model::CompareFacesRequest&, const CompareFacesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> CompareFacesAsyncHandler;
@@ -67,6 +72,9 @@ namespace AlibabaCloud
GetVerifyTokenOutcome getVerifyToken(const Model::GetVerifyTokenRequest &request)const;
void getVerifyTokenAsync(const Model::GetVerifyTokenRequest& request, const GetVerifyTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
GetVerifyTokenOutcomeCallable getVerifyTokenCallable(const Model::GetVerifyTokenRequest& request) const;
DetectFaceAttributesOutcome detectFaceAttributes(const Model::DetectFaceAttributesRequest &request)const;
void detectFaceAttributesAsync(const Model::DetectFaceAttributesRequest& request, const DetectFaceAttributesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
DetectFaceAttributesOutcomeCallable detectFaceAttributesCallable(const Model::DetectFaceAttributesRequest& request) const;
CompareFacesOutcome compareFaces(const Model::CompareFacesRequest &request)const;
void compareFacesAsync(const Model::CompareFacesRequest& request, const CompareFacesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
CompareFacesOutcomeCallable compareFacesCallable(const Model::CompareFacesRequest& request) const;

View File

@@ -0,0 +1,69 @@
/*
* 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_DETECTFACEATTRIBUTESREQUEST_H_
#define ALIBABACLOUD_CLOUDAUTH_MODEL_DETECTFACEATTRIBUTESREQUEST_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 DetectFaceAttributesRequest : public RpcServiceRequest
{
public:
DetectFaceAttributesRequest();
~DetectFaceAttributesRequest();
int getMaxNumPhotosPerCategory()const;
void setMaxNumPhotosPerCategory(int maxNumPhotosPerCategory);
int getMaxFaceNum()const;
void setMaxFaceNum(int maxFaceNum);
long getResourceOwnerId()const;
void setResourceOwnerId(long resourceOwnerId);
std::string getSourceIp()const;
void setSourceIp(const std::string& sourceIp);
std::string getRetAttributes()const;
void setRetAttributes(const std::string& retAttributes);
std::string getMaterialValue()const;
void setMaterialValue(const std::string& materialValue);
bool getDontSaveDB()const;
void setDontSaveDB(bool dontSaveDB);
std::string getClientTag()const;
void setClientTag(const std::string& clientTag);
private:
int maxNumPhotosPerCategory_;
int maxFaceNum_;
long resourceOwnerId_;
std::string sourceIp_;
std::string retAttributes_;
std::string materialValue_;
bool dontSaveDB_;
std::string clientTag_;
};
}
}
}
#endif // !ALIBABACLOUD_CLOUDAUTH_MODEL_DETECTFACEATTRIBUTESREQUEST_H_

View File

@@ -0,0 +1,102 @@
/*
* 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_DETECTFACEATTRIBUTESRESULT_H_
#define ALIBABACLOUD_CLOUDAUTH_MODEL_DETECTFACEATTRIBUTESRESULT_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 DetectFaceAttributesResult : public ServiceResult
{
public:
struct Data
{
struct FaceAttributesDetectInfo
{
struct FaceRect
{
int left;
int top;
int height;
int width;
};
struct FaceAttributes
{
struct Gender
{
float score;
std::string value;
};
struct Smiling
{
float value;
float threshold;
};
struct Headpose
{
float pitchAngle;
float rollAngle;
float yawAngle;
};
std::string ethnicity;
std::string facetype;
Headpose headpose;
std::string glasses;
float blur;
Smiling smiling;
Gender gender;
int age;
};
FaceAttributes faceAttributes;
FaceRect faceRect;
};
int imgWidth;
int imgHeight;
std::vector<FaceAttributesDetectInfo> faceInfos;
};
DetectFaceAttributesResult();
explicit DetectFaceAttributesResult(const std::string &payload);
~DetectFaceAttributesResult();
std::string getMessage()const;
Data getData()const;
std::string getCode()const;
bool getSuccess()const;
protected:
void parse(const std::string &payload);
private:
std::string message_;
Data data_;
std::string code_;
bool success_;
};
}
}
}
#endif // !ALIBABACLOUD_CLOUDAUTH_MODEL_DETECTFACEATTRIBUTESRESULT_H_

View File

@@ -36,10 +36,8 @@ namespace AlibabaCloud
{
std::string facePic;
std::string identificationNumber;
std::string idCardStartDate;
std::string address;
std::string idCardFrontPic;
std::string ethnicGroup;
std::string sex;
std::string idCardExpiry;
std::string idCardType;

View File

@@ -50,6 +50,7 @@ namespace AlibabaCloud
std::string endPoint;
};
StsToken stsToken;
std::string cloudauthPageUrl;
VerifyToken verifyToken;
};

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