Iot_20180120 TeaDSL SDK.

This commit is contained in:
sdk-team
2023-03-06 11:19:16 +00:00
parent 159a3aa236
commit eb9e915503
14 changed files with 630 additions and 4 deletions

View File

@@ -31,21 +31,21 @@ IotClient::IotClient(const Credentials &credentials, const ClientConfiguration &
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "iot");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
IotClient::IotClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
{
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "iot");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
IotClient::IotClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
{
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "iot");
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
}
IotClient::~IotClient()
@@ -6171,6 +6171,42 @@ IotClient::GetSceneRuleOutcomeCallable IotClient::getSceneRuleCallable(const Get
return task->get_future();
}
IotClient::GetShareSpeechModelAudioOutcome IotClient::getShareSpeechModelAudio(const GetShareSpeechModelAudioRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return GetShareSpeechModelAudioOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return GetShareSpeechModelAudioOutcome(GetShareSpeechModelAudioResult(outcome.result()));
else
return GetShareSpeechModelAudioOutcome(outcome.error());
}
void IotClient::getShareSpeechModelAudioAsync(const GetShareSpeechModelAudioRequest& request, const GetShareSpeechModelAudioAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, getShareSpeechModelAudio(request), context);
};
asyncExecute(new Runnable(fn));
}
IotClient::GetShareSpeechModelAudioOutcomeCallable IotClient::getShareSpeechModelAudioCallable(const GetShareSpeechModelAudioRequest &request) const
{
auto task = std::make_shared<std::packaged_task<GetShareSpeechModelAudioOutcome()>>(
[this, request]()
{
return this->getShareSpeechModelAudio(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
IotClient::GetShareTaskByDeviceOpenOutcome IotClient::getShareTaskByDeviceOpen(const GetShareTaskByDeviceOpenRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
@@ -11031,6 +11067,42 @@ IotClient::QuerySpeechDeviceOutcomeCallable IotClient::querySpeechDeviceCallable
return task->get_future();
}
IotClient::QuerySpeechLicenseAvailableQuotaOutcome IotClient::querySpeechLicenseAvailableQuota(const QuerySpeechLicenseAvailableQuotaRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return QuerySpeechLicenseAvailableQuotaOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return QuerySpeechLicenseAvailableQuotaOutcome(QuerySpeechLicenseAvailableQuotaResult(outcome.result()));
else
return QuerySpeechLicenseAvailableQuotaOutcome(outcome.error());
}
void IotClient::querySpeechLicenseAvailableQuotaAsync(const QuerySpeechLicenseAvailableQuotaRequest& request, const QuerySpeechLicenseAvailableQuotaAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, querySpeechLicenseAvailableQuota(request), context);
};
asyncExecute(new Runnable(fn));
}
IotClient::QuerySpeechLicenseAvailableQuotaOutcomeCallable IotClient::querySpeechLicenseAvailableQuotaCallable(const QuerySpeechLicenseAvailableQuotaRequest &request) const
{
auto task = std::make_shared<std::packaged_task<QuerySpeechLicenseAvailableQuotaOutcome()>>(
[this, request]()
{
return this->querySpeechLicenseAvailableQuota(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
IotClient::QuerySpeechLicenseDeviceListOutcome IotClient::querySpeechLicenseDeviceList(const QuerySpeechLicenseDeviceListRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -44,6 +44,12 @@ void AddShareTaskDeviceResult::parse(const std::string &payload)
data_.progress = std::stoi(dataNode["Progress"].asString());
if(!dataNode["ProgressId"].isNull())
data_.progressId = dataNode["ProgressId"].asString();
if(!dataNode["SuccessSum"].isNull())
data_.successSum = std::stoi(dataNode["SuccessSum"].asString());
if(!dataNode["FailSum"].isNull())
data_.failSum = std::stoi(dataNode["FailSum"].asString());
if(!dataNode["FailedResultCsvFile"].isNull())
data_.failedResultCsvFile = dataNode["FailedResultCsvFile"].asString();
if(!value["Success"].isNull())
success_ = value["Success"].asString() == "true";
if(!value["Code"].isNull())

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/GetShareSpeechModelAudioRequest.h>
using AlibabaCloud::Iot::Model::GetShareSpeechModelAudioRequest;
GetShareSpeechModelAudioRequest::GetShareSpeechModelAudioRequest() :
RpcServiceRequest("iot", "2018-01-20", "GetShareSpeechModelAudio")
{
setMethod(HttpRequest::Method::Post);
}
GetShareSpeechModelAudioRequest::~GetShareSpeechModelAudioRequest()
{}
std::string GetShareSpeechModelAudioRequest::getIotInstanceId()const
{
return iotInstanceId_;
}
void GetShareSpeechModelAudioRequest::setIotInstanceId(const std::string& iotInstanceId)
{
iotInstanceId_ = iotInstanceId;
setBodyParameter("IotInstanceId", iotInstanceId);
}
std::string GetShareSpeechModelAudioRequest::getShareTaskId()const
{
return shareTaskId_;
}
void GetShareSpeechModelAudioRequest::setShareTaskId(const std::string& shareTaskId)
{
shareTaskId_ = shareTaskId;
setBodyParameter("ShareTaskId", shareTaskId);
}
std::string GetShareSpeechModelAudioRequest::getApiProduct()const
{
return apiProduct_;
}
void GetShareSpeechModelAudioRequest::setApiProduct(const std::string& apiProduct)
{
apiProduct_ = apiProduct;
setBodyParameter("ApiProduct", apiProduct);
}
std::string GetShareSpeechModelAudioRequest::getApiRevision()const
{
return apiRevision_;
}
void GetShareSpeechModelAudioRequest::setApiRevision(const std::string& apiRevision)
{
apiRevision_ = apiRevision;
setBodyParameter("ApiRevision", apiRevision);
}
std::vector<std::string> GetShareSpeechModelAudioRequest::getSpeechModelCodeList()const
{
return speechModelCodeList_;
}
void GetShareSpeechModelAudioRequest::setSpeechModelCodeList(const std::vector<std::string>& speechModelCodeList)
{
speechModelCodeList_ = speechModelCodeList;
for(int dep1 = 0; dep1!= speechModelCodeList.size(); dep1++) {
setBodyParameter("SpeechModelCodeList."+ std::to_string(dep1), speechModelCodeList.at(dep1));
}
}

View File

@@ -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 <alibabacloud/iot/model/GetShareSpeechModelAudioResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Iot;
using namespace AlibabaCloud::Iot::Model;
GetShareSpeechModelAudioResult::GetShareSpeechModelAudioResult() :
ServiceResult()
{}
GetShareSpeechModelAudioResult::GetShareSpeechModelAudioResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
GetShareSpeechModelAudioResult::~GetShareSpeechModelAudioResult()
{}
void GetShareSpeechModelAudioResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allData = value["Data"]["data"];
for (const auto &item : allData)
data_.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<std::string> GetShareSpeechModelAudioResult::getData()const
{
return data_;
}
std::string GetShareSpeechModelAudioResult::getErrorMessage()const
{
return errorMessage_;
}
std::string GetShareSpeechModelAudioResult::getCode()const
{
return code_;
}
bool GetShareSpeechModelAudioResult::getSuccess()const
{
return success_;
}

View File

@@ -0,0 +1,62 @@
/*
* 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/QuerySpeechLicenseAvailableQuotaRequest.h>
using AlibabaCloud::Iot::Model::QuerySpeechLicenseAvailableQuotaRequest;
QuerySpeechLicenseAvailableQuotaRequest::QuerySpeechLicenseAvailableQuotaRequest() :
RpcServiceRequest("iot", "2018-01-20", "QuerySpeechLicenseAvailableQuota")
{
setMethod(HttpRequest::Method::Post);
}
QuerySpeechLicenseAvailableQuotaRequest::~QuerySpeechLicenseAvailableQuotaRequest()
{}
std::string QuerySpeechLicenseAvailableQuotaRequest::getIotInstanceId()const
{
return iotInstanceId_;
}
void QuerySpeechLicenseAvailableQuotaRequest::setIotInstanceId(const std::string& iotInstanceId)
{
iotInstanceId_ = iotInstanceId;
setBodyParameter("IotInstanceId", iotInstanceId);
}
std::string QuerySpeechLicenseAvailableQuotaRequest::getApiProduct()const
{
return apiProduct_;
}
void QuerySpeechLicenseAvailableQuotaRequest::setApiProduct(const std::string& apiProduct)
{
apiProduct_ = apiProduct;
setBodyParameter("ApiProduct", apiProduct);
}
std::string QuerySpeechLicenseAvailableQuotaRequest::getApiRevision()const
{
return apiRevision_;
}
void QuerySpeechLicenseAvailableQuotaRequest::setApiRevision(const std::string& apiRevision)
{
apiRevision_ = apiRevision;
setBodyParameter("ApiRevision", apiRevision);
}

View File

@@ -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.
*/
#include <alibabacloud/iot/model/QuerySpeechLicenseAvailableQuotaResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Iot;
using namespace AlibabaCloud::Iot::Model;
QuerySpeechLicenseAvailableQuotaResult::QuerySpeechLicenseAvailableQuotaResult() :
ServiceResult()
{}
QuerySpeechLicenseAvailableQuotaResult::QuerySpeechLicenseAvailableQuotaResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
QuerySpeechLicenseAvailableQuotaResult::~QuerySpeechLicenseAvailableQuotaResult()
{}
void QuerySpeechLicenseAvailableQuotaResult::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();
if(!value["Data"].isNull())
data_ = std::stol(value["Data"].asString());
}
long QuerySpeechLicenseAvailableQuotaResult::getData()const
{
return data_;
}
std::string QuerySpeechLicenseAvailableQuotaResult::getErrorMessage()const
{
return errorMessage_;
}
std::string QuerySpeechLicenseAvailableQuotaResult::getCode()const
{
return code_;
}
bool QuerySpeechLicenseAvailableQuotaResult::getSuccess()const
{
return success_;
}