diff --git a/CHANGELOG b/CHANGELOG index 2e0754401..a7de6c9ac 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2018-09-28 Version: 1.27.1 +1, Add one api, QueryAppDeviceList. + 2018-09-27 Version: 1.27.0 1, Add new API ListQueues, modify API SetAutoScaleConfig to support queue related features. diff --git a/VERSION b/VERSION index e43da41f6..c5b4f6ed0 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.27.0 \ No newline at end of file +1.27.1 \ No newline at end of file diff --git a/iot/CMakeLists.txt b/iot/CMakeLists.txt index 3103d97e4..717f7bd63 100644 --- a/iot/CMakeLists.txt +++ b/iot/CMakeLists.txt @@ -21,6 +21,8 @@ set(iot_public_header include/alibabacloud/iot/IotExport.h ) set(iot_public_header_model + include/alibabacloud/iot/model/QueryAppDeviceListRequest.h + include/alibabacloud/iot/model/QueryAppDeviceListResult.h include/alibabacloud/iot/model/DeleteTopicRouteTableRequest.h include/alibabacloud/iot/model/DeleteTopicRouteTableResult.h include/alibabacloud/iot/model/QueryDeviceEventDataRequest.h @@ -55,6 +57,8 @@ set(iot_public_header_model include/alibabacloud/iot/model/DeleteDevicePropResult.h include/alibabacloud/iot/model/StopRuleRequest.h include/alibabacloud/iot/model/StopRuleResult.h + include/alibabacloud/iot/model/QueryDeviceGroupByDeviceRequest.h + include/alibabacloud/iot/model/QueryDeviceGroupByDeviceResult.h include/alibabacloud/iot/model/QueryDeviceDetailRequest.h include/alibabacloud/iot/model/QueryDeviceDetailResult.h include/alibabacloud/iot/model/NotifyAddThingTopoRequest.h @@ -138,6 +142,8 @@ set(iot_public_header_model set(iot_src src/IotClient.cc + src/model/QueryAppDeviceListRequest.cc + src/model/QueryAppDeviceListResult.cc src/model/DeleteTopicRouteTableRequest.cc src/model/DeleteTopicRouteTableResult.cc src/model/QueryDeviceEventDataRequest.cc @@ -172,6 +178,8 @@ set(iot_src src/model/DeleteDevicePropResult.cc src/model/StopRuleRequest.cc src/model/StopRuleResult.cc + src/model/QueryDeviceGroupByDeviceRequest.cc + src/model/QueryDeviceGroupByDeviceResult.cc src/model/QueryDeviceDetailRequest.cc src/model/QueryDeviceDetailResult.cc src/model/NotifyAddThingTopoRequest.cc diff --git a/iot/include/alibabacloud/iot/IotClient.h b/iot/include/alibabacloud/iot/IotClient.h index a35fe6e68..377e47296 100644 --- a/iot/include/alibabacloud/iot/IotClient.h +++ b/iot/include/alibabacloud/iot/IotClient.h @@ -22,6 +22,8 @@ #include #include #include "IotExport.h" +#include "model/QueryAppDeviceListRequest.h" +#include "model/QueryAppDeviceListResult.h" #include "model/DeleteTopicRouteTableRequest.h" #include "model/DeleteTopicRouteTableResult.h" #include "model/QueryDeviceEventDataRequest.h" @@ -56,6 +58,8 @@ #include "model/DeleteDevicePropResult.h" #include "model/StopRuleRequest.h" #include "model/StopRuleResult.h" +#include "model/QueryDeviceGroupByDeviceRequest.h" +#include "model/QueryDeviceGroupByDeviceResult.h" #include "model/QueryDeviceDetailRequest.h" #include "model/QueryDeviceDetailResult.h" #include "model/NotifyAddThingTopoRequest.h" @@ -145,6 +149,9 @@ namespace AlibabaCloud class ALIBABACLOUD_IOT_EXPORT IotClient : public RpcServiceClient { public: + typedef Outcome QueryAppDeviceListOutcome; + typedef std::future QueryAppDeviceListOutcomeCallable; + typedef std::function&)> QueryAppDeviceListAsyncHandler; typedef Outcome DeleteTopicRouteTableOutcome; typedef std::future DeleteTopicRouteTableOutcomeCallable; typedef std::function&)> DeleteTopicRouteTableAsyncHandler; @@ -196,6 +203,9 @@ namespace AlibabaCloud typedef Outcome StopRuleOutcome; typedef std::future StopRuleOutcomeCallable; typedef std::function&)> StopRuleAsyncHandler; + typedef Outcome QueryDeviceGroupByDeviceOutcome; + typedef std::future QueryDeviceGroupByDeviceOutcomeCallable; + typedef std::function&)> QueryDeviceGroupByDeviceAsyncHandler; typedef Outcome QueryDeviceDetailOutcome; typedef std::future QueryDeviceDetailOutcomeCallable; typedef std::function&)> QueryDeviceDetailAsyncHandler; @@ -321,6 +331,9 @@ namespace AlibabaCloud IotClient(const std::shared_ptr &credentialsProvider, const ClientConfiguration &configuration); IotClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration); ~IotClient(); + QueryAppDeviceListOutcome queryAppDeviceList(const Model::QueryAppDeviceListRequest &request)const; + void queryAppDeviceListAsync(const Model::QueryAppDeviceListRequest& request, const QueryAppDeviceListAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + QueryAppDeviceListOutcomeCallable queryAppDeviceListCallable(const Model::QueryAppDeviceListRequest& request) const; DeleteTopicRouteTableOutcome deleteTopicRouteTable(const Model::DeleteTopicRouteTableRequest &request)const; void deleteTopicRouteTableAsync(const Model::DeleteTopicRouteTableRequest& request, const DeleteTopicRouteTableAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DeleteTopicRouteTableOutcomeCallable deleteTopicRouteTableCallable(const Model::DeleteTopicRouteTableRequest& request) const; @@ -372,6 +385,9 @@ namespace AlibabaCloud StopRuleOutcome stopRule(const Model::StopRuleRequest &request)const; void stopRuleAsync(const Model::StopRuleRequest& request, const StopRuleAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; StopRuleOutcomeCallable stopRuleCallable(const Model::StopRuleRequest& request) const; + QueryDeviceGroupByDeviceOutcome queryDeviceGroupByDevice(const Model::QueryDeviceGroupByDeviceRequest &request)const; + void queryDeviceGroupByDeviceAsync(const Model::QueryDeviceGroupByDeviceRequest& request, const QueryDeviceGroupByDeviceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + QueryDeviceGroupByDeviceOutcomeCallable queryDeviceGroupByDeviceCallable(const Model::QueryDeviceGroupByDeviceRequest& request) const; QueryDeviceDetailOutcome queryDeviceDetail(const Model::QueryDeviceDetailRequest &request)const; void queryDeviceDetailAsync(const Model::QueryDeviceDetailRequest& request, const QueryDeviceDetailAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; QueryDeviceDetailOutcomeCallable queryDeviceDetailCallable(const Model::QueryDeviceDetailRequest& request) const; diff --git a/iot/include/alibabacloud/iot/model/QueryAppDeviceListRequest.h b/iot/include/alibabacloud/iot/model/QueryAppDeviceListRequest.h new file mode 100644 index 000000000..877fc80b4 --- /dev/null +++ b/iot/include/alibabacloud/iot/model/QueryAppDeviceListRequest.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_IOT_MODEL_QUERYAPPDEVICELISTREQUEST_H_ +#define ALIBABACLOUD_IOT_MODEL_QUERYAPPDEVICELISTREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Iot + { + namespace Model + { + class ALIBABACLOUD_IOT_EXPORT QueryAppDeviceListRequest : public RpcServiceRequest + { + struct TagList + { + std::string tagName; + std::string tagValue; + }; + + public: + QueryAppDeviceListRequest(); + ~QueryAppDeviceListRequest(); + + std::vector getProductKeyList()const; + void setProductKeyList(const std::vector& productKeyList); + std::vector getCategoryKeyList()const; + void setCategoryKeyList(const std::vector& categoryKeyList); + int getPageSize()const; + void setPageSize(int pageSize); + int getCurrentPage()const; + void setCurrentPage(int currentPage); + std::string getAppKey()const; + void setAppKey(const std::string& appKey); + std::vector getTagList()const; + void setTagList(const std::vector& tagList); + + private: + std::vector productKeyList_; + std::vector categoryKeyList_; + int pageSize_; + int currentPage_; + std::string appKey_; + std::vector tagList_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IOT_MODEL_QUERYAPPDEVICELISTREQUEST_H_ \ No newline at end of file diff --git a/iot/include/alibabacloud/iot/model/QueryAppDeviceListResult.h b/iot/include/alibabacloud/iot/model/QueryAppDeviceListResult.h new file mode 100644 index 000000000..252647594 --- /dev/null +++ b/iot/include/alibabacloud/iot/model/QueryAppDeviceListResult.h @@ -0,0 +1,80 @@ +/* + * 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_IOT_MODEL_QUERYAPPDEVICELISTRESULT_H_ +#define ALIBABACLOUD_IOT_MODEL_QUERYAPPDEVICELISTRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Iot + { + namespace Model + { + class ALIBABACLOUD_IOT_EXPORT QueryAppDeviceListResult : public ServiceResult + { + public: + struct DataItem + { + std::string status; + std::string lastOnlineTime; + std::string utcActiveTime; + std::string utcCreateTime; + std::string productName; + long childDeviceCount; + std::string activeTime; + std::string utcLastOnlineTime; + int nodeType; + std::string createTime; + std::string productKey; + std::string deviceName; + }; + + + QueryAppDeviceListResult(); + explicit QueryAppDeviceListResult(const std::string &payload); + ~QueryAppDeviceListResult(); + int getPageSize()const; + int getPageCount()const; + int getTotal()const; + std::vector getData()const; + int getPage()const; + std::string getErrorMessage()const; + std::string getCode()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + int pageSize_; + int pageCount_; + int total_; + std::vector data_; + int page_; + std::string errorMessage_; + std::string code_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IOT_MODEL_QUERYAPPDEVICELISTRESULT_H_ \ No newline at end of file diff --git a/iot/include/alibabacloud/iot/model/QueryDeviceGroupByDeviceRequest.h b/iot/include/alibabacloud/iot/model/QueryDeviceGroupByDeviceRequest.h new file mode 100644 index 000000000..9dff1cbae --- /dev/null +++ b/iot/include/alibabacloud/iot/model/QueryDeviceGroupByDeviceRequest.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_IOT_MODEL_QUERYDEVICEGROUPBYDEVICEREQUEST_H_ +#define ALIBABACLOUD_IOT_MODEL_QUERYDEVICEGROUPBYDEVICEREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Iot + { + namespace Model + { + class ALIBABACLOUD_IOT_EXPORT QueryDeviceGroupByDeviceRequest : public RpcServiceRequest + { + + public: + QueryDeviceGroupByDeviceRequest(); + ~QueryDeviceGroupByDeviceRequest(); + + std::string getDeviceName()const; + void setDeviceName(const std::string& deviceName); + std::string getProductKey()const; + void setProductKey(const std::string& productKey); + std::string getAccessKeyId()const; + void setAccessKeyId(const std::string& accessKeyId); + + private: + std::string deviceName_; + std::string productKey_; + std::string accessKeyId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IOT_MODEL_QUERYDEVICEGROUPBYDEVICEREQUEST_H_ \ No newline at end of file diff --git a/iot/include/alibabacloud/iot/model/QueryDeviceGroupByDeviceResult.h b/iot/include/alibabacloud/iot/model/QueryDeviceGroupByDeviceResult.h new file mode 100644 index 000000000..de0f78281 --- /dev/null +++ b/iot/include/alibabacloud/iot/model/QueryDeviceGroupByDeviceResult.h @@ -0,0 +1,64 @@ +/* + * 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_IOT_MODEL_QUERYDEVICEGROUPBYDEVICERESULT_H_ +#define ALIBABACLOUD_IOT_MODEL_QUERYDEVICEGROUPBYDEVICERESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Iot + { + namespace Model + { + class ALIBABACLOUD_IOT_EXPORT QueryDeviceGroupByDeviceResult : public ServiceResult + { + public: + struct GroupInfo + { + std::string groupName; + std::string utcCreate; + std::string groupDesc; + std::string groupId; + }; + + + QueryDeviceGroupByDeviceResult(); + explicit QueryDeviceGroupByDeviceResult(const std::string &payload); + ~QueryDeviceGroupByDeviceResult(); + std::vector getGroupInfos()const; + std::string getErrorMessage()const; + std::string getCode()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + std::vector groupInfos_; + std::string errorMessage_; + std::string code_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IOT_MODEL_QUERYDEVICEGROUPBYDEVICERESULT_H_ \ No newline at end of file diff --git a/iot/src/IotClient.cc b/iot/src/IotClient.cc index 86449d224..01111476c 100644 --- a/iot/src/IotClient.cc +++ b/iot/src/IotClient.cc @@ -51,6 +51,42 @@ IotClient::IotClient(const std::string & accessKeyId, const std::string & access IotClient::~IotClient() {} +IotClient::QueryAppDeviceListOutcome IotClient::queryAppDeviceList(const QueryAppDeviceListRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return QueryAppDeviceListOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return QueryAppDeviceListOutcome(QueryAppDeviceListResult(outcome.result())); + else + return QueryAppDeviceListOutcome(outcome.error()); +} + +void IotClient::queryAppDeviceListAsync(const QueryAppDeviceListRequest& request, const QueryAppDeviceListAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, queryAppDeviceList(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +IotClient::QueryAppDeviceListOutcomeCallable IotClient::queryAppDeviceListCallable(const QueryAppDeviceListRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->queryAppDeviceList(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + IotClient::DeleteTopicRouteTableOutcome IotClient::deleteTopicRouteTable(const DeleteTopicRouteTableRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); @@ -663,6 +699,42 @@ IotClient::StopRuleOutcomeCallable IotClient::stopRuleCallable(const StopRuleReq return task->get_future(); } +IotClient::QueryDeviceGroupByDeviceOutcome IotClient::queryDeviceGroupByDevice(const QueryDeviceGroupByDeviceRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return QueryDeviceGroupByDeviceOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return QueryDeviceGroupByDeviceOutcome(QueryDeviceGroupByDeviceResult(outcome.result())); + else + return QueryDeviceGroupByDeviceOutcome(outcome.error()); +} + +void IotClient::queryDeviceGroupByDeviceAsync(const QueryDeviceGroupByDeviceRequest& request, const QueryDeviceGroupByDeviceAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, queryDeviceGroupByDevice(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +IotClient::QueryDeviceGroupByDeviceOutcomeCallable IotClient::queryDeviceGroupByDeviceCallable(const QueryDeviceGroupByDeviceRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->queryDeviceGroupByDevice(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + IotClient::QueryDeviceDetailOutcome IotClient::queryDeviceDetail(const QueryDeviceDetailRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/iot/src/model/QueryAppDeviceListRequest.cc b/iot/src/model/QueryAppDeviceListRequest.cc new file mode 100644 index 000000000..e4a0be629 --- /dev/null +++ b/iot/src/model/QueryAppDeviceListRequest.cc @@ -0,0 +1,101 @@ +/* + * 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::Iot::Model::QueryAppDeviceListRequest; + +QueryAppDeviceListRequest::QueryAppDeviceListRequest() : + RpcServiceRequest("iot", "2018-01-20", "QueryAppDeviceList") +{} + +QueryAppDeviceListRequest::~QueryAppDeviceListRequest() +{} + +std::vector QueryAppDeviceListRequest::getProductKeyList()const +{ + return productKeyList_; +} + +void QueryAppDeviceListRequest::setProductKeyList(const std::vector& productKeyList) +{ + productKeyList_ = productKeyList; + for(int i = 0; i!= productKeyList.size(); i++) + setParameter("ProductKeyList."+ std::to_string(i), productKeyList.at(i)); +} + +std::vector QueryAppDeviceListRequest::getCategoryKeyList()const +{ + return categoryKeyList_; +} + +void QueryAppDeviceListRequest::setCategoryKeyList(const std::vector& categoryKeyList) +{ + categoryKeyList_ = categoryKeyList; + for(int i = 0; i!= categoryKeyList.size(); i++) + setParameter("CategoryKeyList."+ std::to_string(i), categoryKeyList.at(i)); +} + +int QueryAppDeviceListRequest::getPageSize()const +{ + return pageSize_; +} + +void QueryAppDeviceListRequest::setPageSize(int pageSize) +{ + pageSize_ = pageSize; + setParameter("PageSize", std::to_string(pageSize)); +} + +int QueryAppDeviceListRequest::getCurrentPage()const +{ + return currentPage_; +} + +void QueryAppDeviceListRequest::setCurrentPage(int currentPage) +{ + currentPage_ = currentPage; + setParameter("CurrentPage", std::to_string(currentPage)); +} + +std::string QueryAppDeviceListRequest::getAppKey()const +{ + return appKey_; +} + +void QueryAppDeviceListRequest::setAppKey(const std::string& appKey) +{ + appKey_ = appKey; + setParameter("AppKey", appKey); +} + +std::vector QueryAppDeviceListRequest::getTagList()const +{ + return tagList_; +} + +void QueryAppDeviceListRequest::setTagList(const std::vector& tagList) +{ + tagList_ = tagList; + int i = 0; + for(int i = 0; i!= tagList.size(); i++) { + auto obj = tagList.at(i); + std::string str ="TagList."+ std::to_string(i); + setParameter(str + ".TagName", obj.tagName); + setParameter(str + ".TagValue", obj.tagValue); + } +} + diff --git a/iot/src/model/QueryAppDeviceListResult.cc b/iot/src/model/QueryAppDeviceListResult.cc new file mode 100644 index 000000000..1b0c3d87d --- /dev/null +++ b/iot/src/model/QueryAppDeviceListResult.cc @@ -0,0 +1,129 @@ +/* + * 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::Iot; +using namespace AlibabaCloud::Iot::Model; + +QueryAppDeviceListResult::QueryAppDeviceListResult() : + ServiceResult() +{} + +QueryAppDeviceListResult::QueryAppDeviceListResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +QueryAppDeviceListResult::~QueryAppDeviceListResult() +{} + +void QueryAppDeviceListResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto allData = value["Data"]["DataItem"]; + for (auto value : allData) + { + DataItem dataObject; + if(!value["ProductName"].isNull()) + dataObject.productName = value["ProductName"].asString(); + if(!value["ProductKey"].isNull()) + dataObject.productKey = value["ProductKey"].asString(); + if(!value["DeviceName"].isNull()) + dataObject.deviceName = value["DeviceName"].asString(); + if(!value["NodeType"].isNull()) + dataObject.nodeType = std::stoi(value["NodeType"].asString()); + if(!value["Status"].isNull()) + dataObject.status = value["Status"].asString(); + if(!value["ActiveTime"].isNull()) + dataObject.activeTime = value["ActiveTime"].asString(); + if(!value["LastOnlineTime"].isNull()) + dataObject.lastOnlineTime = value["LastOnlineTime"].asString(); + if(!value["CreateTime"].isNull()) + dataObject.createTime = value["CreateTime"].asString(); + if(!value["ChildDeviceCount"].isNull()) + dataObject.childDeviceCount = std::stol(value["ChildDeviceCount"].asString()); + if(!value["UtcActiveTime"].isNull()) + dataObject.utcActiveTime = value["UtcActiveTime"].asString(); + if(!value["UtcLastOnlineTime"].isNull()) + dataObject.utcLastOnlineTime = value["UtcLastOnlineTime"].asString(); + if(!value["UtcCreateTime"].isNull()) + dataObject.utcCreateTime = value["UtcCreateTime"].asString(); + data_.push_back(dataObject); + } + if(!value["Success"].isNull()) + success_ = value["Success"].asString() == "true"; + if(!value["ErrorMessage"].isNull()) + errorMessage_ = value["ErrorMessage"].asString(); + if(!value["Code"].isNull()) + code_ = value["Code"].asString(); + if(!value["Page"].isNull()) + page_ = std::stoi(value["Page"].asString()); + if(!value["PageSize"].isNull()) + pageSize_ = std::stoi(value["PageSize"].asString()); + if(!value["PageCount"].isNull()) + pageCount_ = std::stoi(value["PageCount"].asString()); + if(!value["Total"].isNull()) + total_ = std::stoi(value["Total"].asString()); + +} + +int QueryAppDeviceListResult::getPageSize()const +{ + return pageSize_; +} + +int QueryAppDeviceListResult::getPageCount()const +{ + return pageCount_; +} + +int QueryAppDeviceListResult::getTotal()const +{ + return total_; +} + +std::vector QueryAppDeviceListResult::getData()const +{ + return data_; +} + +int QueryAppDeviceListResult::getPage()const +{ + return page_; +} + +std::string QueryAppDeviceListResult::getErrorMessage()const +{ + return errorMessage_; +} + +std::string QueryAppDeviceListResult::getCode()const +{ + return code_; +} + +bool QueryAppDeviceListResult::getSuccess()const +{ + return success_; +} + diff --git a/iot/src/model/QueryDeviceGroupByDeviceRequest.cc b/iot/src/model/QueryDeviceGroupByDeviceRequest.cc new file mode 100644 index 000000000..480c64c73 --- /dev/null +++ b/iot/src/model/QueryDeviceGroupByDeviceRequest.cc @@ -0,0 +1,60 @@ +/* + * 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::Iot::Model::QueryDeviceGroupByDeviceRequest; + +QueryDeviceGroupByDeviceRequest::QueryDeviceGroupByDeviceRequest() : + RpcServiceRequest("iot", "2018-01-20", "QueryDeviceGroupByDevice") +{} + +QueryDeviceGroupByDeviceRequest::~QueryDeviceGroupByDeviceRequest() +{} + +std::string QueryDeviceGroupByDeviceRequest::getDeviceName()const +{ + return deviceName_; +} + +void QueryDeviceGroupByDeviceRequest::setDeviceName(const std::string& deviceName) +{ + deviceName_ = deviceName; + setParameter("DeviceName", deviceName); +} + +std::string QueryDeviceGroupByDeviceRequest::getProductKey()const +{ + return productKey_; +} + +void QueryDeviceGroupByDeviceRequest::setProductKey(const std::string& productKey) +{ + productKey_ = productKey; + setParameter("ProductKey", productKey); +} + +std::string QueryDeviceGroupByDeviceRequest::getAccessKeyId()const +{ + return accessKeyId_; +} + +void QueryDeviceGroupByDeviceRequest::setAccessKeyId(const std::string& accessKeyId) +{ + accessKeyId_ = accessKeyId; + setParameter("AccessKeyId", accessKeyId); +} + diff --git a/iot/src/model/QueryDeviceGroupByDeviceResult.cc b/iot/src/model/QueryDeviceGroupByDeviceResult.cc new file mode 100644 index 000000000..6e1a930e7 --- /dev/null +++ b/iot/src/model/QueryDeviceGroupByDeviceResult.cc @@ -0,0 +1,85 @@ +/* + * 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::Iot; +using namespace AlibabaCloud::Iot::Model; + +QueryDeviceGroupByDeviceResult::QueryDeviceGroupByDeviceResult() : + ServiceResult() +{} + +QueryDeviceGroupByDeviceResult::QueryDeviceGroupByDeviceResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +QueryDeviceGroupByDeviceResult::~QueryDeviceGroupByDeviceResult() +{} + +void QueryDeviceGroupByDeviceResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + + setRequestId(value["RequestId"].asString()); + auto allGroupInfos = value["GroupInfos"]["GroupInfo"]; + for (auto value : allGroupInfos) + { + GroupInfo groupInfosObject; + if(!value["GroupId"].isNull()) + groupInfosObject.groupId = value["GroupId"].asString(); + if(!value["GroupName"].isNull()) + groupInfosObject.groupName = value["GroupName"].asString(); + if(!value["UtcCreate"].isNull()) + groupInfosObject.utcCreate = value["UtcCreate"].asString(); + if(!value["GroupDesc"].isNull()) + groupInfosObject.groupDesc = value["GroupDesc"].asString(); + groupInfos_.push_back(groupInfosObject); + } + 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 QueryDeviceGroupByDeviceResult::getGroupInfos()const +{ + return groupInfos_; +} + +std::string QueryDeviceGroupByDeviceResult::getErrorMessage()const +{ + return errorMessage_; +} + +std::string QueryDeviceGroupByDeviceResult::getCode()const +{ + return code_; +} + +bool QueryDeviceGroupByDeviceResult::getSuccess()const +{ + return success_; +} +