From 549e90ee7cc21a93395526ff01a5eaa7921b3fb1 Mon Sep 17 00:00:00 2001 From: "haowei.yao" Date: Mon, 18 Mar 2019 15:40:31 +0800 Subject: [PATCH] =?UTF-8?q?IMAGESEARCH=20SDK=20Auto=20Released=20By=20shen?= =?UTF-8?q?shi,Version=EF=BC=9A1.34.41?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: haowei.yao --- CHANGELOG | 3 + CMakeLists.txt | 3 +- VERSION | 2 +- imagesearch/CMakeLists.txt | 94 ++++++++++ .../imagesearch/ImageSearchClient.h | 70 ++++++++ .../imagesearch/ImageSearchExport.h | 32 ++++ .../imagesearch/model/AddItemRequest.h | 48 ++++++ .../imagesearch/model/AddItemResult.h | 55 ++++++ .../imagesearch/model/DeleteItemRequest.h | 48 ++++++ .../imagesearch/model/DeleteItemResult.h | 55 ++++++ .../imagesearch/model/SearchItemRequest.h | 48 ++++++ .../imagesearch/model/SearchItemResult.h | 86 ++++++++++ imagesearch/src/ImageSearchClient.cc | 161 ++++++++++++++++++ imagesearch/src/model/AddItemRequest.cc | 38 +++++ imagesearch/src/model/AddItemResult.cc | 66 +++++++ imagesearch/src/model/DeleteItemRequest.cc | 38 +++++ imagesearch/src/model/DeleteItemResult.cc | 66 +++++++ imagesearch/src/model/SearchItemRequest.cc | 38 +++++ imagesearch/src/model/SearchItemResult.cc | 119 +++++++++++++ 19 files changed, 1068 insertions(+), 2 deletions(-) create mode 100644 imagesearch/CMakeLists.txt create mode 100644 imagesearch/include/alibabacloud/imagesearch/ImageSearchClient.h create mode 100644 imagesearch/include/alibabacloud/imagesearch/ImageSearchExport.h create mode 100644 imagesearch/include/alibabacloud/imagesearch/model/AddItemRequest.h create mode 100644 imagesearch/include/alibabacloud/imagesearch/model/AddItemResult.h create mode 100644 imagesearch/include/alibabacloud/imagesearch/model/DeleteItemRequest.h create mode 100644 imagesearch/include/alibabacloud/imagesearch/model/DeleteItemResult.h create mode 100644 imagesearch/include/alibabacloud/imagesearch/model/SearchItemRequest.h create mode 100644 imagesearch/include/alibabacloud/imagesearch/model/SearchItemResult.h create mode 100644 imagesearch/src/ImageSearchClient.cc create mode 100644 imagesearch/src/model/AddItemRequest.cc create mode 100644 imagesearch/src/model/AddItemResult.cc create mode 100644 imagesearch/src/model/DeleteItemRequest.cc create mode 100644 imagesearch/src/model/DeleteItemResult.cc create mode 100644 imagesearch/src/model/SearchItemRequest.cc create mode 100644 imagesearch/src/model/SearchItemResult.cc diff --git a/CHANGELOG b/CHANGELOG index 275a95b3c..0b9418a45 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2019-03-18 Version: 1.34.41 +1, Update Dependency + 2019-03-18 Version: 1.34.40 1, move AssociatePerson\Tag field 2, Optimize RealName field diff --git a/CMakeLists.txt b/CMakeLists.txt index 740a8113e..9720be543 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,4 +107,5 @@ add_subdirectory(ubsms) add_subdirectory(yundun) -add_subdirectory(arms4finance) \ No newline at end of file +add_subdirectory(arms4finance) +add_subdirectory(imagesearch) \ No newline at end of file diff --git a/VERSION b/VERSION index 0853ca3f1..e8ef36c70 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.34.40 \ No newline at end of file +1.34.41 \ No newline at end of file diff --git a/imagesearch/CMakeLists.txt b/imagesearch/CMakeLists.txt new file mode 100644 index 000000000..bd8feb2a5 --- /dev/null +++ b/imagesearch/CMakeLists.txt @@ -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. +# + +set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include) + +set(imagesearch_public_header + include/alibabacloud/imagesearch/ImageSearchClient.h + include/alibabacloud/imagesearch/ImageSearchExport.h ) + +set(imagesearch_public_header_model + include/alibabacloud/imagesearch/model/DeleteItemRequest.h + include/alibabacloud/imagesearch/model/DeleteItemResult.h + include/alibabacloud/imagesearch/model/AddItemRequest.h + include/alibabacloud/imagesearch/model/AddItemResult.h + include/alibabacloud/imagesearch/model/SearchItemRequest.h + include/alibabacloud/imagesearch/model/SearchItemResult.h ) + +set(imagesearch_src + src/ImageSearchClient.cc + src/model/DeleteItemRequest.cc + src/model/DeleteItemResult.cc + src/model/AddItemRequest.cc + src/model/AddItemResult.cc + src/model/SearchItemRequest.cc + src/model/SearchItemResult.cc ) + +add_library(imagesearch ${LIB_TYPE} + ${imagesearch_public_header} + ${imagesearch_public_header_model} + ${imagesearch_src}) + +set_target_properties(imagesearch + 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}imagesearch + ) + +if(${LIB_TYPE} STREQUAL "SHARED") + set_target_properties(imagesearch + PROPERTIES + DEFINE_SYMBOL ALIBABACLOUD_IMAGESEARCH_LIBRARY) +endif() + +target_include_directories(imagesearch + PRIVATE include + ${CMAKE_SOURCE_DIR}/core/include + ) +target_link_libraries(imagesearch + core) + +if(CMAKE_HOST_WIN32) + ExternalProject_Get_Property(jsoncpp INSTALL_DIR) + set(jsoncpp_install_dir ${INSTALL_DIR}) + add_dependencies(imagesearch + jsoncpp) + target_include_directories(imagesearch + PRIVATE ${jsoncpp_install_dir}/include) + target_link_libraries(imagesearch + ${jsoncpp_install_dir}/lib/jsoncpp.lib) + set_target_properties(imagesearch + PROPERTIES + COMPILE_OPTIONS "/bigobj") +else() + target_include_directories(imagesearch + PRIVATE /usr/include/jsoncpp) + target_link_libraries(imagesearch + jsoncpp) +endif() + +install(FILES ${imagesearch_public_header} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/imagesearch) +install(FILES ${imagesearch_public_header_model} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/imagesearch/model) +install(TARGETS imagesearch + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) \ No newline at end of file diff --git a/imagesearch/include/alibabacloud/imagesearch/ImageSearchClient.h b/imagesearch/include/alibabacloud/imagesearch/ImageSearchClient.h new file mode 100644 index 000000000..ac10ca4ca --- /dev/null +++ b/imagesearch/include/alibabacloud/imagesearch/ImageSearchClient.h @@ -0,0 +1,70 @@ +/* + * 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_IMAGESEARCH_IMAGESEARCHCLIENT_H_ +#define ALIBABACLOUD_IMAGESEARCH_IMAGESEARCHCLIENT_H_ + +#include +#include +#include +#include +#include "ImageSearchExport.h" +#include "model/DeleteItemRequest.h" +#include "model/DeleteItemResult.h" +#include "model/AddItemRequest.h" +#include "model/AddItemResult.h" +#include "model/SearchItemRequest.h" +#include "model/SearchItemResult.h" + + +namespace AlibabaCloud +{ + namespace ImageSearch + { + class ALIBABACLOUD_IMAGESEARCH_EXPORT ImageSearchClient : public RoaServiceClient + { + public: + typedef Outcome DeleteItemOutcome; + typedef std::future DeleteItemOutcomeCallable; + typedef std::function&)> DeleteItemAsyncHandler; + typedef Outcome AddItemOutcome; + typedef std::future AddItemOutcomeCallable; + typedef std::function&)> AddItemAsyncHandler; + typedef Outcome SearchItemOutcome; + typedef std::future SearchItemOutcomeCallable; + typedef std::function&)> SearchItemAsyncHandler; + + ImageSearchClient(const Credentials &credentials, const ClientConfiguration &configuration); + ImageSearchClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); + ImageSearchClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); + ~ImageSearchClient(); + DeleteItemOutcome deleteItem(const Model::DeleteItemRequest &request)const; + void deleteItemAsync(const Model::DeleteItemRequest& request, const DeleteItemAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + DeleteItemOutcomeCallable deleteItemCallable(const Model::DeleteItemRequest& request) const; + AddItemOutcome addItem(const Model::AddItemRequest &request)const; + void addItemAsync(const Model::AddItemRequest& request, const AddItemAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + AddItemOutcomeCallable addItemCallable(const Model::AddItemRequest& request) const; + SearchItemOutcome searchItem(const Model::SearchItemRequest &request)const; + void searchItemAsync(const Model::SearchItemRequest& request, const SearchItemAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + SearchItemOutcomeCallable searchItemCallable(const Model::SearchItemRequest& request) const; + + private: + std::shared_ptr endpointProvider_; + }; + } +} + +#endif // !ALIBABACLOUD_IMAGESEARCH_IMAGESEARCHCLIENT_H_ diff --git a/imagesearch/include/alibabacloud/imagesearch/ImageSearchExport.h b/imagesearch/include/alibabacloud/imagesearch/ImageSearchExport.h new file mode 100644 index 000000000..313e3fe65 --- /dev/null +++ b/imagesearch/include/alibabacloud/imagesearch/ImageSearchExport.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_IMAGESEARCH_IMAGESEARCHEXPORT_H_ +#define ALIBABACLOUD_IMAGESEARCH_IMAGESEARCHEXPORT_H_ + +#include + +#if defined(ALIBABACLOUD_SHARED) +# if defined(ALIBABACLOUD_IMAGESEARCH_LIBRARY) +# define ALIBABACLOUD_IMAGESEARCH_EXPORT ALIBABACLOUD_DECL_EXPORT +# else +# define ALIBABACLOUD_IMAGESEARCH_EXPORT ALIBABACLOUD_DECL_IMPORT +# endif +#else +# define ALIBABACLOUD_IMAGESEARCH_EXPORT +#endif + +#endif // !ALIBABACLOUD_IMAGESEARCH_IMAGESEARCHEXPORT_H_ \ No newline at end of file diff --git a/imagesearch/include/alibabacloud/imagesearch/model/AddItemRequest.h b/imagesearch/include/alibabacloud/imagesearch/model/AddItemRequest.h new file mode 100644 index 000000000..587a39f2f --- /dev/null +++ b/imagesearch/include/alibabacloud/imagesearch/model/AddItemRequest.h @@ -0,0 +1,48 @@ +/* + * 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_IMAGESEARCH_MODEL_ADDITEMREQUEST_H_ +#define ALIBABACLOUD_IMAGESEARCH_MODEL_ADDITEMREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ImageSearch + { + namespace Model + { + class ALIBABACLOUD_IMAGESEARCH_EXPORT AddItemRequest : public RoaServiceRequest + { + + public: + AddItemRequest(); + ~AddItemRequest(); + + std::string getInstanceName()const; + void setInstanceName(const std::string& instanceName); + + private: + std::string instanceName_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IMAGESEARCH_MODEL_ADDITEMREQUEST_H_ \ No newline at end of file diff --git a/imagesearch/include/alibabacloud/imagesearch/model/AddItemResult.h b/imagesearch/include/alibabacloud/imagesearch/model/AddItemResult.h new file mode 100644 index 000000000..fad8df2a5 --- /dev/null +++ b/imagesearch/include/alibabacloud/imagesearch/model/AddItemResult.h @@ -0,0 +1,55 @@ +/* + * 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_IMAGESEARCH_MODEL_ADDITEMRESULT_H_ +#define ALIBABACLOUD_IMAGESEARCH_MODEL_ADDITEMRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ImageSearch + { + namespace Model + { + class ALIBABACLOUD_IMAGESEARCH_EXPORT AddItemResult : public ServiceResult + { + public: + + + AddItemResult(); + explicit AddItemResult(const std::string &payload); + ~AddItemResult(); + std::string getMessage()const; + int getCode()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + int code_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IMAGESEARCH_MODEL_ADDITEMRESULT_H_ \ No newline at end of file diff --git a/imagesearch/include/alibabacloud/imagesearch/model/DeleteItemRequest.h b/imagesearch/include/alibabacloud/imagesearch/model/DeleteItemRequest.h new file mode 100644 index 000000000..2737ac573 --- /dev/null +++ b/imagesearch/include/alibabacloud/imagesearch/model/DeleteItemRequest.h @@ -0,0 +1,48 @@ +/* + * 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_IMAGESEARCH_MODEL_DELETEITEMREQUEST_H_ +#define ALIBABACLOUD_IMAGESEARCH_MODEL_DELETEITEMREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ImageSearch + { + namespace Model + { + class ALIBABACLOUD_IMAGESEARCH_EXPORT DeleteItemRequest : public RoaServiceRequest + { + + public: + DeleteItemRequest(); + ~DeleteItemRequest(); + + std::string getInstanceName()const; + void setInstanceName(const std::string& instanceName); + + private: + std::string instanceName_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IMAGESEARCH_MODEL_DELETEITEMREQUEST_H_ \ No newline at end of file diff --git a/imagesearch/include/alibabacloud/imagesearch/model/DeleteItemResult.h b/imagesearch/include/alibabacloud/imagesearch/model/DeleteItemResult.h new file mode 100644 index 000000000..87c0ba4fa --- /dev/null +++ b/imagesearch/include/alibabacloud/imagesearch/model/DeleteItemResult.h @@ -0,0 +1,55 @@ +/* + * 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_IMAGESEARCH_MODEL_DELETEITEMRESULT_H_ +#define ALIBABACLOUD_IMAGESEARCH_MODEL_DELETEITEMRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ImageSearch + { + namespace Model + { + class ALIBABACLOUD_IMAGESEARCH_EXPORT DeleteItemResult : public ServiceResult + { + public: + + + DeleteItemResult(); + explicit DeleteItemResult(const std::string &payload); + ~DeleteItemResult(); + std::string getMessage()const; + int getCode()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + int code_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IMAGESEARCH_MODEL_DELETEITEMRESULT_H_ \ No newline at end of file diff --git a/imagesearch/include/alibabacloud/imagesearch/model/SearchItemRequest.h b/imagesearch/include/alibabacloud/imagesearch/model/SearchItemRequest.h new file mode 100644 index 000000000..11279cd9d --- /dev/null +++ b/imagesearch/include/alibabacloud/imagesearch/model/SearchItemRequest.h @@ -0,0 +1,48 @@ +/* + * 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_IMAGESEARCH_MODEL_SEARCHITEMREQUEST_H_ +#define ALIBABACLOUD_IMAGESEARCH_MODEL_SEARCHITEMREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ImageSearch + { + namespace Model + { + class ALIBABACLOUD_IMAGESEARCH_EXPORT SearchItemRequest : public RoaServiceRequest + { + + public: + SearchItemRequest(); + ~SearchItemRequest(); + + std::string getInstanceName()const; + void setInstanceName(const std::string& instanceName); + + private: + std::string instanceName_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IMAGESEARCH_MODEL_SEARCHITEMREQUEST_H_ \ No newline at end of file diff --git a/imagesearch/include/alibabacloud/imagesearch/model/SearchItemResult.h b/imagesearch/include/alibabacloud/imagesearch/model/SearchItemResult.h new file mode 100644 index 000000000..66adf7654 --- /dev/null +++ b/imagesearch/include/alibabacloud/imagesearch/model/SearchItemResult.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_IMAGESEARCH_MODEL_SEARCHITEMRESULT_H_ +#define ALIBABACLOUD_IMAGESEARCH_MODEL_SEARCHITEMRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace ImageSearch + { + namespace Model + { + class ALIBABACLOUD_IMAGESEARCH_EXPORT SearchItemResult : public ServiceResult + { + public: + struct Head + { + int docsFound; + int docsReturn; + int searchTime; + }; + struct PicInfo + { + struct Category + { + std::string id; + std::string name; + }; + std::string category; + std::vector allCategory; + std::string region; + }; + struct Auction + { + std::string picName; + std::string custContent; + std::string catId; + std::string itemId; + std::string sortExprValues; + }; + + + SearchItemResult(); + explicit SearchItemResult(const std::string &payload); + ~SearchItemResult(); + Head getHead()const; + std::string getMessage()const; + std::vector getAuctions()const; + PicInfo getPicInfo()const; + int getCode()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + Head head_; + std::string message_; + std::vector auctions_; + PicInfo picInfo_; + int code_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IMAGESEARCH_MODEL_SEARCHITEMRESULT_H_ \ No newline at end of file diff --git a/imagesearch/src/ImageSearchClient.cc b/imagesearch/src/ImageSearchClient.cc new file mode 100644 index 000000000..0081a0f99 --- /dev/null +++ b/imagesearch/src/ImageSearchClient.cc @@ -0,0 +1,161 @@ +/* + * 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::ImageSearch; +using namespace AlibabaCloud::ImageSearch::Model; + +namespace +{ + const std::string SERVICE_NAME = "ImageSearch"; +} + +ImageSearchClient::ImageSearchClient(const Credentials &credentials, const ClientConfiguration &configuration) : + RoaServiceClient(SERVICE_NAME, std::make_shared(credentials), configuration) +{ + auto locationClient = std::make_shared(credentials, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "imagesearch"); +} + +ImageSearchClient::ImageSearchClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : + RoaServiceClient(SERVICE_NAME, credentialsProvider, configuration) +{ + auto locationClient = std::make_shared(credentialsProvider, configuration); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "imagesearch"); +} + +ImageSearchClient::ImageSearchClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : + RoaServiceClient(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, "imagesearch"); +} + +ImageSearchClient::~ImageSearchClient() +{} + +ImageSearchClient::DeleteItemOutcome ImageSearchClient::deleteItem(const DeleteItemRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return DeleteItemOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return DeleteItemOutcome(DeleteItemResult(outcome.result())); + else + return DeleteItemOutcome(outcome.error()); +} + +void ImageSearchClient::deleteItemAsync(const DeleteItemRequest& request, const DeleteItemAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, deleteItem(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ImageSearchClient::DeleteItemOutcomeCallable ImageSearchClient::deleteItemCallable(const DeleteItemRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->deleteItem(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +ImageSearchClient::AddItemOutcome ImageSearchClient::addItem(const AddItemRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return AddItemOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return AddItemOutcome(AddItemResult(outcome.result())); + else + return AddItemOutcome(outcome.error()); +} + +void ImageSearchClient::addItemAsync(const AddItemRequest& request, const AddItemAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, addItem(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ImageSearchClient::AddItemOutcomeCallable ImageSearchClient::addItemCallable(const AddItemRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->addItem(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + +ImageSearchClient::SearchItemOutcome ImageSearchClient::searchItem(const SearchItemRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return SearchItemOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return SearchItemOutcome(SearchItemResult(outcome.result())); + else + return SearchItemOutcome(outcome.error()); +} + +void ImageSearchClient::searchItemAsync(const SearchItemRequest& request, const SearchItemAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, searchItem(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +ImageSearchClient::SearchItemOutcomeCallable ImageSearchClient::searchItemCallable(const SearchItemRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->searchItem(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + diff --git a/imagesearch/src/model/AddItemRequest.cc b/imagesearch/src/model/AddItemRequest.cc new file mode 100644 index 000000000..5256100f7 --- /dev/null +++ b/imagesearch/src/model/AddItemRequest.cc @@ -0,0 +1,38 @@ +/* + * 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::ImageSearch::Model::AddItemRequest; + +AddItemRequest::AddItemRequest() : + RoaServiceRequest("imagesearch", "2018-01-20") +{} + +AddItemRequest::~AddItemRequest() +{} + +std::string AddItemRequest::getInstanceName()const +{ + return instanceName_; +} + +void AddItemRequest::setInstanceName(const std::string& instanceName) +{ + instanceName_ = instanceName; + setParameter("InstanceName", instanceName); +} + diff --git a/imagesearch/src/model/AddItemResult.cc b/imagesearch/src/model/AddItemResult.cc new file mode 100644 index 000000000..e9d5ad42c --- /dev/null +++ b/imagesearch/src/model/AddItemResult.cc @@ -0,0 +1,66 @@ +/* + * 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::ImageSearch; +using namespace AlibabaCloud::ImageSearch::Model; + +AddItemResult::AddItemResult() : + ServiceResult() +{} + +AddItemResult::AddItemResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +AddItemResult::~AddItemResult() +{} + +void AddItemResult::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["Message"].isNull()) + message_ = value["Message"].asString(); + if(!value["Code"].isNull()) + code_ = std::stoi(value["Code"].asString()); + +} + +std::string AddItemResult::getMessage()const +{ + return message_; +} + +int AddItemResult::getCode()const +{ + return code_; +} + +bool AddItemResult::getSuccess()const +{ + return success_; +} + diff --git a/imagesearch/src/model/DeleteItemRequest.cc b/imagesearch/src/model/DeleteItemRequest.cc new file mode 100644 index 000000000..50d63aeb3 --- /dev/null +++ b/imagesearch/src/model/DeleteItemRequest.cc @@ -0,0 +1,38 @@ +/* + * 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::ImageSearch::Model::DeleteItemRequest; + +DeleteItemRequest::DeleteItemRequest() : + RoaServiceRequest("imagesearch", "2018-01-20") +{} + +DeleteItemRequest::~DeleteItemRequest() +{} + +std::string DeleteItemRequest::getInstanceName()const +{ + return instanceName_; +} + +void DeleteItemRequest::setInstanceName(const std::string& instanceName) +{ + instanceName_ = instanceName; + setParameter("InstanceName", instanceName); +} + diff --git a/imagesearch/src/model/DeleteItemResult.cc b/imagesearch/src/model/DeleteItemResult.cc new file mode 100644 index 000000000..09544a918 --- /dev/null +++ b/imagesearch/src/model/DeleteItemResult.cc @@ -0,0 +1,66 @@ +/* + * 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::ImageSearch; +using namespace AlibabaCloud::ImageSearch::Model; + +DeleteItemResult::DeleteItemResult() : + ServiceResult() +{} + +DeleteItemResult::DeleteItemResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +DeleteItemResult::~DeleteItemResult() +{} + +void DeleteItemResult::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["Message"].isNull()) + message_ = value["Message"].asString(); + if(!value["Code"].isNull()) + code_ = std::stoi(value["Code"].asString()); + +} + +std::string DeleteItemResult::getMessage()const +{ + return message_; +} + +int DeleteItemResult::getCode()const +{ + return code_; +} + +bool DeleteItemResult::getSuccess()const +{ + return success_; +} + diff --git a/imagesearch/src/model/SearchItemRequest.cc b/imagesearch/src/model/SearchItemRequest.cc new file mode 100644 index 000000000..4d9b05070 --- /dev/null +++ b/imagesearch/src/model/SearchItemRequest.cc @@ -0,0 +1,38 @@ +/* + * 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::ImageSearch::Model::SearchItemRequest; + +SearchItemRequest::SearchItemRequest() : + RoaServiceRequest("imagesearch", "2018-01-20") +{} + +SearchItemRequest::~SearchItemRequest() +{} + +std::string SearchItemRequest::getInstanceName()const +{ + return instanceName_; +} + +void SearchItemRequest::setInstanceName(const std::string& instanceName) +{ + instanceName_ = instanceName; + setParameter("InstanceName", instanceName); +} + diff --git a/imagesearch/src/model/SearchItemResult.cc b/imagesearch/src/model/SearchItemResult.cc new file mode 100644 index 000000000..04244f258 --- /dev/null +++ b/imagesearch/src/model/SearchItemResult.cc @@ -0,0 +1,119 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +using namespace AlibabaCloud::ImageSearch; +using namespace AlibabaCloud::ImageSearch::Model; + +SearchItemResult::SearchItemResult() : + ServiceResult() +{} + +SearchItemResult::SearchItemResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +SearchItemResult::~SearchItemResult() +{} + +void SearchItemResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto allAuctions = value["Auctions"]["Auction"]; + for (auto value : allAuctions) + { + Auction auctionsObject; + if(!value["CustContent"].isNull()) + auctionsObject.custContent = value["CustContent"].asString(); + if(!value["ItemId"].isNull()) + auctionsObject.itemId = value["ItemId"].asString(); + if(!value["SortExprValues"].isNull()) + auctionsObject.sortExprValues = value["SortExprValues"].asString(); + if(!value["CatId"].isNull()) + auctionsObject.catId = value["CatId"].asString(); + if(!value["PicName"].isNull()) + auctionsObject.picName = value["PicName"].asString(); + auctions_.push_back(auctionsObject); + } + auto headNode = value["Head"]; + if(!headNode["SearchTime"].isNull()) + head_.searchTime = std::stoi(headNode["SearchTime"].asString()); + if(!headNode["DocsFound"].isNull()) + head_.docsFound = std::stoi(headNode["DocsFound"].asString()); + if(!headNode["DocsReturn"].isNull()) + head_.docsReturn = std::stoi(headNode["DocsReturn"].asString()); + auto picInfoNode = value["PicInfo"]; + if(!picInfoNode["Category"].isNull()) + picInfo_.category = picInfoNode["Category"].asString(); + if(!picInfoNode["Region"].isNull()) + picInfo_.region = picInfoNode["Region"].asString(); + auto allAllCategory = value["AllCategory"]["Category"]; + for (auto value : allAllCategory) + { + PicInfo::Category categoryObject; + if(!value["Name"].isNull()) + categoryObject.name = value["Name"].asString(); + if(!value["Id"].isNull()) + categoryObject.id = value["Id"].asString(); + picInfo_.allCategory.push_back(categoryObject); + } + if(!value["Success"].isNull()) + success_ = value["Success"].asString() == "true"; + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + if(!value["Code"].isNull()) + code_ = std::stoi(value["Code"].asString()); + +} + +SearchItemResult::Head SearchItemResult::getHead()const +{ + return head_; +} + +std::string SearchItemResult::getMessage()const +{ + return message_; +} + +std::vector SearchItemResult::getAuctions()const +{ + return auctions_; +} + +SearchItemResult::PicInfo SearchItemResult::getPicInfo()const +{ + return picInfo_; +} + +int SearchItemResult::getCode()const +{ + return code_; +} + +bool SearchItemResult::getSuccess()const +{ + return success_; +} +