diff --git a/CHANGELOG b/CHANGELOG index 081d8a92f..cbe70241a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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. diff --git a/VERSION b/VERSION index 8e38a1021..528cacc46 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.916 \ No newline at end of file +1.36.917 \ No newline at end of file diff --git a/vod/CMakeLists.txt b/vod/CMakeLists.txt index ba240f847..9054530dc 100644 --- a/vod/CMakeLists.txt +++ b/vod/CMakeLists.txt @@ -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 ) diff --git a/vod/include/alibabacloud/vod/VodClient.h b/vod/include/alibabacloud/vod/VodClient.h index 9314e25a1..ee5a7a091 100644 --- a/vod/include/alibabacloud/vod/VodClient.h +++ b/vod/include/alibabacloud/vod/VodClient.h @@ -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 UploadMediaByURLOutcome; typedef std::future UploadMediaByURLOutcomeCallable; typedef std::function&)> UploadMediaByURLAsyncHandler; + typedef Outcome UploadStreamByURLOutcome; + typedef std::future UploadStreamByURLOutcomeCallable; + typedef std::function&)> UploadStreamByURLAsyncHandler; typedef Outcome VerifyVodDomainOwnerOutcome; typedef std::future VerifyVodDomainOwnerOutcomeCallable; typedef std::function&)> 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& 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& 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& context = nullptr) const; VerifyVodDomainOwnerOutcomeCallable verifyVodDomainOwnerCallable(const Model::VerifyVodDomainOwnerRequest& request) const; diff --git a/vod/include/alibabacloud/vod/model/UploadStreamByURLRequest.h b/vod/include/alibabacloud/vod/model/UploadStreamByURLRequest.h new file mode 100644 index 000000000..7dea6626d --- /dev/null +++ b/vod/include/alibabacloud/vod/model/UploadStreamByURLRequest.h @@ -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 +#include +#include +#include + +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_ \ No newline at end of file diff --git a/vod/include/alibabacloud/vod/model/UploadStreamByURLResult.h b/vod/include/alibabacloud/vod/model/UploadStreamByURLResult.h new file mode 100644 index 000000000..232ea8b2c --- /dev/null +++ b/vod/include/alibabacloud/vod/model/UploadStreamByURLResult.h @@ -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 +#include +#include +#include +#include + +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_ \ No newline at end of file diff --git a/vod/src/VodClient.cc b/vod/src/VodClient.cc index bcf95fcaf..2bbc93ed1 100644 --- a/vod/src/VodClient.cc +++ b/vod/src/VodClient.cc @@ -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& 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>( + [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(); diff --git a/vod/src/model/UploadStreamByURLRequest.cc b/vod/src/model/UploadStreamByURLRequest.cc new file mode 100644 index 000000000..3fa603f42 --- /dev/null +++ b/vod/src/model/UploadStreamByURLRequest.cc @@ -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 + +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); +} + diff --git a/vod/src/model/UploadStreamByURLResult.cc b/vod/src/model/UploadStreamByURLResult.cc new file mode 100644 index 000000000..64becf4af --- /dev/null +++ b/vod/src/model/UploadStreamByURLResult.cc @@ -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 +#include + +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_; +} +