booru
Version:
Search (and do other things) on a bunch of different boorus!
76 lines • 3.06 kB
TypeScript
/**
* @packageDocumentation
* @module Index
*/
import Booru, { type BooruCredentials } from './boorus/Booru';
import Derpibooru from './boorus/Derpibooru';
import XmlBooru from './boorus/XmlBooru';
import Post from './structures/Post';
import type SearchParameters from './structures/SearchParameters';
import SearchResults from './structures/SearchResults';
import Site from './structures/Site';
import type TagListParameters from './structures/TagListParameters';
import type TagListResults from './structures/TagListResults';
/**
* Create a new booru to search with
*
* @constructor
* @param {String} site The {@link Site} domain (or alias of it) to create a booru from
* @param {BooruCredentials} credentials The credentials to use on this booru
* @return {Booru} A booru to use
*/
declare function booruForSite(site: string, credentials?: BooruCredentials): Booru;
export { booruForSite as forSite };
export default booruForSite;
export interface BooruSearch extends SearchParameters {
credentials?: BooruCredentials;
}
export interface BooruTagList extends TagListParameters {
credentials?: BooruCredentials;
}
/**
* Searches a site for images with tags and returns the results
* @param {String} site The site to search
* @param {String[]|String} [tags=[]] Tags to search with
* @param {SearchParameters} [searchOptions={}] The options for searching
* if provided (Unused)
* @return {Promise<SearchResults>} A promise with the images as an array of objects
*
* @example
* ```
* const Booru = require('booru')
* // Returns a promise with the latest cute glace pic from e926
* Booru.search('e926', ['glaceon', 'cute'])
* ```
*/
export declare function search(site: string, tags?: string[] | string, { limit, random, page, credentials }?: BooruSearch): Promise<SearchResults>;
/**
* Get a list of tags from a site
* @param {String} site The site to get the tags from
* @param {TagListParameters} [options={}] The options for the tag list
* @return {Promise<TagListResults>} A promise with the tags as an array of objects
*
* @example
* ```
* const Booru = require('booru')
* // Returns a promise with the first 100 tags from e926
* Booru.tagList('e926')
* ```
*/
export declare function tagList(site: string, { limit, page, credentials }?: BooruTagList): Promise<TagListResults>;
/**
* Deprecated, now a noop
* <p>This will be removed *soon* please stop using it</p>
* <p>Just access <code><{@link Post}>.prop</code>, no need to commonfy anymore
*
* @deprecated Just use <code><{@link Post}>.prop</code> instead
* @param {Post[]} images Array of {@link Post} objects
* @return {Promise<Post[]>} Array of {@link Post} objects
*/
export declare function commonfy(images: Post[]): Promise<Post[]>;
export { Booru as BooruClass } from './boorus/Booru';
export { BooruError, sites } from './Constants';
export { resolveSite } from './Utils';
export { Derpibooru, Post, SearchResults, Site, XmlBooru };
export type { BooruCredentials, SearchParameters };
//# sourceMappingURL=index.d.ts.map