Skip to content

Latest commit

 

History

History
42 lines (27 loc) · 1.48 KB

youtubes.js.pagination.next.md

File metadata and controls

42 lines (27 loc) · 1.48 KB

Home > youtubes.js > Pagination > next

Pagination.next() method

Fetches the next page.

Signature:

next(): Promise<Result<Pagination<T>, YouTubesJsErrors> | null>;

Returns:

Promise<Result<Pagination<T>, YouTubesJsErrors> | null>

The next page. If there is no next page, returns null.

Remarks

  • This method will use the same quotas as the original request. - Normally, GET requests use a quota of 1 unit, while other methods use 50 units. - However, some heavy methods use more than 50 units. - See more details on the YouTube Data API reference

Example

import { ApiClient, StaticOAuthProvider } from "youtubes.js";

const oauth = new StaticOAuthProvider({
   accessToken: "ACCESS_TOKEN",
});
const client = new ApiClient({ oauth });

const playlists = await client.playlists.getMine();
if (playlists.isErr()) return;
console.log(playlists.value); // The first page of playlists
const nextPage = await playlists.next();
if (nextPage?.isErr()) return;
console.log(nextPage?.value); // The second page of playlists or null if there is no next page