import { ClientOptions, ErrorResponse } from './types'; export default class TornClient { private apiKey; private doVerifySelection; private baseUrl; /** * Constructor for the TornClient. An API key must be provided. * @param apiKey The API key of the user performing the requests. * @param options Custom options to control the client behavior. */ constructor(apiKey: string, options?: ClientOptions); setApiKey(apiKey: string): void; company(id?: string, selections?: string[]): Promise; faction(id?: string, selections?: string[]): Promise; market(id?: string, selections?: string[]): Promise; property(id?: string, selections?: string[]): Promise; torn(id?: string, selections?: string[]): Promise; user(id?: string, selections?: string[]): Promise; /** * Executes the request to the Torn API and logs the response if it is an error. * @param url The Torn API URL including parameters * @returns The response from the Torn API, currently unchecked. */ private execute; /** * Builds the URL that is sent to the Torn API. Handles the path, selections and id params. * @param compartment The path to send the request to, will be one of user, faction, etc.. * @param id The id of the user, faction, company or other. * @param selections List of selections to specify the requested content. * @returns */ private buildUrl; private buildSelectionParam; /** * Checks whether all provided selections are valid for their request type. * @param selections List of the provided selections. * @param isSelection Method that should be used to check the selection. * @returns Returns nothing if successful, otherwise throws an exception. */ private verifySelections; }