feat: add duration and title options to clip command (#6669)
Reviewed-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
///
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user