ps2census
Version:
Client to connect to the PS2 Event Stream websocket.
107 lines (106 loc) • 3.47 kB
TypeScript
import { CollectionNames, Conditions, Format, PartialPaths, Paths } from './types/collection';
import { CensusResponse } from './utils/census-response';
import { Join, Langs, Resolve, Sort, Tree } from './types/commands';
import { CensusBoolean } from './types/census';
import { RestContract } from './concern/rest.contract';
/**
* GetQuery commands uses clone to make sure the types are correct
*/
export declare class GetQuery<C extends CollectionNames, R = Format<C>> {
private readonly census;
readonly collection: C;
private readonly params;
constructor(census: RestContract, collection: C);
/**
* @param x wheter the search should be case sensitive, default by census is true
*/
case(x: CensusBoolean): GetQuery<C, R>;
/**
* @param path returns a list of unique values of a field, data returned will be an array with a single object that
* contains one key with the name of the field and as value an array of possible values of the field.
*/
distinct(path: Paths<C>): GetQuery<C, any>;
/**
* @param x if there is an exact match put it at the top of the list
*/
exactMatchFirst(x: CensusBoolean): GetQuery<C, R>;
/**
* @param path data entry must have the specified field
*/
has(path: PartialPaths<C>): GetQuery<C, R>;
/**
* @param paths hide the following fields from the result
*/
hide(...paths: PartialPaths<C>[]): GetQuery<C, R>;
/**
* @param x include fields that are empty in the results, default by census is false
*/
includeNull(x: CensusBoolean): GetQuery<C, R>;
/**
* @param joins joins results from other collections into parent collection
*/
join(...joins: Join<C, any>[]): GetQuery<C, any>;
/**
* @param x filters names and descriptions to only include the specified language
*/
lang(x: Langs): GetQuery<C, R>;
/**
* @param x limits the number of results
*/
limit(x: number): GetQuery<C, R>;
/**
* This command only works on the character collection
*
* @param x limits the number of results per database
*/
limitPerDB(x: number): GetQuery<C, R>;
/**
* @param resolve joins data from prepared joins by census
*/
resolve(...resolve: Resolve<C>[]): GetQuery<C, any>;
/**
* @param x retries the query if a query fails on the census server, default by census is true
*/
retry(x: CensusBoolean): GetQuery<C, R>;
/**
* @param paths only include specified fields in the results
*/
show(...paths: PartialPaths<C>[]): GetQuery<C, R>;
/**
* @param x sort results by specified fields
*/
sort(...x: Sort<C>[]): GetQuery<C, R>;
/**
* @param x skips specified number of results
*/
start(x: number): GetQuery<C, R>;
/**
* @param x add stats to the query to see performance of the census database, default by census is false
*/
timing(x: CensusBoolean): GetQuery<C, R>;
/**
* @param tree group data by field
*/
tree(tree: Tree<C>): GetQuery<C, any>;
/**
* Execute the query
*
* @param query conditions to filter results
*/
get(query?: Conditions<C>): Promise<CensusResponse<R>>;
/**
* @param key
* @param value
* @private
*/
private set;
/**
* @private
*/
private clone;
/**
* @param joins
* @private
*/
private joinToString;
}