Add API UploadStreamByURL.

This commit is contained in:
sdk-team
2021-11-02 04:10:06 +00:00
parent a6fdb87ef4
commit e4fc46970b
9 changed files with 298 additions and 1 deletions

View File

@@ -1,3 +1,6 @@
2021-11-02 Version: 1.36.917
- Add API UploadStreamByURL.
2021-11-02 Version: 1.36.916
- Fixed SDK update delay.

View File

@@ -1 +1 @@
1.36.916
1.36.917

View File

@@ -349,6 +349,8 @@ set(vod_public_header_model
include/alibabacloud/vod/model/UpdateWatermarkResult.h
include/alibabacloud/vod/model/UploadMediaByURLRequest.h
include/alibabacloud/vod/model/UploadMediaByURLResult.h
include/alibabacloud/vod/model/UploadStreamByURLRequest.h
include/alibabacloud/vod/model/UploadStreamByURLResult.h
include/alibabacloud/vod/model/VerifyVodDomainOwnerRequest.h
include/alibabacloud/vod/model/VerifyVodDomainOwnerResult.h )
@@ -682,6 +684,8 @@ set(vod_src
src/model/UpdateWatermarkResult.cc
src/model/UploadMediaByURLRequest.cc
src/model/UploadMediaByURLResult.cc
src/model/UploadStreamByURLRequest.cc
src/model/UploadStreamByURLResult.cc
src/model/VerifyVodDomainOwnerRequest.cc
src/model/VerifyVodDomainOwnerResult.cc )

View File

