From e32ce45b9d0263b26e6ac4b044dbf06dc714f4d9 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Sun, 21 Jun 2020 22:21:45 +0800 Subject: [PATCH] Add persons API. --- CHANGELOG | 3 + VERSION | 2 +- vcs/CMakeLists.txt | 8 ++ vcs/include/alibabacloud/vcs/VcsClient.h | 16 +++ .../vcs/model/GetPersonDetailRequest.h | 51 ++++++++++ .../vcs/model/GetPersonDetailResult.h | 68 +++++++++++++ .../vcs/model/ListPersonsRequest.h | 54 ++++++++++ .../vcs/model/ListPersonsResult.h | 77 +++++++++++++++ vcs/src/VcsClient.cc | 72 ++++++++++++++ vcs/src/model/GetPersonDetailRequest.cc | 51 ++++++++++ vcs/src/model/GetPersonDetailResult.cc | 82 ++++++++++++++++ vcs/src/model/ListPersonsRequest.cc | 62 ++++++++++++ vcs/src/model/ListPersonsResult.cc | 98 +++++++++++++++++++ 13 files changed, 643 insertions(+), 1 deletion(-) create mode 100644 vcs/include/alibabacloud/vcs/model/GetPersonDetailRequest.h create mode 100644 vcs/include/alibabacloud/vcs/model/GetPersonDetailResult.h create mode 100644 vcs/include/alibabacloud/vcs/model/ListPersonsRequest.h create mode 100644 vcs/include/alibabacloud/vcs/model/ListPersonsResult.h create mode 100644 vcs/src/model/GetPersonDetailRequest.cc create mode 100644 vcs/src/model/GetPersonDetailResult.cc create mode 100644 vcs/src/model/ListPersonsRequest.cc create mode 100644 vcs/src/model/ListPersonsResult.cc diff --git a/CHANGELOG b/CHANGELOG index ffa7d83fa..e58d3e55c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2020-06-21 Version: 1.36.469 +- Add persons API. + 2020-06-18 Version: 1.36.468 - Supported TransformDBInstancePayType API. diff --git a/VERSION b/VERSION index d4af86e15..89924db7b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.468 \ No newline at end of file +1.36.469 \ No newline at end of file diff --git a/vcs/CMakeLists.txt b/vcs/CMakeLists.txt index 303dc4484..5ddd137cc 100644 --- a/vcs/CMakeLists.txt +++ b/vcs/CMakeLists.txt @@ -41,10 +41,14 @@ set(vcs_public_header_model include/alibabacloud/vcs/model/GetInventoryResult.h include/alibabacloud/vcs/model/GetMonitorResultRequest.h include/alibabacloud/vcs/model/GetMonitorResultResult.h + include/alibabacloud/vcs/model/GetPersonDetailRequest.h + include/alibabacloud/vcs/model/GetPersonDetailResult.h include/alibabacloud/vcs/model/ListCorpsRequest.h include/alibabacloud/vcs/model/ListCorpsResult.h include/alibabacloud/vcs/model/ListDevicesRequest.h include/alibabacloud/vcs/model/ListDevicesResult.h + include/alibabacloud/vcs/model/ListPersonsRequest.h + include/alibabacloud/vcs/model/ListPersonsResult.h include/alibabacloud/vcs/model/RecognizeImageRequest.h include/alibabacloud/vcs/model/RecognizeImageResult.h include/alibabacloud/vcs/model/SearchBodyRequest.h @@ -82,10 +86,14 @@ set(vcs_src src/model/GetInventoryResult.cc src/model/GetMonitorResultRequest.cc src/model/GetMonitorResultResult.cc + src/model/GetPersonDetailRequest.cc + src/model/GetPersonDetailResult.cc src/model/ListCorpsRequest.cc src/model/ListCorpsResult.cc src/model/ListDevicesRequest.cc src/model/ListDevicesResult.cc + src/model/ListPersonsRequest.cc + src/model/ListPersonsResult.cc src/model/RecognizeImageRequest.cc src/model/RecognizeImageResult.cc src/model/SearchBodyRequest.cc diff --git a/vcs/include/alibabacloud/vcs/VcsClient.h b/vcs/include/alibabacloud/vcs/VcsClient.h index 19f5fcf44..25bcf5de4 100644 --- a/vcs/include/alibabacloud/vcs/VcsClient.h +++ b/vcs/include/alibabacloud/vcs/VcsClient.h @@ -42,10 +42,14 @@ #include "model/GetInventoryResult.h" #include "model/GetMonitorResultRequest.h" #include "model/GetMonitorResultResult.h" +#include "model/GetPersonDetailRequest.h" +#include "model/GetPersonDetailResult.h" #include "model/ListCorpsRequest.h" #include "model/ListCorpsResult.h" #include "model/ListDevicesRequest.h" #include "model/ListDevicesResult.h" +#include "model/ListPersonsRequest.h" +#include "model/ListPersonsResult.h" #include "model/RecognizeImageRequest.h" #include "model/RecognizeImageResult.h" #include "model/SearchBodyRequest.h" @@ -99,12 +103,18 @@ namespace AlibabaCloud typedef Outcome GetMonitorResultOutcome; typedef std::future GetMonitorResultOutcomeCallable; typedef std::function&)> GetMonitorResultAsyncHandler; + typedef Outcome GetPersonDetailOutcome; + typedef std::future GetPersonDetailOutcomeCallable; + typedef std::function&)> GetPersonDetailAsyncHandler; typedef Outcome ListCorpsOutcome; typedef std::future ListCorpsOutcomeCallable; typedef std::function&)> ListCorpsAsyncHandler; typedef Outcome ListDevicesOutcome; typedef std::future ListDevicesOutcomeCallable; typedef std::function&)> ListDevicesAsyncHandler; + typedef Outcome ListPersonsOutcome; + typedef std::future ListPersonsOutcomeCallable; + typedef std::function&)> ListPersonsAsyncHandler; typedef Outcome RecognizeImageOutcome; typedef std::future RecognizeImageOutcomeCallable; typedef std::function&)> RecognizeImageAsyncHandler; @@ -161,12 +171,18 @@ namespace AlibabaCloud GetMonitorResultOutcome getMonitorResult(const Model::GetMonitorResultRequest &request)const; void getMonitorResultAsync(const Model::GetMonitorResultRequest& request, const GetMonitorResultAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; GetMonitorResultOutcomeCallable getMonitorResultCallable(const Model::GetMonitorResultRequest& request) const; + GetPersonDetailOutcome getPersonDetail(const Model::GetPersonDetailRequest &request)const; + void getPersonDetailAsync(const Model::GetPersonDetailRequest& request, const GetPersonDetailAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetPersonDetailOutcomeCallable getPersonDetailCallable(const Model::GetPersonDetailRequest& request) const; ListCorpsOutcome listCorps(const Model::ListCorpsRequest &request)const; void listCorpsAsync(const Model::ListCorpsRequest& request, const ListCorpsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ListCorpsOutcomeCallable listCorpsCallable(const Model::ListCorpsRequest& request) const; ListDevicesOutcome listDevices(const Model::ListDevicesRequest &request)const; void listDevicesAsync(const Model::ListDevicesRequest& request, const ListDevicesAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ListDevicesOutcomeCallable listDevicesCallable(const Model::ListDevicesRequest& request) const; + ListPersonsOutcome listPersons(const Model::ListPersonsRequest &request)const; + void listPersonsAsync(const Model::ListPersonsRequest& request, const ListPersonsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ListPersonsOutcomeCallable listPersonsCallable(const Model::ListPersonsRequest& request) const; RecognizeImageOutcome recognizeImage(const Model::RecognizeImageRequest &request)const; void recognizeImageAsync(const Model::RecognizeImageRequest& request, const RecognizeImageAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; RecognizeImageOutcomeCallable recognizeImageCallable(const Model::RecognizeImageRequest& request) const; diff --git a/vcs/include/alibabacloud/vcs/model/GetPersonDetailRequest.h b/vcs/include/alibabacloud/vcs/model/GetPersonDetailRequest.h new file mode 100644 index 000000000..25a3b3fc0 --- /dev/null +++ b/vcs/include/alibabacloud/vcs/model/GetPersonDetailRequest.h @@ -0,0 +1,51 @@ +/* + * 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_VCS_MODEL_GETPERSONDETAILREQUEST_H_ +#define ALIBABACLOUD_VCS_MODEL_GETPERSONDETAILREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Vcs + { + namespace Model + { + class ALIBABACLOUD_VCS_EXPORT GetPersonDetailRequest : public RpcServiceRequest + { + + public: + GetPersonDetailRequest(); + ~GetPersonDetailRequest(); + + std::string getCorpId()const; + void setCorpId(const std::string& corpId); + std::string getPersonID()const; + void setPersonID(const std::string& personID); + + private: + std::string corpId_; + std::string personID_; + + }; + } + } +} +#endif // !ALIBABACLOUD_VCS_MODEL_GETPERSONDETAILREQUEST_H_ \ No newline at end of file diff --git a/vcs/include/alibabacloud/vcs/model/GetPersonDetailResult.h b/vcs/include/alibabacloud/vcs/model/GetPersonDetailResult.h new file mode 100644 index 000000000..18af8d447 --- /dev/null +++ b/vcs/include/alibabacloud/vcs/model/GetPersonDetailResult.h @@ -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. + */ + +#ifndef ALIBABACLOUD_VCS_MODEL_GETPERSONDETAILRESULT_H_ +#define ALIBABACLOUD_VCS_MODEL_GETPERSONDETAILRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Vcs + { + namespace Model + { + class ALIBABACLOUD_VCS_EXPORT GetPersonDetailResult : public ServiceResult + { + public: + struct Data + { + struct TagListItem + { + std::string tagName; + std::string tagValueId; + std::string tagCode; + std::string tagValue; + }; + std::string personId; + std::vector tagList; + std::string picUrl; + }; + + + GetPersonDetailResult(); + explicit GetPersonDetailResult(const std::string &payload); + ~GetPersonDetailResult(); + std::string getMessage()const; + Data getData()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + Data data_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_VCS_MODEL_GETPERSONDETAILRESULT_H_ \ No newline at end of file diff --git a/vcs/include/alibabacloud/vcs/model/ListPersonsRequest.h b/vcs/include/alibabacloud/vcs/model/ListPersonsRequest.h new file mode 100644 index 000000000..ba4284a8a --- /dev/null +++ b/vcs/include/alibabacloud/vcs/model/ListPersonsRequest.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_VCS_MODEL_LISTPERSONSREQUEST_H_ +#define ALIBABACLOUD_VCS_MODEL_LISTPERSONSREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Vcs + { + namespace Model + { + class ALIBABACLOUD_VCS_EXPORT ListPersonsRequest : public RpcServiceRequest + { + + public: + ListPersonsRequest(); + ~ListPersonsRequest(); + + std::string getCorpId()const; + void setCorpId(const std::string& corpId); + std::string getPageNo()const; + void setPageNo(const std::string& pageNo); + std::string getPageSize()const; + void setPageSize(const std::string& pageSize); + + private: + std::string corpId_; + std::string pageNo_; + std::string pageSize_; + + }; + } + } +} +#endif // !ALIBABACLOUD_VCS_MODEL_LISTPERSONSREQUEST_H_ \ No newline at end of file diff --git a/vcs/include/alibabacloud/vcs/model/ListPersonsResult.h b/vcs/include/alibabacloud/vcs/model/ListPersonsResult.h new file mode 100644 index 000000000..106f065dc --- /dev/null +++ b/vcs/include/alibabacloud/vcs/model/ListPersonsResult.h @@ -0,0 +1,77 @@ +/* + * Copyright 2009-2017 Alibaba Cloud All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ALIBABACLOUD_VCS_MODEL_LISTPERSONSRESULT_H_ +#define ALIBABACLOUD_VCS_MODEL_LISTPERSONSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Vcs + { + namespace Model + { + class ALIBABACLOUD_VCS_EXPORT ListPersonsResult : public ServiceResult + { + public: + struct Data + { + struct RecordsItem + { + struct TagListItem + { + std::string tagName; + std::string tagValueId; + std::string tagCode; + std::string tagValue; + }; + std::string firstAppearTime; + std::string personId; + std::vector tagList; + std::string picUrl; + }; + std::string totalCount; + std::string pageSize; + std::string totalPage; + std::string pageNo; + std::vector records; + }; + + + ListPersonsResult(); + explicit ListPersonsResult(const std::string &payload); + ~ListPersonsResult(); + std::string getMessage()const; + Data getData()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + Data data_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_VCS_MODEL_LISTPERSONSRESULT_H_ \ No newline at end of file diff --git a/vcs/src/VcsClient.cc b/vcs/src/VcsClient.cc index 61862da9f..4df0f114c 100644 --- a/vcs/src/VcsClient.cc +++ b/vcs/src/VcsClient.cc @@ -411,6 +411,42 @@ VcsClient::GetMonitorResultOutcomeCallable VcsClient::getMonitorResultCallable(c return task->get_future(); } +VcsClient::GetPersonDetailOutcome VcsClient::getPersonDetail(const GetPersonDetailRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return GetPersonDetailOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return GetPersonDetailOutcome(GetPersonDetailResult(outcome.result())); + else + return GetPersonDetailOutcome(outcome.error()); +} + +void VcsClient::getPersonDetailAsync(const GetPersonDetailRequest& request, const GetPersonDetailAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, getPersonDetail(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +VcsClient::GetPersonDetailOutcomeCallable VcsClient::getPersonDetailCallable(const GetPersonDetailRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->getPersonDetail(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + VcsClient::ListCorpsOutcome VcsClient::listCorps(const ListCorpsRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); @@ -483,6 +519,42 @@ VcsClient::ListDevicesOutcomeCallable VcsClient::listDevicesCallable(const ListD return task->get_future(); } +VcsClient::ListPersonsOutcome VcsClient::listPersons(const ListPersonsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ListPersonsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ListPersonsOutcome(ListPersonsResult(outcome.result())); + else + return ListPersonsOutcome(outcome.error()); +} + +void VcsClient::listPersonsAsync(const ListPersonsRequest& request, const ListPersonsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, listPersons(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +VcsClient::ListPersonsOutcomeCallable VcsClient::listPersonsCallable(const ListPersonsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->listPersons(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + VcsClient::RecognizeImageOutcome VcsClient::recognizeImage(const RecognizeImageRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/vcs/src/model/GetPersonDetailRequest.cc b/vcs/src/model/GetPersonDetailRequest.cc new file mode 100644 index 000000000..65e73753d --- /dev/null +++ b/vcs/src/model/GetPersonDetailRequest.cc @@ -0,0 +1,51 @@ +/* + * 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::Vcs::Model::GetPersonDetailRequest; + +GetPersonDetailRequest::GetPersonDetailRequest() : + RpcServiceRequest("vcs", "2020-05-15", "GetPersonDetail") +{ + setMethod(HttpRequest::Method::Post); +} + +GetPersonDetailRequest::~GetPersonDetailRequest() +{} + +std::string GetPersonDetailRequest::getCorpId()const +{ + return corpId_; +} + +void GetPersonDetailRequest::setCorpId(const std::string& corpId) +{ + corpId_ = corpId; + setBodyParameter("CorpId", corpId); +} + +std::string GetPersonDetailRequest::getPersonID()const +{ + return personID_; +} + +void GetPersonDetailRequest::setPersonID(const std::string& personID) +{ + personID_ = personID; + setBodyParameter("PersonID", personID); +} + diff --git a/vcs/src/model/GetPersonDetailResult.cc b/vcs/src/model/GetPersonDetailResult.cc new file mode 100644 index 000000000..bb2921999 --- /dev/null +++ b/vcs/src/model/GetPersonDetailResult.cc @@ -0,0 +1,82 @@ +/* + * 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::Vcs; +using namespace AlibabaCloud::Vcs::Model; + +GetPersonDetailResult::GetPersonDetailResult() : + ServiceResult() +{} + +GetPersonDetailResult::GetPersonDetailResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +GetPersonDetailResult::~GetPersonDetailResult() +{} + +void GetPersonDetailResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + if(!dataNode["PicUrl"].isNull()) + data_.picUrl = dataNode["PicUrl"].asString(); + if(!dataNode["PersonId"].isNull()) + data_.personId = dataNode["PersonId"].asString(); + auto allTagListNode = dataNode["TagList"]["TagListItem"]; + for (auto dataNodeTagListTagListItem : allTagListNode) + { + Data::TagListItem tagListItemObject; + if(!dataNodeTagListTagListItem["TagCode"].isNull()) + tagListItemObject.tagCode = dataNodeTagListTagListItem["TagCode"].asString(); + if(!dataNodeTagListTagListItem["TagName"].isNull()) + tagListItemObject.tagName = dataNodeTagListTagListItem["TagName"].asString(); + if(!dataNodeTagListTagListItem["TagValue"].isNull()) + tagListItemObject.tagValue = dataNodeTagListTagListItem["TagValue"].asString(); + if(!dataNodeTagListTagListItem["TagValueId"].isNull()) + tagListItemObject.tagValueId = dataNodeTagListTagListItem["TagValueId"].asString(); + data_.tagList.push_back(tagListItemObject); + } + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string GetPersonDetailResult::getMessage()const +{ + return message_; +} + +GetPersonDetailResult::Data GetPersonDetailResult::getData()const +{ + return data_; +} + +std::string GetPersonDetailResult::getCode()const +{ + return code_; +} + diff --git a/vcs/src/model/ListPersonsRequest.cc b/vcs/src/model/ListPersonsRequest.cc new file mode 100644 index 000000000..d2ea35f97 --- /dev/null +++ b/vcs/src/model/ListPersonsRequest.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::Vcs::Model::ListPersonsRequest; + +ListPersonsRequest::ListPersonsRequest() : + RpcServiceRequest("vcs", "2020-05-15", "ListPersons") +{ + setMethod(HttpRequest::Method::Post); +} + +ListPersonsRequest::~ListPersonsRequest() +{} + +std::string ListPersonsRequest::getCorpId()const +{ + return corpId_; +} + +void ListPersonsRequest::setCorpId(const std::string& corpId) +{ + corpId_ = corpId; + setBodyParameter("CorpId", corpId); +} + +std::string ListPersonsRequest::getPageNo()const +{ + return pageNo_; +} + +void ListPersonsRequest::setPageNo(const std::string& pageNo) +{ + pageNo_ = pageNo; + setBodyParameter("PageNo", pageNo); +} + +std::string ListPersonsRequest::getPageSize()const +{ + return pageSize_; +} + +void ListPersonsRequest::setPageSize(const std::string& pageSize) +{ + pageSize_ = pageSize; + setBodyParameter("PageSize", pageSize); +} + diff --git a/vcs/src/model/ListPersonsResult.cc b/vcs/src/model/ListPersonsResult.cc new file mode 100644 index 000000000..fc88dcc00 --- /dev/null +++ b/vcs/src/model/ListPersonsResult.cc @@ -0,0 +1,98 @@ +/* + * 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::Vcs; +using namespace AlibabaCloud::Vcs::Model; + +ListPersonsResult::ListPersonsResult() : + ServiceResult() +{} + +ListPersonsResult::ListPersonsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ListPersonsResult::~ListPersonsResult() +{} + +void ListPersonsResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto dataNode = value["Data"]; + if(!dataNode["PageNo"].isNull()) + data_.pageNo = dataNode["PageNo"].asString(); + if(!dataNode["PageSize"].isNull()) + data_.pageSize = dataNode["PageSize"].asString(); + if(!dataNode["TotalCount"].isNull()) + data_.totalCount = dataNode["TotalCount"].asString(); + if(!dataNode["TotalPage"].isNull()) + data_.totalPage = dataNode["TotalPage"].asString(); + auto allRecordsNode = dataNode["Records"]["RecordsItem"]; + for (auto dataNodeRecordsRecordsItem : allRecordsNode) + { + Data::RecordsItem recordsItemObject; + if(!dataNodeRecordsRecordsItem["FirstAppearTime"].isNull()) + recordsItemObject.firstAppearTime = dataNodeRecordsRecordsItem["FirstAppearTime"].asString(); + if(!dataNodeRecordsRecordsItem["PersonId"].isNull()) + recordsItemObject.personId = dataNodeRecordsRecordsItem["PersonId"].asString(); + if(!dataNodeRecordsRecordsItem["PicUrl"].isNull()) + recordsItemObject.picUrl = dataNodeRecordsRecordsItem["PicUrl"].asString(); + auto allTagListNode = allRecordsNode["TagList"]["TagListItem"]; + for (auto allRecordsNodeTagListTagListItem : allTagListNode) + { + Data::RecordsItem::TagListItem tagListObject; + if(!allRecordsNodeTagListTagListItem["TagCode"].isNull()) + tagListObject.tagCode = allRecordsNodeTagListTagListItem["TagCode"].asString(); + if(!allRecordsNodeTagListTagListItem["TagName"].isNull()) + tagListObject.tagName = allRecordsNodeTagListTagListItem["TagName"].asString(); + if(!allRecordsNodeTagListTagListItem["TagValue"].isNull()) + tagListObject.tagValue = allRecordsNodeTagListTagListItem["TagValue"].asString(); + if(!allRecordsNodeTagListTagListItem["TagValueId"].isNull()) + tagListObject.tagValueId = allRecordsNodeTagListTagListItem["TagValueId"].asString(); + recordsItemObject.tagList.push_back(tagListObject); + } + data_.records.push_back(recordsItemObject); + } + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + if(!value["Message"].isNull()) + message_ = value["Message"].asString(); + +} + +std::string ListPersonsResult::getMessage()const +{ + return message_; +} + +ListPersonsResult::Data ListPersonsResult::getData()const +{ + return data_; +} + +std::string ListPersonsResult::getCode()const +{ + return code_; +} +