Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Booru

An instance of a specific booru site. Has common methods for getting data from a booru. Can be used on its own or as a ZenBridge service.

Hierarchy

Index

Constructors

constructor

  • Create instance of a specific booru site

    Parameters

    • base: string

      Base URI of a booru site

    • Optional credentials: Credentials

      Credentials for authentication on the site

    Returns Booru

Properties

base

base: string

Base URI of a booru site

Protected Abstract converter

converter: Converter

Functions that convert API responses to Booru data objects

Optional options

options: Map<string, any>

Stores any global options for the booru. This has different members based on the booru type.

Protected Optional pCredentials

pCredentials: Credentials

Stores credentials for authentication. From outside the class, use credentials accessor or set it in the constructor directly.

Protected Abstract uriBuilder

uriBuilder: UriBuilder

Functions that build the URI to fetch for each Booru function

Abstract xml

xml: boolean

True if this booru has a XML-based API.

Accessors

credentials

  • Set credentials object to use for authentication on the site. See Credentials for more about required fields.

    Parameters

    Returns void

Protected fetchOptions

  • get fetchOptions(): object

loggedIn

  • get loggedIn(): boolean
  • Check if the auth credentials are set

    Returns boolean

Methods

artist

  • artist(id: number | string): Promise<Artist>
  • Get a single Artist by ID

    Parameters

    • id: number | string

      ID of the artist

    Returns Promise<Artist>

artists

  • Get an array of Artists that match a query

    Parameters

    • query: Artists

      Artists search query object

    Returns Promise<Artist[]>

comment

  • comment(id: number | string): Promise<Comment>
  • Get a single Comment by ID

    Parameters

    • id: number | string

      ID of the comment

    Returns Promise<Comment>

comments

  • Get an array of Comments that match a query

    Parameters

    • query: Comments

      Comments search query object

    Returns Promise<Comment[]>

  • Get back the Post you passed in with the comments field populated

    Parameters

    • post: Post

      The post to find comments for

    Returns Promise<Post>

Abstract favorite

  • favorite(id: number | string): Promise<boolean>
  • Add a post to favorites

    precondition

    Credentials are set (for authentication, see credentials)

    Parameters

    • id: number | string

      ID of the target post

    Returns Promise<boolean>

Protected fetch

  • fetch(path: string, config?: undefined | object): Promise<any>
  • GET an API call result as an object

    Parameters

    • path: string

      Part of the URI appended to the base

    • Optional config: undefined | object

      Axios config object

    Returns Promise<any>

Protected genericQuery

  • genericQuery(type: string, query: Query.Any): Promise<any[]>
  • Parameters

    • type: string
    • query: Query.Any

    Returns Promise<any[]>

Protected genericSingle

  • genericSingle(type: string, id: number | string): Promise<any>
  • Parameters

    • type: string
    • id: number | string

    Returns Promise<any>

note

  • note(id: number | string): Promise<Note>
  • Get a single Note by ID

    Parameters

    • id: number | string

      ID of the note

    Returns Promise<Note>

notes

  • Get an array of Notes that match a query

    Parameters

    • query: Notes

      Notes search query object

    Returns Promise<Note[]>

  • Get back the Post you passed in with the notes field populated

    Parameters

    • post: Post

      The post to find notes for

    Returns Promise<Post>

pool

  • pool(id: number | string): Promise<Pool>
  • Get a single Pool by ID

    Parameters

    • id: number | string

      ID of the pool

    Returns Promise<Pool>

pools

  • Get an array of Pools that match a query

    Parameters

    • query: Pools

      Pools search query object

    Returns Promise<Pool[]>

post

  • post(id: number | string): Promise<Post>
  • Get a single Post by ID

    Parameters

    • id: number | string

      ID of the post

    Returns Promise<Post>

posts

  • Get an array of Posts that match a query

    Parameters

    • query: Posts

      Posts search query object

    Returns Promise<Post[]>

Abstract unfavorite

  • unfavorite(id: number | string): Promise<boolean>
  • Remove a post from favorites

    precondition

    Credentials are set (for authentication, see credentials)

    Parameters

    • id: number | string

      ID of the target post

    Returns Promise<boolean>

user

  • user(id: number | string): Promise<User>
  • Get a single User by ID

    Parameters

    • id: number | string

      ID of the user

    Returns Promise<User>

users

  • Get an array of Users that match a query

    Parameters

    • query: Users

      Users search query object

    Returns Promise<User[]>

wiki

  • wiki(id: number | string): Promise<Wiki>
  • Get a single Wiki page by ID

    Parameters

    • id: number | string

      ID of the wiki page

    Returns Promise<Wiki>

wikis

  • Get an array of Wikis that match a query

    Parameters

    • query: Wikis

      Wikis search query object

    Returns Promise<Wiki[]>

Generated using TypeDoc