feat: add duration and title options to clip command (#6669)

Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
iProdigy
2025-12-28 05:26:48 -06:00
committed by GitHub
parent e084ae6ef1
commit a9ab584cbb
9 changed files with 60 additions and 10 deletions
+3 -2
View File
@@ -1956,7 +1956,8 @@ void TwitchChannel::setCheerEmoteSets(
*this->cheerEmoteSets_.access() = std::move(emoteSets);
}
void TwitchChannel::createClip()
void TwitchChannel::createClip(const QString &title,
const std::optional<int> duration)
{
if (!this->isLive())
{
@@ -1980,7 +1981,7 @@ void TwitchChannel::createClip()
this->isClipCreationInProgress = true;
getHelix()->createClip(
this->roomId(),
this->roomId(), title, duration,
// successCallback
[this](const HelixClip &clip) {
MessageBuilder builder;
+1 -1
View File
@@ -182,7 +182,7 @@ public:
bool canReconnect() const override;
void reconnect() override;
QString getCurrentStreamID() const override;
void createClip();
void createClip(const QString &title, std::optional<int> duration);
/// Delete the message with the specified ID as a moderator.
///
+12 -1
View File
@@ -354,13 +354,24 @@ void Helix::getGameById(QString gameId,
}
void Helix::createClip(
QString channelId, ResultCallback<HelixClip> successCallback,
QString channelId, QString title, std::optional<int> duration,
ResultCallback<HelixClip> successCallback,
std::function<void(HelixClipError, QString)> failureCallback,
std::function<void()> finallyCallback)
{
QUrlQuery urlQuery;
urlQuery.addQueryItem("broadcaster_id", channelId);
if (!title.isEmpty())
{
urlQuery.addQueryItem("title", title);
}
if (duration.has_value())
{
urlQuery.addQueryItem("duration", QString::number(*duration));
}
this->makePost("clips", urlQuery)
.header("Content-Type", "application/json")
.onSuccess([successCallback, failureCallback](auto result) {
+4 -2
View File
@@ -1036,7 +1036,8 @@ public:
// https://dev.twitch.tv/docs/api/reference#create-clip
virtual void createClip(
QString channelId, ResultCallback<HelixClip> successCallback,
QString channelId, QString title, std::optional<int> duration,
ResultCallback<HelixClip> successCallback,
std::function<void(HelixClipError, QString)> failureCallback,
std::function<void()> finallyCallback) = 0;
@@ -1428,7 +1429,8 @@ public:
// https://dev.twitch.tv/docs/api/reference#create-clip
void createClip(
QString channelId, ResultCallback<HelixClip> successCallback,
QString channelId, QString title, std::optional<int> duration,
ResultCallback<HelixClip> successCallback,
std::function<void(HelixClipError, QString)> failureCallback,
std::function<void()> finallyCallback) final;