Add persons API.
This commit is contained in:
@@ -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<const AsyncCallerContext>& 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<std::packaged_task<GetPersonDetailOutcome()>>(
|
||||
[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<const AsyncCallerContext>& 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<std::packaged_task<ListPersonsOutcome()>>(
|
||||
[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();
|
||||
|
||||
51
vcs/src/model/GetPersonDetailRequest.cc
Normal file
51
vcs/src/model/GetPersonDetailRequest.cc
Normal file
@@ -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 <alibabacloud/vcs/model/GetPersonDetailRequest.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
82
vcs/src/model/GetPersonDetailResult.cc
Normal file
82
vcs/src/model/GetPersonDetailResult.cc
Normal file
@@ -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 <alibabacloud/vcs/model/GetPersonDetailResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
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_;
|
||||
}
|
||||
|
||||
62
vcs/src/model/ListPersonsRequest.cc
Normal file
62
vcs/src/model/ListPersonsRequest.cc
Normal file
@@ -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 <alibabacloud/vcs/model/ListPersonsRequest.h>
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
98
vcs/src/model/ListPersonsResult.cc
Normal file
98
vcs/src/model/ListPersonsResult.cc
Normal file
@@ -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 <alibabacloud/vcs/model/ListPersonsResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
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_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user