Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ZenBridge

Allows interfacing with multiple Boorus simultaneously and provides methods for manipulating the results

Hierarchy

  • ZenBridge

Index

Constructors

Properties

Methods

Object literals

Constructors

constructor

  • Create a ZenBridge with predefined set of Boorus to interface with

    Parameters

    • services: Booru[]

      Array of instances of Booru-compatibiles

    Returns ZenBridge

Properties

services

services: Booru[]

Array of instances of Booru-compatibiles

Methods

aggregate

  • Runs a query and automatically dedupes in one go

    Type parameters

    • T

      One of booru Data interface types

    Parameters

    • type: string

      Query type to execute as a string index

    • query: Query.Any

      Query object with search parameters

    • Optional comparer: comparerCallback<T>

      Comparer function for dedupe (if not provided, built-in comparer is used based on the query type)

    Returns Promise<Array<BooruResult<T>>>

dedupe

  • Returns a copy of BooruResult array with duplicate records removed

    Type parameters

    • T

      One of booru Data interface types

    Parameters

    • data: Array<BooruResult<T>>

      Array of BooruResult objects to search through

    • comparer: comparerCallback<T>

      A function that tests every record in BooruResult data against records in the first dataset and returns true if the record is unique (eg. NOT a duplicate)

    Returns Array<BooruResult<T>>

query

  • query<T>(type: string, query: Query.Any): Promise<Array<BooruResult<T>>>
  • Queris all provided Boorus simultaneously

    Type parameters

    • T

      One of booru Data interface types

    Parameters

    • type: string

      Query type to execute as a string index

    • query: Query.Any

      Query object with search parameters

    Returns Promise<Array<BooruResult<T>>>

    Array of BooruResult objects (site base URI and results from that site)

Static merge

  • Merges results from many booru sites into one array, throws additional info and errored results away

    Type parameters

    • T

      One of booru Data interface types

    Parameters

    Returns T[]

Object literals

Static builtInComparers

builtInComparers: object

Collection of built-in comparer functions for the dedupe method. Note that not all Data types are covered as for some deduping would not make sense. You can of course provide your own comparer to dedupe if you want to dedupe those.

artists

  • Tries to dedupe a collection of Artists based on name and at least one identical link. Note that differernt boorus could still have different info about the same artist, which you would lose by deduping. Remember to use query to get data without deduping!

    Parameters

    Returns boolean

comments

  • Tries to dedupe a collection of Comments based on their content (use with caution, this is potentially too aggressive for short-form comments).

    Parameters

    Returns boolean

posts

  • posts(current: Post, data: Post[]): boolean
  • Dedupes a collection of Posts based on md5. This is useful when (for example) displaying the images, but you lose some information (like comments) that other boorus may have had for the same image.

    Parameters

    Returns boolean

Generated using TypeDoc