Files
chatterino2/src/providers/seventv/eventapi/Dispatch.hpp
nerix 33fa3e0a97 Use New 7TV Cosmetics System (#4512)
* feat(seventv): use new cosmetics system

* chore: add changelog entry

* fix: old `clang-format`

* fix: small suggestions pt1

* refactor: add 7tv api wrapper

* fix: small clang-tidy things

* fix: remove unused constants

* fix: old clangtidy

* refactor: rename

* fix: increase interval to 60s

* fix: newline

* fix: Twitch

* docs: add comment

* fix: remove v2 badges endpoint

* fix: deadlock

This is actually really sad.

* fix: remove api entry

* fix: old clang-format

* Sort functions in SeventvBadges.hpp/cpp

* Remove unused vector include

* Add comments to SeventvBadges.hpp functions

* Rename `addBadge` to `registerBadge`

* fix: cleanup eventloop

* ci(test): add timeout

---------

Co-authored-by: Felanbird <41973452+Felanbird@users.noreply.github.com>
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
2023-07-29 09:49:44 +00:00

94 lines
2.0 KiB
C++

#pragma once
#include "providers/seventv/eventapi/Subscription.hpp"
#include "providers/seventv/SeventvCosmetics.hpp"
#include <QJsonObject>
#include <QString>
namespace chatterino::seventv::eventapi {
// https://github.com/SevenTV/EventAPI/tree/ca4ff15cc42b89560fa661a76c5849047763d334#message-payload
struct Dispatch {
SubscriptionType type;
QJsonObject body;
QString id;
// it's okay for this to be empty
QString actorName;
Dispatch(QJsonObject obj);
};
struct EmoteAddDispatch {
QString emoteSetID;
QString actorName;
QJsonObject emoteJson;
QString emoteID;
EmoteAddDispatch(const Dispatch &dispatch, QJsonObject emote);
bool validate() const;
};
struct EmoteRemoveDispatch {
QString emoteSetID;
QString actorName;
QString emoteName;
QString emoteID;
EmoteRemoveDispatch(const Dispatch &dispatch, QJsonObject emote);
bool validate() const;
};
struct EmoteUpdateDispatch {
QString emoteSetID;
QString actorName;
QString emoteID;
QString oldEmoteName;
QString emoteName;
EmoteUpdateDispatch(const Dispatch &dispatch, QJsonObject oldValue,
QJsonObject value);
bool validate() const;
};
struct UserConnectionUpdateDispatch {
QString userID;
QString actorName;
QString oldEmoteSetID;
QString emoteSetID;
size_t connectionIndex;
UserConnectionUpdateDispatch(const Dispatch &dispatch,
const QJsonObject &update,
size_t connectionIndex);
bool validate() const;
};
struct CosmeticCreateDispatch {
QJsonObject data;
CosmeticKind kind;
CosmeticCreateDispatch(const Dispatch &dispatch);
bool validate() const;
};
struct EntitlementCreateDeleteDispatch {
/** id of the user */
QString userID;
QString userName;
/** id of the entitlement */
QString refID;
CosmeticKind kind;
EntitlementCreateDeleteDispatch(const Dispatch &dispatch);
bool validate() const;
};
} // namespace chatterino::seventv::eventapi