twitcheasy-twitch-bottwitch-authtwitch-auth-tmitwitch-chat-clienttwitch-eventsubtwitch-pubsub-clienttwitch-webhooks
Welcome

HelixPaginatedRequest<D, T>

Represents a request to the new Twitch API (Helix) that utilizes a cursor to paginate through its results.

Overview

Aside from the methods described below, you can also utilize the async iterator using for await .. of:

const result = client.helix.videos.getVideosByUserPaginated('125328655');
for await (const video of result) {
    console.log(video.title);
}

Properties

current

Type: ?Array<D>

The last retrieved page of data associated to the requested resource.

Only works with HelixPaginatedRequest#getNext and not with any other methods of data retrieval.

currentCursor

Type: ?string

Retrieves the current cursor.

Only useful if you want to make manual requests to the API.

Methods

[Symbol.asyncIterator]()

Return type: AsyncGenerator<T, void, undefined>

getAll()

async

Retrieves and returns all data associated to the requested resource.

Be aware that this makes multiple calls to the Twitch API. Due to this, you might be more suspectible to rate limits.

Also be aware that this resets the internal cursor, so avoid using this and HelixPaginatedRequest#getNext together.

Return type: Array<T>

getNext()

async

Retrieves and returns the next available page of data associated to the requested resource, or an empty array if there are no more available pages.

Return type: Array<T>

reset()

Resets the internal cursor.

This will make HelixPaginatedRequest#getNext start from the first page again.

Return type: void