@@ -350,6 +350,8 @@
#include "model/UpdateWatermarkResult.h"
#include "model/UploadMediaByURLRequest.h"
#include "model/UploadMediaByURLResult.h"
#include "model/UploadStreamByURLRequest.h"
#include "model/UploadStreamByURLResult.h"
#include "model/VerifyVodDomainOwnerRequest.h"
#include "model/VerifyVodDomainOwnerResult.h"
@@ -853,6 +855,9 @@ namespace AlibabaCloud
typedef Outcome<Error, Model::UploadMediaByURLResult> UploadMediaByURLOutcome;
typedef std::future<UploadMediaByURLOutcome> UploadMediaByURLOutcomeCallable;
typedef std::function<void(const VodClient*, const Model::UploadMediaByURLRequest&, const UploadMediaByURLOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UploadMediaByURLAsyncHandler;
typedef Outcome<Error, Model::UploadStreamByURLResult> UploadStreamByURLOutcome;
typedef std::future<UploadStreamByURLOutcome> UploadStreamByURLOutcomeCallable;
typedef std::function<void(const VodClient*, const Model::UploadStreamByURLRequest&, const UploadStreamByURLOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UploadStreamByURLAsyncHandler;
typedef Outcome<Error, Model::VerifyVodDomainOwnerResult> VerifyVodDomainOwnerOutcome;
typedef std::future<VerifyVodDomainOwnerOutcome> VerifyVodDomainOwnerOutcomeCallable;
typedef std::function<void(const VodClient*, const Model::VerifyVodDomainOwnerRequest&, const VerifyVodDomainOwnerOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> VerifyVodDomainOwnerAsyncHandler;
@@ -1353,6 +1358,9 @@ namespace AlibabaCloud
UploadMediaByURLOutcome uploadMediaByURL(const Model::UploadMediaByURLRequest &request)const;
void uploadMediaByURLAsync(const Model::UploadMediaByURLRequest& request, const UploadMediaByURLAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
UploadMediaByURLOutcomeCallable uploadMediaByURLCallable(const Model::UploadMediaByURLRequest& request) const;
UploadStreamByURLOutcome uploadStreamByURL(const Model::UploadStreamByURLRequest &request)const;
void uploadStreamByURLAsync(const Model::UploadStreamByURLRequest& request, const UploadStreamByURLAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
UploadStreamByURLOutcomeCallable uploadStreamByURLCallable(const Model::UploadStreamByURLRequest& request) const;
VerifyVodDomainOwnerOutcome verifyVodDomainOwner(const Model::VerifyVodDomainOwnerRequest &request)const;
void verifyVodDomainOwnerAsync(const Model::VerifyVodDomainOwnerRequest& request, const VerifyVodDomainOwnerAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
VerifyVodDomainOwnerOutcomeCallable verifyVodDomainOwnerCallable(const Model::VerifyVodDomainOwnerRequest& request) const;

View File

@@ -0,0 +1,60 @@
/*
* 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_UPLOADSTREAMBYURLREQUEST_H_
#define ALIBABACLOUD_VOD_MODEL_UPLOADSTREAMBYURLREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/vod/VodExport.h>
namespace AlibabaCloud
{
namespace Vod
{
namespace Model
{
class ALIBABACLOUD_VOD_EXPORT UploadStreamByURLRequest : public RpcServiceRequest
{
public:
UploadStreamByURLRequest();
~UploadStreamByURLRequest();
std::string getFileExtension()const;
void setFileExtension(const std::string& fileExtension);
std::string getMediaId()const;
void setMediaId(const std::string& mediaId);
std::string getUserData()const;
void setUserData(const std::string& userData);
std::string getDefinition()const;
void setDefinition(const std::string& definition);
std::string getStreamURL()const;
void setStreamURL(const std::string& streamURL);
private:
std::string fileExtension_;
std::string mediaId_;
std::string userData_;
std::string definition_;
std::string streamURL_;
};
}
}
}
#endif // !ALIBABACLOUD_VOD_MODEL_UPLOADSTREAMBYURLREQUEST_H_

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_UPLOADSTREAMBYURLRESULT_H_
#define ALIBABACLOUD_VOD_MODEL_UPLOADSTREAMBYURLRESULT_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 UploadStreamByURLResult : public ServiceResult
{
public:
UploadStreamByURLResult();
explicit UploadStreamByURLResult(const std::string &payload);
~UploadStreamByURLResult();
std::string getStreamJobId()const;
protected:
void parse(const std::string &payload);
private:
std::string streamJobId_;
};
}
}
}
#endif // !ALIBABACLOUD_VOD_MODEL_UPLOADSTREAMBYURLRESULT_H_

View File

@@ -5955,6 +5955,42 @@ VodClient::UploadMediaByURLOutcomeCallable VodClient::uploadMediaByURLCallable(c
return task->get_future();
}
VodClient::UploadStreamByURLOutcome VodClient::uploadStreamByURL(const UploadStreamByURLRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return UploadStreamByURLOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return UploadStreamByURLOutcome(UploadStreamByURLResult(outcome.result()));
else
return UploadStreamByURLOutcome(outcome.error());
}
void VodClient::uploadStreamByURLAsync(const UploadStreamByURLRequest& request, const UploadStreamByURLAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, uploadStreamByURL(request), context);
};
asyncExecute(new Runnable(fn));
}
VodClient::UploadStreamByURLOutcomeCallable VodClient::uploadStreamByURLCallable(const UploadStreamByURLRequest &request) const
{
auto task = std::make_shared<std::packaged_task<UploadStreamByURLOutcome()>>(
[this, request]()
{
return this->uploadStreamByURL(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
VodClient::VerifyVodDomainOwnerOutcome VodClient::verifyVodDomainOwner(const VerifyVodDomainOwnerRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -0,0 +1,84 @@
/*
* 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/UploadStreamByURLRequest.h>
using AlibabaCloud::Vod::Model::UploadStreamByURLRequest;
UploadStreamByURLRequest::UploadStreamByURLRequest() :
RpcServiceRequest("vod", "2017-03-21", "UploadStreamByURL")
{
setMethod(HttpRequest::Method::Post);
}
UploadStreamByURLRequest::~UploadStreamByURLRequest()
{}
std::string UploadStreamByURLRequest::getFileExtension()const
{
return fileExtension_;
}
void UploadStreamByURLRequest::setFileExtension(const std::string& fileExtension)
{
fileExtension_ = fileExtension;
setParameter("FileExtension", fileExtension);
}
std::string UploadStreamByURLRequest::getMediaId()const
{
return mediaId_;
}
void UploadStreamByURLRequest::setMediaId(const std::string& mediaId)
{
mediaId_ = mediaId;
setParameter("MediaId", mediaId);
}
std::string UploadStreamByURLRequest::getUserData()const
{
return userData_;
}
void UploadStreamByURLRequest::setUserData(const std::string& userData)
{
userData_ = userData;
setParameter("UserData", userData);
}
std::string UploadStreamByURLRequest::getDefinition()const
{
return definition_;
}
void UploadStreamByURLRequest::setDefinition(const std::string& definition)
{
definition_ = definition;
setParameter("Definition", definition);
}
std::string UploadStreamByURLRequest::getStreamURL()const
{
return streamURL_;
}
void UploadStreamByURLRequest::setStreamURL(const std::string& streamURL)
{
streamURL_ = streamURL;
setParameter("StreamURL", streamURL);
}

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.
*/
#include <alibabacloud/vod/model/UploadStreamByURLResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Vod;
using namespace AlibabaCloud::Vod::Model;
UploadStreamByURLResult::UploadStreamByURLResult() :
ServiceResult()
{}
UploadStreamByURLResult::UploadStreamByURLResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
UploadStreamByURLResult::~UploadStreamByURLResult()
{}
void UploadStreamByURLResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["StreamJobId"].isNull())
streamJobId_ = value["StreamJobId"].asString();
}
std::string UploadStreamByURLResult::getStreamJobId()const
{
return streamJobId_;
}