From 8c76154f4f7d586bc734dfbbb838458c61978a68 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Fri, 26 Jan 2024 03:08:45 +0000 Subject: [PATCH] Generated 2023-03-05 for captcha. --- VERSION | 2 +- captcha/CMakeLists.txt | 90 +++++++++++++ .../alibabacloud/captcha/CaptchaClient.h | 62 +++++++++ .../alibabacloud/captcha/CaptchaExport.h | 32 +++++ .../captcha/model/VerifyCaptchaRequest.h | 42 ++++++ .../captcha/model/VerifyCaptchaResult.h | 61 +++++++++ .../model/VerifyIntelligentCaptchaRequest.h | 45 +++++++ .../model/VerifyIntelligentCaptchaResult.h | 62 +++++++++ captcha/src/CaptchaClient.cc | 125 ++++++++++++++++++ captcha/src/model/VerifyCaptchaRequest.cc | 36 +++++ captcha/src/model/VerifyCaptchaResult.cc | 73 ++++++++++ .../model/VerifyIntelligentCaptchaRequest.cc | 45 +++++++ .../model/VerifyIntelligentCaptchaResult.cc | 75 +++++++++++ 13 files changed, 749 insertions(+), 1 deletion(-) create mode 100644 captcha/CMakeLists.txt create mode 100644 captcha/include/alibabacloud/captcha/CaptchaClient.h create mode 100644 captcha/include/alibabacloud/captcha/CaptchaExport.h create mode 100644 captcha/include/alibabacloud/captcha/model/VerifyCaptchaRequest.h create mode 100644 captcha/include/alibabacloud/captcha/model/VerifyCaptchaResult.h create mode 100644 captcha/include/alibabacloud/captcha/model/VerifyIntelligentCaptchaRequest.h create mode 100644 captcha/include/alibabacloud/captcha/model/VerifyIntelligentCaptchaResult.h create mode 100644 captcha/src/CaptchaClient.cc create mode 100644 captcha/src/model/VerifyCaptchaRequest.cc create mode 100644 captcha/src/model/VerifyCaptchaResult.cc create mode 100644 captcha/src/model/VerifyIntelligentCaptchaRequest.cc create mode 100644 captcha/src/model/VerifyIntelligentCaptchaResult.cc diff --git a/VERSION b/VERSION index 1618d583e..128a13c53 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1853 \ No newline at end of file +1.36.1854 \ No newline at end of file diff --git a/captcha/CMakeLists.txt b/captcha/CMakeLists.txt new file mode 100644 index 000000000..c60b9f5be --- /dev/null +++ b/captcha/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(captcha_public_header + include/alibabacloud/captcha/CaptchaClient.h + include/alibabacloud/captcha/CaptchaExport.h ) + +set(captcha_public_header_model + include/alibabacloud/captcha/model/VerifyCaptchaRequest.h + include/alibabacloud/captcha/model/VerifyCaptchaResult.h + include/alibabacloud/captcha/model/VerifyIntelligentCaptchaRequest.h + include/alibabacloud/captcha/model/VerifyIntelligentCaptchaResult.h ) + +set(captcha_src + src/CaptchaClient.cc + src/model/VerifyCaptchaRequest.cc + src/model/VerifyCaptchaResult.cc + src/model/VerifyIntelligentCaptchaRequest.cc + src/model/VerifyIntelligentCaptchaResult.cc ) + +add_library(captcha ${LIB_TYPE} + ${captcha_public_header} + ${captcha_public_header_model} + ${captcha_src}) + +set_target_properties(captcha + 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}captcha + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(captcha + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_CAPTCHA_LIBRARY) +endif() + +target_include_directories(captcha + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(captcha + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(captcha + jsoncpp) + target_include_directories(captcha + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(captcha + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(captcha + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(captcha + PRIVATE /usr/include/jsoncpp) + target_link_libraries(captcha + jsoncpp) +endif() + +install(FILES ${captcha_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/captcha) +install(FILES ${captcha_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/captcha/model) +install(TARGETS captcha + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/captcha/include/alibabacloud/captcha/CaptchaClient.h b/captcha/include/alibabacloud/captcha/CaptchaClient.h new file mode 100644 index 000000000..21d5c122e --- /dev/null +++ b/captcha/include/alibabacloud/captcha/CaptchaClient.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_CAPTCHA_CAPTCHACLIENT_H_ +#define ALIBABACLOUD_CAPTCHA_CAPTCHACLIENT_H_ + +#include +#include +#include +#include +#include "CaptchaExport.h" +#include "model/VerifyCaptchaRequest.h" +#include "model/VerifyCaptchaResult.h" +#include "model/VerifyIntelligentCaptchaRequest.h" +#include "model/VerifyIntelligentCaptchaResult.h" + + +namespace AlibabaCloud +{ + namespace Captcha + { + class ALIBABACLOUD_CAPTCHA_EXPORT CaptchaClient : public RpcServiceClient + { + public: + typedef Outcome VerifyCaptchaOutcome; + typedef std::future VerifyCaptchaOutcomeCallable; + typedef std::function&)> VerifyCaptchaAsyncHandler; + typedef Outcome VerifyIntelligentCaptchaOutcome; + typedef std::future VerifyIntelligentCaptchaOutcomeCallable; + typedef std::function&)> VerifyIntelligentCaptchaAsyncHandler; + + CaptchaClient(const Credentials &credentials, const ClientConfiguration &configuration); + CaptchaClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + CaptchaClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~CaptchaClient(); + VerifyCaptchaOutcome verifyCaptcha(const Model::VerifyCaptchaRequest &request)const; + void verifyCaptchaAsync(const Model::VerifyCaptchaRequest& request, const VerifyCaptchaAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + VerifyCaptchaOutcomeCallable verifyCaptchaCallable(const Model::VerifyCaptchaRequest& request) const; + VerifyIntelligentCaptchaOutcome verifyIntelligentCaptcha(const Model::VerifyIntelligentCaptchaRequest &request)const; + void verifyIntelligentCaptchaAsync(const Model::VerifyIntelligentCaptchaRequest& request, const VerifyIntelligentCaptchaAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + VerifyIntelligentCaptchaOutcomeCallable verifyIntelligentCaptchaCallable(const Model::VerifyIntelligentCaptchaRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_CAPTCHA_CAPTCHACLIENT_H_ diff --git a/captcha/include/alibabacloud/captcha/CaptchaExport.h b/captcha/include/alibabacloud/captcha/CaptchaExport.h new file mode 100644 index 000000000..8a98e1dae --- /dev/null +++ b/captcha/include/alibabacloud/captcha/CaptchaExport.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_CAPTCHA_CAPTCHAEXPORT_H_ +#define ALIBABACLOUD_CAPTCHA_CAPTCHAEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_CAPTCHA_LIBRARY) +# define ALIBABACLOUD_CAPTCHA_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_CAPTCHA_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_CAPTCHA_EXPORT +#endif + +#endif // !ALIBABACLOUD_CAPTCHA_CAPTCHAEXPORT_H_ \ No newline at end of file diff --git a/captcha/include/alibabacloud/captcha/model/VerifyCaptchaRequest.h b/captcha/include/alibabacloud/captcha/model/VerifyCaptchaRequest.h new file mode 100644 index 000000000..9e5c64988 --- /dev/null +++ b/captcha/include/alibabacloud/captcha/model/VerifyCaptchaRequest.h @@ -0,0 +1,42 @@ +/* + * 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_CAPTCHA_MODEL_VERIFYCAPTCHAREQUEST_H_ +#define ALIBABACLOUD_CAPTCHA_MODEL_VERIFYCAPTCHAREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Captcha { +namespace Model { +class ALIBABACLOUD_CAPTCHA_EXPORT VerifyCaptchaRequest : public RpcServiceRequest { +public: + VerifyCaptchaRequest(); + ~VerifyCaptchaRequest(); + std::string getCaptchaVerifyParam() const; + void setCaptchaVerifyParam(const std::string &captchaVerifyParam); + +private: + std::string captchaVerifyParam_; +}; +} // namespace Model +} // namespace Captcha +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_CAPTCHA_MODEL_VERIFYCAPTCHAREQUEST_H_ diff --git a/captcha/include/alibabacloud/captcha/model/VerifyCaptchaResult.h b/captcha/include/alibabacloud/captcha/model/VerifyCaptchaResult.h new file mode 100644 index 000000000..9a8723150 --- /dev/null +++ b/captcha/include/alibabacloud/captcha/model/VerifyCaptchaResult.h @@ -0,0 +1,61 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_CAPTCHA_MODEL_VERIFYCAPTCHARESULT_H_ +#define ALIBABACLOUD_CAPTCHA_MODEL_VERIFYCAPTCHARESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Captcha + { + namespace Model + { + class ALIBABACLOUD_CAPTCHA_EXPORT VerifyCaptchaResult : public ServiceResult + { + public: + struct Result + { + bool verifyResult; + }; + + + VerifyCaptchaResult(); + explicit VerifyCaptchaResult(const std::string &payload); + ~VerifyCaptchaResult(); + std::string getMessage()const; + std::string getCode()const; + bool getSuccess()const; + Result getResult()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + std::string code_; + bool success_; + Result result_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CAPTCHA_MODEL_VERIFYCAPTCHARESULT_H_ \ No newline at end of file diff --git a/captcha/include/alibabacloud/captcha/model/VerifyIntelligentCaptchaRequest.h b/captcha/include/alibabacloud/captcha/model/VerifyIntelligentCaptchaRequest.h new file mode 100644 index 000000000..7ba3defd1 --- /dev/null +++ b/captcha/include/alibabacloud/captcha/model/VerifyIntelligentCaptchaRequest.h @@ -0,0 +1,45 @@ +/* + * 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_CAPTCHA_MODEL_VERIFYINTELLIGENTCAPTCHAREQUEST_H_ +#define ALIBABACLOUD_CAPTCHA_MODEL_VERIFYINTELLIGENTCAPTCHAREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Captcha { +namespace Model { +class ALIBABACLOUD_CAPTCHA_EXPORT VerifyIntelligentCaptchaRequest : public RpcServiceRequest { +public: + VerifyIntelligentCaptchaRequest(); + ~VerifyIntelligentCaptchaRequest(); + std::string getCaptchaVerifyParam() const; + void setCaptchaVerifyParam(const std::string &captchaVerifyParam); + std::string getSceneId() const; + void setSceneId(const std::string &sceneId); + +private: + std::string captchaVerifyParam_; + std::string sceneId_; +}; +} // namespace Model +} // namespace Captcha +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_CAPTCHA_MODEL_VERIFYINTELLIGENTCAPTCHAREQUEST_H_ diff --git a/captcha/include/alibabacloud/captcha/model/VerifyIntelligentCaptchaResult.h b/captcha/include/alibabacloud/captcha/model/VerifyIntelligentCaptchaResult.h new file mode 100644 index 000000000..5b3525859 --- /dev/null +++ b/captcha/include/alibabacloud/captcha/model/VerifyIntelligentCaptchaResult.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_CAPTCHA_MODEL_VERIFYINTELLIGENTCAPTCHARESULT_H_ +#define ALIBABACLOUD_CAPTCHA_MODEL_VERIFYINTELLIGENTCAPTCHARESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Captcha + { + namespace Model + { + class ALIBABACLOUD_CAPTCHA_EXPORT VerifyIntelligentCaptchaResult : public ServiceResult + { + public: + struct Result + { + std::string verifyCode; + bool verifyResult; + }; + + + VerifyIntelligentCaptchaResult(); + explicit VerifyIntelligentCaptchaResult(const std::string &payload); + ~VerifyIntelligentCaptchaResult(); + std::string getMessage()const; + std::string getCode()const; + bool getSuccess()const; + Result getResult()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + std::string code_; + bool success_; + Result result_; + + }; + } + } +} +#endif // !ALIBABACLOUD_CAPTCHA_MODEL_VERIFYINTELLIGENTCAPTCHARESULT_H_ \ No newline at end of file diff --git a/captcha/src/CaptchaClient.cc b/captcha/src/CaptchaClient.cc new file mode 100644 index 000000000..100185d91 --- /dev/null +++ b/captcha/src/CaptchaClient.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::Captcha; +using namespace AlibabaCloud::Captcha::Model; + +namespace +{ + const std::string SERVICE_NAME = "captcha"; +} + +CaptchaClient::CaptchaClient(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, ""); +} + +CaptchaClient::CaptchaClient(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, ""); +} + +CaptchaClient::CaptchaClient(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, ""); +} + +CaptchaClient::~CaptchaClient() +{} + +CaptchaClient::VerifyCaptchaOutcome CaptchaClient::verifyCaptcha(const VerifyCaptchaRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return VerifyCaptchaOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return VerifyCaptchaOutcome(VerifyCaptchaResult(outcome.result())); + else + return VerifyCaptchaOutcome(outcome.error()); +} + +void CaptchaClient::verifyCaptchaAsync(const VerifyCaptchaRequest& request, const VerifyCaptchaAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, verifyCaptcha(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +CaptchaClient::VerifyCaptchaOutcomeCallable CaptchaClient::verifyCaptchaCallable(const VerifyCaptchaRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->verifyCaptcha(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +CaptchaClient::VerifyIntelligentCaptchaOutcome CaptchaClient::verifyIntelligentCaptcha(const VerifyIntelligentCaptchaRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return VerifyIntelligentCaptchaOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return VerifyIntelligentCaptchaOutcome(VerifyIntelligentCaptchaResult(outcome.result())); + else + return VerifyIntelligentCaptchaOutcome(outcome.error()); +} + +void CaptchaClient::verifyIntelligentCaptchaAsync(const VerifyIntelligentCaptchaRequest& request, const VerifyIntelligentCaptchaAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, verifyIntelligentCaptcha(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +CaptchaClient::VerifyIntelligentCaptchaOutcomeCallable CaptchaClient::verifyIntelligentCaptchaCallable(const VerifyIntelligentCaptchaRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->verifyIntelligentCaptcha(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/captcha/src/model/VerifyCaptchaRequest.cc b/captcha/src/model/VerifyCaptchaRequest.cc new file mode 100644 index 000000000..15d754fac --- /dev/null +++ b/captcha/src/model/VerifyCaptchaRequest.cc @@ -0,0 +1,36 @@ +/* + * 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::Captcha::Model::VerifyCaptchaRequest; + +VerifyCaptchaRequest::VerifyCaptchaRequest() + : RpcServiceRequest("captcha", "2023-03-05", "VerifyCaptcha") { + setMethod(HttpRequest::Method::Post); +} + +VerifyCaptchaRequest::~VerifyCaptchaRequest() {} + +std::string VerifyCaptchaRequest::getCaptchaVerifyParam() const { + return captchaVerifyParam_; +} + +void VerifyCaptchaRequest::setCaptchaVerifyParam(const std::string &captchaVerifyParam) { + captchaVerifyParam_ = captchaVerifyParam; + setParameter(std::string("CaptchaVerifyParam"), captchaVerifyParam); +} + diff --git a/captcha/src/model/VerifyCaptchaResult.cc b/captcha/src/model/VerifyCaptchaResult.cc new file mode 100644 index 000000000..71ae042bc --- /dev/null +++ b/captcha/src/model/VerifyCaptchaResult.cc @@ -0,0 +1,73 @@ +/* + * 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::Captcha; +using namespace AlibabaCloud::Captcha::Model; + +VerifyCaptchaResult::VerifyCaptchaResult() : + ServiceResult() +{} + +VerifyCaptchaResult::VerifyCaptchaResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +VerifyCaptchaResult::~VerifyCaptchaResult() +{} + +void VerifyCaptchaResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto resultNode = value["Result"]; + if(!resultNode["VerifyResult"].isNull()) + result_.verifyResult = resultNode["VerifyResult"].asString() == "true"; + 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 VerifyCaptchaResult::getMessage()const +{ + return message_; +} + +std::string VerifyCaptchaResult::getCode()const +{ + return code_; +} + +bool VerifyCaptchaResult::getSuccess()const +{ + return success_; +} + +VerifyCaptchaResult::Result VerifyCaptchaResult::getResult()const +{ + return result_; +} + diff --git a/captcha/src/model/VerifyIntelligentCaptchaRequest.cc b/captcha/src/model/VerifyIntelligentCaptchaRequest.cc new file mode 100644 index 000000000..121fa163f --- /dev/null +++ b/captcha/src/model/VerifyIntelligentCaptchaRequest.cc @@ -0,0 +1,45 @@ +/* + * 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::Captcha::Model::VerifyIntelligentCaptchaRequest; + +VerifyIntelligentCaptchaRequest::VerifyIntelligentCaptchaRequest() + : RpcServiceRequest("captcha", "2023-03-05", "VerifyIntelligentCaptcha") { + setMethod(HttpRequest::Method::Post); +} + +VerifyIntelligentCaptchaRequest::~VerifyIntelligentCaptchaRequest() {} + +std::string VerifyIntelligentCaptchaRequest::getCaptchaVerifyParam() const { + return captchaVerifyParam_; +} + +void VerifyIntelligentCaptchaRequest::setCaptchaVerifyParam(const std::string &captchaVerifyParam) { + captchaVerifyParam_ = captchaVerifyParam; + setBodyParameter(std::string("CaptchaVerifyParam"), captchaVerifyParam); +} + +std::string VerifyIntelligentCaptchaRequest::getSceneId() const { + return sceneId_; +} + +void VerifyIntelligentCaptchaRequest::setSceneId(const std::string &sceneId) { + sceneId_ = sceneId; + setBodyParameter(std::string("SceneId"), sceneId); +} + diff --git a/captcha/src/model/VerifyIntelligentCaptchaResult.cc b/captcha/src/model/VerifyIntelligentCaptchaResult.cc new file mode 100644 index 000000000..8e5081eb9 --- /dev/null +++ b/captcha/src/model/VerifyIntelligentCaptchaResult.cc @@ -0,0 +1,75 @@ +/* + * 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::Captcha; +using namespace AlibabaCloud::Captcha::Model; + +VerifyIntelligentCaptchaResult::VerifyIntelligentCaptchaResult() : + ServiceResult() +{} + +VerifyIntelligentCaptchaResult::VerifyIntelligentCaptchaResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +VerifyIntelligentCaptchaResult::~VerifyIntelligentCaptchaResult() +{} + +void VerifyIntelligentCaptchaResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto resultNode = value["Result"]; + if(!resultNode["VerifyResult"].isNull()) + result_.verifyResult = resultNode["VerifyResult"].asString() == "true"; + if(!resultNode["VerifyCode"].isNull()) + result_.verifyCode = resultNode["VerifyCode"].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 VerifyIntelligentCaptchaResult::getMessage()const +{ + return message_; +} + +std::string VerifyIntelligentCaptchaResult::getCode()const +{ + return code_; +} + +bool VerifyIntelligentCaptchaResult::getSuccess()const +{ + return success_; +} + +VerifyIntelligentCaptchaResult::Result VerifyIntelligentCaptchaResult::getResult()const +{ + return result_; +} +