Prettify scripts
parent
eace0e6056
commit
9d8118aca8
|
@ -33,7 +33,11 @@ export declare function isLogged(): boolean;
|
|||
* Callback used if two-factor authentication is required for the profile.
|
||||
* It must return he OTP code to use for the login.
|
||||
*/
|
||||
export declare function login(username: string, password: string, cb2fa?: () => Promise<number>): Promise<LoginResult>;
|
||||
export declare function login(
|
||||
username: string,
|
||||
password: string,
|
||||
cb2fa?: () => Promise<number>
|
||||
): Promise<LoginResult>;
|
||||
/**
|
||||
* Chek if exists a new version of the handiwork.
|
||||
*
|
||||
|
@ -48,7 +52,10 @@ export declare function checkIfHandiworkHasUpdate(hw: HandiWork): Promise<boolea
|
|||
* @param {HandiworkSearchQuery} query Parameters used for the search.
|
||||
* @param {Number} limit Maximum number of results. Default: 10
|
||||
*/
|
||||
export declare function searchHandiwork<T extends IBasic>(query: HandiworkSearchQuery, limit?: number): Promise<T[]>;
|
||||
export declare function searchHandiwork<T extends IBasic>(
|
||||
query: HandiworkSearchQuery,
|
||||
limit?: number
|
||||
): Promise<T[]>;
|
||||
/**
|
||||
* Given the url, it gets all the information about the handiwork requested.
|
||||
*
|
||||
|
@ -71,4 +78,7 @@ export declare function getUserData(): Promise<UserProfile>;
|
|||
* @param {LatestSearchQuery} query Parameters used for the search.
|
||||
* @param {Number} limit Maximum number of results. Default: 10
|
||||
*/
|
||||
export declare function getLatestUpdates<T extends IBasic>(query: LatestSearchQuery, limit?: number): Promise<T[]>;
|
||||
export declare function getLatestUpdates<T extends IBasic>(
|
||||
query: LatestSearchQuery,
|
||||
limit?: number
|
||||
): Promise<T[]>;
|
||||
|
|
|
@ -24,10 +24,7 @@ export declare class UnexpectedResponseContentType extends Error implements IBas
|
|||
error: Error;
|
||||
constructor(args: IBaseError);
|
||||
}
|
||||
export declare class InvalidF95Token extends Error {
|
||||
}
|
||||
export declare class UserNotLogged extends Error {
|
||||
}
|
||||
export declare class ParameterError extends Error {
|
||||
}
|
||||
export declare class InvalidF95Token extends Error {}
|
||||
export declare class UserNotLogged extends Error {}
|
||||
export declare class ParameterError extends Error {}
|
||||
export {};
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
import { TAuthor, TRating, IHandiwork, TEngine, TCategory, TStatus } from "../../interfaces";
|
||||
import {
|
||||
TAuthor,
|
||||
TRating,
|
||||
IHandiwork,
|
||||
TEngine,
|
||||
TCategory,
|
||||
TStatus
|
||||
} from "../../interfaces";
|
||||
/**
|
||||
* It represents a generic work, be it a game, a comic, an animation or an asset.
|
||||
*/
|
||||
|
|
|
@ -20,7 +20,13 @@ import { Result } from "../result.js";
|
|||
*
|
||||
* `views`: Order based on the number of visits. Replacement: `replies`.
|
||||
*/
|
||||
declare type THandiworkOrder = "date" | "likes" | "relevance" | "replies" | "title" | "views";
|
||||
declare type THandiworkOrder =
|
||||
| "date"
|
||||
| "likes"
|
||||
| "relevance"
|
||||
| "replies"
|
||||
| "title"
|
||||
| "views";
|
||||
declare type TExecuteResult = Result<GenericAxiosError, AxiosResponse<any>>;
|
||||
export default class HandiworkSearchQuery implements IQuery {
|
||||
static MIN_PAGE: number;
|
||||
|
|
|
@ -8,4 +8,7 @@ import HandiworkSearchQuery from "../classes/query/handiwork-search-query";
|
|||
* Maximum number of items to get. Default: 30
|
||||
* @returns {Promise<String[]>} URLs of the handiworks
|
||||
*/
|
||||
export default function fetchHandiworkURLs(query: HandiworkSearchQuery, limit?: number): Promise<string[]>;
|
||||
export default function fetchHandiworkURLs(
|
||||
query: HandiworkSearchQuery,
|
||||
limit?: number
|
||||
): Promise<string[]>;
|
||||
|
|
|
@ -9,4 +9,7 @@ import LatestSearchQuery from "../classes/query/latest-search-query.js";
|
|||
* Maximum number of items to get. Default: 30
|
||||
* @returns {Promise<String[]>} URLs of the handiworks
|
||||
*/
|
||||
export default function fetchLatestHandiworkURLs(query: LatestSearchQuery, limit?: number): Promise<string[]>;
|
||||
export default function fetchLatestHandiworkURLs(
|
||||
query: LatestSearchQuery,
|
||||
limit?: number
|
||||
): Promise<string[]>;
|
||||
|
|
|
@ -4,4 +4,7 @@ import { IQuery } from "../interfaces.js";
|
|||
* @param limit Maximum number of items to get. Default: 30
|
||||
* @returns URLs of the fetched games
|
||||
*/
|
||||
export default function getURLsFromQuery(query: IQuery, limit?: number): Promise<string[]>;
|
||||
export default function getURLsFromQuery(
|
||||
query: IQuery,
|
||||
limit?: number
|
||||
): Promise<string[]>;
|
||||
|
|
|
@ -9,4 +9,7 @@ import ThreadSearchQuery from "../classes/query/thread-search-query.js";
|
|||
* Maximum number of items to get. Default: 30
|
||||
* @returns {Promise<String[]>} URLs of the handiworks
|
||||
*/
|
||||
export default function fetchThreadHandiworkURLs(query: ThreadSearchQuery, limit?: number): Promise<string[]>;
|
||||
export default function fetchThreadHandiworkURLs(
|
||||
query: ThreadSearchQuery,
|
||||
limit?: number
|
||||
): Promise<string[]>;
|
||||
|
|
|
@ -44,7 +44,21 @@ export declare type TRating = {
|
|||
/**
|
||||
* List of possible graphics engines used for game development.
|
||||
*/
|
||||
export declare type TEngine = "QSP" | "RPGM" | "Unity" | "HTML" | "RAGS" | "Java" | "Ren'Py" | "Flash" | "ADRIFT" | "Others" | "Tads" | "Wolf RPG" | "Unreal Engine" | "WebGL";
|
||||
export declare type TEngine =
|
||||
| "QSP"
|
||||
| "RPGM"
|
||||
| "Unity"
|
||||
| "HTML"
|
||||
| "RAGS"
|
||||
| "Java"
|
||||
| "Ren'Py"
|
||||
| "Flash"
|
||||
| "ADRIFT"
|
||||
| "Others"
|
||||
| "Tads"
|
||||
| "Wolf RPG"
|
||||
| "Unreal Engine"
|
||||
| "WebGL";
|
||||
/**
|
||||
* List of possible progress states associated with a game.
|
||||
*/
|
||||
|
@ -56,7 +70,10 @@ export declare type TCategory = "games" | "mods" | "comics" | "animations" | "as
|
|||
/**
|
||||
* Valid names of classes that implement the IQuery interface.
|
||||
*/
|
||||
export declare type TQueryInterface = "LatestSearchQuery" | "ThreadSearchQuery" | "HandiworkSearchQuery";
|
||||
export declare type TQueryInterface =
|
||||
| "LatestSearchQuery"
|
||||
| "ThreadSearchQuery"
|
||||
| "HandiworkSearchQuery";
|
||||
/**
|
||||
* Collection of values defined for each
|
||||
* handiwork on the F95Zone platform.
|
||||
|
@ -246,8 +263,7 @@ export interface IAsset extends IBasic {
|
|||
* Collection of values extrapolated from the
|
||||
* F95 platform representing a particular work.
|
||||
*/
|
||||
export interface IHandiwork extends IGame, IComic, IAnimation, IAsset {
|
||||
}
|
||||
export interface IHandiwork extends IGame, IComic, IAnimation, IAsset {}
|
||||
export interface IQuery {
|
||||
/**
|
||||
* Name of the implemented interface.
|
||||
|
|
|
@ -6,7 +6,9 @@ import Credentials from "./classes/credentials.js";
|
|||
/**
|
||||
* Gets the HTML code of a page.
|
||||
*/
|
||||
export declare function fetchHTML(url: string): Promise<Result<GenericAxiosError | UnexpectedResponseContentType, string>>;
|
||||
export declare function fetchHTML(
|
||||
url: string
|
||||
): Promise<Result<GenericAxiosError | UnexpectedResponseContentType, string>>;
|
||||
/**
|
||||
* It authenticates to the platform using the credentials
|
||||
* and token obtained previously. Save cookies on your
|
||||
|
@ -15,14 +17,21 @@ export declare function fetchHTML(url: string): Promise<Result<GenericAxiosError
|
|||
* @param {Boolean} force Specifies whether the request should be forced, ignoring any saved cookies
|
||||
* @returns {Promise<LoginResult>} Result of the operation
|
||||
*/
|
||||
export declare function authenticate(credentials: Credentials, force?: boolean): Promise<LoginResult>;
|
||||
export declare function authenticate(
|
||||
credentials: Credentials,
|
||||
force?: boolean
|
||||
): Promise<LoginResult>;
|
||||
/**
|
||||
* Send an OTP code if the login procedure requires it.
|
||||
* @param code OTP code.
|
||||
* @param token Unique token for the session associated with the credentials in use.
|
||||
* @param trustedDevice If the device in use is trusted, 2FA authentication is not required for 30 days.
|
||||
*/
|
||||
export declare function send2faCode(code: number, token: string, trustedDevice?: boolean): Promise<Result<GenericAxiosError, LoginResult>>;
|
||||
export declare function send2faCode(
|
||||
code: number,
|
||||
token: string,
|
||||
trustedDevice?: boolean
|
||||
): Promise<Result<GenericAxiosError, LoginResult>>;
|
||||
/**
|
||||
* Obtain the token used to authenticate the user to the platform.
|
||||
*/
|
||||
|
@ -30,16 +39,22 @@ export declare function getF95Token(): Promise<string>;
|
|||
/**
|
||||
* Performs a GET request to a specific URL and returns the response.
|
||||
*/
|
||||
export declare function fetchGETResponse(url: string): Promise<Result<GenericAxiosError, AxiosResponse<any>>>;
|
||||
export declare function fetchGETResponse(
|
||||
url: string
|
||||
): Promise<Result<GenericAxiosError, AxiosResponse<any>>>;
|
||||
/**
|
||||
* Performs a POST request through axios.
|
||||
* @param url URL to request
|
||||
* @param params List of value pairs to send with the request
|
||||
* @param force If `true`, the request ignores the sending of cookies already present on the device.
|
||||
*/
|
||||
export declare function fetchPOSTResponse(url: string, params: {
|
||||
export declare function fetchPOSTResponse(
|
||||
url: string,
|
||||
params: {
|
||||
[s: string]: string;
|
||||
}, force?: boolean): Promise<Result<GenericAxiosError, AxiosResponse<any>>>;
|
||||
},
|
||||
force?: boolean
|
||||
): Promise<Result<GenericAxiosError, AxiosResponse<any>>>;
|
||||
/**
|
||||
* Enforces the scheme of the URL is https and returns the new URL.
|
||||
*/
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
import Thread from "../classes/mapping/thread.js";
|
||||
import { IBasic } from "../interfaces.js";
|
||||
export declare function getHandiworkInformation<T extends IBasic>(url: string): Promise<T>;
|
||||
export declare function getHandiworkInformation<T extends IBasic>(url: string): Promise<T>;
|
||||
export declare function getHandiworkInformation<T extends IBasic>(
|
||||
url: string
|
||||
): Promise<T>;
|
||||
export declare function getHandiworkInformation<T extends IBasic>(
|
||||
url: string
|
||||
): Promise<T>;
|
||||
/**
|
||||
* Gets information of a particular handiwork from its thread.
|
||||
*
|
||||
|
@ -9,4 +13,6 @@ export declare function getHandiworkInformation<T extends IBasic>(url: string):
|
|||
*
|
||||
* @todo It does not currently support assets.
|
||||
*/
|
||||
export default function getHandiworkInformation<T extends IBasic>(arg: string | Thread): Promise<T>;
|
||||
export default function getHandiworkInformation<T extends IBasic>(
|
||||
arg: string | Thread
|
||||
): Promise<T>;
|
||||
|
|
|
@ -12,4 +12,7 @@ export interface ILink extends IPostElement {
|
|||
/**
|
||||
* Given a post of a thread page it extracts the information contained in the body.
|
||||
*/
|
||||
export declare function parseF95ThreadPost($: cheerio.Root, post: cheerio.Cheerio): IPostElement[];
|
||||
export declare function parseF95ThreadPost(
|
||||
$: cheerio.Root,
|
||||
post: cheerio.Cheerio
|
||||
): IPostElement[];
|
||||
|
|
|
@ -5,4 +5,7 @@ import { IBasic, IQuery } from "./interfaces.js";
|
|||
* @param {Number} limit
|
||||
* Maximum number of items to get. Default: 30
|
||||
*/
|
||||
export default function search<T extends IBasic>(query: IQuery, limit?: number): Promise<T[]>;
|
||||
export default function search<T extends IBasic>(
|
||||
query: IQuery,
|
||||
limit?: number
|
||||
): Promise<T[]>;
|
||||
|
|
Loading…
Reference in New Issue