Supported CreateSegmentBodyJob.
This commit is contained in:
@@ -31,21 +31,21 @@ IvpdClient::IvpdClient(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, "ivpd");
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
|
||||
}
|
||||
|
||||
IvpdClient::IvpdClient(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, "ivpd");
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
|
||||
}
|
||||
|
||||
IvpdClient::IvpdClient(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, "ivpd");
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "");
|
||||
}
|
||||
|
||||
IvpdClient::~IvpdClient()
|
||||
@@ -87,6 +87,42 @@ IvpdClient::ChangeImageSizeOutcomeCallable IvpdClient::changeImageSizeCallable(c
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
IvpdClient::CreateSegmentBodyJobOutcome IvpdClient::createSegmentBodyJob(const CreateSegmentBodyJobRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return CreateSegmentBodyJobOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return CreateSegmentBodyJobOutcome(CreateSegmentBodyJobResult(outcome.result()));
|
||||
else
|
||||
return CreateSegmentBodyJobOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void IvpdClient::createSegmentBodyJobAsync(const CreateSegmentBodyJobRequest& request, const CreateSegmentBodyJobAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, createSegmentBodyJob(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
IvpdClient::CreateSegmentBodyJobOutcomeCallable IvpdClient::createSegmentBodyJobCallable(const CreateSegmentBodyJobRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<CreateSegmentBodyJobOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->createSegmentBodyJob(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
IvpdClient::DetectImageElementsOutcome IvpdClient::detectImageElements(const DetectImageElementsRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
@@ -159,6 +195,78 @@ IvpdClient::ExtendImageStyleOutcomeCallable IvpdClient::extendImageStyleCallable
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
IvpdClient::GetJobResultOutcome IvpdClient::getJobResult(const GetJobResultRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetJobResultOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetJobResultOutcome(GetJobResultResult(outcome.result()));
|
||||
else
|
||||
return GetJobResultOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void IvpdClient::getJobResultAsync(const GetJobResultRequest& request, const GetJobResultAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getJobResult(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
IvpdClient::GetJobResultOutcomeCallable IvpdClient::getJobResultCallable(const GetJobResultRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetJobResultOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getJobResult(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
IvpdClient::GetJobStatusOutcome IvpdClient::getJobStatus(const GetJobStatusRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return GetJobStatusOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return GetJobStatusOutcome(GetJobStatusResult(outcome.result()));
|
||||
else
|
||||
return GetJobStatusOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void IvpdClient::getJobStatusAsync(const GetJobStatusRequest& request, const GetJobStatusAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, getJobStatus(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
IvpdClient::GetJobStatusOutcomeCallable IvpdClient::getJobStatusCallable(const GetJobStatusRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<GetJobStatusOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->getJobStatus(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
IvpdClient::MakeSuperResolutionImageOutcome IvpdClient::makeSuperResolutionImage(const MakeSuperResolutionImageRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
78
ivpd/src/model/CreateSegmentBodyJobRequest.cc
Normal file
78
ivpd/src/model/CreateSegmentBodyJobRequest.cc
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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/ivpd/model/CreateSegmentBodyJobRequest.h>
|
||||
|
||||
using AlibabaCloud::Ivpd::Model::CreateSegmentBodyJobRequest;
|
||||
|
||||
CreateSegmentBodyJobRequest::CreateSegmentBodyJobRequest() :
|
||||
RpcServiceRequest("ivpd", "2019-06-25", "CreateSegmentBodyJob")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
CreateSegmentBodyJobRequest::~CreateSegmentBodyJobRequest()
|
||||
{}
|
||||
|
||||
std::vector<CreateSegmentBodyJobRequest::DataList> CreateSegmentBodyJobRequest::getDataList()const
|
||||
{
|
||||
return dataList_;
|
||||
}
|
||||
|
||||
void CreateSegmentBodyJobRequest::setDataList(const std::vector<DataList>& dataList)
|
||||
{
|
||||
dataList_ = dataList;
|
||||
for(int dep1 = 0; dep1!= dataList.size(); dep1++) {
|
||||
auto dataListObj = dataList.at(dep1);
|
||||
std::string dataListObjStr = "DataList." + std::to_string(dep1 + 1);
|
||||
setParameter(dataListObjStr + ".DataId", dataListObj.dataId);
|
||||
setParameter(dataListObjStr + ".ImageUrl", dataListObj.imageUrl);
|
||||
}
|
||||
}
|
||||
|
||||
bool CreateSegmentBodyJobRequest::getAsync()const
|
||||
{
|
||||
return async_;
|
||||
}
|
||||
|
||||
void CreateSegmentBodyJobRequest::setAsync(bool async)
|
||||
{
|
||||
async_ = async;
|
||||
setBodyParameter("Async", async ? "true" : "false");
|
||||
}
|
||||
|
||||
std::string CreateSegmentBodyJobRequest::getJobId()const
|
||||
{
|
||||
return jobId_;
|
||||
}
|
||||
|
||||
void CreateSegmentBodyJobRequest::setJobId(const std::string& jobId)
|
||||
{
|
||||
jobId_ = jobId;
|
||||
setBodyParameter("JobId", jobId);
|
||||
}
|
||||
|
||||
int CreateSegmentBodyJobRequest::getTimeToLive()const
|
||||
{
|
||||
return timeToLive_;
|
||||
}
|
||||
|
||||
void CreateSegmentBodyJobRequest::setTimeToLive(int timeToLive)
|
||||
{
|
||||
timeToLive_ = timeToLive;
|
||||
setBodyParameter("TimeToLive", std::to_string(timeToLive));
|
||||
}
|
||||
|
||||
93
ivpd/src/model/CreateSegmentBodyJobResult.cc
Normal file
93
ivpd/src/model/CreateSegmentBodyJobResult.cc
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* 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/ivpd/model/CreateSegmentBodyJobResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ivpd;
|
||||
using namespace AlibabaCloud::Ivpd::Model;
|
||||
|
||||
CreateSegmentBodyJobResult::CreateSegmentBodyJobResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
CreateSegmentBodyJobResult::CreateSegmentBodyJobResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
CreateSegmentBodyJobResult::~CreateSegmentBodyJobResult()
|
||||
{}
|
||||
|
||||
void CreateSegmentBodyJobResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
if(!dataNode["Status"].isNull())
|
||||
data_.status = dataNode["Status"].asString();
|
||||
if(!dataNode["Completed"].isNull())
|
||||
data_.completed = dataNode["Completed"].asString() == "true";
|
||||
if(!dataNode["BatchSize"].isNull())
|
||||
data_.batchSize = std::stoi(dataNode["BatchSize"].asString());
|
||||
if(!dataNode["TotalUsedTime"].isNull())
|
||||
data_.totalUsedTime = std::stol(dataNode["TotalUsedTime"].asString());
|
||||
if(!dataNode["Progress"].isNull())
|
||||
data_.progress = std::stoi(dataNode["Progress"].asString());
|
||||
if(!dataNode["JobId"].isNull())
|
||||
data_.jobId = dataNode["JobId"].asString();
|
||||
auto allResultListNode = dataNode["ResultList"]["Result"];
|
||||
for (auto dataNodeResultListResult : allResultListNode)
|
||||
{
|
||||
Data::Result resultObject;
|
||||
if(!dataNodeResultListResult["DataId"].isNull())
|
||||
resultObject.dataId = dataNodeResultListResult["DataId"].asString();
|
||||
if(!dataNodeResultListResult["Success"].isNull())
|
||||
resultObject.success = dataNodeResultListResult["Success"].asString() == "true";
|
||||
if(!dataNodeResultListResult["Code"].isNull())
|
||||
resultObject.code = dataNodeResultListResult["Code"].asString();
|
||||
if(!dataNodeResultListResult["Message"].isNull())
|
||||
resultObject.message = dataNodeResultListResult["Message"].asString();
|
||||
auto resultDataNode = value["ResultData"];
|
||||
if(!resultDataNode["ImageUrl"].isNull())
|
||||
resultObject.resultData.imageUrl = resultDataNode["ImageUrl"].asString();
|
||||
data_.resultList.push_back(resultObject);
|
||||
}
|
||||
if(!value["Code"].isNull())
|
||||
code_ = value["Code"].asString();
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string CreateSegmentBodyJobResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
CreateSegmentBodyJobResult::Data CreateSegmentBodyJobResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
std::string CreateSegmentBodyJobResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
40
ivpd/src/model/GetJobResultRequest.cc
Normal file
40
ivpd/src/model/GetJobResultRequest.cc
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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/ivpd/model/GetJobResultRequest.h>
|
||||
|
||||
using AlibabaCloud::Ivpd::Model::GetJobResultRequest;
|
||||
|
||||
GetJobResultRequest::GetJobResultRequest() :
|
||||
RpcServiceRequest("ivpd", "2019-06-25", "GetJobResult")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
GetJobResultRequest::~GetJobResultRequest()
|
||||
{}
|
||||
|
||||
std::string GetJobResultRequest::getJobId()const
|
||||
{
|
||||
return jobId_;
|
||||
}
|
||||
|
||||
void GetJobResultRequest::setJobId(const std::string& jobId)
|
||||
{
|
||||
jobId_ = jobId;
|
||||
setBodyParameter("JobId", jobId);
|
||||
}
|
||||
|
||||
81
ivpd/src/model/GetJobResultResult.cc
Normal file
81
ivpd/src/model/GetJobResultResult.cc
Normal file
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* 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/ivpd/model/GetJobResultResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ivpd;
|
||||
using namespace AlibabaCloud::Ivpd::Model;
|
||||
|
||||
GetJobResultResult::GetJobResultResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
GetJobResultResult::GetJobResultResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
GetJobResultResult::~GetJobResultResult()
|
||||
{}
|
||||
|
||||
void GetJobResultResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
if(!dataNode["Status"].isNull())
|
||||
data_.status = dataNode["Status"].asString();
|
||||
if(!dataNode["BatchSize"].isNull())
|
||||
data_.batchSize = dataNode["BatchSize"].asString();
|
||||
if(!dataNode["Finish"].isNull())
|
||||
data_.finish = dataNode["Finish"].asString() == "true";
|
||||
if(!dataNode["Progress"].isNull())
|
||||
data_.progress = std::stof(dataNode["Progress"].asString());
|
||||
if(!dataNode["Message"].isNull())
|
||||
data_.message = dataNode["Message"].asString();
|
||||
if(!dataNode["Completed"].isNull())
|
||||
data_.completed = dataNode["Completed"].asString() == "true";
|
||||
if(!dataNode["TotalUsedTime"].isNull())
|
||||
data_.totalUsedTime = std::stol(dataNode["TotalUsedTime"].asString());
|
||||
auto allResultList = dataNode["ResultList"]["Result"];
|
||||
for (auto value : allResultList)
|
||||
data_.resultList.push_back(value.asString());
|
||||
if(!value["Code"].isNull())
|
||||
code_ = value["Code"].asString();
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string GetJobResultResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
GetJobResultResult::Data GetJobResultResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
std::string GetJobResultResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
40
ivpd/src/model/GetJobStatusRequest.cc
Normal file
40
ivpd/src/model/GetJobStatusRequest.cc
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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/ivpd/model/GetJobStatusRequest.h>
|
||||
|
||||
using AlibabaCloud::Ivpd::Model::GetJobStatusRequest;
|
||||
|
||||
GetJobStatusRequest::GetJobStatusRequest() :
|
||||
RpcServiceRequest("ivpd", "2019-06-25", "GetJobStatus")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
GetJobStatusRequest::~GetJobStatusRequest()
|
||||
{}
|
||||
|
||||
std::string GetJobStatusRequest::getJobId()const
|
||||
{
|
||||
return jobId_;
|
||||
}
|
||||
|
||||
void GetJobStatusRequest::setJobId(const std::string& jobId)
|
||||
{
|
||||
jobId_ = jobId;
|
||||
setBodyParameter("JobId", jobId);
|
||||
}
|
||||
|
||||
80
ivpd/src/model/GetJobStatusResult.cc
Normal file
80
ivpd/src/model/GetJobStatusResult.cc
Normal file
@@ -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.
|
||||
*/
|
||||
|
||||
#include <alibabacloud/ivpd/model/GetJobStatusResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Ivpd;
|
||||
using namespace AlibabaCloud::Ivpd::Model;
|
||||
|
||||
GetJobStatusResult::GetJobStatusResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
GetJobStatusResult::GetJobStatusResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
GetJobStatusResult::~GetJobStatusResult()
|
||||
{}
|
||||
|
||||
void GetJobStatusResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto dataNode = value["Data"];
|
||||
if(!dataNode["Status"].isNull())
|
||||
data_.status = dataNode["Status"].asString();
|
||||
if(!dataNode["BatchSize"].isNull())
|
||||
data_.batchSize = dataNode["BatchSize"].asString();
|
||||
if(!dataNode["Finish"].isNull())
|
||||
data_.finish = dataNode["Finish"].asString() == "true";
|
||||
if(!dataNode["Progress"].isNull())
|
||||
data_.progress = std::stof(dataNode["Progress"].asString());
|
||||
if(!dataNode["Message"].isNull())
|
||||
data_.message = dataNode["Message"].asString();
|
||||
if(!dataNode["Completed"].isNull())
|
||||
data_.completed = dataNode["Completed"].asString() == "true";
|
||||
if(!dataNode["TimeToLive"].isNull())
|
||||
data_.timeToLive = std::stoi(dataNode["TimeToLive"].asString());
|
||||
if(!dataNode["TotalUsedTime"].isNull())
|
||||
data_.totalUsedTime = std::stol(dataNode["TotalUsedTime"].asString());
|
||||
if(!value["Code"].isNull())
|
||||
code_ = value["Code"].asString();
|
||||
if(!value["Message"].isNull())
|
||||
message_ = value["Message"].asString();
|
||||
|
||||
}
|
||||
|
||||
std::string GetJobStatusResult::getMessage()const
|
||||
{
|
||||
return message_;
|
||||
}
|
||||
|
||||
GetJobStatusResult::Data GetJobStatusResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
std::string GetJobStatusResult::getCode()const
|
||||
{
|
||||
return code_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user