UNPKG

@re621/zestyapi

Version:

Comprehensive JS wrapper for e621.net API

30 lines (29 loc) 1.11 kB
import Endpoint, { SearchParams } from "../components/Endpoint"; import { FormattedResponse } from "../components/RequestQueue"; import { APITag, APITagCategory } from "../responses/APITag"; export default class TagsEndpoint extends Endpoint<APITag> { Category: typeof APITagCategory; protected endpoint: string; protected searchParams: string[]; find(search?: TagSearchParams): Promise<FormattedResponse<APITag>>; /** * Fetch user data based on the exact ID or name. * [b]Important:[/b] Due to a bug in E621's API, requests to this endpoint * may not return JSON if the tag does not exist. If you are not sure, use * `find()` instead, as it does not have that problem. * @param {string} tag Tag name * @returns {FormattedResponse<APITag>} Tag data */ get(tag: string): Promise<FormattedResponse<APITag>>; } interface TagSearchParams extends SearchParams { name?: string | string[]; category?: APITagCategory; order?: TagSearchOrder; } declare enum TagSearchOrder { Newest = "date", Count = "count", Name = "name" } export {};