Update TMP API, including QueryDevice, CreateThingModel, UpdateThingModel, ImportThingModelTsl, BatchPickThingModel, ListDeviceDistributeJob.

This commit is contained in:
sdk-team
2021-06-09 06:54:22 +00:00
parent 648aacf470
commit 08cc0d55f3
35 changed files with 1282 additions and 1 deletions

View File

@@ -1455,6 +1455,42 @@ IotClient::CloseEdgeInstanceDeploymentOutcomeCallable IotClient::closeEdgeInstan
return task->get_future();
}
IotClient::ConfirmOTATaskOutcome IotClient::confirmOTATask(const ConfirmOTATaskRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ConfirmOTATaskOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ConfirmOTATaskOutcome(ConfirmOTATaskResult(outcome.result()));
else
return ConfirmOTATaskOutcome(outcome.error());
}
void IotClient::confirmOTATaskAsync(const ConfirmOTATaskRequest& request, const ConfirmOTATaskAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, confirmOTATask(request), context);
};
asyncExecute(new Runnable(fn));
}
IotClient::ConfirmOTATaskOutcomeCallable IotClient::confirmOTATaskCallable(const ConfirmOTATaskRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ConfirmOTATaskOutcome()>>(
[this, request]()
{
return this->confirmOTATask(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
IotClient::CopyThingModelOutcome IotClient::copyThingModel(const CopyThingModelRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -5307,6 +5343,42 @@ IotClient::ListOTATaskByJobOutcomeCallable IotClient::listOTATaskByJobCallable(c
return task->get_future();
}
IotClient::ListOTAUnfinishedTaskByDeviceOutcome IotClient::listOTAUnfinishedTaskByDevice(const ListOTAUnfinishedTaskByDeviceRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ListOTAUnfinishedTaskByDeviceOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ListOTAUnfinishedTaskByDeviceOutcome(ListOTAUnfinishedTaskByDeviceResult(outcome.result()));
else
return ListOTAUnfinishedTaskByDeviceOutcome(outcome.error());
}
void IotClient::listOTAUnfinishedTaskByDeviceAsync(const ListOTAUnfinishedTaskByDeviceRequest& request, const ListOTAUnfinishedTaskByDeviceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, listOTAUnfinishedTaskByDevice(request), context);
};
asyncExecute(new Runnable(fn));
}
IotClient::ListOTAUnfinishedTaskByDeviceOutcomeCallable IotClient::listOTAUnfinishedTaskByDeviceCallable(const ListOTAUnfinishedTaskByDeviceRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ListOTAUnfinishedTaskByDeviceOutcome()>>(
[this, request]()
{
return this->listOTAUnfinishedTaskByDevice(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
IotClient::ListProductByTagsOutcome IotClient::listProductByTags(const ListProductByTagsRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -6747,6 +6819,42 @@ IotClient::QueryDeviceGroupTagListOutcomeCallable IotClient::queryDeviceGroupTag
return task->get_future();
}
IotClient::QueryDeviceInfoOutcome IotClient::queryDeviceInfo(const QueryDeviceInfoRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return QueryDeviceInfoOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return QueryDeviceInfoOutcome(QueryDeviceInfoResult(outcome.result()));
else
return QueryDeviceInfoOutcome(outcome.error());
}
void IotClient::queryDeviceInfoAsync(const QueryDeviceInfoRequest& request, const QueryDeviceInfoAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, queryDeviceInfo(request), context);
};
asyncExecute(new Runnable(fn));
}
IotClient::QueryDeviceInfoOutcomeCallable IotClient::queryDeviceInfoCallable(const QueryDeviceInfoRequest &request) const
{
auto task = std::make_shared<std::packaged_task<QueryDeviceInfoOutcome()>>(
[this, request]()
{
return this->queryDeviceInfo(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
IotClient::QueryDeviceListByDeviceGroupOutcome IotClient::queryDeviceListByDeviceGroup(const QueryDeviceListByDeviceGroupRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -60,6 +60,17 @@ void CancelOTATaskByJobRequest::setJobId(const std::string& jobId)
setParameter("JobId", jobId);
}
bool CancelOTATaskByJobRequest::getCancelUnconfirmedTask()const
{
return cancelUnconfirmedTask_;
}
void CancelOTATaskByJobRequest::setCancelUnconfirmedTask(bool cancelUnconfirmedTask)
{
cancelUnconfirmedTask_ = cancelUnconfirmedTask;
setParameter("CancelUnconfirmedTask", cancelUnconfirmedTask ? "true" : "false");
}
std::string CancelOTATaskByJobRequest::getIotInstanceId()const
{
return iotInstanceId_;

View File

@@ -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.
*/
#include <alibabacloud/iot/model/ConfirmOTATaskRequest.h>
using AlibabaCloud::Iot::Model::ConfirmOTATaskRequest;
ConfirmOTATaskRequest::ConfirmOTATaskRequest() :
RpcServiceRequest("iot", "2018-01-20", "ConfirmOTATask")
{
setMethod(HttpRequest::Method::Post);
}
ConfirmOTATaskRequest::~ConfirmOTATaskRequest()
{}
std::string ConfirmOTATaskRequest::getAccessKeyId()const
{
return accessKeyId_;
}
void ConfirmOTATaskRequest::setAccessKeyId(const std::string& accessKeyId)
{
accessKeyId_ = accessKeyId;
setParameter("AccessKeyId", accessKeyId);
}
std::string ConfirmOTATaskRequest::getIotInstanceId()const
{
return iotInstanceId_;
}
void ConfirmOTATaskRequest::setIotInstanceId(const std::string& iotInstanceId)
{
iotInstanceId_ = iotInstanceId;
setParameter("IotInstanceId", iotInstanceId);
}
std::vector<std::string> ConfirmOTATaskRequest::getTaskId()const
{
return taskId_;
}
void ConfirmOTATaskRequest::setTaskId(const std::vector<std::string>& taskId)
{
taskId_ = taskId;
for(int dep1 = 0; dep1!= taskId.size(); dep1++) {
setParameter("TaskId."+ std::to_string(dep1), taskId.at(dep1));
}
}
std::string ConfirmOTATaskRequest::getApiProduct()const
{
return apiProduct_;
}
void ConfirmOTATaskRequest::setApiProduct(const std::string& apiProduct)
{
apiProduct_ = apiProduct;
setBodyParameter("ApiProduct", apiProduct);
}
std::string ConfirmOTATaskRequest::getApiRevision()const
{
return apiRevision_;
}
void ConfirmOTATaskRequest::setApiRevision(const std::string& apiRevision)
{
apiRevision_ = apiRevision;
setBodyParameter("ApiRevision", apiRevision);
}

View File

@@ -0,0 +1,65 @@
/*
* 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/iot/model/ConfirmOTATaskResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Iot;
using namespace AlibabaCloud::Iot::Model;
ConfirmOTATaskResult::ConfirmOTATaskResult() :
ServiceResult()
{}
ConfirmOTATaskResult::ConfirmOTATaskResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ConfirmOTATaskResult::~ConfirmOTATaskResult()
{}
void ConfirmOTATaskResult::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["Code"].isNull())
code_ = value["Code"].asString();
if(!value["ErrorMessage"].isNull())
errorMessage_ = value["ErrorMessage"].asString();
}
std::string ConfirmOTATaskResult::getErrorMessage()const
{
return errorMessage_;
}
std::string ConfirmOTATaskResult::getCode()const
{
return code_;
}
bool ConfirmOTATaskResult::getSuccess()const
{
return success_;
}

View File

@@ -60,6 +60,17 @@ void CreateOTADynamicUpgradeJobRequest::setTimeoutInMinutes(int timeoutInMinutes
setParameter("TimeoutInMinutes", std::to_string(timeoutInMinutes));
}
bool CreateOTADynamicUpgradeJobRequest::getNeedConfirm()const
{
return needConfirm_;
}
void CreateOTADynamicUpgradeJobRequest::setNeedConfirm(bool needConfirm)
{
needConfirm_ = needConfirm;
setParameter("NeedConfirm", needConfirm ? "true" : "false");
}
std::string CreateOTADynamicUpgradeJobRequest::getAccessKeyId()const
{
return accessKeyId_;
@@ -71,6 +82,17 @@ void CreateOTADynamicUpgradeJobRequest::setAccessKeyId(const std::string& access
setParameter("AccessKeyId", accessKeyId);
}
bool CreateOTADynamicUpgradeJobRequest::getNeedPush()const
{
return needPush_;
}
void CreateOTADynamicUpgradeJobRequest::setNeedPush(bool needPush)
{
needPush_ = needPush;
setParameter("NeedPush", needPush ? "true" : "false");
}
std::string CreateOTADynamicUpgradeJobRequest::getIotInstanceId()const
{
return iotInstanceId_;

View File

@@ -49,6 +49,17 @@ void CreateOTAStaticUpgradeJobRequest::setTimeoutInMinutes(int timeoutInMinutes)
setParameter("TimeoutInMinutes", std::to_string(timeoutInMinutes));
}
bool CreateOTAStaticUpgradeJobRequest::getNeedConfirm()const
{
return needConfirm_;
}
void CreateOTAStaticUpgradeJobRequest::setNeedConfirm(bool needConfirm)
{
needConfirm_ = needConfirm;
setParameter("NeedConfirm", needConfirm ? "true" : "false");
}
std::string CreateOTAStaticUpgradeJobRequest::getAccessKeyId()const
{
return accessKeyId_;
@@ -60,6 +71,17 @@ void CreateOTAStaticUpgradeJobRequest::setAccessKeyId(const std::string& accessK
setParameter("AccessKeyId", accessKeyId);
}
bool CreateOTAStaticUpgradeJobRequest::getNeedPush()const
{
return needPush_;
}
void CreateOTAStaticUpgradeJobRequest::setNeedPush(bool needPush)
{
needPush_ = needPush;
setParameter("NeedPush", needPush ? "true" : "false");
}
std::string CreateOTAStaticUpgradeJobRequest::getIotInstanceId()const
{
return iotInstanceId_;

View File

@@ -38,6 +38,17 @@ void CreateOTAVerifyJobRequest::setTimeoutInMinutes(int timeoutInMinutes)
setParameter("TimeoutInMinutes", std::to_string(timeoutInMinutes));
}
bool CreateOTAVerifyJobRequest::getNeedConfirm()const
{
return needConfirm_;
}
void CreateOTAVerifyJobRequest::setNeedConfirm(bool needConfirm)
{
needConfirm_ = needConfirm;
setParameter("NeedConfirm", needConfirm ? "true" : "false");
}
std::string CreateOTAVerifyJobRequest::getAccessKeyId()const
{
return accessKeyId_;
@@ -49,6 +60,17 @@ void CreateOTAVerifyJobRequest::setAccessKeyId(const std::string& accessKeyId)
setParameter("AccessKeyId", accessKeyId);
}
bool CreateOTAVerifyJobRequest::getNeedPush()const
{
return needPush_;
}
void CreateOTAVerifyJobRequest::setNeedPush(bool needPush)
{
needPush_ = needPush;
setParameter("NeedPush", needPush ? "true" : "false");
}
std::string CreateOTAVerifyJobRequest::getIotInstanceId()const
{
return iotInstanceId_;

View File

@@ -38,6 +38,17 @@ void ListDeviceDistributeJobRequest::setJobId(const std::string& jobId)
setBodyParameter("JobId", jobId);
}
std::string ListDeviceDistributeJobRequest::getNextToken()const
{
return nextToken_;
}
void ListDeviceDistributeJobRequest::setNextToken(const std::string& nextToken)
{
nextToken_ = nextToken;
setParameter("NextToken", nextToken);
}
int ListDeviceDistributeJobRequest::getPageSize()const
{
return pageSize_;

View File

@@ -42,6 +42,8 @@ void ListDeviceDistributeJobResult::parse(const std::string &payload)
auto dataNode = value["Data"];
if(!dataNode["Total"].isNull())
data_.total = std::stoi(dataNode["Total"].asString());
if(!dataNode["NextToken"].isNull())
data_.nextToken = dataNode["NextToken"].asString();
auto allJobInfoNode = dataNode["JobInfo"]["items"];
for (auto dataNodeJobInfoitems : allJobInfoNode)
{

View File

@@ -0,0 +1,128 @@
/*
* 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/iot/model/ListOTAUnfinishedTaskByDeviceRequest.h>
using AlibabaCloud::Iot::Model::ListOTAUnfinishedTaskByDeviceRequest;
ListOTAUnfinishedTaskByDeviceRequest::ListOTAUnfinishedTaskByDeviceRequest() :
RpcServiceRequest("iot", "2018-01-20", "ListOTAUnfinishedTaskByDevice")
{
setMethod(HttpRequest::Method::Post);
}
ListOTAUnfinishedTaskByDeviceRequest::~ListOTAUnfinishedTaskByDeviceRequest()
{}
std::string ListOTAUnfinishedTaskByDeviceRequest::getAccessKeyId()const
{
return accessKeyId_;
}
void ListOTAUnfinishedTaskByDeviceRequest::setAccessKeyId(const std::string& accessKeyId)
{
accessKeyId_ = accessKeyId;
setParameter("AccessKeyId", accessKeyId);
}
std::string ListOTAUnfinishedTaskByDeviceRequest::getTaskStatus()const
{
return taskStatus_;
}
void ListOTAUnfinishedTaskByDeviceRequest::setTaskStatus(const std::string& taskStatus)
{
taskStatus_ = taskStatus;
setParameter("TaskStatus", taskStatus);
}
std::string ListOTAUnfinishedTaskByDeviceRequest::getIotId()const
{
return iotId_;
}
void ListOTAUnfinishedTaskByDeviceRequest::setIotId(const std::string& iotId)
{
iotId_ = iotId;
setParameter("IotId", iotId);
}
std::string ListOTAUnfinishedTaskByDeviceRequest::getIotInstanceId()const
{
return iotInstanceId_;
}
void ListOTAUnfinishedTaskByDeviceRequest::setIotInstanceId(const std::string& iotInstanceId)
{
iotInstanceId_ = iotInstanceId;
setParameter("IotInstanceId", iotInstanceId);
}
std::string ListOTAUnfinishedTaskByDeviceRequest::getModuleName()const
{
return moduleName_;
}
void ListOTAUnfinishedTaskByDeviceRequest::setModuleName(const std::string& moduleName)
{
moduleName_ = moduleName;
setParameter("ModuleName", moduleName);
}
std::string ListOTAUnfinishedTaskByDeviceRequest::getProductKey()const
{
return productKey_;
}
void ListOTAUnfinishedTaskByDeviceRequest::setProductKey(const std::string& productKey)
{
productKey_ = productKey;
setParameter("ProductKey", productKey);
}
std::string ListOTAUnfinishedTaskByDeviceRequest::getApiProduct()const
{
return apiProduct_;
}
void ListOTAUnfinishedTaskByDeviceRequest::setApiProduct(const std::string& apiProduct)
{
apiProduct_ = apiProduct;
setBodyParameter("ApiProduct", apiProduct);
}
std::string ListOTAUnfinishedTaskByDeviceRequest::getApiRevision()const
{
return apiRevision_;
}
void ListOTAUnfinishedTaskByDeviceRequest::setApiRevision(const std::string& apiRevision)
{
apiRevision_ = apiRevision;
setBodyParameter("ApiRevision", apiRevision);
}
std::string ListOTAUnfinishedTaskByDeviceRequest::getDeviceName()const
{
return deviceName_;
}
void ListOTAUnfinishedTaskByDeviceRequest::setDeviceName(const std::string& deviceName)
{
deviceName_ = deviceName;
setParameter("DeviceName", deviceName);
}

View File

@@ -0,0 +1,102 @@
/*
* 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/iot/model/ListOTAUnfinishedTaskByDeviceResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Iot;
using namespace AlibabaCloud::Iot::Model;
ListOTAUnfinishedTaskByDeviceResult::ListOTAUnfinishedTaskByDeviceResult() :
ServiceResult()
{}
ListOTAUnfinishedTaskByDeviceResult::ListOTAUnfinishedTaskByDeviceResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ListOTAUnfinishedTaskByDeviceResult::~ListOTAUnfinishedTaskByDeviceResult()
{}
void ListOTAUnfinishedTaskByDeviceResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allDataNode = value["Data"]["SimpleOTATaskInfo"];
for (auto valueDataSimpleOTATaskInfo : allDataNode)
{
SimpleOTATaskInfo dataObject;
if(!valueDataSimpleOTATaskInfo["TaskId"].isNull())
dataObject.taskId = valueDataSimpleOTATaskInfo["TaskId"].asString();
if(!valueDataSimpleOTATaskInfo["UtcModified"].isNull())
dataObject.utcModified = valueDataSimpleOTATaskInfo["UtcModified"].asString();
if(!valueDataSimpleOTATaskInfo["ProductKey"].isNull())
dataObject.productKey = valueDataSimpleOTATaskInfo["ProductKey"].asString();
if(!valueDataSimpleOTATaskInfo["TaskStatus"].isNull())
dataObject.taskStatus = valueDataSimpleOTATaskInfo["TaskStatus"].asString();
if(!valueDataSimpleOTATaskInfo["JobId"].isNull())
dataObject.jobId = valueDataSimpleOTATaskInfo["JobId"].asString();
if(!valueDataSimpleOTATaskInfo["ProductName"].isNull())
dataObject.productName = valueDataSimpleOTATaskInfo["ProductName"].asString();
if(!valueDataSimpleOTATaskInfo["DeviceName"].isNull())
dataObject.deviceName = valueDataSimpleOTATaskInfo["DeviceName"].asString();
if(!valueDataSimpleOTATaskInfo["SrcVersion"].isNull())
dataObject.srcVersion = valueDataSimpleOTATaskInfo["SrcVersion"].asString();
if(!valueDataSimpleOTATaskInfo["DestVersion"].isNull())
dataObject.destVersion = valueDataSimpleOTATaskInfo["DestVersion"].asString();
if(!valueDataSimpleOTATaskInfo["IotId"].isNull())
dataObject.iotId = valueDataSimpleOTATaskInfo["IotId"].asString();
if(!valueDataSimpleOTATaskInfo["UtcCreate"].isNull())
dataObject.utcCreate = valueDataSimpleOTATaskInfo["UtcCreate"].asString();
if(!valueDataSimpleOTATaskInfo["ModuleName"].isNull())
dataObject.moduleName = valueDataSimpleOTATaskInfo["ModuleName"].asString();
if(!valueDataSimpleOTATaskInfo["FirmwareId"].isNull())
dataObject.firmwareId = valueDataSimpleOTATaskInfo["FirmwareId"].asString();
data_.push_back(dataObject);
}
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["ErrorMessage"].isNull())
errorMessage_ = value["ErrorMessage"].asString();
}
std::vector<ListOTAUnfinishedTaskByDeviceResult::SimpleOTATaskInfo> ListOTAUnfinishedTaskByDeviceResult::getData()const
{
return data_;
}
std::string ListOTAUnfinishedTaskByDeviceResult::getErrorMessage()const
{
return errorMessage_;
}
std::string ListOTAUnfinishedTaskByDeviceResult::getCode()const
{
return code_;
}
bool ListOTAUnfinishedTaskByDeviceResult::getSuccess()const
{
return success_;
}

View File

@@ -0,0 +1,128 @@
/*
* 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/iot/model/QueryDeviceInfoRequest.h>
using AlibabaCloud::Iot::Model::QueryDeviceInfoRequest;
QueryDeviceInfoRequest::QueryDeviceInfoRequest() :
RpcServiceRequest("iot", "2018-01-20", "QueryDeviceInfo")
{
setMethod(HttpRequest::Method::Post);
}
QueryDeviceInfoRequest::~QueryDeviceInfoRequest()
{}
std::string QueryDeviceInfoRequest::getRealTenantId()const
{
return realTenantId_;
}
void QueryDeviceInfoRequest::setRealTenantId(const std::string& realTenantId)
{
realTenantId_ = realTenantId;
setParameter("RealTenantId", realTenantId);
}
std::string QueryDeviceInfoRequest::getAccessKeyId()const
{
return accessKeyId_;
}
void QueryDeviceInfoRequest::setAccessKeyId(const std::string& accessKeyId)
{
accessKeyId_ = accessKeyId;
setParameter("AccessKeyId", accessKeyId);
}
std::string QueryDeviceInfoRequest::getRealTripartiteKey()const
{
return realTripartiteKey_;
}
void QueryDeviceInfoRequest::setRealTripartiteKey(const std::string& realTripartiteKey)
{
realTripartiteKey_ = realTripartiteKey;
setParameter("RealTripartiteKey", realTripartiteKey);
}
std::string QueryDeviceInfoRequest::getIotId()const
{
return iotId_;
}
void QueryDeviceInfoRequest::setIotId(const std::string& iotId)
{
iotId_ = iotId;
setParameter("IotId", iotId);
}
std::string QueryDeviceInfoRequest::getIotInstanceId()const
{
return iotInstanceId_;
}
void QueryDeviceInfoRequest::setIotInstanceId(const std::string& iotInstanceId)
{
iotInstanceId_ = iotInstanceId;
setParameter("IotInstanceId", iotInstanceId);
}
std::string QueryDeviceInfoRequest::getProductKey()const
{
return productKey_;
}
void QueryDeviceInfoRequest::setProductKey(const std::string& productKey)
{
productKey_ = productKey;
setParameter("ProductKey", productKey);
}
std::string QueryDeviceInfoRequest::getApiProduct()const
{
return apiProduct_;
}
void QueryDeviceInfoRequest::setApiProduct(const std::string& apiProduct)
{
apiProduct_ = apiProduct;
setBodyParameter("ApiProduct", apiProduct);
}
std::string QueryDeviceInfoRequest::getApiRevision()const
{
return apiRevision_;
}
void QueryDeviceInfoRequest::setApiRevision(const std::string& apiRevision)
{
apiRevision_ = apiRevision;
setBodyParameter("ApiRevision", apiRevision);
}
std::string QueryDeviceInfoRequest::getDeviceName()const
{
return deviceName_;
}
void QueryDeviceInfoRequest::setDeviceName(const std::string& deviceName)
{
deviceName_ = deviceName;
setParameter("DeviceName", deviceName);
}

View File

@@ -0,0 +1,81 @@
/*
* 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/iot/model/QueryDeviceInfoResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Iot;
using namespace AlibabaCloud::Iot::Model;
QueryDeviceInfoResult::QueryDeviceInfoResult() :
ServiceResult()
{}
QueryDeviceInfoResult::QueryDeviceInfoResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
QueryDeviceInfoResult::~QueryDeviceInfoResult()
{}
void QueryDeviceInfoResult::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["IotId"].isNull())
data_.iotId = dataNode["IotId"].asString();
if(!dataNode["ProductKey"].isNull())
data_.productKey = dataNode["ProductKey"].asString();
if(!dataNode["DeviceName"].isNull())
data_.deviceName = dataNode["DeviceName"].asString();
if(!dataNode["DeviceSecret"].isNull())
data_.deviceSecret = dataNode["DeviceSecret"].asString();
if(!dataNode["Nickname"].isNull())
data_.nickname = dataNode["Nickname"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["ErrorMessage"].isNull())
errorMessage_ = value["ErrorMessage"].asString();
}
QueryDeviceInfoResult::Data QueryDeviceInfoResult::getData()const
{
return data_;
}
std::string QueryDeviceInfoResult::getErrorMessage()const
{
return errorMessage_;
}
std::string QueryDeviceInfoResult::getCode()const
{
return code_;
}
bool QueryDeviceInfoResult::getSuccess()const
{
return success_;
}

View File

@@ -60,6 +60,17 @@ void QueryDeviceRequest::setRealTripartiteKey(const std::string& realTripartiteK
setParameter("RealTripartiteKey", realTripartiteKey);
}
std::string QueryDeviceRequest::getNextToken()const
{
return nextToken_;
}
void QueryDeviceRequest::setNextToken(const std::string& nextToken)
{
nextToken_ = nextToken;
setParameter("NextToken", nextToken);
}
std::string QueryDeviceRequest::getIotInstanceId()const
{
return iotInstanceId_;

View File

@@ -83,6 +83,8 @@ void QueryDeviceResult::parse(const std::string &payload)
pageCount_ = std::stoi(value["PageCount"].asString());
if(!value["Page"].isNull())
page_ = std::stoi(value["Page"].asString());
if(!value["NextToken"].isNull())
nextToken_ = value["NextToken"].asString();
}
@@ -96,6 +98,11 @@ int QueryDeviceResult::getPageCount()const
return pageCount_;
}
std::string QueryDeviceResult::getNextToken()const
{
return nextToken_;
}
int QueryDeviceResult::getTotal()const
{
return total_;

View File

@@ -86,6 +86,10 @@ void QueryOTAJobResult::parse(const std::string &payload)
data_.overwriteMode = std::stoi(dataNode["OverwriteMode"].asString());
if(!dataNode["DynamicMode"].isNull())
data_.dynamicMode = std::stoi(dataNode["DynamicMode"].asString());
if(!dataNode["NeedPush"].isNull())
data_.needPush = dataNode["NeedPush"].asString() == "true";
if(!dataNode["NeedConfirm"].isNull())
data_.needConfirm = dataNode["NeedConfirm"].asString() == "true";
auto allTagsNode = dataNode["Tags"]["OtaTagDTO"];
for (auto dataNodeTagsOtaTagDTO : allTagsNode)
{