diff --git a/VERSION b/VERSION index 3feea9196..fd118dacf 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1860 \ No newline at end of file +1.36.1861 \ No newline at end of file diff --git a/iot/CMakeLists.txt b/iot/CMakeLists.txt index b32186496..390add15c 100644 --- a/iot/CMakeLists.txt +++ b/iot/CMakeLists.txt @@ -809,6 +809,8 @@ set(iot_public_header_model include/alibabacloud/iot/model/UnbindRoleFromEdgeInstanceResult.h include/alibabacloud/iot/model/UnbindSceneRuleFromEdgeInstanceRequest.h include/alibabacloud/iot/model/UnbindSceneRuleFromEdgeInstanceResult.h + include/alibabacloud/iot/model/UnsubscribeTopicRequest.h + include/alibabacloud/iot/model/UnsubscribeTopicResult.h include/alibabacloud/iot/model/UpdateConsumerGroupRequest.h include/alibabacloud/iot/model/UpdateConsumerGroupResult.h include/alibabacloud/iot/model/UpdateDestinationRequest.h @@ -1660,6 +1662,8 @@ set(iot_src src/model/UnbindRoleFromEdgeInstanceResult.cc src/model/UnbindSceneRuleFromEdgeInstanceRequest.cc src/model/UnbindSceneRuleFromEdgeInstanceResult.cc + src/model/UnsubscribeTopicRequest.cc + src/model/UnsubscribeTopicResult.cc src/model/UpdateConsumerGroupRequest.cc src/model/UpdateConsumerGroupResult.cc src/model/UpdateDestinationRequest.cc diff --git a/iot/include/alibabacloud/iot/IotClient.h b/iot/include/alibabacloud/iot/IotClient.h index 9825419d9..3459df25b 100644 --- a/iot/include/alibabacloud/iot/IotClient.h +++ b/iot/include/alibabacloud/iot/IotClient.h @@ -810,6 +810,8 @@ #include "model/UnbindRoleFromEdgeInstanceResult.h" #include "model/UnbindSceneRuleFromEdgeInstanceRequest.h" #include "model/UnbindSceneRuleFromEdgeInstanceResult.h" +#include "model/UnsubscribeTopicRequest.h" +#include "model/UnsubscribeTopicResult.h" #include "model/UpdateConsumerGroupRequest.h" #include "model/UpdateConsumerGroupResult.h" #include "model/UpdateDestinationRequest.h" @@ -2061,6 +2063,9 @@ namespace AlibabaCloud typedef Outcome UnbindSceneRuleFromEdgeInstanceOutcome; typedef std::future UnbindSceneRuleFromEdgeInstanceOutcomeCallable; typedef std::function&)> UnbindSceneRuleFromEdgeInstanceAsyncHandler; + typedef Outcome UnsubscribeTopicOutcome; + typedef std::future UnsubscribeTopicOutcomeCallable; + typedef std::function&)> UnsubscribeTopicAsyncHandler; typedef Outcome UpdateConsumerGroupOutcome; typedef std::future UpdateConsumerGroupOutcomeCallable; typedef std::function&)> UpdateConsumerGroupAsyncHandler; @@ -3338,6 +3343,9 @@ namespace AlibabaCloud UnbindSceneRuleFromEdgeInstanceOutcome unbindSceneRuleFromEdgeInstance(const Model::UnbindSceneRuleFromEdgeInstanceRequest &request)const; void unbindSceneRuleFromEdgeInstanceAsync(const Model::UnbindSceneRuleFromEdgeInstanceRequest& request, const UnbindSceneRuleFromEdgeInstanceAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; UnbindSceneRuleFromEdgeInstanceOutcomeCallable unbindSceneRuleFromEdgeInstanceCallable(const Model::UnbindSceneRuleFromEdgeInstanceRequest& request) const; + UnsubscribeTopicOutcome unsubscribeTopic(const Model::UnsubscribeTopicRequest &request)const; + void unsubscribeTopicAsync(const Model::UnsubscribeTopicRequest& request, const UnsubscribeTopicAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + UnsubscribeTopicOutcomeCallable unsubscribeTopicCallable(const Model::UnsubscribeTopicRequest& request) const; UpdateConsumerGroupOutcome updateConsumerGroup(const Model::UpdateConsumerGroupRequest &request)const; void updateConsumerGroupAsync(const Model::UpdateConsumerGroupRequest& request, const UpdateConsumerGroupAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; UpdateConsumerGroupOutcomeCallable updateConsumerGroupCallable(const Model::UpdateConsumerGroupRequest& request) const; diff --git a/iot/include/alibabacloud/iot/model/UnsubscribeTopicRequest.h b/iot/include/alibabacloud/iot/model/UnsubscribeTopicRequest.h new file mode 100644 index 000000000..d7cdaee57 --- /dev/null +++ b/iot/include/alibabacloud/iot/model/UnsubscribeTopicRequest.h @@ -0,0 +1,63 @@ +/* + * 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_UNSUBSCRIBETOPICREQUEST_H_ +#define ALIBABACLOUD_IOT_MODEL_UNSUBSCRIBETOPICREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Iot + { + namespace Model + { + class ALIBABACLOUD_IOT_EXPORT UnsubscribeTopicRequest : public RpcServiceRequest + { + + public: + UnsubscribeTopicRequest(); + ~UnsubscribeTopicRequest(); + + std::string getIotInstanceId()const; + void setIotInstanceId(const std::string& iotInstanceId); + std::string getProductKey()const; + void setProductKey(const std::string& productKey); + std::string getApiProduct()const; + void setApiProduct(const std::string& apiProduct); + std::vector getTopic()const; + void setTopic(const std::vector& topic); + std::string getApiRevision()const; + void setApiRevision(const std::string& apiRevision); + std::string getDeviceName()const; + void setDeviceName(const std::string& deviceName); + + private: + std::string iotInstanceId_; + std::string productKey_; + std::string apiProduct_; + std::vector topic_; + std::string apiRevision_; + std::string deviceName_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IOT_MODEL_UNSUBSCRIBETOPICREQUEST_H_ \ No newline at end of file diff --git a/iot/include/alibabacloud/iot/model/UnsubscribeTopicResult.h b/iot/include/alibabacloud/iot/model/UnsubscribeTopicResult.h new file mode 100644 index 000000000..eec3c47f4 --- /dev/null +++ b/iot/include/alibabacloud/iot/model/UnsubscribeTopicResult.h @@ -0,0 +1,57 @@ +/* + * 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_UNSUBSCRIBETOPICRESULT_H_ +#define ALIBABACLOUD_IOT_MODEL_UNSUBSCRIBETOPICRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Iot + { + namespace Model + { + class ALIBABACLOUD_IOT_EXPORT UnsubscribeTopicResult : public ServiceResult + { + public: + + + UnsubscribeTopicResult(); + explicit UnsubscribeTopicResult(const std::string &payload); + ~UnsubscribeTopicResult(); + std::vector getFailureTopics()const; + std::string getErrorMessage()const; + std::string getCode()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + std::vector failureTopics_; + std::string errorMessage_; + std::string code_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IOT_MODEL_UNSUBSCRIBETOPICRESULT_H_ \ No newline at end of file diff --git a/iot/src/IotClient.cc b/iot/src/IotClient.cc index aff830a66..de70f1f2a 100644 --- a/iot/src/IotClient.cc +++ b/iot/src/IotClient.cc @@ -14235,6 +14235,42 @@ IotClient::UnbindSceneRuleFromEdgeInstanceOutcomeCallable IotClient::unbindScene return task->get_future(); } +IotClient::UnsubscribeTopicOutcome IotClient::unsubscribeTopic(const UnsubscribeTopicRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return UnsubscribeTopicOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return UnsubscribeTopicOutcome(UnsubscribeTopicResult(outcome.result())); + else + return UnsubscribeTopicOutcome(outcome.error()); +} + +void IotClient::unsubscribeTopicAsync(const UnsubscribeTopicRequest& request, const UnsubscribeTopicAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, unsubscribeTopic(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +IotClient::UnsubscribeTopicOutcomeCallable IotClient::unsubscribeTopicCallable(const UnsubscribeTopicRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->unsubscribeTopic(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + IotClient::UpdateConsumerGroupOutcome IotClient::updateConsumerGroup(const UpdateConsumerGroupRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/iot/src/model/UnsubscribeTopicRequest.cc b/iot/src/model/UnsubscribeTopicRequest.cc new file mode 100644 index 000000000..2728f7022 --- /dev/null +++ b/iot/src/model/UnsubscribeTopicRequest.cc @@ -0,0 +1,97 @@ +/* + * 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::UnsubscribeTopicRequest; + +UnsubscribeTopicRequest::UnsubscribeTopicRequest() : + RpcServiceRequest("iot", "2018-01-20", "UnsubscribeTopic") +{ + setMethod(HttpRequest::Method::Post); +} + +UnsubscribeTopicRequest::~UnsubscribeTopicRequest() +{} + +std::string UnsubscribeTopicRequest::getIotInstanceId()const +{ + return iotInstanceId_; +} + +void UnsubscribeTopicRequest::setIotInstanceId(const std::string& iotInstanceId) +{ + iotInstanceId_ = iotInstanceId; + setParameter("IotInstanceId", iotInstanceId); +} + +std::string UnsubscribeTopicRequest::getProductKey()const +{ + return productKey_; +} + +void UnsubscribeTopicRequest::setProductKey(const std::string& productKey) +{ + productKey_ = productKey; + setParameter("ProductKey", productKey); +} + +std::string UnsubscribeTopicRequest::getApiProduct()const +{ + return apiProduct_; +} + +void UnsubscribeTopicRequest::setApiProduct(const std::string& apiProduct) +{ + apiProduct_ = apiProduct; + setBodyParameter("ApiProduct", apiProduct); +} + +std::vector UnsubscribeTopicRequest::getTopic()const +{ + return topic_; +} + +void UnsubscribeTopicRequest::setTopic(const std::vector& topic) +{ + topic_ = topic; + for(int dep1 = 0; dep1!= topic.size(); dep1++) { + setParameter("Topic."+ std::to_string(dep1), topic.at(dep1)); + } +} + +std::string UnsubscribeTopicRequest::getApiRevision()const +{ + return apiRevision_; +} + +void UnsubscribeTopicRequest::setApiRevision(const std::string& apiRevision) +{ + apiRevision_ = apiRevision; + setBodyParameter("ApiRevision", apiRevision); +} + +std::string UnsubscribeTopicRequest::getDeviceName()const +{ + return deviceName_; +} + +void UnsubscribeTopicRequest::setDeviceName(const std::string& deviceName) +{ + deviceName_ = deviceName; + setParameter("DeviceName", deviceName); +} + diff --git a/iot/src/model/UnsubscribeTopicResult.cc b/iot/src/model/UnsubscribeTopicResult.cc new file mode 100644 index 000000000..6cf1bc880 --- /dev/null +++ b/iot/src/model/UnsubscribeTopicResult.cc @@ -0,0 +1,73 @@ +/* + * 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; + +UnsubscribeTopicResult::UnsubscribeTopicResult() : + ServiceResult() +{} + +UnsubscribeTopicResult::UnsubscribeTopicResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +UnsubscribeTopicResult::~UnsubscribeTopicResult() +{} + +void UnsubscribeTopicResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allFailureTopics = value["FailureTopics"]["topic"]; + for (const auto &item : allFailureTopics) + failureTopics_.push_back(item.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::vector UnsubscribeTopicResult::getFailureTopics()const +{ + return failureTopics_; +} + +std::string UnsubscribeTopicResult::getErrorMessage()const +{ + return errorMessage_; +} + +std::string UnsubscribeTopicResult::getCode()const +{ + return code_; +} + +bool UnsubscribeTopicResult::getSuccess()const +{ + return success_; +} +