From 1d3414a9201b225e18fd6ef4f506984eedfd278e Mon Sep 17 00:00:00 2001 From: sdk-team Date: Tue, 9 Sep 2025 09:17:01 +0000 Subject: [PATCH] support query rtc live rooms --- VERSION | 2 +- live/CMakeLists.txt | 4 ++ live/include/alibabacloud/live/LiveClient.h | 8 +++ .../live/model/ListRTCLiveRoomsRequest.h | 48 +++++++++++++++ .../live/model/ListRTCLiveRoomsResult.h | 53 +++++++++++++++++ live/src/LiveClient.cc | 36 +++++++++++ live/src/model/ListRTCLiveRoomsRequest.cc | 54 +++++++++++++++++ live/src/model/ListRTCLiveRoomsResult.cc | 59 +++++++++++++++++++ 8 files changed, 263 insertions(+), 1 deletion(-) create mode 100644 live/include/alibabacloud/live/model/ListRTCLiveRoomsRequest.h create mode 100644 live/include/alibabacloud/live/model/ListRTCLiveRoomsResult.h create mode 100644 live/src/model/ListRTCLiveRoomsRequest.cc create mode 100644 live/src/model/ListRTCLiveRoomsResult.cc diff --git a/VERSION b/VERSION index 2a02aca28..b42ae4f24 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.36.2104 \ No newline at end of file +1.36.2105 \ No newline at end of file diff --git a/live/CMakeLists.txt b/live/CMakeLists.txt index 9012aab0f..6aa078db1 100644 --- a/live/CMakeLists.txt +++ b/live/CMakeLists.txt @@ -645,6 +645,8 @@ set(live_public_header_model include/alibabacloud/live/model/ListPlaylistResult.h include/alibabacloud/live/model/ListPlaylistItemsRequest.h include/alibabacloud/live/model/ListPlaylistItemsResult.h + include/alibabacloud/live/model/ListRTCLiveRoomsRequest.h + include/alibabacloud/live/model/ListRTCLiveRoomsResult.h include/alibabacloud/live/model/ListRtcMPUEventSubRecordRequest.h include/alibabacloud/live/model/ListRtcMPUEventSubRecordResult.h include/alibabacloud/live/model/ListRtcMPUTaskDetailRequest.h @@ -1506,6 +1508,8 @@ set(live_src src/model/ListPlaylistResult.cc src/model/ListPlaylistItemsRequest.cc src/model/ListPlaylistItemsResult.cc + src/model/ListRTCLiveRoomsRequest.cc + src/model/ListRTCLiveRoomsResult.cc src/model/ListRtcMPUEventSubRecordRequest.cc src/model/ListRtcMPUEventSubRecordResult.cc src/model/ListRtcMPUTaskDetailRequest.cc diff --git a/live/include/alibabacloud/live/LiveClient.h b/live/include/alibabacloud/live/LiveClient.h index 2742de311..11d78ee28 100644 --- a/live/include/alibabacloud/live/LiveClient.h +++ b/live/include/alibabacloud/live/LiveClient.h @@ -646,6 +646,8 @@ #include "model/ListPlaylistResult.h" #include "model/ListPlaylistItemsRequest.h" #include "model/ListPlaylistItemsResult.h" +#include "model/ListRTCLiveRoomsRequest.h" +#include "model/ListRTCLiveRoomsResult.h" #include "model/ListRtcMPUEventSubRecordRequest.h" #include "model/ListRtcMPUEventSubRecordResult.h" #include "model/ListRtcMPUTaskDetailRequest.h" @@ -1825,6 +1827,9 @@ namespace AlibabaCloud typedef Outcome ListPlaylistItemsOutcome; typedef std::future ListPlaylistItemsOutcomeCallable; typedef std::function&)> ListPlaylistItemsAsyncHandler; + typedef Outcome ListRTCLiveRoomsOutcome; + typedef std::future ListRTCLiveRoomsOutcomeCallable; + typedef std::function&)> ListRTCLiveRoomsAsyncHandler; typedef Outcome ListRtcMPUEventSubRecordOutcome; typedef std::future ListRtcMPUEventSubRecordOutcomeCallable; typedef std::function&)> ListRtcMPUEventSubRecordAsyncHandler; @@ -3117,6 +3122,9 @@ namespace AlibabaCloud ListPlaylistItemsOutcome listPlaylistItems(const Model::ListPlaylistItemsRequest &request)const; void listPlaylistItemsAsync(const Model::ListPlaylistItemsRequest& request, const ListPlaylistItemsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ListPlaylistItemsOutcomeCallable listPlaylistItemsCallable(const Model::ListPlaylistItemsRequest& request) const; + ListRTCLiveRoomsOutcome listRTCLiveRooms(const Model::ListRTCLiveRoomsRequest &request)const; + void listRTCLiveRoomsAsync(const Model::ListRTCLiveRoomsRequest& request, const ListRTCLiveRoomsAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; + ListRTCLiveRoomsOutcomeCallable listRTCLiveRoomsCallable(const Model::ListRTCLiveRoomsRequest& request) const; ListRtcMPUEventSubRecordOutcome listRtcMPUEventSubRecord(const Model::ListRtcMPUEventSubRecordRequest &request)const; void listRtcMPUEventSubRecordAsync(const Model::ListRtcMPUEventSubRecordRequest& request, const ListRtcMPUEventSubRecordAsyncHandler& handler, const std::shared_ptr& context = nullptr) const; ListRtcMPUEventSubRecordOutcomeCallable listRtcMPUEventSubRecordCallable(const Model::ListRtcMPUEventSubRecordRequest& request) const; diff --git a/live/include/alibabacloud/live/model/ListRTCLiveRoomsRequest.h b/live/include/alibabacloud/live/model/ListRTCLiveRoomsRequest.h new file mode 100644 index 000000000..5f05d8bdf --- /dev/null +++ b/live/include/alibabacloud/live/model/ListRTCLiveRoomsRequest.h @@ -0,0 +1,48 @@ +/* + * 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_LIVE_MODEL_LISTRTCLIVEROOMSREQUEST_H_ +#define ALIBABACLOUD_LIVE_MODEL_LISTRTCLIVEROOMSREQUEST_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud { +namespace Live { +namespace Model { +class ALIBABACLOUD_LIVE_EXPORT ListRTCLiveRoomsRequest : public RpcServiceRequest { +public: + ListRTCLiveRoomsRequest(); + ~ListRTCLiveRoomsRequest(); + int getPageNo() const; + void setPageNo(int pageNo); + std::string getAppId() const; + void setAppId(const std::string &appId); + int getPageSize() const; + void setPageSize(int pageSize); + +private: + int pageNo_; + std::string appId_; + int pageSize_; +}; +} // namespace Model +} // namespace Live +} // namespace AlibabaCloud +#endif // !ALIBABACLOUD_LIVE_MODEL_LISTRTCLIVEROOMSREQUEST_H_ diff --git a/live/include/alibabacloud/live/model/ListRTCLiveRoomsResult.h b/live/include/alibabacloud/live/model/ListRTCLiveRoomsResult.h new file mode 100644 index 000000000..e3e718f01 --- /dev/null +++ b/live/include/alibabacloud/live/model/ListRTCLiveRoomsResult.h @@ -0,0 +1,53 @@ +/* + * 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_LIVE_MODEL_LISTRTCLIVEROOMSRESULT_H_ +#define ALIBABACLOUD_LIVE_MODEL_LISTRTCLIVEROOMSRESULT_H_ + +#include +#include +#include +#include +#include + +namespace AlibabaCloud +{ + namespace Live + { + namespace Model + { + class ALIBABACLOUD_LIVE_EXPORT ListRTCLiveRoomsResult : public ServiceResult + { + public: + + + ListRTCLiveRoomsResult(); + explicit ListRTCLiveRoomsResult(const std::string &payload); + ~ListRTCLiveRoomsResult(); + int getTotal()const; + std::vector getRooms()const; + + protected: + void parse(const std::string &payload); + private: + int total_; + std::vector rooms_; + + }; + } + } +} +#endif // !ALIBABACLOUD_LIVE_MODEL_LISTRTCLIVEROOMSRESULT_H_ \ No newline at end of file diff --git a/live/src/LiveClient.cc b/live/src/LiveClient.cc index 5c270d7fb..8652c98fd 100644 --- a/live/src/LiveClient.cc +++ b/live/src/LiveClient.cc @@ -11283,6 +11283,42 @@ LiveClient::ListPlaylistItemsOutcomeCallable LiveClient::listPlaylistItemsCallab return task->get_future(); } +LiveClient::ListRTCLiveRoomsOutcome LiveClient::listRTCLiveRooms(const ListRTCLiveRoomsRequest &request) const +{ + auto endpointOutcome = endpointProvider_->getEndpoint(); + if (!endpointOutcome.isSuccess()) + return ListRTCLiveRoomsOutcome(endpointOutcome.error()); + + auto outcome = makeRequest(endpointOutcome.result(), request); + + if (outcome.isSuccess()) + return ListRTCLiveRoomsOutcome(ListRTCLiveRoomsResult(outcome.result())); + else + return ListRTCLiveRoomsOutcome(outcome.error()); +} + +void LiveClient::listRTCLiveRoomsAsync(const ListRTCLiveRoomsRequest& request, const ListRTCLiveRoomsAsyncHandler& handler, const std::shared_ptr& context) const +{ + auto fn = [this, request, handler, context]() + { + handler(this, request, listRTCLiveRooms(request), context); + }; + + asyncExecute(new Runnable(fn)); +} + +LiveClient::ListRTCLiveRoomsOutcomeCallable LiveClient::listRTCLiveRoomsCallable(const ListRTCLiveRoomsRequest &request) const +{ + auto task = std::make_shared>( + [this, request]() + { + return this->listRTCLiveRooms(request); + }); + + asyncExecute(new Runnable([task]() { (*task)(); })); + return task->get_future(); +} + LiveClient::ListRtcMPUEventSubRecordOutcome LiveClient::listRtcMPUEventSubRecord(const ListRtcMPUEventSubRecordRequest &request) const { auto endpointOutcome = endpointProvider_->getEndpoint(); diff --git a/live/src/model/ListRTCLiveRoomsRequest.cc b/live/src/model/ListRTCLiveRoomsRequest.cc new file mode 100644 index 000000000..6fd3465aa --- /dev/null +++ b/live/src/model/ListRTCLiveRoomsRequest.cc @@ -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. + */ + +#include + +using AlibabaCloud::Live::Model::ListRTCLiveRoomsRequest; + +ListRTCLiveRoomsRequest::ListRTCLiveRoomsRequest() + : RpcServiceRequest("live", "2016-11-01", "ListRTCLiveRooms") { + setMethod(HttpRequest::Method::Post); +} + +ListRTCLiveRoomsRequest::~ListRTCLiveRoomsRequest() {} + +int ListRTCLiveRoomsRequest::getPageNo() const { + return pageNo_; +} + +void ListRTCLiveRoomsRequest::setPageNo(int pageNo) { + pageNo_ = pageNo; + setParameter(std::string("PageNo"), std::to_string(pageNo)); +} + +std::string ListRTCLiveRoomsRequest::getAppId() const { + return appId_; +} + +void ListRTCLiveRoomsRequest::setAppId(const std::string &appId) { + appId_ = appId; + setParameter(std::string("AppId"), appId); +} + +int ListRTCLiveRoomsRequest::getPageSize() const { + return pageSize_; +} + +void ListRTCLiveRoomsRequest::setPageSize(int pageSize) { + pageSize_ = pageSize; + setParameter(std::string("PageSize"), std::to_string(pageSize)); +} + diff --git a/live/src/model/ListRTCLiveRoomsResult.cc b/live/src/model/ListRTCLiveRoomsResult.cc new file mode 100644 index 000000000..a2acf79ec --- /dev/null +++ b/live/src/model/ListRTCLiveRoomsResult.cc @@ -0,0 +1,59 @@ +/* + * 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::Live; +using namespace AlibabaCloud::Live::Model; + +ListRTCLiveRoomsResult::ListRTCLiveRoomsResult() : + ServiceResult() +{} + +ListRTCLiveRoomsResult::ListRTCLiveRoomsResult(const std::string &payload) : + ServiceResult() +{ + parse(payload); +} + +ListRTCLiveRoomsResult::~ListRTCLiveRoomsResult() +{} + +void ListRTCLiveRoomsResult::parse(const std::string &payload) +{ + Json::Reader reader; + Json::Value value; + reader.parse(payload, value); + setRequestId(value["RequestId"].asString()); + auto allRooms = value["Rooms"]["rooms"]; + for (const auto &item : allRooms) + rooms_.push_back(item.asString()); + if(!value["Total"].isNull()) + total_ = std::stoi(value["Total"].asString()); + +} + +int ListRTCLiveRoomsResult::getTotal()const +{ + return total_; +} + +std::vector ListRTCLiveRoomsResult::getRooms()const +{ + return rooms_; +} +