diff --git a/CHANGELOG b/CHANGELOG index e882f2432..251bde7e3 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2022-02-23 Version: 1.36.1067 +- SDK. + 2022-02-23 Version: 1.36.1066 - Add AuthId. diff --git a/VERSION b/VERSION index d114fa3de..18c2b9655 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1066 \ No newline at end of file +1.36.1067 \ No newline at end of file diff --git a/cloudauth-console/CMakeLists.txt b/cloudauth-console/CMakeLists.txt new file mode 100644 index 000000000..1045d8712 --- /dev/null +++ b/cloudauth-console/CMakeLists.txt @@ -0,0 +1,90 @@ +# +# 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-console_public_header + include/alibabacloud/cloudauth-console/Cloudauth_consoleClient.h + include/alibabacloud/cloudauth-console/Cloudauth_consoleExport.h ) + +set(cloudauth-console_public_header_model + include/alibabacloud/cloudauth-console/model/RetrieveFaceRequest.h + include/alibabacloud/cloudauth-console/model/RetrieveFaceResult.h + include/alibabacloud/cloudauth-console/model/UploadIdentifyRecordRequest.h + include/alibabacloud/cloudauth-console/model/UploadIdentifyRecordResult.h ) + +set(cloudauth-console_src + src/Cloudauth-consoleClient.cc + src/model/RetrieveFaceRequest.cc + src/model/RetrieveFaceResult.cc + src/model/UploadIdentifyRecordRequest.cc + src/model/UploadIdentifyRecordResult.cc ) + +add_library(cloudauth-console ${LIB_TYPE} + ${cloudauth-console_public_header} + ${cloudauth-console_public_header_model} + ${cloudauth-console_src}) + +set_target_properties(cloudauth-console + 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-console + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(cloudauth-console + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_CLOUDAUTH_CONSOLE_LIBRARY) +endif() + +target_include_directories(cloudauth-console + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(cloudauth-console + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(cloudauth-console + jsoncpp) + target_include_directories(cloudauth-console + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(cloudauth-console + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(cloudauth-console + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(cloudauth-console + PRIVATE /usr/include/jsoncpp) + target_link_libraries(cloudauth-console + jsoncpp) +endif() + +install(FILES ${cloudauth-console_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/cloudauth-console) +install(FILES ${cloudauth-console_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/cloudauth-console/model) +install(TARGETS cloudauth-console + 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-console/include/alibabacloud/cloudauth-console/Cloudauth_consoleClient.h b/cloudauth-console/include/alibabacloud/cloudauth-console/Cloudauth_consoleClient.h new file mode 100644 index 000000000..81f901b2c --- /dev/null +++ b/cloudauth-console/include/alibabacloud/cloudauth-console/Cloudauth_consoleClient.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_CONSOLE_CLOUDAUTH_CONSOLECLIENT_H_ +#define ALIBABACLOUD_CLOUDAUTH_CONSOLE_CLOUDAUTH_CONSOLECLIENT_H_ + +#include +#include +#include +#include +#include "Cloudauth_consoleExport.h" +#include "model/RetrieveFaceRequest.h" +#include "model/RetrieveFaceResult.h" +#include "model/UploadIdentifyRecordRequest.h" +#include "model/UploadIdentifyRecordResult.h" + + +namespace AlibabaCloud +{ + namespace Cloudauth_console + { + class ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT Cloudauth_consoleClient : public RpcServiceClient + { + public: + typedef Outcome RetrieveFaceOutcome; + typedef std::future RetrieveFaceOutcomeCallable; + typedef std::function&)> RetrieveFaceAsyncHandler; + typedef Outcome UploadIdentifyRecordOutcome; + typedef std::future UploadIdentifyRecordOutcomeCallable; + typedef std::function&)> UploadIdentifyRecordAsyncHandler; + + Cloudauth_consoleClient(const Credentials &credentials, const ClientConfiguration &configuration); + Cloudauth_consoleClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + Cloudauth_consoleClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~Cloudauth_consoleClient(); + RetrieveFaceOutcome retrieveFace(const Model::RetrieveFaceRequest &request)const; + void retrieveFaceAsync(const Model::RetrieveFaceRequest& request, const RetrieveFaceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + RetrieveFaceOutcomeCallable retrieveFaceCallable(const Model::RetrieveFaceRequest& request) const; + UploadIdentifyRecordOutcome uploadIdentifyRecord(const Model::UploadIdentifyRecordRequest &request)const; + void uploadIdentifyRecordAsync(const Model::UploadIdentifyRecordRequest& request, const UploadIdentifyRecordAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + UploadIdentifyRecordOutcomeCallable uploadIdentifyRecordCallable(const Model::UploadIdentifyRecordRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_CLOUDAUTH_CONSOLE_CLOUDAUTH_CONSOLECLIENT_H_ diff --git a/cloudauth-console/include/alibabacloud/cloudauth-console/Cloudauth_consoleExport.h b/cloudauth-console/include/alibabacloud/cloudauth-console/Cloudauth_consoleExport.h new file mode 100644 index 000000000..cbbb4fd53 --- /dev/null +++ b/cloudauth-console/include/alibabacloud/cloudauth-console/Cloudauth_consoleExport.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_CONSOLE_CLOUDAUTH_CONSOLEEXPORT_H_ +#define ALIBABACLOUD_CLOUDAUTH_CONSOLE_CLOUDAUTH_CONSOLEEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_CLOUDAUTH_CONSOLE_LIBRARY) +# define ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT +#endif + +#endif // !ALIBABACLOUD_CLOUDAUTH_CONSOLE_CLOUDAUTH_CONSOLEEXPORT_H_ \ No newline at end of file diff --git a/cloudauth-console/include/alibabacloud/cloudauth-console/model/RetrieveFaceRequest.h b/cloudauth-console/include/alibabacloud/cloudauth-console/model/RetrieveFaceRequest.h new file mode 100644 index 000000000..02cd2345b --- /dev/null +++ b/cloudauth-console/include/alibabacloud/cloudauth-console/model/RetrieveFaceRequest.h @@ -0,0 +1,54 @@ +/* + * 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_CONSOLE_MODEL_RETRIEVEFACEREQUEST_H_ +#define ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_RETRIEVEFACEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth_console + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT RetrieveFaceRequest : public RpcServiceRequest + { + + public: + RetrieveFaceRequest(); + ~RetrieveFaceRequest(); + + std::string getFace64String()const; + void setFace64String(const std::string& face64String); + std::string getFaceUrl()const; + void setFaceUrl(const std::string& faceUrl); + std::string getProjectId()const; + void setProjectId(const std::string& projectId); + + private: + std::string face64String_; + std::string faceUrl_; + std::string projectId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_RETRIEVEFACEREQUEST_H_ \ No newline at end of file diff --git a/cloudauth-console/include/alibabacloud/cloudauth-console/model/RetrieveFaceResult.h b/cloudauth-console/include/alibabacloud/cloudauth-console/model/RetrieveFaceResult.h new file mode 100644 index 000000000..cd22c9580 --- /dev/null +++ b/cloudauth-console/include/alibabacloud/cloudauth-console/model/RetrieveFaceResult.h @@ -0,0 +1,59 @@ +/* + * 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_CONSOLE_MODEL_RETRIEVEFACERESULT_H_ +#define ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_RETRIEVEFACERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth_console + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT RetrieveFaceResult : public ServiceResult + { + public: + struct DataItem + { + std::string userName; + long userId; + std::string rate; + }; + + + RetrieveFaceResult(); + explicit RetrieveFaceResult(const std::string &payload); + ~RetrieveFaceResult(); + std::vector getData()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + std::vector data_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_RETRIEVEFACERESULT_H_ \ No newline at end of file diff --git a/cloudauth-console/include/alibabacloud/cloudauth-console/model/UploadIdentifyRecordRequest.h b/cloudauth-console/include/alibabacloud/cloudauth-console/model/UploadIdentifyRecordRequest.h new file mode 100644 index 000000000..7403b59d7 --- /dev/null +++ b/cloudauth-console/include/alibabacloud/cloudauth-console/model/UploadIdentifyRecordRequest.h @@ -0,0 +1,78 @@ +/* + * 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_CONSOLE_MODEL_UPLOADIDENTIFYRECORDREQUEST_H_ +#define ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_UPLOADIDENTIFYRECORDREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth_console + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT UploadIdentifyRecordRequest : public RpcServiceRequest + { + + public: + UploadIdentifyRecordRequest(); + ~UploadIdentifyRecordRequest(); + + std::string getExt()const; + void setExt(const std::string& ext); + std::string getIdentifyingImageUrl()const; + void setIdentifyingImageUrl(const std::string& identifyingImageUrl); + std::string getIdentifyingImageBase64()const; + void setIdentifyingImageBase64(const std::string& identifyingImageBase64); + std::string getDeviceSecret()const; + void setDeviceSecret(const std::string& deviceSecret); + std::string getProductKey()const; + void setProductKey(const std::string& productKey); + std::string getUserId()const; + void setUserId(const std::string& userId); + std::string getIotId()const; + void setIotId(const std::string& iotId); + std::string getDeviceName()const; + void setDeviceName(const std::string& deviceName); + long getIdentifyingTime()const; + void setIdentifyingTime(long identifyingTime); + std::string getProjectId()const; + void setProjectId(const std::string& projectId); + std::string getUserName()const; + void setUserName(const std::string& userName); + + private: + std::string ext_; + std::string identifyingImageUrl_; + std::string identifyingImageBase64_; + std::string deviceSecret_; + std::string productKey_; + std::string userId_; + std::string iotId_; + std::string deviceName_; + long identifyingTime_; + std::string projectId_; + std::string userName_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_UPLOADIDENTIFYRECORDREQUEST_H_ \ No newline at end of file diff --git a/cloudauth-console/include/alibabacloud/cloudauth-console/model/UploadIdentifyRecordResult.h b/cloudauth-console/include/alibabacloud/cloudauth-console/model/UploadIdentifyRecordResult.h new file mode 100644 index 000000000..e05f9bec8 --- /dev/null +++ b/cloudauth-console/include/alibabacloud/cloudauth-console/model/UploadIdentifyRecordResult.h @@ -0,0 +1,53 @@ +/* + * 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_CONSOLE_MODEL_UPLOADIDENTIFYRECORDRESULT_H_ +#define ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_UPLOADIDENTIFYRECORDRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Cloudauth_console + { + namespace Model + { + class ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT UploadIdentifyRecordResult : public ServiceResult + { + public: + + + UploadIdentifyRecordResult(); + explicit UploadIdentifyRecordResult(const std::string &payload); + ~UploadIdentifyRecordResult(); + int getHttpStatusCode()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + int httpStatusCode_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_UPLOADIDENTIFYRECORDRESULT_H_ \ No newline at end of file diff --git a/cloudauth-console/src/Cloudauth-consoleClient.cc b/cloudauth-console/src/Cloudauth-consoleClient.cc new file mode 100644 index 000000000..9ef723fa2 --- /dev/null +++ b/cloudauth-console/src/Cloudauth-consoleClient.cc @@ -0,0 +1,125 @@ +/* + * 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_console; +using namespace AlibabaCloud::Cloudauth_console::Model; + +namespace +{ + const std::string SERVICE_NAME = "Cloudauth-console"; +} + +Cloudauth_consoleClient::Cloudauth_consoleClient(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-console"); +} + +Cloudauth_consoleClient::Cloudauth_consoleClient(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-console"); +} + +Cloudauth_consoleClient::Cloudauth_consoleClient(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-console"); +} + +Cloudauth_consoleClient::~Cloudauth_consoleClient() +{} + +Cloudauth_consoleClient::RetrieveFaceOutcome Cloudauth_consoleClient::retrieveFace(const RetrieveFaceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return RetrieveFaceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return RetrieveFaceOutcome(RetrieveFaceResult(outcome.result())); + else + return RetrieveFaceOutcome(outcome.error()); +} + +void Cloudauth_consoleClient::retrieveFaceAsync(const RetrieveFaceRequest& request, const RetrieveFaceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, retrieveFace(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +Cloudauth_consoleClient::RetrieveFaceOutcomeCallable Cloudauth_consoleClient::retrieveFaceCallable(const RetrieveFaceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->retrieveFace(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +Cloudauth_consoleClient::UploadIdentifyRecordOutcome Cloudauth_consoleClient::uploadIdentifyRecord(const UploadIdentifyRecordRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return UploadIdentifyRecordOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return UploadIdentifyRecordOutcome(UploadIdentifyRecordResult(outcome.result())); + else + return UploadIdentifyRecordOutcome(outcome.error()); +} + +void Cloudauth_consoleClient::uploadIdentifyRecordAsync(const UploadIdentifyRecordRequest& request, const UploadIdentifyRecordAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, uploadIdentifyRecord(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +Cloudauth_consoleClient::UploadIdentifyRecordOutcomeCallable Cloudauth_consoleClient::uploadIdentifyRecordCallable(const UploadIdentifyRecordRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->uploadIdentifyRecord(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/cloudauth-console/src/model/RetrieveFaceRequest.cc b/cloudauth-console/src/model/RetrieveFaceRequest.cc new file mode 100644 index 000000000..4bd842ac8 --- /dev/null +++ b/cloudauth-console/src/model/RetrieveFaceRequest.cc @@ -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. + */ + +#include + +using AlibabaCloud::Cloudauth_console::Model::RetrieveFaceRequest; + +RetrieveFaceRequest::RetrieveFaceRequest() : + RpcServiceRequest("cloudauth-console", "2019-04-03", "RetrieveFace") +{ + setMethod(HttpRequest::Method::Post); +} + +RetrieveFaceRequest::~RetrieveFaceRequest() +{} + +std::string RetrieveFaceRequest::getFace64String()const +{ + return face64String_; +} + +void RetrieveFaceRequest::setFace64String(const std::string& face64String) +{ + face64String_ = face64String; + setBodyParameter("Face64String", face64String); +} + +std::string RetrieveFaceRequest::getFaceUrl()const +{ + return faceUrl_; +} + +void RetrieveFaceRequest::setFaceUrl(const std::string& faceUrl) +{ + faceUrl_ = faceUrl; + setParameter("FaceUrl", faceUrl); +} + +std::string RetrieveFaceRequest::getProjectId()const +{ + return projectId_; +} + +void RetrieveFaceRequest::setProjectId(const std::string& projectId) +{ + projectId_ = projectId; + setParameter("ProjectId", projectId); +} + diff --git a/cloudauth-console/src/model/RetrieveFaceResult.cc b/cloudauth-console/src/model/RetrieveFaceResult.cc new file mode 100644 index 000000000..69f6483e7 --- /dev/null +++ b/cloudauth-console/src/model/RetrieveFaceResult.cc @@ -0,0 +1,68 @@ +/* + * 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_console; +using namespace AlibabaCloud::Cloudauth_console::Model; + +RetrieveFaceResult::RetrieveFaceResult() : + ServiceResult() +{} + +RetrieveFaceResult::RetrieveFaceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +RetrieveFaceResult::~RetrieveFaceResult() +{} + +void RetrieveFaceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allDataNode = value["Data"]["DataItem"]; + for (auto valueDataDataItem : allDataNode) + { + DataItem dataObject; + if(!valueDataDataItem["UserId"].isNull()) + dataObject.userId = std::stol(valueDataDataItem["UserId"].asString()); + if(!valueDataDataItem["UserName"].isNull()) + dataObject.userName = valueDataDataItem["UserName"].asString(); + if(!valueDataDataItem["Rate"].isNull()) + dataObject.rate = valueDataDataItem["Rate"].asString(); + data_.push_back(dataObject); + } + if(!value["Success"].isNull()) + success_ = value["Success"].asString() == "true"; + +} + +std::vector RetrieveFaceResult::getData()const +{ + return data_; +} + +bool RetrieveFaceResult::getSuccess()const +{ + return success_; +} + diff --git a/cloudauth-console/src/model/UploadIdentifyRecordRequest.cc b/cloudauth-console/src/model/UploadIdentifyRecordRequest.cc new file mode 100644 index 000000000..6f9ad958b --- /dev/null +++ b/cloudauth-console/src/model/UploadIdentifyRecordRequest.cc @@ -0,0 +1,150 @@ +/* + * 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_console::Model::UploadIdentifyRecordRequest; + +UploadIdentifyRecordRequest::UploadIdentifyRecordRequest() : + RpcServiceRequest("cloudauth-console", "2019-04-03", "UploadIdentifyRecord") +{ + setMethod(HttpRequest::Method::Post); +} + +UploadIdentifyRecordRequest::~UploadIdentifyRecordRequest() +{} + +std::string UploadIdentifyRecordRequest::getExt()const +{ + return ext_; +} + +void UploadIdentifyRecordRequest::setExt(const std::string& ext) +{ + ext_ = ext; + setParameter("Ext", ext); +} + +std::string UploadIdentifyRecordRequest::getIdentifyingImageUrl()const +{ + return identifyingImageUrl_; +} + +void UploadIdentifyRecordRequest::setIdentifyingImageUrl(const std::string& identifyingImageUrl) +{ + identifyingImageUrl_ = identifyingImageUrl; + setParameter("IdentifyingImageUrl", identifyingImageUrl); +} + +std::string UploadIdentifyRecordRequest::getIdentifyingImageBase64()const +{ + return identifyingImageBase64_; +} + +void UploadIdentifyRecordRequest::setIdentifyingImageBase64(const std::string& identifyingImageBase64) +{ + identifyingImageBase64_ = identifyingImageBase64; + setBodyParameter("IdentifyingImageBase64", identifyingImageBase64); +} + +std::string UploadIdentifyRecordRequest::getDeviceSecret()const +{ + return deviceSecret_; +} + +void UploadIdentifyRecordRequest::setDeviceSecret(const std::string& deviceSecret) +{ + deviceSecret_ = deviceSecret; + setParameter("DeviceSecret", deviceSecret); +} + +std::string UploadIdentifyRecordRequest::getProductKey()const +{ + return productKey_; +} + +void UploadIdentifyRecordRequest::setProductKey(const std::string& productKey) +{ + productKey_ = productKey; + setParameter("ProductKey", productKey); +} + +std::string UploadIdentifyRecordRequest::getUserId()const +{ + return userId_; +} + +void UploadIdentifyRecordRequest::setUserId(const std::string& userId) +{ + userId_ = userId; + setParameter("UserId", userId); +} + +std::string UploadIdentifyRecordRequest::getIotId()const +{ + return iotId_; +} + +void UploadIdentifyRecordRequest::setIotId(const std::string& iotId) +{ + iotId_ = iotId; + setParameter("IotId", iotId); +} + +std::string UploadIdentifyRecordRequest::getDeviceName()const +{ + return deviceName_; +} + +void UploadIdentifyRecordRequest::setDeviceName(const std::string& deviceName) +{ + deviceName_ = deviceName; + setParameter("DeviceName", deviceName); +} + +long UploadIdentifyRecordRequest::getIdentifyingTime()const +{ + return identifyingTime_; +} + +void UploadIdentifyRecordRequest::setIdentifyingTime(long identifyingTime) +{ + identifyingTime_ = identifyingTime; + setParameter("IdentifyingTime", std::to_string(identifyingTime)); +} + +std::string UploadIdentifyRecordRequest::getProjectId()const +{ + return projectId_; +} + +void UploadIdentifyRecordRequest::setProjectId(const std::string& projectId) +{ + projectId_ = projectId; + setParameter("ProjectId", projectId); +} + +std::string UploadIdentifyRecordRequest::getUserName()const +{ + return userName_; +} + +void UploadIdentifyRecordRequest::setUserName(const std::string& userName) +{ + userName_ = userName; + setParameter("UserName", userName); +} + diff --git a/cloudauth-console/src/model/UploadIdentifyRecordResult.cc b/cloudauth-console/src/model/UploadIdentifyRecordResult.cc new file mode 100644 index 000000000..9e61a9e95 --- /dev/null +++ b/cloudauth-console/src/model/UploadIdentifyRecordResult.cc @@ -0,0 +1,58 @@ +/* + * 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_console; +using namespace AlibabaCloud::Cloudauth_console::Model; + +UploadIdentifyRecordResult::UploadIdentifyRecordResult() : + ServiceResult() +{} + +UploadIdentifyRecordResult::UploadIdentifyRecordResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +UploadIdentifyRecordResult::~UploadIdentifyRecordResult() +{} + +void UploadIdentifyRecordResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + if(!value["Success"].isNull()) + success_ = value["Success"].asString() == "true"; + if(!value["HttpStatusCode"].isNull()) + httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString()); + +} + +int UploadIdentifyRecordResult::getHttpStatusCode()const +{ + return httpStatusCode_; +} + +bool UploadIdentifyRecordResult::getSuccess()const +{ + return success_; +} +