Class WaifuClient

WaifuClient is the main class used to interact with the Waifu.im API.

Constructors

Properties

token?: string

The token used for authentication, if provided.

userAgent: string

The User-Agent used in requests.

Methods

  • Type Parameters

    • T

    Parameters

    • endpoint: string
    • Optional body: unknown

    Returns Promise<T>

  • Removes an image from the user

    Parameters

    • image_id: number

      The ID of the image to insert.

    • Optional user_id: number

      The user ID of the user whose favorites you want to edit. Defaults to token's owner.

    Returns Promise<FavoriteStatus>

  • Get your favorites. By default, this endpoint returns all images in the user favorites, meaning it will also returns lewd images if there are some in the user favorites.

    Parameters

    • Optional query: SearchQuery

      Search query options.

    • Optional userId: number

    Returns Promise<Image[]>

    Array of images.

  • Get full tag information.

    Parameters

    • full: true

    Returns Promise<Tags<Tag>>

  • Get list of available tags.

    Parameters

    • full: false

    Returns Promise<Tags<string>>

  • Gets the list of available tags.

    Parameters

    • full: boolean

      Whether to return full tag information.

    Returns Promise<Tags<Tag> | Tags<string>>

  • Inserts an image into the user

    Parameters

    • image_id: number

      The ID of the image to insert.

    • Optional user_id: number

      The user ID of the user whose favorites you want to edit. Defaults to token's owner.

    Returns Promise<FavoriteStatus>

  • Reports an image. Used to report any inappropriate, offensive or wrongly labelled image in the API. Requires report permission.

    Parameters

    • image_id: number

      The ID of the image to report.

    • description: string

      A brief explanation (up to 200 characters) used to describe the issue.

    Returns Promise<ImageReport>

  • Search images. Retrieves images randomly or by tag based on the specified search criteria.

    Parameters

    Returns Promise<Image[]>

    Array of images.

  • Toggles an image in the user

    Parameters

    • image_id: number

      The ID of the image to insert.

    • Optional user_id: number

      The user ID of the user whose favorites you want to edit. Defaults to token's owner.

    Returns Promise<FavoriteStatus>