diff --git a/CHANGELOG b/CHANGELOG index addef9669..230d15cf3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2018-05-17 Version: 1.10.1 +1, Supporting ethnicGroup and idCardStartDate fields in GetMaterials api + 2018-05-17 Version: 1.10.0 1, the first version of private dns SDK diff --git a/CMakeLists.txt b/CMakeLists.txt index 177db97d8..0d64ef058 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -71,4 +71,5 @@ add_subdirectory(domain) add_subdirectory(green) add_subdirectory(hsm) add_subdirectory(dcdn) -add_subdirectory(pvtz) \ No newline at end of file +add_subdirectory(pvtz) +add_subdirectory(cloudauth) \ No newline at end of file diff --git a/VERSION b/VERSION index ed21137ee..e33692ab6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.10.0 \ No newline at end of file +1.10.1 \ No newline at end of file diff --git a/cloudauth/CMakeLists.txt b/cloudauth/CMakeLists.txt new file mode 100644 index 000000000..b9ad62529 --- /dev/null +++ b/cloudauth/CMakeLists.txt @@ -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. +# + +set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include) + +set(cloudauth_public_header + include/alibabacloud/cloudauth/CloudauthClient.h + include/alibabacloud/cloudauth/CloudauthExport.h ) + +set(cloudauth_public_header_model + include/alibabacloud/cloudauth/model/GetMaterialsRequest.h + include/alibabacloud/cloudauth/model/GetMaterialsResult.h + include/alibabacloud/cloudauth/model/GetVerifyTokenRequest.h + include/alibabacloud/cloudauth/model/GetVerifyTokenResult.h + include/alibabacloud/cloudauth/model/CompareFacesRequest.h + include/alibabacloud/cloudauth/model/CompareFacesResult.h + include/alibabacloud/cloudauth/model/SubmitMaterialsRequest.h + include/alibabacloud/cloudauth/model/SubmitMaterialsResult.h + include/alibabacloud/cloudauth/model/GetStatusRequest.h + include/alibabacloud/cloudauth/model/GetStatusResult.h ) + +set(cloudauth_src + src/CloudauthClient.cc + src/model/GetMaterialsRequest.cc + src/model/GetMaterialsResult.cc + src/model/GetVerifyTokenRequest.cc + src/model/GetVerifyTokenResult.cc + src/model/CompareFacesRequest.cc + src/model/CompareFacesResult.cc + src/model/SubmitMaterialsRequest.cc + src/model/SubmitMaterialsResult.cc + src/model/GetStatusRequest.cc + src/model/GetStatusResult.cc ) + +add_library(cloudauth ${LIB_TYPE} + ${cloudauth_public_header} + ${cloudauth_public_header_model} + ${cloudauth_src}) + +set_target_properties(cloudauth + PROPERTIES + LINKER_LANGUAGE CXX + ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin + OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}cloudauth + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(cloudauth + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_CLOUDAUTH_LIBRARY) +endif() + +target_include_directories(cloudauth + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(cloudauth + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(cloudauth + jsoncpp) + target_include_directories(cloudauth + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(cloudauth + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(cloudauth + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(cloudauth + PRIVATE /usr/include/jsoncpp) + target_link_libraries(cloudauth + jsoncpp) +endif() + +install(FILES ${cloudauth_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/cloudauth) +install(FILES ${cloudauth_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/cloudauth/model) +install(TARGETS cloudauth + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/cloudauth/include/alibabacloud/cloudauth/CloudauthClient.h b/cloudauth/include/alibabacloud/cloudauth/CloudauthClient.h new file mode 100644 index 000000000..d10c68b77 --- /dev/null +++ b/cloudauth/include/alibabacloud/cloudauth/CloudauthClient.h @@ -0,0 +1,86 @@ +/* + * 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_CLOUDAUTHCLIENT_H_ +#define ALIBABACLOUD_CLOUDAUTH_CLOUDAUTHCLIENT_H_ + +#include +#include +#include +#include +#include "CloudauthExport.h" +#include "model/GetMaterialsRequest.h" +#include "model/GetMaterialsResult.h" +#include "model/GetVerifyTokenRequest.h" +#include "model/GetVerifyTokenResult.h" +#include "model/CompareFacesRequest.h" +#include "model/CompareFacesResult.h" +#include "model/SubmitMaterialsRequest.h" +#include "model/SubmitMaterialsResult.h" +#include "model/GetStatusRequest.h" +#include "model/GetStatusResult.h" + + +namespace AlibabaCloud +{ + namespace Cloudauth + { + class ALIBABACLOUD_CLOUDAUTH_EXPORT CloudauthClient : public RpcServiceClient + { + public: + typedef Outcome GetMaterialsOutcome; + typedef std::future GetMaterialsOutcomeCallable; + typedef std::function&)> GetMaterialsAsyncHandler; + typedef Outcome GetVerifyTokenOutcome; + typedef std::future GetVerifyTokenOutcomeCallable; + typedef std::function&)> GetVerifyTokenAsyncHandler; + typedef Outcome CompareFacesOutcome; + typedef std::future CompareFacesOutcomeCallable; + typedef std::function&)> CompareFacesAsyncHandler; + typedef Outcome SubmitMaterialsOutcome; + typedef std::future SubmitMaterialsOutcomeCallable; + typedef std::function&)> SubmitMaterialsAsyncHandler; + typedef Outcome GetStatusOutcome; + typedef std::future GetStatusOutcomeCallable; + typedef std::function&)> GetStatusAsyncHandler; + + CloudauthClient(const Credentials &credentials, const ClientConfiguration &configuration); + CloudauthClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + CloudauthClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~CloudauthClient(); + GetMaterialsOutcome getMaterials(const Model::GetMaterialsRequest &request)const; + void getMaterialsAsync(const Model::GetMaterialsRequest& request, const GetMaterialsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetMaterialsOutcomeCallable getMaterialsCallable(const Model::GetMaterialsRequest& request) const; + GetVerifyTokenOutcome getVerifyToken(const Model::GetVerifyTokenRequest &request)const; + void getVerifyTokenAsync(const Model::GetVerifyTokenRequest& request, const GetVerifyTokenAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetVerifyTokenOutcomeCallable getVerifyTokenCallable(const Model::GetVerifyTokenRequest& request) const; + CompareFacesOutcome compareFaces(const Model::CompareFacesRequest &request)const; + void compareFacesAsync(const Model::CompareFacesRequest& request, const CompareFacesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + CompareFacesOutcomeCallable compareFacesCallable(const Model::CompareFacesRequest& request) const; + SubmitMaterialsOutcome submitMaterials(const Model::SubmitMaterialsRequest &request)const; + void submitMaterialsAsync(const Model::SubmitMaterialsRequest& request, const SubmitMaterialsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + SubmitMaterialsOutcomeCallable submitMaterialsCallable(const Model::SubmitMaterialsRequest& request) const; + GetStatusOutcome getStatus(const Model::GetStatusRequest &request)const; + void getStatusAsync(const Model::GetStatusRequest& request, const GetStatusAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetStatusOutcomeCallable getStatusCallable(const Model::GetStatusRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_CLOUDAUTH_CLOUDAUTHCLIENT_H_ diff --git a/cloudauth/include/alibabacloud/cloudauth/CloudauthExport.h b/cloudauth/include/alibabacloud/cloudauth/CloudauthExport.h new file mode 100644 index 000000000..054ebeadf --- /dev/null +++ b/cloudauth/include/alibabacloud/cloudauth/CloudauthExport.h @@ -0,0 +1,32 @@ +/* + * 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_CLOUDAUTHEXPORT_H_ +#define ALIBABACLOUD_CLOUDAUTH_CLOUDAUTHEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_CLOUDAUTH_LIBRARY) +# define ALIBABACLOUD_CLOUDAUTH_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_CLOUDAUTH_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_CLOUDAUTH_EXPORT +#endif + +#endif // !ALIBABACLOUD_CLOUDAUTH_CLOUDAUTHEXPORT_H_ \ No newline at end of file diff --git a/cloudauth/include/alibabacloud/cloudauth/model/CompareFacesRequest.h b/cloudauth/include/alibabacloud/cloudauth/model/CompareFacesRequest.h new file mode 100644 index 000000000..867a4548b --- /dev/null +++ b/cloudauth/include/alibabacloud/cloudauth/model/CompareFacesRequest.h @@ -0,0 +1,63 @@ +/* + * 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_COMPAREFACESREQUEST_H_ +#define ALIBABACLOUD_CLOUDAUTH_MODEL_COMPAREFACESREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_EXPORT CompareFacesRequest : public RpcServiceRequest + { + + public: + CompareFacesRequest(); + ~CompareFacesRequest(); + + std::string getSourceImageType()const; + void setSourceImageType(const std::string& sourceImageType); + long getResourceOwnerId()const; + void setResourceOwnerId(long resourceOwnerId); + std::string getSourceIp()const; + void setSourceIp(const std::string& sourceIp); + std::string getTargetImageType()const; + void setTargetImageType(const std::string& targetImageType); + std::string getSourceImageValue()const; + void setSourceImageValue(const std::string& sourceImageValue); + std::string getTargetImageValue()const; + void setTargetImageValue(const std::string& targetImageValue); + + private: + std::string sourceImageType_; + long resourceOwnerId_; + std::string sourceIp_; + std::string targetImageType_; + std::string sourceImageValue_; + std::string targetImageValue_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CLOUDAUTH_MODEL_COMPAREFACESREQUEST_H_ \ No newline at end of file diff --git a/cloudauth/include/alibabacloud/cloudauth/model/CompareFacesResult.h b/cloudauth/include/alibabacloud/cloudauth/model/CompareFacesResult.h new file mode 100644 index 000000000..6536b7ff4 --- /dev/null +++ b/cloudauth/include/alibabacloud/cloudauth/model/CompareFacesResult.h @@ -0,0 +1,62 @@ +/* + * 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_COMPAREFACESRESULT_H_ +#define ALIBABACLOUD_CLOUDAUTH_MODEL_COMPAREFACESRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_EXPORT CompareFacesResult : public ServiceResult + { + public: + struct Data + { + std::string confidenceThresholds; + float similarityScore; + }; + + + CompareFacesResult(); + explicit CompareFacesResult(const std::string &payload); + ~CompareFacesResult(); + 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_COMPAREFACESRESULT_H_ \ No newline at end of file diff --git a/cloudauth/include/alibabacloud/cloudauth/model/GetMaterialsRequest.h b/cloudauth/include/alibabacloud/cloudauth/model/GetMaterialsRequest.h new file mode 100644 index 000000000..cfe3a9be7 --- /dev/null +++ b/cloudauth/include/alibabacloud/cloudauth/model/GetMaterialsRequest.h @@ -0,0 +1,57 @@ +/* + * 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_GETMATERIALSREQUEST_H_ +#define ALIBABACLOUD_CLOUDAUTH_MODEL_GETMATERIALSREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_EXPORT GetMaterialsRequest : public RpcServiceRequest + { + + public: + GetMaterialsRequest(); + ~GetMaterialsRequest(); + + long getResourceOwnerId()const; + void setResourceOwnerId(long resourceOwnerId); + std::string getBiz()const; + void setBiz(const std::string& biz); + std::string getSourceIp()const; + void setSourceIp(const std::string& sourceIp); + std::string getTicketId()const; + void setTicketId(const std::string& ticketId); + + private: + long resourceOwnerId_; + std::string biz_; + std::string sourceIp_; + std::string ticketId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CLOUDAUTH_MODEL_GETMATERIALSREQUEST_H_ \ No newline at end of file diff --git a/cloudauth/include/alibabacloud/cloudauth/model/GetMaterialsResult.h b/cloudauth/include/alibabacloud/cloudauth/model/GetMaterialsResult.h new file mode 100644 index 000000000..73b636936 --- /dev/null +++ b/cloudauth/include/alibabacloud/cloudauth/model/GetMaterialsResult.h @@ -0,0 +1,71 @@ +/* + * 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_GETMATERIALSRESULT_H_ +#define ALIBABACLOUD_CLOUDAUTH_MODEL_GETMATERIALSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_EXPORT GetMaterialsResult : public ServiceResult + { + public: + struct Data + { + 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; + std::string idCardBackPic; + std::string name; + }; + + + GetMaterialsResult(); + explicit GetMaterialsResult(const std::string &payload); + ~GetMaterialsResult(); + 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_GETMATERIALSRESULT_H_ \ No newline at end of file diff --git a/cloudauth/include/alibabacloud/cloudauth/model/GetStatusRequest.h b/cloudauth/include/alibabacloud/cloudauth/model/GetStatusRequest.h new file mode 100644 index 000000000..5ed0c9910 --- /dev/null +++ b/cloudauth/include/alibabacloud/cloudauth/model/GetStatusRequest.h @@ -0,0 +1,57 @@ +/* + * 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_GETSTATUSREQUEST_H_ +#define ALIBABACLOUD_CLOUDAUTH_MODEL_GETSTATUSREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_EXPORT GetStatusRequest : public RpcServiceRequest + { + + public: + GetStatusRequest(); + ~GetStatusRequest(); + + long getResourceOwnerId()const; + void setResourceOwnerId(long resourceOwnerId); + std::string getBiz()const; + void setBiz(const std::string& biz); + std::string getSourceIp()const; + void setSourceIp(const std::string& sourceIp); + std::string getTicketId()const; + void setTicketId(const std::string& ticketId); + + private: + long resourceOwnerId_; + std::string biz_; + std::string sourceIp_; + std::string ticketId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CLOUDAUTH_MODEL_GETSTATUSREQUEST_H_ \ No newline at end of file diff --git a/cloudauth/include/alibabacloud/cloudauth/model/GetStatusResult.h b/cloudauth/include/alibabacloud/cloudauth/model/GetStatusResult.h new file mode 100644 index 000000000..bd41650ad --- /dev/null +++ b/cloudauth/include/alibabacloud/cloudauth/model/GetStatusResult.h @@ -0,0 +1,64 @@ +/* + * 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_GETSTATUSRESULT_H_ +#define ALIBABACLOUD_CLOUDAUTH_MODEL_GETSTATUSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_EXPORT GetStatusResult : public ServiceResult + { + public: + struct Data + { + std::string auditConclusions; + float trustedScore; + float similarityScore; + int statusCode; + }; + + + GetStatusResult(); + explicit GetStatusResult(const std::string &payload); + ~GetStatusResult(); + 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_GETSTATUSRESULT_H_ \ No newline at end of file diff --git a/cloudauth/include/alibabacloud/cloudauth/model/GetVerifyTokenRequest.h b/cloudauth/include/alibabacloud/cloudauth/model/GetVerifyTokenRequest.h new file mode 100644 index 000000000..fb2c56079 --- /dev/null +++ b/cloudauth/include/alibabacloud/cloudauth/model/GetVerifyTokenRequest.h @@ -0,0 +1,63 @@ +/* + * 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_GETVERIFYTOKENREQUEST_H_ +#define ALIBABACLOUD_CLOUDAUTH_MODEL_GETVERIFYTOKENREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_EXPORT GetVerifyTokenRequest : public RpcServiceRequest + { + + public: + GetVerifyTokenRequest(); + ~GetVerifyTokenRequest(); + + std::string getUserData()const; + void setUserData(const std::string& userData); + long getResourceOwnerId()const; + void setResourceOwnerId(long resourceOwnerId); + std::string getBiz()const; + void setBiz(const std::string& biz); + std::string getSourceIp()const; + void setSourceIp(const std::string& sourceIp); + std::string getBinding()const; + void setBinding(const std::string& binding); + std::string getTicketId()const; + void setTicketId(const std::string& ticketId); + + private: + std::string userData_; + long resourceOwnerId_; + std::string biz_; + std::string sourceIp_; + std::string binding_; + std::string ticketId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CLOUDAUTH_MODEL_GETVERIFYTOKENREQUEST_H_ \ No newline at end of file diff --git a/cloudauth/include/alibabacloud/cloudauth/model/GetVerifyTokenResult.h b/cloudauth/include/alibabacloud/cloudauth/model/GetVerifyTokenResult.h new file mode 100644 index 000000000..178eff031 --- /dev/null +++ b/cloudauth/include/alibabacloud/cloudauth/model/GetVerifyTokenResult.h @@ -0,0 +1,77 @@ +/* + * 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_GETVERIFYTOKENRESULT_H_ +#define ALIBABACLOUD_CLOUDAUTH_MODEL_GETVERIFYTOKENRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_EXPORT GetVerifyTokenResult : public ServiceResult + { + public: + struct Data + { + struct VerifyToken + { + std::string token; + int durationSeconds; + }; + struct StsToken + { + std::string path; + std::string bucketName; + std::string accessKeyId; + std::string accessKeySecret; + std::string expiration; + std::string token; + std::string endPoint; + }; + StsToken stsToken; + VerifyToken verifyToken; + }; + + + GetVerifyTokenResult(); + explicit GetVerifyTokenResult(const std::string &payload); + ~GetVerifyTokenResult(); + 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_GETVERIFYTOKENRESULT_H_ \ No newline at end of file diff --git a/cloudauth/include/alibabacloud/cloudauth/model/SubmitMaterialsRequest.h b/cloudauth/include/alibabacloud/cloudauth/model/SubmitMaterialsRequest.h new file mode 100644 index 000000000..94c80d911 --- /dev/null +++ b/cloudauth/include/alibabacloud/cloudauth/model/SubmitMaterialsRequest.h @@ -0,0 +1,62 @@ +/* + * 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_SUBMITMATERIALSREQUEST_H_ +#define ALIBABACLOUD_CLOUDAUTH_MODEL_SUBMITMATERIALSREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_EXPORT SubmitMaterialsRequest : public RpcServiceRequest + { + struct Material + { + std::string materialType; + std::string value; + }; + + public: + SubmitMaterialsRequest(); + ~SubmitMaterialsRequest(); + + long getResourceOwnerId()const; + void setResourceOwnerId(long resourceOwnerId); + std::string getSourceIp()const; + void setSourceIp(const std::string& sourceIp); + std::vector getMaterial()const; + void setMaterial(const std::vector& material); + std::string getVerifyToken()const; + void setVerifyToken(const std::string& verifyToken); + + private: + long resourceOwnerId_; + std::string sourceIp_; + std::vector material_; + std::string verifyToken_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CLOUDAUTH_MODEL_SUBMITMATERIALSREQUEST_H_ \ No newline at end of file diff --git a/cloudauth/include/alibabacloud/cloudauth/model/SubmitMaterialsResult.h b/cloudauth/include/alibabacloud/cloudauth/model/SubmitMaterialsResult.h new file mode 100644 index 000000000..09ab2c0f8 --- /dev/null +++ b/cloudauth/include/alibabacloud/cloudauth/model/SubmitMaterialsResult.h @@ -0,0 +1,67 @@ +/* + * 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_SUBMITMATERIALSRESULT_H_ +#define ALIBABACLOUD_CLOUDAUTH_MODEL_SUBMITMATERIALSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_EXPORT SubmitMaterialsResult : public ServiceResult + { + public: + struct Data + { + struct VerifyStatus + { + float trustedScore; + float similarityScore; + int statusCode; + }; + VerifyStatus verifyStatus; + }; + + + SubmitMaterialsResult(); + explicit SubmitMaterialsResult(const std::string &payload); + ~SubmitMaterialsResult(); + 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_SUBMITMATERIALSRESULT_H_ \ No newline at end of file diff --git a/cloudauth/src/CloudauthClient.cc b/cloudauth/src/CloudauthClient.cc new file mode 100644 index 000000000..6f6332526 --- /dev/null +++ b/cloudauth/src/CloudauthClient.cc @@ -0,0 +1,233 @@ +/* + * 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 +#include + +using namespace AlibabaCloud; +using namespace AlibabaCloud::Location; +using namespace AlibabaCloud::Cloudauth; +using namespace AlibabaCloud::Cloudauth::Model; + +namespace +{ + const std::string SERVICE_NAME = "Cloudauth"; +} + +CloudauthClient::CloudauthClient(const Credentials &credentials, const ClientConfiguration &configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(credentials), configuration) +{ + auto locationClient = std::make_shared(credentials, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "cloudauth"); +} + +CloudauthClient::CloudauthClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) +{ + auto locationClient = std::make_shared(credentialsProvider, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "cloudauth"); +} + +CloudauthClient::CloudauthClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : + RpcServiceClient(SERVICE_NAME, std::make_shared(accessKeyId, accessKeySecret), configuration) +{ + auto locationClient = std::make_shared(accessKeyId, accessKeySecret, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "cloudauth"); +} + +CloudauthClient::~CloudauthClient() +{} + +CloudauthClient::GetMaterialsOutcome CloudauthClient::getMaterials(const GetMaterialsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetMaterialsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetMaterialsOutcome(GetMaterialsResult(outcome.result())); + else + return GetMaterialsOutcome(outcome.error()); +} + +void CloudauthClient::getMaterialsAsync(const GetMaterialsRequest& request, const GetMaterialsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getMaterials(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +CloudauthClient::GetMaterialsOutcomeCallable CloudauthClient::getMaterialsCallable(const GetMaterialsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getMaterials(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +CloudauthClient::GetVerifyTokenOutcome CloudauthClient::getVerifyToken(const GetVerifyTokenRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetVerifyTokenOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetVerifyTokenOutcome(GetVerifyTokenResult(outcome.result())); + else + return GetVerifyTokenOutcome(outcome.error()); +} + +void CloudauthClient::getVerifyTokenAsync(const GetVerifyTokenRequest& request, const GetVerifyTokenAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getVerifyToken(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +CloudauthClient::GetVerifyTokenOutcomeCallable CloudauthClient::getVerifyTokenCallable(const GetVerifyTokenRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getVerifyToken(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +CloudauthClient::CompareFacesOutcome CloudauthClient::compareFaces(const CompareFacesRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return CompareFacesOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return CompareFacesOutcome(CompareFacesResult(outcome.result())); + else + return CompareFacesOutcome(outcome.error()); +} + +void CloudauthClient::compareFacesAsync(const CompareFacesRequest& request, const CompareFacesAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, compareFaces(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +CloudauthClient::CompareFacesOutcomeCallable CloudauthClient::compareFacesCallable(const CompareFacesRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->compareFaces(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +CloudauthClient::SubmitMaterialsOutcome CloudauthClient::submitMaterials(const SubmitMaterialsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return SubmitMaterialsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return SubmitMaterialsOutcome(SubmitMaterialsResult(outcome.result())); + else + return SubmitMaterialsOutcome(outcome.error()); +} + +void CloudauthClient::submitMaterialsAsync(const SubmitMaterialsRequest& request, const SubmitMaterialsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, submitMaterials(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +CloudauthClient::SubmitMaterialsOutcomeCallable CloudauthClient::submitMaterialsCallable(const SubmitMaterialsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->submitMaterials(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +CloudauthClient::GetStatusOutcome CloudauthClient::getStatus(const GetStatusRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetStatusOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetStatusOutcome(GetStatusResult(outcome.result())); + else + return GetStatusOutcome(outcome.error()); +} + +void CloudauthClient::getStatusAsync(const GetStatusRequest& request, const GetStatusAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getStatus(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +CloudauthClient::GetStatusOutcomeCallable CloudauthClient::getStatusCallable(const GetStatusRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getStatus(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/cloudauth/src/model/CompareFacesRequest.cc b/cloudauth/src/model/CompareFacesRequest.cc new file mode 100644 index 000000000..31add3973 --- /dev/null +++ b/cloudauth/src/model/CompareFacesRequest.cc @@ -0,0 +1,93 @@ +/* + * 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 + +using AlibabaCloud::Cloudauth::Model::CompareFacesRequest; + +CompareFacesRequest::CompareFacesRequest() : + RpcServiceRequest("cloudauth", "2018-05-04", "CompareFaces") +{} + +CompareFacesRequest::~CompareFacesRequest() +{} + +std::string CompareFacesRequest::getSourceImageType()const +{ + return sourceImageType_; +} + +void CompareFacesRequest::setSourceImageType(const std::string& sourceImageType) +{ + sourceImageType_ = sourceImageType; + setParameter("SourceImageType", sourceImageType); +} + +long CompareFacesRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void CompareFacesRequest::setResourceOwnerId(long resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); +} + +std::string CompareFacesRequest::getSourceIp()const +{ + return sourceIp_; +} + +void CompareFacesRequest::setSourceIp(const std::string& sourceIp) +{ + sourceIp_ = sourceIp; + setParameter("SourceIp", sourceIp); +} + +std::string CompareFacesRequest::getTargetImageType()const +{ + return targetImageType_; +} + +void CompareFacesRequest::setTargetImageType(const std::string& targetImageType) +{ + targetImageType_ = targetImageType; + setParameter("TargetImageType", targetImageType); +} + +std::string CompareFacesRequest::getSourceImageValue()const +{ + return sourceImageValue_; +} + +void CompareFacesRequest::setSourceImageValue(const std::string& sourceImageValue) +{ + sourceImageValue_ = sourceImageValue; + setParameter("SourceImageValue", sourceImageValue); +} + +std::string CompareFacesRequest::getTargetImageValue()const +{ + return targetImageValue_; +} + +void CompareFacesRequest::setTargetImageValue(const std::string& targetImageValue) +{ + targetImageValue_ = targetImageValue; + setParameter("TargetImageValue", targetImageValue); +} + diff --git a/cloudauth/src/model/CompareFacesResult.cc b/cloudauth/src/model/CompareFacesResult.cc new file mode 100644 index 000000000..65fbd7d28 --- /dev/null +++ b/cloudauth/src/model/CompareFacesResult.cc @@ -0,0 +1,76 @@ +/* + * 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 +#include + +using namespace AlibabaCloud::Cloudauth; +using namespace AlibabaCloud::Cloudauth::Model; + +CompareFacesResult::CompareFacesResult() : + ServiceResult() +{} + +CompareFacesResult::CompareFacesResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +CompareFacesResult::~CompareFacesResult() +{} + +void CompareFacesResult::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["SimilarityScore"].isNull()) + data_.similarityScore = std::stof(dataNode["SimilarityScore"].asString()); + if(!dataNode["ConfidenceThresholds"].isNull()) + data_.confidenceThresholds = dataNode["ConfidenceThresholds"].asString(); + 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 CompareFacesResult::getMessage()const +{ + return message_; +} + +CompareFacesResult::Data CompareFacesResult::getData()const +{ + return data_; +} + +std::string CompareFacesResult::getCode()const +{ + return code_; +} + +bool CompareFacesResult::getSuccess()const +{ + return success_; +} + diff --git a/cloudauth/src/model/GetMaterialsRequest.cc b/cloudauth/src/model/GetMaterialsRequest.cc new file mode 100644 index 000000000..fe1d3f0e1 --- /dev/null +++ b/cloudauth/src/model/GetMaterialsRequest.cc @@ -0,0 +1,71 @@ +/* + * 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 + +using AlibabaCloud::Cloudauth::Model::GetMaterialsRequest; + +GetMaterialsRequest::GetMaterialsRequest() : + RpcServiceRequest("cloudauth", "2018-05-04", "GetMaterials") +{} + +GetMaterialsRequest::~GetMaterialsRequest() +{} + +long GetMaterialsRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void GetMaterialsRequest::setResourceOwnerId(long resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); +} + +std::string GetMaterialsRequest::getBiz()const +{ + return biz_; +} + +void GetMaterialsRequest::setBiz(const std::string& biz) +{ + biz_ = biz; + setParameter("Biz", biz); +} + +std::string GetMaterialsRequest::getSourceIp()const +{ + return sourceIp_; +} + +void GetMaterialsRequest::setSourceIp(const std::string& sourceIp) +{ + sourceIp_ = sourceIp; + setParameter("SourceIp", sourceIp); +} + +std::string GetMaterialsRequest::getTicketId()const +{ + return ticketId_; +} + +void GetMaterialsRequest::setTicketId(const std::string& ticketId) +{ + ticketId_ = ticketId; + setParameter("TicketId", ticketId); +} + diff --git a/cloudauth/src/model/GetMaterialsResult.cc b/cloudauth/src/model/GetMaterialsResult.cc new file mode 100644 index 000000000..bb218c722 --- /dev/null +++ b/cloudauth/src/model/GetMaterialsResult.cc @@ -0,0 +1,94 @@ +/* + * 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 +#include + +using namespace AlibabaCloud::Cloudauth; +using namespace AlibabaCloud::Cloudauth::Model; + +GetMaterialsResult::GetMaterialsResult() : + ServiceResult() +{} + +GetMaterialsResult::GetMaterialsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetMaterialsResult::~GetMaterialsResult() +{} + +void GetMaterialsResult::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["Name"].isNull()) + data_.name = dataNode["Name"].asString(); + if(!dataNode["IdentificationNumber"].isNull()) + 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()) + data_.address = dataNode["Address"].asString(); + if(!dataNode["Sex"].isNull()) + data_.sex = dataNode["Sex"].asString(); + if(!dataNode["IdCardFrontPic"].isNull()) + data_.idCardFrontPic = dataNode["IdCardFrontPic"].asString(); + if(!dataNode["IdCardBackPic"].isNull()) + 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()) + code_ = value["Code"].asString(); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string GetMaterialsResult::getMessage()const +{ + return message_; +} + +GetMaterialsResult::Data GetMaterialsResult::getData()const +{ + return data_; +} + +std::string GetMaterialsResult::getCode()const +{ + return code_; +} + +bool GetMaterialsResult::getSuccess()const +{ + return success_; +} + diff --git a/cloudauth/src/model/GetStatusRequest.cc b/cloudauth/src/model/GetStatusRequest.cc new file mode 100644 index 000000000..845381c73 --- /dev/null +++ b/cloudauth/src/model/GetStatusRequest.cc @@ -0,0 +1,71 @@ +/* + * 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 + +using AlibabaCloud::Cloudauth::Model::GetStatusRequest; + +GetStatusRequest::GetStatusRequest() : + RpcServiceRequest("cloudauth", "2018-05-04", "GetStatus") +{} + +GetStatusRequest::~GetStatusRequest() +{} + +long GetStatusRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void GetStatusRequest::setResourceOwnerId(long resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); +} + +std::string GetStatusRequest::getBiz()const +{ + return biz_; +} + +void GetStatusRequest::setBiz(const std::string& biz) +{ + biz_ = biz; + setParameter("Biz", biz); +} + +std::string GetStatusRequest::getSourceIp()const +{ + return sourceIp_; +} + +void GetStatusRequest::setSourceIp(const std::string& sourceIp) +{ + sourceIp_ = sourceIp; + setParameter("SourceIp", sourceIp); +} + +std::string GetStatusRequest::getTicketId()const +{ + return ticketId_; +} + +void GetStatusRequest::setTicketId(const std::string& ticketId) +{ + ticketId_ = ticketId; + setParameter("TicketId", ticketId); +} + diff --git a/cloudauth/src/model/GetStatusResult.cc b/cloudauth/src/model/GetStatusResult.cc new file mode 100644 index 000000000..b2967881f --- /dev/null +++ b/cloudauth/src/model/GetStatusResult.cc @@ -0,0 +1,80 @@ +/* + * 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 +#include + +using namespace AlibabaCloud::Cloudauth; +using namespace AlibabaCloud::Cloudauth::Model; + +GetStatusResult::GetStatusResult() : + ServiceResult() +{} + +GetStatusResult::GetStatusResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetStatusResult::~GetStatusResult() +{} + +void GetStatusResult::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["StatusCode"].isNull()) + data_.statusCode = std::stoi(dataNode["StatusCode"].asString()); + if(!dataNode["TrustedScore"].isNull()) + data_.trustedScore = std::stof(dataNode["TrustedScore"].asString()); + if(!dataNode["SimilarityScore"].isNull()) + data_.similarityScore = std::stof(dataNode["SimilarityScore"].asString()); + if(!dataNode["AuditConclusions"].isNull()) + data_.auditConclusions = dataNode["AuditConclusions"].asString(); + 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 GetStatusResult::getMessage()const +{ + return message_; +} + +GetStatusResult::Data GetStatusResult::getData()const +{ + return data_; +} + +std::string GetStatusResult::getCode()const +{ + return code_; +} + +bool GetStatusResult::getSuccess()const +{ + return success_; +} + diff --git a/cloudauth/src/model/GetVerifyTokenRequest.cc b/cloudauth/src/model/GetVerifyTokenRequest.cc new file mode 100644 index 000000000..16c0bf380 --- /dev/null +++ b/cloudauth/src/model/GetVerifyTokenRequest.cc @@ -0,0 +1,93 @@ +/* + * 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 + +using AlibabaCloud::Cloudauth::Model::GetVerifyTokenRequest; + +GetVerifyTokenRequest::GetVerifyTokenRequest() : + RpcServiceRequest("cloudauth", "2018-05-04", "GetVerifyToken") +{} + +GetVerifyTokenRequest::~GetVerifyTokenRequest() +{} + +std::string GetVerifyTokenRequest::getUserData()const +{ + return userData_; +} + +void GetVerifyTokenRequest::setUserData(const std::string& userData) +{ + userData_ = userData; + setParameter("UserData", userData); +} + +long GetVerifyTokenRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void GetVerifyTokenRequest::setResourceOwnerId(long resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); +} + +std::string GetVerifyTokenRequest::getBiz()const +{ + return biz_; +} + +void GetVerifyTokenRequest::setBiz(const std::string& biz) +{ + biz_ = biz; + setParameter("Biz", biz); +} + +std::string GetVerifyTokenRequest::getSourceIp()const +{ + return sourceIp_; +} + +void GetVerifyTokenRequest::setSourceIp(const std::string& sourceIp) +{ + sourceIp_ = sourceIp; + setParameter("SourceIp", sourceIp); +} + +std::string GetVerifyTokenRequest::getBinding()const +{ + return binding_; +} + +void GetVerifyTokenRequest::setBinding(const std::string& binding) +{ + binding_ = binding; + setParameter("Binding", binding); +} + +std::string GetVerifyTokenRequest::getTicketId()const +{ + return ticketId_; +} + +void GetVerifyTokenRequest::setTicketId(const std::string& ticketId) +{ + ticketId_ = ticketId; + setParameter("TicketId", ticketId); +} + diff --git a/cloudauth/src/model/GetVerifyTokenResult.cc b/cloudauth/src/model/GetVerifyTokenResult.cc new file mode 100644 index 000000000..67c929ce6 --- /dev/null +++ b/cloudauth/src/model/GetVerifyTokenResult.cc @@ -0,0 +1,92 @@ +/* + * 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 +#include + +using namespace AlibabaCloud::Cloudauth; +using namespace AlibabaCloud::Cloudauth::Model; + +GetVerifyTokenResult::GetVerifyTokenResult() : + ServiceResult() +{} + +GetVerifyTokenResult::GetVerifyTokenResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetVerifyTokenResult::~GetVerifyTokenResult() +{} + +void GetVerifyTokenResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + auto verifyTokenNode = dataNode["VerifyToken"]; + if(!verifyTokenNode["Token"].isNull()) + data_.verifyToken.token = verifyTokenNode["Token"].asString(); + if(!verifyTokenNode["DurationSeconds"].isNull()) + data_.verifyToken.durationSeconds = std::stoi(verifyTokenNode["DurationSeconds"].asString()); + auto stsTokenNode = dataNode["StsToken"]; + if(!stsTokenNode["AccessKeyId"].isNull()) + data_.stsToken.accessKeyId = stsTokenNode["AccessKeyId"].asString(); + if(!stsTokenNode["AccessKeySecret"].isNull()) + data_.stsToken.accessKeySecret = stsTokenNode["AccessKeySecret"].asString(); + if(!stsTokenNode["Expiration"].isNull()) + data_.stsToken.expiration = stsTokenNode["Expiration"].asString(); + if(!stsTokenNode["EndPoint"].isNull()) + data_.stsToken.endPoint = stsTokenNode["EndPoint"].asString(); + if(!stsTokenNode["BucketName"].isNull()) + data_.stsToken.bucketName = stsTokenNode["BucketName"].asString(); + if(!stsTokenNode["Path"].isNull()) + data_.stsToken.path = stsTokenNode["Path"].asString(); + if(!stsTokenNode["Token"].isNull()) + data_.stsToken.token = stsTokenNode["Token"].asString(); + 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 GetVerifyTokenResult::getMessage()const +{ + return message_; +} + +GetVerifyTokenResult::Data GetVerifyTokenResult::getData()const +{ + return data_; +} + +std::string GetVerifyTokenResult::getCode()const +{ + return code_; +} + +bool GetVerifyTokenResult::getSuccess()const +{ + return success_; +} + diff --git a/cloudauth/src/model/SubmitMaterialsRequest.cc b/cloudauth/src/model/SubmitMaterialsRequest.cc new file mode 100644 index 000000000..f1f7020fc --- /dev/null +++ b/cloudauth/src/model/SubmitMaterialsRequest.cc @@ -0,0 +1,77 @@ +/* + * 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 + +using AlibabaCloud::Cloudauth::Model::SubmitMaterialsRequest; + +SubmitMaterialsRequest::SubmitMaterialsRequest() : + RpcServiceRequest("cloudauth", "2018-05-04", "SubmitMaterials") +{} + +SubmitMaterialsRequest::~SubmitMaterialsRequest() +{} + +long SubmitMaterialsRequest::getResourceOwnerId()const +{ + return resourceOwnerId_; +} + +void SubmitMaterialsRequest::setResourceOwnerId(long resourceOwnerId) +{ + resourceOwnerId_ = resourceOwnerId; + setParameter("ResourceOwnerId", std::to_string(resourceOwnerId)); +} + +std::string SubmitMaterialsRequest::getSourceIp()const +{ + return sourceIp_; +} + +void SubmitMaterialsRequest::setSourceIp(const std::string& sourceIp) +{ + sourceIp_ = sourceIp; + setParameter("SourceIp", sourceIp); +} + +std::vector SubmitMaterialsRequest::getMaterial()const +{ + return material_; +} + +void SubmitMaterialsRequest::setMaterial(const std::vector& material) +{ + material_ = material; + int i = 0; + for(int i = 0; i!= material.size(); i++) { + auto obj = material.at(i); + std::string str ="Material."+ std::to_string(i); + setParameter(str + ".MaterialType", obj.materialType); + setParameter(str + ".Value", obj.value); + } +} + +std::string SubmitMaterialsRequest::getVerifyToken()const +{ + return verifyToken_; +} + +void SubmitMaterialsRequest::setVerifyToken(const std::string& verifyToken) +{ + verifyToken_ = verifyToken; + setParameter("VerifyToken", verifyToken); +} + diff --git a/cloudauth/src/model/SubmitMaterialsResult.cc b/cloudauth/src/model/SubmitMaterialsResult.cc new file mode 100644 index 000000000..b0b79d770 --- /dev/null +++ b/cloudauth/src/model/SubmitMaterialsResult.cc @@ -0,0 +1,79 @@ +/* + * 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 +#include + +using namespace AlibabaCloud::Cloudauth; +using namespace AlibabaCloud::Cloudauth::Model; + +SubmitMaterialsResult::SubmitMaterialsResult() : + ServiceResult() +{} + +SubmitMaterialsResult::SubmitMaterialsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +SubmitMaterialsResult::~SubmitMaterialsResult() +{} + +void SubmitMaterialsResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + auto verifyStatusNode = dataNode["VerifyStatus"]; + if(!verifyStatusNode["StatusCode"].isNull()) + data_.verifyStatus.statusCode = std::stoi(verifyStatusNode["StatusCode"].asString()); + if(!verifyStatusNode["TrustedScore"].isNull()) + data_.verifyStatus.trustedScore = std::stof(verifyStatusNode["TrustedScore"].asString()); + if(!verifyStatusNode["SimilarityScore"].isNull()) + data_.verifyStatus.similarityScore = std::stof(verifyStatusNode["SimilarityScore"].asString()); + 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 SubmitMaterialsResult::getMessage()const +{ + return message_; +} + +SubmitMaterialsResult::Data SubmitMaterialsResult::getData()const +{ + return data_; +} + +std::string SubmitMaterialsResult::getCode()const +{ + return code_; +} + +bool SubmitMaterialsResult::getSuccess()const +{ + return success_; +} +