Remove authenticated get function from urlfetch
Implement twitch account emote getter function in TwitchAccount
This commit is contained in:
@@ -18,10 +18,12 @@ struct Serialize<QString> {
|
||||
|
||||
template <>
|
||||
struct Deserialize<QString> {
|
||||
static QString get(const rapidjson::Value &value)
|
||||
static QString get(const rapidjson::Value &value, bool *error = nullptr)
|
||||
{
|
||||
if (!value.IsString()) {
|
||||
throw std::runtime_error("Deserialized rapidjson::Value is not a string");
|
||||
PAJLADA_REPORT_ERROR(error)
|
||||
PAJLADA_THROW_EXCEPTION("Deserialized rapidjson::Value is not a string");
|
||||
return QString{};
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -35,7 +37,7 @@ struct Deserialize<QString> {
|
||||
// int y = 5;
|
||||
}
|
||||
|
||||
return QString();
|
||||
return QString{};
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -50,21 +50,6 @@ static void twitchApiGet2(QString url, const QObject *caller, bool useQuickLoadC
|
||||
});
|
||||
}
|
||||
|
||||
static void twitchApiGetAuthorized(QString url, const QString &clientID, const QString &oauthToken,
|
||||
const QObject *caller,
|
||||
std::function<void(const QJsonObject &)> successCallback)
|
||||
{
|
||||
NetworkRequest req(url);
|
||||
req.setCaller(caller);
|
||||
req.setRawHeader("Client-ID", clientID.toUtf8());
|
||||
req.setRawHeader("Authorization", "OAuth " + oauthToken.toUtf8());
|
||||
req.setRawHeader("Accept", "application/vnd.twitchtv.v5+json");
|
||||
|
||||
req.getJSON([=](const QJsonObject &node) {
|
||||
successCallback(node); //
|
||||
});
|
||||
}
|
||||
|
||||
static void twitchApiGetUserID(QString username, const QObject *caller,
|
||||
std::function<void(QString)> successCallback)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user