Add GetImageInfos api.

This commit is contained in:
sdk-team
2022-07-28 06:42:44 +00:00
parent 29faefa1ab
commit 58b8b52591
9 changed files with 347 additions and 1 deletions

View File

@@ -2535,6 +2535,42 @@ VodClient::GetImageInfoOutcomeCallable VodClient::getImageInfoCallable(const Get
return task->get_future();
}
VodClient::GetImageInfosOutcome VodClient::getImageInfos(const GetImageInfosRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return GetImageInfosOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return GetImageInfosOutcome(GetImageInfosResult(outcome.result()));
else
return GetImageInfosOutcome(outcome.error());
}
void VodClient::getImageInfosAsync(const GetImageInfosRequest& request, const GetImageInfosAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, getImageInfos(request), context);
};
asyncExecute(new Runnable(fn));
}
VodClient::GetImageInfosOutcomeCallable VodClient::getImageInfosCallable(const GetImageInfosRequest &request) const
{
auto task = std::make_shared<std::packaged_task<GetImageInfosOutcome()>>(
[this, request]()
{
return this->getImageInfos(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
VodClient::GetMediaAuditAudioResultDetailOutcome VodClient::getMediaAuditAudioResultDetail(const GetMediaAuditAudioResultDetailRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -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.
*/
#include <alibabacloud/vod/model/GetImageInfosRequest.h>
using AlibabaCloud::Vod::Model::GetImageInfosRequest;
GetImageInfosRequest::GetImageInfosRequest()
: RpcServiceRequest("vod", "2017-03-21", "GetImageInfos") {
setMethod(HttpRequest::Method::Post);
}
GetImageInfosRequest::~GetImageInfosRequest() {}
std::string GetImageInfosRequest::getAccessKeyId() const {
return accessKeyId_;
}
void GetImageInfosRequest::setAccessKeyId(const std::string &accessKeyId) {
accessKeyId_ = accessKeyId;
setParameter(std::string("AccessKeyId"), accessKeyId);
}
std::string GetImageInfosRequest::getOutputType() const {
return outputType_;
}
void GetImageInfosRequest::setOutputType(const std::string &outputType) {
outputType_ = outputType;
setParameter(std::string("OutputType"), outputType);
}
long GetImageInfosRequest::getAuthTimeout() const {
return authTimeout_;
}
void GetImageInfosRequest::setAuthTimeout(long authTimeout) {
authTimeout_ = authTimeout;
setParameter(std::string("AuthTimeout"), std::to_string(authTimeout));
}
std::string GetImageInfosRequest::getImageIds() const {
return imageIds_;
}
void GetImageInfosRequest::setImageIds(const std::string &imageIds) {
imageIds_ = imageIds;
setParameter(std::string("ImageIds"), imageIds);
}

View File

@@ -0,0 +1,102 @@
/*
* 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/vod/model/GetImageInfosResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Vod;
using namespace AlibabaCloud::Vod::Model;
GetImageInfosResult::GetImageInfosResult() :
ServiceResult()
{}
GetImageInfosResult::GetImageInfosResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
GetImageInfosResult::~GetImageInfosResult()
{}
void GetImageInfosResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto allImageInfoNode = value["ImageInfo"]["Image"];
for (auto valueImageInfoImage : allImageInfoNode)
{
Image imageInfoObject;
if(!valueImageInfoImage["CreationTime"].isNull())
imageInfoObject.creationTime = valueImageInfoImage["CreationTime"].asString();
if(!valueImageInfoImage["StorageLocation"].isNull())
imageInfoObject.storageLocation = valueImageInfoImage["StorageLocation"].asString();
if(!valueImageInfoImage["Status"].isNull())
imageInfoObject.status = valueImageInfoImage["Status"].asString();
if(!valueImageInfoImage["CateId"].isNull())
imageInfoObject.cateId = std::stol(valueImageInfoImage["CateId"].asString());
if(!valueImageInfoImage["Tags"].isNull())
imageInfoObject.tags = valueImageInfoImage["Tags"].asString();
if(!valueImageInfoImage["RegionId"].isNull())
imageInfoObject.regionId = valueImageInfoImage["RegionId"].asString();
if(!valueImageInfoImage["ImageType"].isNull())
imageInfoObject.imageType = valueImageInfoImage["ImageType"].asString();
if(!valueImageInfoImage["CateName"].isNull())
imageInfoObject.cateName = valueImageInfoImage["CateName"].asString();
if(!valueImageInfoImage["Description"].isNull())
imageInfoObject.description = valueImageInfoImage["Description"].asString();
if(!valueImageInfoImage["AppId"].isNull())
imageInfoObject.appId = valueImageInfoImage["AppId"].asString();
if(!valueImageInfoImage["URL"].isNull())
imageInfoObject.uRL = valueImageInfoImage["URL"].asString();
if(!valueImageInfoImage["Title"].isNull())
imageInfoObject.title = valueImageInfoImage["Title"].asString();
if(!valueImageInfoImage["ImageId"].isNull())
imageInfoObject.imageId = valueImageInfoImage["ImageId"].asString();
if(!valueImageInfoImage["AuditStatus"].isNull())
imageInfoObject.auditStatus = valueImageInfoImage["AuditStatus"].asString();
auto mezzanineNode = value["Mezzanine"];
if(!mezzanineNode["FileURL"].isNull())
imageInfoObject.mezzanine.fileURL = mezzanineNode["FileURL"].asString();
if(!mezzanineNode["OriginalFileName"].isNull())
imageInfoObject.mezzanine.originalFileName = mezzanineNode["OriginalFileName"].asString();
if(!mezzanineNode["Width"].isNull())
imageInfoObject.mezzanine.width = std::stoi(mezzanineNode["Width"].asString());
if(!mezzanineNode["Height"].isNull())
imageInfoObject.mezzanine.height = std::stoi(mezzanineNode["Height"].asString());
if(!mezzanineNode["FileSize"].isNull())
imageInfoObject.mezzanine.fileSize = mezzanineNode["FileSize"].asString();
imageInfo_.push_back(imageInfoObject);
}
auto allNonExistImageIds = value["NonExistImageIds"]["ImageId"];
for (const auto &item : allNonExistImageIds)
nonExistImageIds_.push_back(item.asString());
}
std::vector<std::string> GetImageInfosResult::getNonExistImageIds()const
{
return nonExistImageIds_;
}
std::vector<GetImageInfosResult::Image> GetImageInfosResult::getImageInfo()const
{
return imageInfo_;
}