Add source id for file uploader.

This commit is contained in:
sdk-team
2020-07-22 00:18:27 +08:00
parent a4f9a98de3
commit 812a50b07f
13 changed files with 325 additions and 6 deletions

View File

@@ -1,3 +1,6 @@
2020-07-22 Version: 1.36.525
- Add source id for file uploader.
2020-07-21 Version: 1.36.524
- Support Tag API.

View File

@@ -1 +1 @@
1.36.524
1.36.525

View File

@@ -79,6 +79,8 @@ set(vcs_public_header_model
include/alibabacloud/vcs/model/RecognizeFaceQualityResult.h
include/alibabacloud/vcs/model/RecognizeImageRequest.h
include/alibabacloud/vcs/model/RecognizeImageResult.h
include/alibabacloud/vcs/model/SaveVideoSummaryTaskVideoRequest.h
include/alibabacloud/vcs/model/SaveVideoSummaryTaskVideoResult.h
include/alibabacloud/vcs/model/SearchBodyRequest.h
include/alibabacloud/vcs/model/SearchBodyResult.h
include/alibabacloud/vcs/model/SearchFaceRequest.h
@@ -154,6 +156,8 @@ set(vcs_src
src/model/RecognizeFaceQualityResult.cc
src/model/RecognizeImageRequest.cc
src/model/RecognizeImageResult.cc
src/model/SaveVideoSummaryTaskVideoRequest.cc
src/model/SaveVideoSummaryTaskVideoResult.cc
src/model/SearchBodyRequest.cc
src/model/SearchBodyResult.cc
src/model/SearchFaceRequest.cc

View File

@@ -80,6 +80,8 @@
#include "model/RecognizeFaceQualityResult.h"
#include "model/RecognizeImageRequest.h"
#include "model/RecognizeImageResult.h"
#include "model/SaveVideoSummaryTaskVideoRequest.h"
#include "model/SaveVideoSummaryTaskVideoResult.h"
#include "model/SearchBodyRequest.h"
#include "model/SearchBodyResult.h"
#include "model/SearchFaceRequest.h"
@@ -190,6 +192,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::RecognizeImageResult> RecognizeImageOutcome;
typedef std::future<RecognizeImageOutcome> RecognizeImageOutcomeCallable;
typedef std::function<void(const VcsClient*, const Model::RecognizeImageRequest&, const RecognizeImageOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RecognizeImageAsyncHandler;
typedef Outcome<Error, Model::SaveVideoSummaryTaskVideoResult> SaveVideoSummaryTaskVideoOutcome;
typedef std::future<SaveVideoSummaryTaskVideoOutcome> SaveVideoSummaryTaskVideoOutcomeCallable;
typedef std::function<void(const VcsClient*, const Model::SaveVideoSummaryTaskVideoRequest&, const SaveVideoSummaryTaskVideoOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SaveVideoSummaryTaskVideoAsyncHandler;
typedef Outcome<Error, Model::SearchBodyResult> SearchBodyOutcome;
typedef std::future<SearchBodyOutcome> SearchBodyOutcomeCallable;
typedef std::function<void(const VcsClient*, const Model::SearchBodyRequest&, const SearchBodyOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> SearchBodyAsyncHandler;
@@ -303,6 +308,9 @@ namespace AlibabaCloud
RecognizeImageOutcome recognizeImage(const Model::RecognizeImageRequest &request)const;
void recognizeImageAsync(const Model::RecognizeImageRequest& request, const RecognizeImageAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
RecognizeImageOutcomeCallable recognizeImageCallable(const Model::RecognizeImageRequest& request) const;
SaveVideoSummaryTaskVideoOutcome saveVideoSummaryTaskVideo(const Model::SaveVideoSummaryTaskVideoRequest &request)const;
void saveVideoSummaryTaskVideoAsync(const Model::SaveVideoSummaryTaskVideoRequest& request, const SaveVideoSummaryTaskVideoAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
SaveVideoSummaryTaskVideoOutcomeCallable saveVideoSummaryTaskVideoCallable(const Model::SaveVideoSummaryTaskVideoRequest& request) const;
SearchBodyOutcome searchBody(const Model::SearchBodyRequest &request)const;
void searchBodyAsync(const Model::SearchBodyRequest& request, const SearchBodyAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
SearchBodyOutcomeCallable searchBodyCallable(const Model::SearchBodyRequest& request) const;

View File

@@ -43,12 +43,15 @@ namespace AlibabaCloud
void setDescription(const std::string& description);
std::string getDataSourceName()const;
void setDataSourceName(const std::string& dataSourceName);
int getFileRetentionDays()const;
void setFileRetentionDays(int fileRetentionDays);
private:
std::string dataSourceType_;
std::string corpId_;
std::string description_;
std::string dataSourceName_;
int fileRetentionDays_;
};
}

View File

@@ -0,0 +1,54 @@
/*
* 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_VCS_MODEL_SAVEVIDEOSUMMARYTASKVIDEOREQUEST_H_
#define ALIBABACLOUD_VCS_MODEL_SAVEVIDEOSUMMARYTASKVIDEOREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/vcs/VcsExport.h>
namespace AlibabaCloud
{
namespace Vcs
{
namespace Model
{
class ALIBABACLOUD_VCS_EXPORT SaveVideoSummaryTaskVideoRequest : public RpcServiceRequest
{
public:
SaveVideoSummaryTaskVideoRequest();
~SaveVideoSummaryTaskVideoRequest();
std::string getCorpId()const;
void setCorpId(const std::string& corpId);
bool getSaveVideo()const;
void setSaveVideo(bool saveVideo);
long getTaskId()const;
void setTaskId(long taskId);
private:
std::string corpId_;
bool saveVideo_;
long taskId_;
};
}
}
}
#endif // !ALIBABACLOUD_VCS_MODEL_SAVEVIDEOSUMMARYTASKVIDEOREQUEST_H_

View File

@@ -0,0 +1,55 @@
/*
* 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_VCS_MODEL_SAVEVIDEOSUMMARYTASKVIDEORESULT_H_
#define ALIBABACLOUD_VCS_MODEL_SAVEVIDEOSUMMARYTASKVIDEORESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/vcs/VcsExport.h>
namespace AlibabaCloud
{
namespace Vcs
{
namespace Model
{
class ALIBABACLOUD_VCS_EXPORT SaveVideoSummaryTaskVideoResult : public ServiceResult
{
public:
SaveVideoSummaryTaskVideoResult();
explicit SaveVideoSummaryTaskVideoResult(const std::string &payload);
~SaveVideoSummaryTaskVideoResult();
std::string getMessage()const;
std::string getData()const;
std::string getCode()const;
protected:
void parse(const std::string &payload);
private:
std::string message_;
std::string data_;
std::string code_;
};
}
}
}
#endif // !ALIBABACLOUD_VCS_MODEL_SAVEVIDEOSUMMARYTASKVIDEORESULT_H_

View File

@@ -32,20 +32,29 @@ namespace AlibabaCloud
class ALIBABACLOUD_VCS_EXPORT UploadFileResult : public ServiceResult
{
public:
struct Data
{
struct OssPath
{
std::string ossPath;
std::string sourceId;
};
std::vector<OssPath> records;
};
UploadFileResult();
explicit UploadFileResult(const std::string &payload);
~UploadFileResult();
std::string getMessage()const;
std::string getData()const;
Data getData()const;
std::string getCode()const;
protected:
void parse(const std::string &payload);
private:
std::string message_;
std::string data_;
Data data_;
std::string code_;
};

View File

@@ -1095,6 +1095,42 @@ VcsClient::RecognizeImageOutcomeCallable VcsClient::recognizeImageCallable(const
return task->get_future();
}
VcsClient::SaveVideoSummaryTaskVideoOutcome VcsClient::saveVideoSummaryTaskVideo(const SaveVideoSummaryTaskVideoRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return SaveVideoSummaryTaskVideoOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return SaveVideoSummaryTaskVideoOutcome(SaveVideoSummaryTaskVideoResult(outcome.result()));
else
return SaveVideoSummaryTaskVideoOutcome(outcome.error());
}
void VcsClient::saveVideoSummaryTaskVideoAsync(const SaveVideoSummaryTaskVideoRequest& request, const SaveVideoSummaryTaskVideoAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, saveVideoSummaryTaskVideo(request), context);
};
asyncExecute(new Runnable(fn));
}
VcsClient::SaveVideoSummaryTaskVideoOutcomeCallable VcsClient::saveVideoSummaryTaskVideoCallable(const SaveVideoSummaryTaskVideoRequest &request) const
{
auto task = std::make_shared<std::packaged_task<SaveVideoSummaryTaskVideoOutcome()>>(
[this, request]()
{
return this->saveVideoSummaryTaskVideo(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
VcsClient::SearchBodyOutcome VcsClient::searchBody(const SearchBodyRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -71,3 +71,14 @@ void AddDataSourceRequest::setDataSourceName(const std::string& dataSourceName)
setBodyParameter("DataSourceName", dataSourceName);
}
int AddDataSourceRequest::getFileRetentionDays()const
{
return fileRetentionDays_;
}
void AddDataSourceRequest::setFileRetentionDays(int fileRetentionDays)
{
fileRetentionDays_ = fileRetentionDays;
setBodyParameter("FileRetentionDays", std::to_string(fileRetentionDays));
}

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/vcs/model/SaveVideoSummaryTaskVideoRequest.h>
using AlibabaCloud::Vcs::Model::SaveVideoSummaryTaskVideoRequest;
SaveVideoSummaryTaskVideoRequest::SaveVideoSummaryTaskVideoRequest() :
RpcServiceRequest("vcs", "2020-05-15", "SaveVideoSummaryTaskVideo")
{
setMethod(HttpRequest::Method::Post);
}
SaveVideoSummaryTaskVideoRequest::~SaveVideoSummaryTaskVideoRequest()
{}
std::string SaveVideoSummaryTaskVideoRequest::getCorpId()const
{
return corpId_;
}
void SaveVideoSummaryTaskVideoRequest::setCorpId(const std::string& corpId)
{
corpId_ = corpId;
setBodyParameter("CorpId", corpId);
}
bool SaveVideoSummaryTaskVideoRequest::getSaveVideo()const
{
return saveVideo_;
}
void SaveVideoSummaryTaskVideoRequest::setSaveVideo(bool saveVideo)
{
saveVideo_ = saveVideo;
setBodyParameter("SaveVideo", saveVideo ? "true" : "false");
}
long SaveVideoSummaryTaskVideoRequest::getTaskId()const
{
return taskId_;
}
void SaveVideoSummaryTaskVideoRequest::setTaskId(long taskId)
{
taskId_ = taskId;
setBodyParameter("TaskId", std::to_string(taskId));
}

View File

@@ -0,0 +1,65 @@
/*
* 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/vcs/model/SaveVideoSummaryTaskVideoResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Vcs;
using namespace AlibabaCloud::Vcs::Model;
SaveVideoSummaryTaskVideoResult::SaveVideoSummaryTaskVideoResult() :
ServiceResult()
{}
SaveVideoSummaryTaskVideoResult::SaveVideoSummaryTaskVideoResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
SaveVideoSummaryTaskVideoResult::~SaveVideoSummaryTaskVideoResult()
{}
void SaveVideoSummaryTaskVideoResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Data"].isNull())
data_ = value["Data"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
}
std::string SaveVideoSummaryTaskVideoResult::getMessage()const
{
return message_;
}
std::string SaveVideoSummaryTaskVideoResult::getData()const
{
return data_;
}
std::string SaveVideoSummaryTaskVideoResult::getCode()const
{
return code_;
}

View File

@@ -39,10 +39,19 @@ void UploadFileResult::parse(const std::string &payload)
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
auto allRecordsNode = dataNode["Records"]["OssPath"];
for (auto dataNodeRecordsOssPath : allRecordsNode)
{
Data::OssPath ossPathObject;
if(!dataNodeRecordsOssPath["OssPath"].isNull())
ossPathObject.ossPath = dataNodeRecordsOssPath["OssPath"].asString();
if(!dataNodeRecordsOssPath["SourceId"].isNull())
ossPathObject.sourceId = dataNodeRecordsOssPath["SourceId"].asString();
data_.records.push_back(ossPathObject);
}
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["Data"].isNull())
data_ = value["Data"].asString();
if(!value["Message"].isNull())
message_ = value["Message"].asString();
@@ -53,7 +62,7 @@ std::string UploadFileResult::getMessage()const
return message_;
}
std::string UploadFileResult::getData()const
UploadFileResult::Data UploadFileResult::getData()const
{
return data_;
}