Added clip creation support 🎬 (#2271)

You can create clips with `/clip` command, `Alt+X` keybind or `Create a clip` option in split header's context menu. This requires a new authentication scope so re-authentication will be required to use it.

Co-authored-by: Leon Richardt <leon.richardt@gmail.com>
Co-authored-by: pajlada <rasmus.karlsson@pajlada.com>
This commit is contained in:
Paweł
2021-01-17 14:47:34 +01:00
committed by GitHub
parent 0542b81a03
commit cfcac99ae6
12 changed files with 253 additions and 8 deletions
+25
View File
@@ -135,6 +135,23 @@ struct HelixGame {
}
};
struct HelixClip {
QString id; // clip slug
QString editUrl;
explicit HelixClip(QJsonObject jsonObject)
: id(jsonObject.value("id").toString())
, editUrl(jsonObject.value("edit_url").toString())
{
}
};
enum class HelixClipError {
Unknown,
ClipsDisabled,
UserNotAuthenticated,
};
class Helix final : boost::noncopyable
{
public:
@@ -185,14 +202,22 @@ public:
void getGameById(QString gameId, ResultCallback<HelixGame> successCallback,
HelixFailureCallback failureCallback);
// https://dev.twitch.tv/docs/api/reference#create-user-follows
void followUser(QString userId, QString targetId,
std::function<void()> successCallback,
HelixFailureCallback failureCallback);
// https://dev.twitch.tv/docs/api/reference#delete-user-follows
void unfollowUser(QString userId, QString targetlId,
std::function<void()> successCallback,
HelixFailureCallback failureCallback);
// https://dev.twitch.tv/docs/api/reference#create-clip
void createClip(QString channelId,
ResultCallback<HelixClip> successCallback,
std::function<void(HelixClipError)> failureCallback,
std::function<void()> finallyCallback);
void update(QString clientId, QString oauthToken);
static void initialize();