diff --git a/CHANGELOG b/CHANGELOG index 75aaefac8..a5dd9e32e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +2020-04-14 Version: 1.36.354 +- Supported CreateSegmentBodyJob. + 2020-04-13 Version: 1.36.353 - Fix ListTaskExecutions SDK error. diff --git a/VERSION b/VERSION index 6c8fa632e..5674f8c88 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.353 \ No newline at end of file +1.36.354 \ No newline at end of file diff --git a/ivpd/CMakeLists.txt b/ivpd/CMakeLists.txt index 41040d9d9..76cd686c6 100644 --- a/ivpd/CMakeLists.txt +++ b/ivpd/CMakeLists.txt @@ -23,10 +23,16 @@ set(ivpd_public_header set(ivpd_public_header_model include/alibabacloud/ivpd/model/ChangeImageSizeRequest.h include/alibabacloud/ivpd/model/ChangeImageSizeResult.h + include/alibabacloud/ivpd/model/CreateSegmentBodyJobRequest.h + include/alibabacloud/ivpd/model/CreateSegmentBodyJobResult.h include/alibabacloud/ivpd/model/DetectImageElementsRequest.h include/alibabacloud/ivpd/model/DetectImageElementsResult.h include/alibabacloud/ivpd/model/ExtendImageStyleRequest.h include/alibabacloud/ivpd/model/ExtendImageStyleResult.h + include/alibabacloud/ivpd/model/GetJobResultRequest.h + include/alibabacloud/ivpd/model/GetJobResultResult.h + include/alibabacloud/ivpd/model/GetJobStatusRequest.h + include/alibabacloud/ivpd/model/GetJobStatusResult.h include/alibabacloud/ivpd/model/MakeSuperResolutionImageRequest.h include/alibabacloud/ivpd/model/MakeSuperResolutionImageResult.h include/alibabacloud/ivpd/model/RecognizeImageColorRequest.h @@ -44,10 +50,16 @@ set(ivpd_src src/IvpdClient.cc src/model/ChangeImageSizeRequest.cc src/model/ChangeImageSizeResult.cc + src/model/CreateSegmentBodyJobRequest.cc + src/model/CreateSegmentBodyJobResult.cc src/model/DetectImageElementsRequest.cc src/model/DetectImageElementsResult.cc src/model/ExtendImageStyleRequest.cc src/model/ExtendImageStyleResult.cc + src/model/GetJobResultRequest.cc + src/model/GetJobResultResult.cc + src/model/GetJobStatusRequest.cc + src/model/GetJobStatusResult.cc src/model/MakeSuperResolutionImageRequest.cc src/model/MakeSuperResolutionImageResult.cc src/model/RecognizeImageColorRequest.cc diff --git a/ivpd/include/alibabacloud/ivpd/IvpdClient.h b/ivpd/include/alibabacloud/ivpd/IvpdClient.h index 0428c3b23..c4122fc20 100644 --- a/ivpd/include/alibabacloud/ivpd/IvpdClient.h +++ b/ivpd/include/alibabacloud/ivpd/IvpdClient.h @@ -24,10 +24,16 @@ #include "IvpdExport.h" #include "model/ChangeImageSizeRequest.h" #include "model/ChangeImageSizeResult.h" +#include "model/CreateSegmentBodyJobRequest.h" +#include "model/CreateSegmentBodyJobResult.h" #include "model/DetectImageElementsRequest.h" #include "model/DetectImageElementsResult.h" #include "model/ExtendImageStyleRequest.h" #include "model/ExtendImageStyleResult.h" +#include "model/GetJobResultRequest.h" +#include "model/GetJobResultResult.h" +#include "model/GetJobStatusRequest.h" +#include "model/GetJobStatusResult.h" #include "model/MakeSuperResolutionImageRequest.h" #include "model/MakeSuperResolutionImageResult.h" #include "model/RecognizeImageColorRequest.h" @@ -52,12 +58,21 @@ namespace AlibabaCloud typedef Outcome ChangeImageSizeOutcome; typedef std::future ChangeImageSizeOutcomeCallable; typedef std::function&)> ChangeImageSizeAsyncHandler; + typedef Outcome CreateSegmentBodyJobOutcome; + typedef std::future CreateSegmentBodyJobOutcomeCallable; + typedef std::function&)> CreateSegmentBodyJobAsyncHandler; typedef Outcome DetectImageElementsOutcome; typedef std::future DetectImageElementsOutcomeCallable; typedef std::function&)> DetectImageElementsAsyncHandler; typedef Outcome ExtendImageStyleOutcome; typedef std::future ExtendImageStyleOutcomeCallable; typedef std::function&)> ExtendImageStyleAsyncHandler; + typedef Outcome GetJobResultOutcome; + typedef std::future GetJobResultOutcomeCallable; + typedef std::function&)> GetJobResultAsyncHandler; + typedef Outcome GetJobStatusOutcome; + typedef std::future GetJobStatusOutcomeCallable; + typedef std::function&)> GetJobStatusAsyncHandler; typedef Outcome MakeSuperResolutionImageOutcome; typedef std::future MakeSuperResolutionImageOutcomeCallable; typedef std::function&)> MakeSuperResolutionImageAsyncHandler; @@ -84,12 +99,21 @@ namespace AlibabaCloud ChangeImageSizeOutcome changeImageSize(const Model::ChangeImageSizeRequest &request)const; void changeImageSizeAsync(const Model::ChangeImageSizeRequest& request, const ChangeImageSizeAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ChangeImageSizeOutcomeCallable changeImageSizeCallable(const Model::ChangeImageSizeRequest& request) const; + CreateSegmentBodyJobOutcome createSegmentBodyJob(const Model::CreateSegmentBodyJobRequest &request)const; + void createSegmentBodyJobAsync(const Model::CreateSegmentBodyJobRequest& request, const CreateSegmentBodyJobAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + CreateSegmentBodyJobOutcomeCallable createSegmentBodyJobCallable(const Model::CreateSegmentBodyJobRequest& request) const; DetectImageElementsOutcome detectImageElements(const Model::DetectImageElementsRequest &request)const; void detectImageElementsAsync(const Model::DetectImageElementsRequest& request, const DetectImageElementsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; DetectImageElementsOutcomeCallable detectImageElementsCallable(const Model::DetectImageElementsRequest& request) const; ExtendImageStyleOutcome extendImageStyle(const Model::ExtendImageStyleRequest &request)const; void extendImageStyleAsync(const Model::ExtendImageStyleRequest& request, const ExtendImageStyleAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ExtendImageStyleOutcomeCallable extendImageStyleCallable(const Model::ExtendImageStyleRequest& request) const; + GetJobResultOutcome getJobResult(const Model::GetJobResultRequest &request)const; + void getJobResultAsync(const Model::GetJobResultRequest& request, const GetJobResultAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetJobResultOutcomeCallable getJobResultCallable(const Model::GetJobResultRequest& request) const; + GetJobStatusOutcome getJobStatus(const Model::GetJobStatusRequest &request)const; + void getJobStatusAsync(const Model::GetJobStatusRequest& request, const GetJobStatusAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + GetJobStatusOutcomeCallable getJobStatusCallable(const Model::GetJobStatusRequest& request) const; MakeSuperResolutionImageOutcome makeSuperResolutionImage(const Model::MakeSuperResolutionImageRequest &request)const; void makeSuperResolutionImageAsync(const Model::MakeSuperResolutionImageRequest& request, const MakeSuperResolutionImageAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; MakeSuperResolutionImageOutcomeCallable makeSuperResolutionImageCallable(const Model::MakeSuperResolutionImageRequest& request) const; diff --git a/ivpd/include/alibabacloud/ivpd/model/CreateSegmentBodyJobRequest.h b/ivpd/include/alibabacloud/ivpd/model/CreateSegmentBodyJobRequest.h new file mode 100644 index 000000000..ed6886bc5 --- /dev/null +++ b/ivpd/include/alibabacloud/ivpd/model/CreateSegmentBodyJobRequest.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_IVPD_MODEL_CREATESEGMENTBODYJOBREQUEST_H_ +#define ALIBABACLOUD_IVPD_MODEL_CREATESEGMENTBODYJOBREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Ivpd + { + namespace Model + { + class ALIBABACLOUD_IVPD_EXPORT CreateSegmentBodyJobRequest : public RpcServiceRequest + { + public: + struct DataList + { + std::string dataId; + std::string imageUrl; + }; + + public: + CreateSegmentBodyJobRequest(); + ~CreateSegmentBodyJobRequest(); + + std::vector getDataList()const; + void setDataList(const std::vector& dataList); + bool getAsync()const; + void setAsync(bool async); + std::string getJobId()const; + void setJobId(const std::string& jobId); + int getTimeToLive()const; + void setTimeToLive(int timeToLive); + + private: + std::vector dataList_; + bool async_; + std::string jobId_; + int timeToLive_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IVPD_MODEL_CREATESEGMENTBODYJOBREQUEST_H_ \ No newline at end of file diff --git a/ivpd/include/alibabacloud/ivpd/model/CreateSegmentBodyJobResult.h b/ivpd/include/alibabacloud/ivpd/model/CreateSegmentBodyJobResult.h new file mode 100644 index 000000000..f38ea698d --- /dev/null +++ b/ivpd/include/alibabacloud/ivpd/model/CreateSegmentBodyJobResult.h @@ -0,0 +1,77 @@ +/* + * 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_IVPD_MODEL_CREATESEGMENTBODYJOBRESULT_H_ +#define ALIBABACLOUD_IVPD_MODEL_CREATESEGMENTBODYJOBRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Ivpd + { + namespace Model + { + class ALIBABACLOUD_IVPD_EXPORT CreateSegmentBodyJobResult : public ServiceResult + { + public: + struct Data + { + struct Result + { + struct ResultData + { + std::string imageUrl; + }; + ResultData resultData; + std::string dataId; + std::string message; + std::string code; + bool success; + }; + std::string status; + int batchSize; + int progress; + std::vector resultList; + long totalUsedTime; + bool completed; + std::string jobId; + }; + + + CreateSegmentBodyJobResult(); + explicit CreateSegmentBodyJobResult(const std::string &payload); + ~CreateSegmentBodyJobResult(); + std::string getMessage()const; + Data getData()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + Data data_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IVPD_MODEL_CREATESEGMENTBODYJOBRESULT_H_ \ No newline at end of file diff --git a/ivpd/include/alibabacloud/ivpd/model/GetJobResultRequest.h b/ivpd/include/alibabacloud/ivpd/model/GetJobResultRequest.h new file mode 100644 index 000000000..94972780a --- /dev/null +++ b/ivpd/include/alibabacloud/ivpd/model/GetJobResultRequest.h @@ -0,0 +1,48 @@ +/* + * 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_IVPD_MODEL_GETJOBRESULTREQUEST_H_ +#define ALIBABACLOUD_IVPD_MODEL_GETJOBRESULTREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Ivpd + { + namespace Model + { + class ALIBABACLOUD_IVPD_EXPORT GetJobResultRequest : public RpcServiceRequest + { + + public: + GetJobResultRequest(); + ~GetJobResultRequest(); + + std::string getJobId()const; + void setJobId(const std::string& jobId); + + private: + std::string jobId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IVPD_MODEL_GETJOBRESULTREQUEST_H_ \ No newline at end of file diff --git a/ivpd/include/alibabacloud/ivpd/model/GetJobResultResult.h b/ivpd/include/alibabacloud/ivpd/model/GetJobResultResult.h new file mode 100644 index 000000000..8980dbd26 --- /dev/null +++ b/ivpd/include/alibabacloud/ivpd/model/GetJobResultResult.h @@ -0,0 +1,66 @@ +/* + * 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_IVPD_MODEL_GETJOBRESULTRESULT_H_ +#define ALIBABACLOUD_IVPD_MODEL_GETJOBRESULTRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Ivpd + { + namespace Model + { + class ALIBABACLOUD_IVPD_EXPORT GetJobResultResult : public ServiceResult + { + public: + struct Data + { + std::string status; + std::string batchSize; + float progress; + std::vector resultList; + std::string message; + long totalUsedTime; + bool completed; + bool finish; + }; + + + GetJobResultResult(); + explicit GetJobResultResult(const std::string &payload); + ~GetJobResultResult(); + std::string getMessage()const; + Data getData()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + Data data_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IVPD_MODEL_GETJOBRESULTRESULT_H_ \ No newline at end of file diff --git a/ivpd/include/alibabacloud/ivpd/model/GetJobStatusRequest.h b/ivpd/include/alibabacloud/ivpd/model/GetJobStatusRequest.h new file mode 100644 index 000000000..1113bcbe8 --- /dev/null +++ b/ivpd/include/alibabacloud/ivpd/model/GetJobStatusRequest.h @@ -0,0 +1,48 @@ +/* + * 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_IVPD_MODEL_GETJOBSTATUSREQUEST_H_ +#define ALIBABACLOUD_IVPD_MODEL_GETJOBSTATUSREQUEST_H_ + +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Ivpd + { + namespace Model + { + class ALIBABACLOUD_IVPD_EXPORT GetJobStatusRequest : public RpcServiceRequest + { + + public: + GetJobStatusRequest(); + ~GetJobStatusRequest(); + + std::string getJobId()const; + void setJobId(const std::string& jobId); + + private: + std::string jobId_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IVPD_MODEL_GETJOBSTATUSREQUEST_H_ \ No newline at end of file diff --git a/ivpd/include/alibabacloud/ivpd/model/GetJobStatusResult.h b/ivpd/include/alibabacloud/ivpd/model/GetJobStatusResult.h new file mode 100644 index 000000000..b5aa3f43c --- /dev/null +++ b/ivpd/include/alibabacloud/ivpd/model/GetJobStatusResult.h @@ -0,0 +1,66 @@ +/* + * 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_IVPD_MODEL_GETJOBSTATUSRESULT_H_ +#define ALIBABACLOUD_IVPD_MODEL_GETJOBSTATUSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Ivpd + { + namespace Model + { + class ALIBABACLOUD_IVPD_EXPORT GetJobStatusResult : public ServiceResult + { + public: + struct Data + { + std::string status; + std::string batchSize; + float progress; + int timeToLive; + std::string message; + long totalUsedTime; + bool completed; + bool finish; + }; + + + GetJobStatusResult(); + explicit GetJobStatusResult(const std::string &payload); + ~GetJobStatusResult(); + std::string getMessage()const; + Data getData()const; + std::string getCode()const; + + protected: + void parse(const std::string &payload); + private: + std::string message_; + Data data_; + std::string code_; + + }; + } + } +} +#endif // !ALIBABACLOUD_IVPD_MODEL_GETJOBSTATUSRESULT_H_ \ No newline at end of file diff --git a/ivpd/src/IvpdClient.cc b/ivpd/src/IvpdClient.cc index aa46e29ab..184c62364 100644 --- a/ivpd/src/IvpdClient.cc +++ b/ivpd/src/IvpdClient.cc @@ -31,21 +31,21 @@ IvpdClient::IvpdClient(const Credentials &credentials, const ClientConfiguration RpcServiceClient(SERVICE_NAME, std::make_shared(credentials), configuration) { auto locationClient = std::make_shared(credentials, configuration); - endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "ivpd"); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); } IvpdClient::IvpdClient(const std::shared_ptr& credentialsProvider, const ClientConfiguration & configuration) : RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration) { auto locationClient = std::make_shared(credentialsProvider, configuration); - endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "ivpd"); + endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, ""); } IvpdClient::IvpdClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) : RpcServiceClient(SERVICE_NAME, std::make_shared(accessKeyId, accessKeySecret), configuration) { auto locationClient = std::make_shared(accessKeyId, accessKeySecret, configuration); - endpointProvider_ = std::make_shared(locationClient, configuration.regionId(), SERVICE_NAME, "ivpd"); + endpointProvider_ = std::make_shared(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& 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>( + [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& 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>( + [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& 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>( + [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(); diff --git a/ivpd/src/model/CreateSegmentBodyJobRequest.cc b/ivpd/src/model/CreateSegmentBodyJobRequest.cc new file mode 100644 index 000000000..02ca4ea98 --- /dev/null +++ b/ivpd/src/model/CreateSegmentBodyJobRequest.cc @@ -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 + +using AlibabaCloud::Ivpd::Model::CreateSegmentBodyJobRequest; + +CreateSegmentBodyJobRequest::CreateSegmentBodyJobRequest() : + RpcServiceRequest("ivpd", "2019-06-25", "CreateSegmentBodyJob") +{ + setMethod(HttpRequest::Method::Post); +} + +CreateSegmentBodyJobRequest::~CreateSegmentBodyJobRequest() +{} + +std::vector CreateSegmentBodyJobRequest::getDataList()const +{ + return dataList_; +} + +void CreateSegmentBodyJobRequest::setDataList(const std::vector& 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)); +} + diff --git a/ivpd/src/model/CreateSegmentBodyJobResult.cc b/ivpd/src/model/CreateSegmentBodyJobResult.cc new file mode 100644 index 000000000..a2532eb66 --- /dev/null +++ b/ivpd/src/model/CreateSegmentBodyJobResult.cc @@ -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 +#include + +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_; +} + diff --git a/ivpd/src/model/GetJobResultRequest.cc b/ivpd/src/model/GetJobResultRequest.cc new file mode 100644 index 000000000..6d3729840 --- /dev/null +++ b/ivpd/src/model/GetJobResultRequest.cc @@ -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 + +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); +} + diff --git a/ivpd/src/model/GetJobResultResult.cc b/ivpd/src/model/GetJobResultResult.cc new file mode 100644 index 000000000..59b8cb6dc --- /dev/null +++ b/ivpd/src/model/GetJobResultResult.cc @@ -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 +#include + +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_; +} + diff --git a/ivpd/src/model/GetJobStatusRequest.cc b/ivpd/src/model/GetJobStatusRequest.cc new file mode 100644 index 000000000..57cbc27d6 --- /dev/null +++ b/ivpd/src/model/GetJobStatusRequest.cc @@ -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 + +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); +} + diff --git a/ivpd/src/model/GetJobStatusResult.cc b/ivpd/src/model/GetJobStatusResult.cc new file mode 100644 index 000000000..b712fb1fc --- /dev/null +++ b/ivpd/src/model/GetJobStatusResult.cc @@ -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 +#include + +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_; +} +