@book000/pixivts - v0.61.1
    Preparing search index...

    Class PaginatedResultAsync<TPage, TItem>

    A ResultAsync<TPage, PixivError> with additional .pages() / .items() async generators for consuming paginated pixiv list responses.

    Returned by all resource methods that produce a nextUrl field.

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Methods

    • Async generator that yields individual items across all pages.

      If any page fetch fails, the generator throws a PixivFetchError.

      Returns AsyncGenerator<TItem, void, unknown>

      for await (const illust of client.illusts.search({ word: 'cat' }).items()) {
      console.log(illust.title)
      }
    • Async generator that yields each page starting from the first.

      If any page fetch fails, the generator throws a PixivFetchError.

      Returns AsyncGenerator<TPage, void, unknown>

      for await (const page of client.illusts.search({ word: 'cat' }).pages()) {
      console.log(page.illusts.length)
      }
    • Wraps a Promise<T> into a ResultAsync<T, E>.

      If the promise rejects, onError maps the rejection reason to E.

      Type Parameters

      • T
      • E

      Parameters

      • promise: Promise<T>

        The promise to wrap

      • onError: (reason: unknown) => E

        Error mapper

      Returns ResultAsync<T, E>