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

@@ -159,6 +159,8 @@ set(vod_public_header_model
include/alibabacloud/vod/model/GetEditingProjectMaterialsResult.h
include/alibabacloud/vod/model/GetImageInfoRequest.h
include/alibabacloud/vod/model/GetImageInfoResult.h
include/alibabacloud/vod/model/GetImageInfosRequest.h
include/alibabacloud/vod/model/GetImageInfosResult.h
include/alibabacloud/vod/model/GetMediaAuditAudioResultDetailRequest.h
include/alibabacloud/vod/model/GetMediaAuditAudioResultDetailResult.h
include/alibabacloud/vod/model/GetMediaAuditResultRequest.h
@@ -450,6 +452,8 @@ set(vod_src
src/model/GetEditingProjectMaterialsResult.cc
src/model/GetImageInfoRequest.cc
src/model/GetImageInfoResult.cc
src/model/GetImageInfosRequest.cc
src/model/GetImageInfosResult.cc
src/model/GetMediaAuditAudioResultDetailRequest.cc
src/model/GetMediaAuditAudioResultDetailResult.cc
src/model/GetMediaAuditResultRequest.cc

View File

@@ -160,6 +160,8 @@
#include "model/GetEditingProjectMaterialsResult.h"
#include "model/GetImageInfoRequest.h"
#include "model/GetImageInfoResult.h"
#include "model/GetImageInfosRequest.h"
#include "model/GetImageInfosResult.h"
#include "model/GetMediaAuditAudioResultDetailRequest.h"
#include "model/GetMediaAuditAudioResultDetailResult.h"
#include "model/GetMediaAuditResultRequest.h"
@@ -526,6 +528,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::GetImageInfoResult> GetImageInfoOutcome;
typedef std::future<GetImageInfoOutcome> GetImageInfoOutcomeCallable;
typedef std::function<void(const VodClient*, const Model::GetImageInfoRequest&, const GetImageInfoOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetImageInfoAsyncHandler;
typedef Outcome<Error, Model::GetImageInfosResult> GetImageInfosOutcome;
typedef std::future<GetImageInfosOutcome> GetImageInfosOutcomeCallable;
typedef std::function<void(const VodClient*, const Model::GetImageInfosRequest&, const GetImageInfosOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetImageInfosAsyncHandler;
typedef Outcome<Error, Model::GetMediaAuditAudioResultDetailResult> GetMediaAuditAudioResultDetailOutcome;
typedef std::future<GetMediaAuditAudioResultDetailOutcome> GetMediaAuditAudioResultDetailOutcomeCallable;
typedef std::function<void(const VodClient*, const Model::GetMediaAuditAudioResultDetailRequest&, const GetMediaAuditAudioResultDetailOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> GetMediaAuditAudioResultDetailAsyncHandler;
@@ -963,6 +968,9 @@ namespace AlibabaCloud
GetImageInfoOutcome getImageInfo(const Model::GetImageInfoRequest &request)const;
void getImageInfoAsync(const Model::GetImageInfoRequest& request, const GetImageInfoAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
GetImageInfoOutcomeCallable getImageInfoCallable(const Model::GetImageInfoRequest& request) const;
GetImageInfosOutcome getImageInfos(const Model::GetImageInfosRequest &request)const;
void getImageInfosAsync(const Model::GetImageInfosRequest& request, const GetImageInfosAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
GetImageInfosOutcomeCallable getImageInfosCallable(const Model::GetImageInfosRequest& request) const;
GetMediaAuditAudioResultDetailOutcome getMediaAuditAudioResultDetail(const Model::GetMediaAuditAudioResultDetailRequest &request)const;
void getMediaAuditAudioResultDetailAsync(const Model::GetMediaAuditAudioResultDetailRequest& request, const GetMediaAuditAudioResultDetailAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
GetMediaAuditAudioResultDetailOutcomeCallable getMediaAuditAudioResultDetailCallable(const Model::GetMediaAuditAudioResultDetailRequest& request) const;

View File

@@ -0,0 +1,51 @@
/*
* 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_VOD_MODEL_GETIMAGEINFOSREQUEST_H_
#define ALIBABACLOUD_VOD_MODEL_GETIMAGEINFOSREQUEST_H_
#include <alibabacloud/vod/VodExport.h>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <string>
#include <vector>
#include <map>
namespace AlibabaCloud {
namespace Vod {
namespace Model {
class ALIBABACLOUD_VOD_EXPORT GetImageInfosRequest : public RpcServiceRequest {
public:
GetImageInfosRequest();
~GetImageInfosRequest();
std::string getAccessKeyId() const;
void setAccessKeyId(const std::string &accessKeyId);
std::string getOutputType() const;
void setOutputType(const std::string &outputType);
long getAuthTimeout() const;
void setAuthTimeout(long authTimeout);
std::string getImageIds() const;
void setImageIds(const std::string &imageIds);
private:
std::string accessKeyId_;
std::string outputType_;
long authTimeout_;
std::string imageIds_;
};
} // namespace Model
} // namespace Vod
} // namespace AlibabaCloud
#endif // !ALIBABACLOUD_VOD_MODEL_GETIMAGEINFOSREQUEST_H_

View File

@@ -0,0 +1,79 @@
/*
* 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_VOD_MODEL_GETIMAGEINFOSRESULT_H_
#define ALIBABACLOUD_VOD_MODEL_GETIMAGEINFOSRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/vod/VodExport.h>
namespace AlibabaCloud
{
namespace Vod
{
namespace Model
{
class ALIBABACLOUD_VOD_EXPORT GetImageInfosResult : public ServiceResult
{
public:
struct Image
{
struct Mezzanine
{
std::string fileURL;
std::string originalFileName;
int height;
int width;
std::string fileSize;
};
std::string status;
std::string description;
Mezzanine mezzanine;
std::string title;
long cateId;
std::string cateName;
std::string uRL;
std::string imageType;
std::string auditStatus;
std::string appId;
std::string creationTime;
std::string imageId;
std::string regionId;
std::string storageLocation;
std::string tags;
};
GetImageInfosResult();
explicit GetImageInfosResult(const std::string &payload);
~GetImageInfosResult();
std::vector<std::string> getNonExistImageIds()const;
std::vector<Image> getImageInfo()const;
protected:
void parse(const std::string &payload);
private:
std::vector<std::string> nonExistImageIds_;
std::vector<Image> imageInfo_;
};
}
}
}
#endif // !ALIBABACLOUD_VOD_MODEL_GETIMAGEINFOSRESULT_H_

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_;
}