Increase max number of blocked users loaded from 100 to 1,000 (#4721)
Also includes a little refactor of how the requests are made & how the blocked users are stored
This commit is contained in:
@@ -24,6 +24,8 @@ using HelixFailureCallback = std::function<void()>;
|
||||
template <typename... T>
|
||||
using ResultCallback = std::function<void(T...)>;
|
||||
|
||||
class CancellationToken;
|
||||
|
||||
struct HelixUser {
|
||||
QString id;
|
||||
QString login;
|
||||
@@ -807,8 +809,9 @@ public:
|
||||
|
||||
// https://dev.twitch.tv/docs/api/reference#get-user-block-list
|
||||
virtual void loadBlocks(
|
||||
QString userId, ResultCallback<std::vector<HelixBlock>> successCallback,
|
||||
HelixFailureCallback failureCallback) = 0;
|
||||
QString userId, ResultCallback<std::vector<HelixBlock>> pageCallback,
|
||||
FailureCallback<QString> failureCallback,
|
||||
CancellationToken &&token) = 0;
|
||||
|
||||
// https://dev.twitch.tv/docs/api/reference#block-user
|
||||
virtual void blockUser(QString targetUserId, const QObject *caller,
|
||||
@@ -1126,8 +1129,9 @@ public:
|
||||
|
||||
// https://dev.twitch.tv/docs/api/reference#get-user-block-list
|
||||
void loadBlocks(QString userId,
|
||||
ResultCallback<std::vector<HelixBlock>> successCallback,
|
||||
HelixFailureCallback failureCallback) final;
|
||||
ResultCallback<std::vector<HelixBlock>> pageCallback,
|
||||
FailureCallback<QString> failureCallback,
|
||||
CancellationToken &&token) final;
|
||||
|
||||
// https://dev.twitch.tv/docs/api/reference#block-user
|
||||
void blockUser(QString targetUserId, const QObject *caller,
|
||||
@@ -1406,6 +1410,13 @@ private:
|
||||
NetworkRequest makePut(const QString &url, const QUrlQuery &urlQuery);
|
||||
NetworkRequest makePatch(const QString &url, const QUrlQuery &urlQuery);
|
||||
|
||||
/// Paginate the `url` endpoint and use `baseQuery` as the starting point for pagination.
|
||||
/// @param onPage returns true while a new page is expected. Once false is returned, pagination will stop.
|
||||
void paginate(const QString &url, const QUrlQuery &baseQuery,
|
||||
std::function<bool(const QJsonObject &)> onPage,
|
||||
std::function<void(NetworkResult)> onError,
|
||||
CancellationToken &&token);
|
||||
|
||||
QString clientId;
|
||||
QString oauthToken;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user