@re621/zestyapi
Version:
Comprehensive JS wrapper for e621.net API
34 lines (33 loc) • 1.46 kB
TypeScript
import Endpoint from "../components/Endpoint";
import { FormattedResponse } from "../components/RequestQueue";
import APIResponse from "../responses/APIResponse";
export default class UtilityEndpoint extends Endpoint<APIResponse> {
/**
* Creates a random string of letters, to be used as an ID.
* The IDs are not cryptographically secure, don't use this for anything important.
* There is no garbage collection here, don't forget to use `remove()` if you need to use this for a long time.
* @param unique If false, simply returns a randomized string
*/
makeID(unique?: boolean): string;
/**
* Checks whether the specified ID has been registered
* @param id String ID to check
*/
hasID(id: string): boolean;
/**
* Remove the provided ID from the records.
* Make sure that the corresponding element has also been removed, to avoid possible collisions
* @param id String ID to remove
* @returns true if the ID existed, false otherwise
*/
clearID(id: string): boolean;
/**
* Checks whether or not e621 is accessible by sending a HEAD request.
* @returns {boolean} `true` if you are online, `false` otherwise
*/
isOnline(): Promise<boolean>;
/** Test command that always returns error 403 */
test403(): Promise<FormattedResponse<null>>;
/** Test command that always returns error 404 */
test404(): Promise<FormattedResponse<null>>;
}