From b94efe4684d474dc47e80401a36a2f02b5c22df2 Mon Sep 17 00:00:00 2001 From: sdk-team Date: Fri, 10 Feb 2023 10:58:10 +0000 Subject: [PATCH] Support broadcast for FengTian. --- VERSION | 2 +- iot/CMakeLists.txt | 4 + iot/include/alibabacloud/iot/IotClient.h | 8 ++ .../iot/model/UpdateTopicConfigRequest.h | 63 ++++++++++++ .../iot/model/UpdateTopicConfigResult.h | 55 +++++++++++ iot/src/IotClient.cc | 36 +++++++ iot/src/model/UpdateTopicConfigRequest.cc | 95 +++++++++++++++++++ iot/src/model/UpdateTopicConfigResult.cc | 65 +++++++++++++ 8 files changed, 327 insertions(+), 1 deletion(-) create mode 100644 iot/include/alibabacloud/iot/model/UpdateTopicConfigRequest.h create mode 100644 iot/include/alibabacloud/iot/model/UpdateTopicConfigResult.h create mode 100644 iot/src/model/UpdateTopicConfigRequest.cc create mode 100644 iot/src/model/UpdateTopicConfigResult.cc diff --git a/VERSION b/VERSION index 6c1252e38..dacbb1262 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.1446 \ No newline at end of file +1.36.1447 \ No newline at end of file diff --git a/iot/CMakeLists.txt b/iot/CMakeLists.txt index 294a6c2cc..c55919503 100644 --- a/iot/CMakeLists.txt +++ b/iot/CMakeLists.txt @@ -809,6 +809,8 @@ set(iot_public_header_model include/alibabacloud/iot/model/UpdateThingModelResult.h include/alibabacloud/iot/model/UpdateThingScriptRequest.h include/alibabacloud/iot/model/UpdateThingScriptResult.h + include/alibabacloud/iot/model/UpdateTopicConfigRequest.h + include/alibabacloud/iot/model/UpdateTopicConfigResult.h include/alibabacloud/iot/model/WriteDevicesHotStorageDataRequest.h include/alibabacloud/iot/model/WriteDevicesHotStorageDataResult.h ) @@ -1602,6 +1604,8 @@ set(iot_src src/model/UpdateThingModelResult.cc src/model/UpdateThingScriptRequest.cc src/model/UpdateThingScriptResult.cc + src/model/UpdateTopicConfigRequest.cc + src/model/UpdateTopicConfigResult.cc src/model/WriteDevicesHotStorageDataRequest.cc src/model/WriteDevicesHotStorageDataResult.cc ) diff --git a/iot/include/alibabacloud/iot/IotClient.h b/iot/include/alibabacloud/iot/IotClient.h index fe7831775..2571b4967 100644 --- a/iot/include/alibabacloud/iot/IotClient.h +++ b/iot/include/alibabacloud/iot/IotClient.h @@ -810,6 +810,8 @@ #include "model/UpdateThingModelResult.h" #include "model/UpdateThingScriptRequest.h" #include "model/UpdateThingScriptResult.h" +#include "model/UpdateTopicConfigRequest.h" +#include "model/UpdateTopicConfigResult.h" #include "model/WriteDevicesHotStorageDataRequest.h" #include "model/WriteDevicesHotStorageDataResult.h" @@ -2003,6 +2005,9 @@ namespace AlibabaCloud typedef Outcome UpdateThingScriptOutcome; typedef std::future UpdateThingScriptOutcomeCallable; typedef std::function&)> UpdateThingScriptAsyncHandler; + typedef Outcome UpdateTopicConfigOutcome; + typedef std::future UpdateTopicConfigOutcomeCallable; + typedef std::function&)> UpdateTopicConfigAsyncHandler; typedef Outcome WriteDevicesHotStorageDataOutcome; typedef std::future WriteDevicesHotStorageDataOutcomeCallable; typedef std::function&)> WriteDevicesHotStorageDataAsyncHandler; @@ -3193,6 +3198,9 @@ namespace AlibabaCloud UpdateThingScriptOutcome updateThingScript(const Model::UpdateThingScriptRequest &request)const; void updateThingScriptAsync(const Model::UpdateThingScriptRequest& request, const UpdateThingScriptAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; UpdateThingScriptOutcomeCallable updateThingScriptCallable(const Model::UpdateThingScriptRequest& request) const; + UpdateTopicConfigOutcome updateTopicConfig(const Model::UpdateTopicConfigRequest &request)const; + void updateTopicConfigAsync(const Model::UpdateTopicConfigRequest& request, const UpdateTopicConfigAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + UpdateTopicConfigOutcomeCallable updateTopicConfigCallable(const Model::UpdateTopicConfigRequest& request) const; WriteDevicesHotStorageDataOutcome writeDevicesHotStorageData(const Model::WriteDevicesHotStorageDataRequest &request)const; void writeDevicesHotStorageDataAsync(const Model::WriteDevicesHotStorageDataRequest& request, const WriteDevicesHotStorageDataAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; WriteDevicesHotStorageDataOutcomeCallable writeDevicesHotStorageDataCallable(const Model::WriteDevicesHotStorageDataRequest& request) const; diff --git a/iot/include/alibabacloud/iot/model/UpdateTopicConfigRequest.h b/iot/include/alibabacloud/iot/model/UpdateTopicConfigRequest.h new file mode 100644 index 000000000..f36e6561e --- /dev/null +++ b/iot/include/alibabacloud/iot/model/UpdateTopicConfigRequest.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_UPDATETOPICCONFIGREQUEST_H_ +#define ALIBABACLOUD_IOT_MODEL_UPDATETOPICCONFIGREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Iot + { + namespace Model + { + class ALIBABACLOUD_IOT_EXPORT UpdateTopicConfigRequest : public RpcServiceRequest + { + + public: + UpdateTopicConfigRequest(); + ~UpdateTopicConfigRequest(); + + std::string getIotInstanceId()const; + void setIotInstanceId(const std::string& iotInstanceId); + std::string getTopicFullName()const; + void setTopicFullName(const std::string& topicFullName); + bool getEnableBroadcast()const; + void setEnableBroadcast(bool enableBroadcast); + std::string getProductKey()const; + void setProductKey(const std::string& productKey); + std::string getApiProduct()const; + void setApiProduct(const std::string& apiProduct); + std::string getApiRevision()const; + void setApiRevision(const std::string& apiRevision); + + private: + std::string iotInstanceId_; + std::string topicFullName_; + bool enableBroadcast_; + std::string productKey_; + std::string apiProduct_; + std::string apiRevision_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IOT_MODEL_UPDATETOPICCONFIGREQUEST_H_ \ No newline at end of file diff --git a/iot/include/alibabacloud/iot/model/UpdateTopicConfigResult.h b/iot/include/alibabacloud/iot/model/UpdateTopicConfigResult.h new file mode 100644 index 000000000..a77c33a46 --- /dev/null +++ b/iot/include/alibabacloud/iot/model/UpdateTopicConfigResult.h @@ -0,0 +1,55 @@ +/* + * 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_UPDATETOPICCONFIGRESULT_H_ +#define ALIBABACLOUD_IOT_MODEL_UPDATETOPICCONFIGRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Iot + { + namespace Model + { + class ALIBABACLOUD_IOT_EXPORT UpdateTopicConfigResult : public ServiceResult + { + public: + + + UpdateTopicConfigResult(); + explicit UpdateTopicConfigResult(const std::string &payload); + ~UpdateTopicConfigResult(); + std::string getErrorMessage()const; + std::string getCode()const; + bool getSuccess()const; + + protected: + void parse(const std::string &payload); + private: + std::string errorMessage_; + std::string code_; + bool success_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IOT_MODEL_UPDATETOPICCONFIGRESULT_H_ \ No newline at end of file diff --git a/iot/src/IotClient.cc b/iot/src/IotClient.cc index 91f1ddc25..5176d1ced 100644 --- a/iot/src/IotClient.cc +++ b/iot/src/IotClient.cc @@ -14235,6 +14235,42 @@ IotClient::UpdateThingScriptOutcomeCallable IotClient::updateThingScriptCallable return task->get_future(); } +IotClient::UpdateTopicConfigOutcome IotClient::updateTopicConfig(const UpdateTopicConfigRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return UpdateTopicConfigOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return UpdateTopicConfigOutcome(UpdateTopicConfigResult(outcome.result())); + else + return UpdateTopicConfigOutcome(outcome.error()); +} + +void IotClient::updateTopicConfigAsync(const UpdateTopicConfigRequest& request, const UpdateTopicConfigAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, updateTopicConfig(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +IotClient::UpdateTopicConfigOutcomeCallable IotClient::updateTopicConfigCallable(const UpdateTopicConfigRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->updateTopicConfig(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + IotClient::WriteDevicesHotStorageDataOutcome IotClient::writeDevicesHotStorageData(const WriteDevicesHotStorageDataRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/iot/src/model/UpdateTopicConfigRequest.cc b/iot/src/model/UpdateTopicConfigRequest.cc new file mode 100644 index 000000000..a084136eb --- /dev/null +++ b/iot/src/model/UpdateTopicConfigRequest.cc @@ -0,0 +1,95 @@ +/* + * 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::UpdateTopicConfigRequest; + +UpdateTopicConfigRequest::UpdateTopicConfigRequest() : + RpcServiceRequest("iot", "2018-01-20", "UpdateTopicConfig") +{ + setMethod(HttpRequest::Method::Post); +} + +UpdateTopicConfigRequest::~UpdateTopicConfigRequest() +{} + +std::string UpdateTopicConfigRequest::getIotInstanceId()const +{ + return iotInstanceId_; +} + +void UpdateTopicConfigRequest::setIotInstanceId(const std::string& iotInstanceId) +{ + iotInstanceId_ = iotInstanceId; + setParameter("IotInstanceId", iotInstanceId); +} + +std::string UpdateTopicConfigRequest::getTopicFullName()const +{ + return topicFullName_; +} + +void UpdateTopicConfigRequest::setTopicFullName(const std::string& topicFullName) +{ + topicFullName_ = topicFullName; + setParameter("TopicFullName", topicFullName); +} + +bool UpdateTopicConfigRequest::getEnableBroadcast()const +{ + return enableBroadcast_; +} + +void UpdateTopicConfigRequest::setEnableBroadcast(bool enableBroadcast) +{ + enableBroadcast_ = enableBroadcast; + setParameter("EnableBroadcast", enableBroadcast ? "true" : "false"); +} + +std::string UpdateTopicConfigRequest::getProductKey()const +{ + return productKey_; +} + +void UpdateTopicConfigRequest::setProductKey(const std::string& productKey) +{ + productKey_ = productKey; + setParameter("ProductKey", productKey); +} + +std::string UpdateTopicConfigRequest::getApiProduct()const +{ + return apiProduct_; +} + +void UpdateTopicConfigRequest::setApiProduct(const std::string& apiProduct) +{ + apiProduct_ = apiProduct; + setBodyParameter("ApiProduct", apiProduct); +} + +std::string UpdateTopicConfigRequest::getApiRevision()const +{ + return apiRevision_; +} + +void UpdateTopicConfigRequest::setApiRevision(const std::string& apiRevision) +{ + apiRevision_ = apiRevision; + setBodyParameter("ApiRevision", apiRevision); +} + diff --git a/iot/src/model/UpdateTopicConfigResult.cc b/iot/src/model/UpdateTopicConfigResult.cc new file mode 100644 index 000000000..98da5d995 --- /dev/null +++ b/iot/src/model/UpdateTopicConfigResult.cc @@ -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 +#include + +using namespace AlibabaCloud::Iot; +using namespace AlibabaCloud::Iot::Model; + +UpdateTopicConfigResult::UpdateTopicConfigResult() : + ServiceResult() +{} + +UpdateTopicConfigResult::UpdateTopicConfigResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +UpdateTopicConfigResult::~UpdateTopicConfigResult() +{} + +void UpdateTopicConfigResult::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 UpdateTopicConfigResult::getErrorMessage()const +{ + return errorMessage_; +} + +std::string UpdateTopicConfigResult::getCode()const +{ + return code_; +} + +bool UpdateTopicConfigResult::getSuccess()const +{ + return success_; +} +