Add describes devices API.

This commit is contained in:
sdk-team
2020-09-05 04:05:12 +00:00
parent 98ef8c88e8
commit 52e7b30f54
18 changed files with 460 additions and 5 deletions

View File

@@ -67,6 +67,8 @@ set(vcs_public_header_model
include/alibabacloud/vcs/model/DeleteUserGroupResult.h
include/alibabacloud/vcs/model/DeleteVideoSummaryTaskRequest.h
include/alibabacloud/vcs/model/DeleteVideoSummaryTaskResult.h
include/alibabacloud/vcs/model/DescribeDevicesRequest.h
include/alibabacloud/vcs/model/DescribeDevicesResult.h
include/alibabacloud/vcs/model/GetBodyOptionsRequest.h
include/alibabacloud/vcs/model/GetBodyOptionsResult.h
include/alibabacloud/vcs/model/GetCatalogListRequest.h
@@ -224,6 +226,8 @@ set(vcs_src
src/model/DeleteUserGroupResult.cc
src/model/DeleteVideoSummaryTaskRequest.cc
src/model/DeleteVideoSummaryTaskResult.cc
src/model/DescribeDevicesRequest.cc
src/model/DescribeDevicesResult.cc
src/model/GetBodyOptionsRequest.cc
src/model/GetBodyOptionsResult.cc
src/model/GetCatalogListRequest.cc

View File

@@ -68,6 +68,8 @@
#include "model/DeleteUserGroupResult.h"
#include "model/DeleteVideoSummaryTaskRequest.h"
#include "model/DeleteVideoSummaryTaskResult.h"
#include "model/DescribeDevicesRequest.h"
#include "model/DescribeDevicesResult.h"
#include "model/GetBodyOptionsRequest.h"
#include "model/GetBodyOptionsResult.h"
#include "model/GetCatalogListRequest.h"
@@ -254,6 +256,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::DeleteVideoSummaryTaskResult> DeleteVideoSummaryTaskOutcome;
typedef std::future<DeleteVideoSummaryTaskOutcome> DeleteVideoSummaryTaskOutcomeCallable;
typedef std::function<void(const VcsClient*, const Model::DeleteVideoSummaryTaskRequest&, const DeleteVideoSummaryTaskOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DeleteVideoSummaryTaskAsyncHandler;
typedef Outcome<Error, Model::DescribeDevicesResult> DescribeDevicesOutcome;
typedef std::future<DescribeDevicesOutcome> DescribeDevicesOutcomeCallable;
typedef std::function<void(const VcsClient*, const Model::DescribeDevicesRequest&, const DescribeDevicesOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> DescribeDevicesAsyncHandler;
typedef Outcome<Error, Model::GetBodyOptionsResult> GetBodyOptionsOutcome;
typedef std::future<GetBodyOptionsOutcome> GetBodyOptionsOutcomeCallable;
typedef std::function<void(const VcsClient*, const Model::GetBodyOptionsRequest&, const GetBodyOptionsOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetBodyOptionsAsyncHandler;
@@ -490,6 +495,9 @@ namespace AlibabaCloud
DeleteVideoSummaryTaskOutcome deleteVideoSummaryTask(const Model::DeleteVideoSummaryTaskRequest &request)const;
void deleteVideoSummaryTaskAsync(const Model::DeleteVideoSummaryTaskRequest& request, const DeleteVideoSummaryTaskAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
DeleteVideoSummaryTaskOutcomeCallable deleteVideoSummaryTaskCallable(const Model::DeleteVideoSummaryTaskRequest& request) const;
DescribeDevicesOutcome describeDevices(const Model::DescribeDevicesRequest &request)const;
void describeDevicesAsync(const Model::DescribeDevicesRequest& request, const DescribeDevicesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
DescribeDevicesOutcomeCallable describeDevicesCallable(const Model::DescribeDevicesRequest& request) const;
GetBodyOptionsOutcome getBodyOptions(const Model::GetBodyOptionsRequest &request)const;
void getBodyOptionsAsync(const Model::GetBodyOptionsRequest& request, const GetBodyOptionsAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
GetBodyOptionsOutcomeCallable getBodyOptionsCallable(const Model::GetBodyOptionsRequest& request) const;

View File

@@ -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_DESCRIBEDEVICESREQUEST_H_
#define ALIBABACLOUD_VCS_MODEL_DESCRIBEDEVICESREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/vcs/VcsExport.h>
namespace AlibabaCloud
{
namespace Vcs
{
namespace Model
{
class ALIBABACLOUD_VCS_EXPORT DescribeDevicesRequest : public RpcServiceRequest
{
public:
DescribeDevicesRequest();
~DescribeDevicesRequest();
int getPageNum()const;
void setPageNum(int pageNum);
std::string getCorpIdList()const;
void setCorpIdList(const std::string& corpIdList);
int getPageSize()const;
void setPageSize(int pageSize);
private:
int pageNum_;
std::string corpIdList_;
int pageSize_;
};
}
}
}
#endif // !ALIBABACLOUD_VCS_MODEL_DESCRIBEDEVICESREQUEST_H_

View File

@@ -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_DESCRIBEDEVICESRESULT_H_
#define ALIBABACLOUD_VCS_MODEL_DESCRIBEDEVICESRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/vcs/VcsExport.h>
namespace AlibabaCloud
{
namespace Vcs
{
namespace Model
{
class ALIBABACLOUD_VCS_EXPORT DescribeDevicesResult : public ServiceResult
{
public:
struct Data
{
struct Record
{
std::string inProtocol;
int status;
std::string deviceType;
std::string corpId;
std::string deviceAddress;
std::string deviceId;
std::string createTime;
std::string latitude;
std::string vendor;
std::string longitude;
std::string deviceName;
};
int totalCount;
int pageNum;
int pageSize;
int totalPage;
std::vector<Record> records;
};
DescribeDevicesResult();
explicit DescribeDevicesResult(const std::string &payload);
~DescribeDevicesResult();
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_DESCRIBEDEVICESRESULT_H_

View File

@@ -35,14 +35,23 @@ namespace AlibabaCloud
GetDeviceLiveUrlRequest();
~GetDeviceLiveUrlRequest();
std::string getOutProtocol()const;
void setOutProtocol(const std::string& outProtocol);
int getStreamType()const;
void setStreamType(int streamType);
std::string getCorpId()const;
void setCorpId(const std::string& corpId);
std::string getGbId()const;
void setGbId(const std::string& gbId);
std::string getDeviceId()const;
void setDeviceId(const std::string& deviceId);
private:
std::string outProtocol_;
int streamType_;
std::string corpId_;
std::string gbId_;
std::string deviceId_;
};
}

View File

@@ -37,15 +37,19 @@ namespace AlibabaCloud
GetDeviceLiveUrlResult();
explicit GetDeviceLiveUrlResult(const std::string &payload);
~GetDeviceLiveUrlResult();
int getStreamType()const;
std::string getMessage()const;
std::string getCode()const;
std::string getOutProtocol()const;
std::string getUrl()const;
protected:
void parse(const std::string &payload);
private:
int streamType_;
std::string message_;
std::string code_;
std::string outProtocol_;
std::string url_;
};

View File

@@ -35,6 +35,8 @@ namespace AlibabaCloud
GetDeviceVideoUrlRequest();
~GetDeviceVideoUrlRequest();
std::string getOutProtocol()const;
void setOutProtocol(const std::string& outProtocol);
std::string getCorpId()const;
void setCorpId(const std::string& corpId);
std::string getGbId()const;
@@ -43,12 +45,16 @@ namespace AlibabaCloud
void setEndTime(long endTime);
long getStartTime()const;
void setStartTime(long startTime);
std::string getDeviceId()const;
void setDeviceId(const std::string& deviceId);
private:
std::string outProtocol_;
std::string corpId_;
std::string gbId_;
long endTime_;
long startTime_;
std::string deviceId_;
};
}

View File

@@ -39,6 +39,7 @@ namespace AlibabaCloud
~GetDeviceVideoUrlResult();
std::string getMessage()const;
std::string getCode()const;
std::string getOutProtocol()const;
std::string getUrl()const;
protected:
@@ -46,6 +47,7 @@ namespace AlibabaCloud
private:
std::string message_;
std::string code_;
std::string outProtocol_;
std::string url_;
};

View File

@@ -47,6 +47,8 @@ namespace AlibabaCloud
void setIdNumber(const std::string& idNumber);
long getPageNumber()const;
void setPageNumber(long pageNumber);
std::string getFaceImageId()const;
void setFaceImageId(const std::string& faceImageId);
std::string getFaceUrl()const;
void setFaceUrl(const std::string& faceUrl);
long getPageSize()const;
@@ -77,6 +79,7 @@ namespace AlibabaCloud
std::string plateNo_;
std::string idNumber_;
long pageNumber_;
std::string faceImageId_;
std::string faceUrl_;
long pageSize_;
std::map<std::string, std::string> personIdList_;

View File

@@ -31,21 +31,21 @@ VcsClient::VcsClient(const Credentials &credentials, const ClientConfiguration &
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "vcs");
}
VcsClient::VcsClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "vcs");
}
VcsClient::VcsClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
{
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "vcs");
}
VcsClient::~VcsClient()
@@ -879,6 +879,42 @@ VcsClient::DeleteVideoSummaryTaskOutcomeCallable VcsClient::deleteVideoSummaryTa
return task->get_future();
}
VcsClient::DescribeDevicesOutcome VcsClient::describeDevices(const DescribeDevicesRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return DescribeDevicesOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return DescribeDevicesOutcome(DescribeDevicesResult(outcome.result()));
else
return DescribeDevicesOutcome(outcome.error());
}
void VcsClient::describeDevicesAsync(const DescribeDevicesRequest& request, const DescribeDevicesAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, describeDevices(request), context);
};
asyncExecute(new Runnable(fn));
}
VcsClient::DescribeDevicesOutcomeCallable VcsClient::describeDevicesCallable(const DescribeDevicesRequest &request) const
{
auto task = std::make_shared<std::packaged_task<DescribeDevicesOutcome()>>(
[this, request]()
{
return this->describeDevices(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
VcsClient::GetBodyOptionsOutcome VcsClient::getBodyOptions(const GetBodyOptionsRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View 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/DescribeDevicesRequest.h>
using AlibabaCloud::Vcs::Model::DescribeDevicesRequest;
DescribeDevicesRequest::DescribeDevicesRequest() :
RpcServiceRequest("vcs", "2020-05-15", "DescribeDevices")
{
setMethod(HttpRequest::Method::Post);
}
DescribeDevicesRequest::~DescribeDevicesRequest()
{}
int DescribeDevicesRequest::getPageNum()const
{
return pageNum_;
}
void DescribeDevicesRequest::setPageNum(int pageNum)
{
pageNum_ = pageNum;
setBodyParameter("PageNum", std::to_string(pageNum));
}
std::string DescribeDevicesRequest::getCorpIdList()const
{
return corpIdList_;
}
void DescribeDevicesRequest::setCorpIdList(const std::string& corpIdList)
{
corpIdList_ = corpIdList;
setBodyParameter("CorpIdList", corpIdList);
}
int DescribeDevicesRequest::getPageSize()const
{
return pageSize_;
}
void DescribeDevicesRequest::setPageSize(int pageSize)
{
pageSize_ = pageSize;
setBodyParameter("PageSize", std::to_string(pageSize));
}

View File

@@ -0,0 +1,100 @@
/*
* 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/DescribeDevicesResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Vcs;
using namespace AlibabaCloud::Vcs::Model;
DescribeDevicesResult::DescribeDevicesResult() :
ServiceResult()
{}
DescribeDevicesResult::DescribeDevicesResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
DescribeDevicesResult::~DescribeDevicesResult()
{}
void DescribeDevicesResult::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["PageNum"].isNull())
data_.pageNum = std::stoi(dataNode["PageNum"].asString());
if(!dataNode["PageSize"].isNull())
data_.pageSize = std::stoi(dataNode["PageSize"].asString());
if(!dataNode["TotalCount"].isNull())
data_.totalCount = std::stoi(dataNode["TotalCount"].asString());
if(!dataNode["TotalPage"].isNull())
data_.totalPage = std::stoi(dataNode["TotalPage"].asString());
auto allRecordsNode = dataNode["Records"]["Record"];
for (auto dataNodeRecordsRecord : allRecordsNode)
{
Data::Record recordObject;
if(!dataNodeRecordsRecord["InProtocol"].isNull())
recordObject.inProtocol = dataNodeRecordsRecord["InProtocol"].asString();
if(!dataNodeRecordsRecord["CreateTime"].isNull())
recordObject.createTime = dataNodeRecordsRecord["CreateTime"].asString();
if(!dataNodeRecordsRecord["DeviceAddress"].isNull())
recordObject.deviceAddress = dataNodeRecordsRecord["DeviceAddress"].asString();
if(!dataNodeRecordsRecord["DeviceId"].isNull())
recordObject.deviceId = dataNodeRecordsRecord["DeviceId"].asString();
if(!dataNodeRecordsRecord["DeviceName"].isNull())
recordObject.deviceName = dataNodeRecordsRecord["DeviceName"].asString();
if(!dataNodeRecordsRecord["DeviceType"].isNull())
recordObject.deviceType = dataNodeRecordsRecord["DeviceType"].asString();
if(!dataNodeRecordsRecord["Latitude"].isNull())
recordObject.latitude = dataNodeRecordsRecord["Latitude"].asString();
if(!dataNodeRecordsRecord["Longitude"].isNull())
recordObject.longitude = dataNodeRecordsRecord["Longitude"].asString();
if(!dataNodeRecordsRecord["Status"].isNull())
recordObject.status = std::stoi(dataNodeRecordsRecord["Status"].asString());
if(!dataNodeRecordsRecord["Vendor"].isNull())
recordObject.vendor = dataNodeRecordsRecord["Vendor"].asString();
if(!dataNodeRecordsRecord["CorpId"].isNull())
recordObject.corpId = dataNodeRecordsRecord["CorpId"].asString();
data_.records.push_back(recordObject);
}
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
}
std::string DescribeDevicesResult::getMessage()const
{
return message_;
}
DescribeDevicesResult::Data DescribeDevicesResult::getData()const
{
return data_;
}
std::string DescribeDevicesResult::getCode()const
{
return code_;
}

View File

@@ -27,6 +27,28 @@ GetDeviceLiveUrlRequest::GetDeviceLiveUrlRequest() :
GetDeviceLiveUrlRequest::~GetDeviceLiveUrlRequest()
{}
std::string GetDeviceLiveUrlRequest::getOutProtocol()const
{
return outProtocol_;
}
void GetDeviceLiveUrlRequest::setOutProtocol(const std::string& outProtocol)
{
outProtocol_ = outProtocol;
setBodyParameter("OutProtocol", outProtocol);
}
int GetDeviceLiveUrlRequest::getStreamType()const
{
return streamType_;
}
void GetDeviceLiveUrlRequest::setStreamType(int streamType)
{
streamType_ = streamType;
setBodyParameter("StreamType", std::to_string(streamType));
}
std::string GetDeviceLiveUrlRequest::getCorpId()const
{
return corpId_;
@@ -49,3 +71,14 @@ void GetDeviceLiveUrlRequest::setGbId(const std::string& gbId)
setBodyParameter("GbId", gbId);
}
std::string GetDeviceLiveUrlRequest::getDeviceId()const
{
return deviceId_;
}
void GetDeviceLiveUrlRequest::setDeviceId(const std::string& deviceId)
{
deviceId_ = deviceId;
setBodyParameter("DeviceId", deviceId);
}

View File

@@ -41,13 +41,22 @@ void GetDeviceLiveUrlResult::parse(const std::string &payload)
setRequestId(value["RequestId"].asString());
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Url"].isNull())
url_ = value["Url"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
if(!value["Url"].isNull())
url_ = value["Url"].asString();
if(!value["OutProtocol"].isNull())
outProtocol_ = value["OutProtocol"].asString();
if(!value["StreamType"].isNull())
streamType_ = std::stoi(value["StreamType"].asString());
}
int GetDeviceLiveUrlResult::getStreamType()const
{
return streamType_;
}
std::string GetDeviceLiveUrlResult::getMessage()const
{
return message_;
@@ -58,6 +67,11 @@ std::string GetDeviceLiveUrlResult::getCode()const
return code_;
}
std::string GetDeviceLiveUrlResult::getOutProtocol()const
{
return outProtocol_;
}
std::string GetDeviceLiveUrlResult::getUrl()const
{
return url_;

View File

@@ -27,6 +27,17 @@ GetDeviceVideoUrlRequest::GetDeviceVideoUrlRequest() :
GetDeviceVideoUrlRequest::~GetDeviceVideoUrlRequest()
{}
std::string GetDeviceVideoUrlRequest::getOutProtocol()const
{
return outProtocol_;
}
void GetDeviceVideoUrlRequest::setOutProtocol(const std::string& outProtocol)
{
outProtocol_ = outProtocol;
setBodyParameter("OutProtocol", outProtocol);
}
std::string GetDeviceVideoUrlRequest::getCorpId()const
{
return corpId_;
@@ -71,3 +82,14 @@ void GetDeviceVideoUrlRequest::setStartTime(long startTime)
setBodyParameter("StartTime", std::to_string(startTime));
}
std::string GetDeviceVideoUrlRequest::getDeviceId()const
{
return deviceId_;
}
void GetDeviceVideoUrlRequest::setDeviceId(const std::string& deviceId)
{
deviceId_ = deviceId;
setBodyParameter("DeviceId", deviceId);
}

View File

@@ -45,6 +45,8 @@ void GetDeviceVideoUrlResult::parse(const std::string &payload)
message_ = value["Message"].asString();
if(!value["Url"].isNull())
url_ = value["Url"].asString();
if(!value["OutProtocol"].isNull())
outProtocol_ = value["OutProtocol"].asString();
}
@@ -58,6 +60,11 @@ std::string GetDeviceVideoUrlResult::getCode()const
return code_;
}
std::string GetDeviceVideoUrlResult::getOutProtocol()const
{
return outProtocol_;
}
std::string GetDeviceVideoUrlResult::getUrl()const
{
return url_;

View File

@@ -93,6 +93,17 @@ void GetProfileListRequest::setPageNumber(long pageNumber)
setBodyParameter("PageNumber", std::to_string(pageNumber));
}
std::string GetProfileListRequest::getFaceImageId()const
{
return faceImageId_;
}
void GetProfileListRequest::setFaceImageId(const std::string& faceImageId)
{
faceImageId_ = faceImageId;
setBodyParameter("FaceImageId", faceImageId);
}
std::string GetProfileListRequest::getFaceUrl()const
{
return faceUrl_;