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

    Class PixivClient

    Main client for the pixiv API.

    Create an instance via PixivClient.of — the constructor is private because initialisation requires an async token refresh.

    Index

    Properties

    illusts: IllustResource

    Illust API namespace.

    images: ImageResource

    Image fetch helpers.

    manga: MangaResource

    Manga API namespace.

    novels: NovelResource

    Novel API namespace.

    ugoira: UgoiraResource

    Ugoira API namespace.

    users: UserResource

    User API namespace.

    Accessors

    • get userId(): number

      Numeric user ID of the authenticated account.

      Available immediately after PixivClient.of resolves. The pixiv OAuth endpoint returns the ID as a string; this getter normalises it to number for consistency with resource method params (e.g. UserBookmarksIllustParams.userId).

      Returns number

      const client = await PixivClient.of(refreshToken)
      const bookmarks = await client.users.bookmarks.illusts({ userId: client.userId })

    Methods

    • Returns the current OAuth access token.

      The access token is short-lived and changes after each call to PixivClient.of and after each automatic token refresh triggered by a 401 response.

      Returns string

      The current bearer access token string

    • Returns the current OAuth refresh token.

      The refresh token is long-lived and is used to obtain new access tokens. It may rotate after a successful token refresh.

      Returns string

      The current refresh token string