Bläddra i källkod

Iot_20180120 Old sdk.

sdk-team 3 år sedan
förälder
incheckning
c71ce3c596

+ 1 - 1
VERSION

@@ -1 +1 @@
-1.36.1314
+1.36.1315

+ 4 - 0
iot/CMakeLists.txt

@@ -383,6 +383,8 @@ set(iot_public_header_model
 	include/alibabacloud/iot/model/GisQueryDeviceLocationResult.h
 	include/alibabacloud/iot/model/GisSearchDeviceTraceRequest.h
 	include/alibabacloud/iot/model/GisSearchDeviceTraceResult.h
+	include/alibabacloud/iot/model/ImportDTDataRequest.h
+	include/alibabacloud/iot/model/ImportDTDataResult.h
 	include/alibabacloud/iot/model/ImportDeviceRequest.h
 	include/alibabacloud/iot/model/ImportDeviceResult.h
 	include/alibabacloud/iot/model/ImportThingModelTslRequest.h
@@ -1160,6 +1162,8 @@ set(iot_src
 	src/model/GisQueryDeviceLocationResult.cc
 	src/model/GisSearchDeviceTraceRequest.cc
 	src/model/GisSearchDeviceTraceResult.cc
+	src/model/ImportDTDataRequest.cc
+	src/model/ImportDTDataResult.cc
 	src/model/ImportDeviceRequest.cc
 	src/model/ImportDeviceResult.cc
 	src/model/ImportThingModelTslRequest.cc

+ 8 - 0
iot/include/alibabacloud/iot/IotClient.h

@@ -384,6 +384,8 @@
 #include "model/GisQueryDeviceLocationResult.h"
 #include "model/GisSearchDeviceTraceRequest.h"
 #include "model/GisSearchDeviceTraceResult.h"
+#include "model/ImportDTDataRequest.h"
+#include "model/ImportDTDataResult.h"
 #include "model/ImportDeviceRequest.h"
 #include "model/ImportDeviceResult.h"
 #include "model/ImportThingModelTslRequest.h"
@@ -1348,6 +1350,9 @@ namespace AlibabaCloud
 			typedef Outcome<Error, Model::GisSearchDeviceTraceResult> GisSearchDeviceTraceOutcome;
 			typedef std::future<GisSearchDeviceTraceOutcome> GisSearchDeviceTraceOutcomeCallable;
 			typedef std::function<void(const IotClient*, const Model::GisSearchDeviceTraceRequest&, const GisSearchDeviceTraceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GisSearchDeviceTraceAsyncHandler;
+			typedef Outcome<Error, Model::ImportDTDataResult> ImportDTDataOutcome;
+			typedef std::future<ImportDTDataOutcome> ImportDTDataOutcomeCallable;
+			typedef std::function<void(const IotClient*, const Model::ImportDTDataRequest&, const ImportDTDataOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ImportDTDataAsyncHandler;
 			typedef Outcome<Error, Model::ImportDeviceResult> ImportDeviceOutcome;
 			typedef std::future<ImportDeviceOutcome> ImportDeviceOutcomeCallable;
 			typedef std::function<void(const IotClient*, const Model::ImportDeviceRequest&, const ImportDeviceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ImportDeviceAsyncHandler;
@@ -2514,6 +2519,9 @@ namespace AlibabaCloud
 			GisSearchDeviceTraceOutcome gisSearchDeviceTrace(const Model::GisSearchDeviceTraceRequest &request)const;
 			void gisSearchDeviceTraceAsync(const Model::GisSearchDeviceTraceRequest& request, const GisSearchDeviceTraceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			GisSearchDeviceTraceOutcomeCallable gisSearchDeviceTraceCallable(const Model::GisSearchDeviceTraceRequest& request) const;
+			ImportDTDataOutcome importDTData(const Model::ImportDTDataRequest &request)const;
+			void importDTDataAsync(const Model::ImportDTDataRequest& request, const ImportDTDataAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
+			ImportDTDataOutcomeCallable importDTDataCallable(const Model::ImportDTDataRequest& request) const;
 			ImportDeviceOutcome importDevice(const Model::ImportDeviceRequest &request)const;
 			void importDeviceAsync(const Model::ImportDeviceRequest& request, const ImportDeviceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
 			ImportDeviceOutcomeCallable importDeviceCallable(const Model::ImportDeviceRequest& request) const;

+ 72 - 0
iot/include/alibabacloud/iot/model/ImportDTDataRequest.h

@@ -0,0 +1,72 @@
+/*
+ * 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_IMPORTDTDATAREQUEST_H_
+#define ALIBABACLOUD_IOT_MODEL_IMPORTDTDATAREQUEST_H_
+
+#include <string>
+#include <vector>
+#include <alibabacloud/core/RpcServiceRequest.h>
+#include <alibabacloud/iot/IotExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Iot
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_IOT_EXPORT ImportDTDataRequest : public RpcServiceRequest
+			{
+			public:
+				struct Items
+				{
+					std::string deviceName;
+					std::string params;
+				};
+
+			public:
+				ImportDTDataRequest();
+				~ImportDTDataRequest();
+
+				std::string getRealTenantId()const;
+				void setRealTenantId(const std::string& realTenantId);
+				std::string getRealTripartiteKey()const;
+				void setRealTripartiteKey(const std::string& realTripartiteKey);
+				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::string getApiRevision()const;
+				void setApiRevision(const std::string& apiRevision);
+				std::vector<Items> getItems()const;
+				void setItems(const std::vector<Items>& items);
+
+            private:
+				std::string realTenantId_;
+				std::string realTripartiteKey_;
+				std::string iotInstanceId_;
+				std::string productKey_;
+				std::string apiProduct_;
+				std::string apiRevision_;
+				std::vector<Items> items_;
+
+			};
+		}
+	}
+}
+#endif // !ALIBABACLOUD_IOT_MODEL_IMPORTDTDATAREQUEST_H_

+ 55 - 0
iot/include/alibabacloud/iot/model/ImportDTDataResult.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_IMPORTDTDATARESULT_H_
+#define ALIBABACLOUD_IOT_MODEL_IMPORTDTDATARESULT_H_
+
+#include <string>
+#include <vector>
+#include <utility>
+#include <alibabacloud/core/ServiceResult.h>
+#include <alibabacloud/iot/IotExport.h>
+
+namespace AlibabaCloud
+{
+	namespace Iot
+	{
+		namespace Model
+		{
+			class ALIBABACLOUD_IOT_EXPORT ImportDTDataResult : public ServiceResult
+			{
+			public:
+
+
+				ImportDTDataResult();
+				explicit ImportDTDataResult(const std::string &payload);
+				~ImportDTDataResult();
+				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_IMPORTDTDATARESULT_H_

+ 36 - 0
iot/src/IotClient.cc

@@ -6567,6 +6567,42 @@ IotClient::GisSearchDeviceTraceOutcomeCallable IotClient::gisSearchDeviceTraceCa
 	return task->get_future();
 }
 
+IotClient::ImportDTDataOutcome IotClient::importDTData(const ImportDTDataRequest &request) const
+{
+	auto endpointOutcome = endpointProvider_->getEndpoint();
+	if (!endpointOutcome.isSuccess())
+		return ImportDTDataOutcome(endpointOutcome.error());
+
+	auto outcome = makeRequest(endpointOutcome.result(), request);
+
+	if (outcome.isSuccess())
+		return ImportDTDataOutcome(ImportDTDataResult(outcome.result()));
+	else
+		return ImportDTDataOutcome(outcome.error());
+}
+
+void IotClient::importDTDataAsync(const ImportDTDataRequest& request, const ImportDTDataAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
+{
+	auto fn = [this, request, handler, context]()
+	{
+		handler(this, request, importDTData(request), context);
+	};
+
+	asyncExecute(new Runnable(fn));
+}
+
+IotClient::ImportDTDataOutcomeCallable IotClient::importDTDataCallable(const ImportDTDataRequest &request) const
+{
+	auto task = std::make_shared<std::packaged_task<ImportDTDataOutcome()>>(
+			[this, request]()
+			{
+			return this->importDTData(request);
+			});
+
+	asyncExecute(new Runnable([task]() { (*task)(); }));
+	return task->get_future();
+}
+
 IotClient::ImportDeviceOutcome IotClient::importDevice(const ImportDeviceRequest &request) const
 {
 	auto endpointOutcome = endpointProvider_->getEndpoint();

+ 111 - 0
iot/src/model/ImportDTDataRequest.cc

@@ -0,0 +1,111 @@
+/*
+ * 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/ImportDTDataRequest.h>
+
+using AlibabaCloud::Iot::Model::ImportDTDataRequest;
+
+ImportDTDataRequest::ImportDTDataRequest() :
+	RpcServiceRequest("iot", "2018-01-20", "ImportDTData")
+{
+	setMethod(HttpRequest::Method::Post);
+}
+
+ImportDTDataRequest::~ImportDTDataRequest()
+{}
+
+std::string ImportDTDataRequest::getRealTenantId()const
+{
+	return realTenantId_;
+}
+
+void ImportDTDataRequest::setRealTenantId(const std::string& realTenantId)
+{
+	realTenantId_ = realTenantId;
+	setBodyParameter("RealTenantId", realTenantId);
+}
+
+std::string ImportDTDataRequest::getRealTripartiteKey()const
+{
+	return realTripartiteKey_;
+}
+
+void ImportDTDataRequest::setRealTripartiteKey(const std::string& realTripartiteKey)
+{
+	realTripartiteKey_ = realTripartiteKey;
+	setParameter("RealTripartiteKey", realTripartiteKey);
+}
+
+std::string ImportDTDataRequest::getIotInstanceId()const
+{
+	return iotInstanceId_;
+}
+
+void ImportDTDataRequest::setIotInstanceId(const std::string& iotInstanceId)
+{
+	iotInstanceId_ = iotInstanceId;
+	setBodyParameter("IotInstanceId", iotInstanceId);
+}
+
+std::string ImportDTDataRequest::getProductKey()const
+{
+	return productKey_;
+}
+
+void ImportDTDataRequest::setProductKey(const std::string& productKey)
+{
+	productKey_ = productKey;
+	setBodyParameter("ProductKey", productKey);
+}
+
+std::string ImportDTDataRequest::getApiProduct()const
+{
+	return apiProduct_;
+}
+
+void ImportDTDataRequest::setApiProduct(const std::string& apiProduct)
+{
+	apiProduct_ = apiProduct;
+	setBodyParameter("ApiProduct", apiProduct);
+}
+
+std::string ImportDTDataRequest::getApiRevision()const
+{
+	return apiRevision_;
+}
+
+void ImportDTDataRequest::setApiRevision(const std::string& apiRevision)
+{
+	apiRevision_ = apiRevision;
+	setBodyParameter("ApiRevision", apiRevision);
+}
+
+std::vector<ImportDTDataRequest::Items> ImportDTDataRequest::getItems()const
+{
+	return items_;
+}
+
+void ImportDTDataRequest::setItems(const std::vector<Items>& items)
+{
+	items_ = items;
+	for(int dep1 = 0; dep1!= items.size(); dep1++) {
+		auto itemsObj = items.at(dep1);
+		std::string itemsObjStr = "Items." + std::to_string(dep1 + 1);
+		setParameter(itemsObjStr + ".DeviceName", itemsObj.deviceName);
+		setParameter(itemsObjStr + ".Params", itemsObj.params);
+	}
+}
+

+ 65 - 0
iot/src/model/ImportDTDataResult.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 <alibabacloud/iot/model/ImportDTDataResult.h>
+#include <json/json.h>
+
+using namespace AlibabaCloud::Iot;
+using namespace AlibabaCloud::Iot::Model;
+
+ImportDTDataResult::ImportDTDataResult() :
+	ServiceResult()
+{}
+
+ImportDTDataResult::ImportDTDataResult(const std::string &payload) :
+	ServiceResult()
+{
+	parse(payload);
+}
+
+ImportDTDataResult::~ImportDTDataResult()
+{}
+
+void ImportDTDataResult::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 ImportDTDataResult::getErrorMessage()const
+{
+	return errorMessage_;
+}
+
+std::string ImportDTDataResult::getCode()const
+{
+	return code_;
+}
+
+bool ImportDTDataResult::getSuccess()const
+{
+	return success_;
+}
+