UNPKG

nationstates.js

Version:

A wrapper to interact with the NationStates API.

30 lines (29 loc) 1.39 kB
import { API, Client } from "../client"; import { RequestBuilder } from "../request_builder/request_builder"; /** * Extends the RequestBuilder to allow authenticating with the NS client and accessing private shards. * No support for accessing private commands. Only shards. * @example const request = new PrivateRequestBuilder(api).authenticate('Testlandia', 'password'); */ export declare class PrivateRequestBuilder extends RequestBuilder { _authentication: Auth; constructor(api: API | Client); /** * Returns the authentication information as an object. */ get authInfo(): Auth; /** * Retrieves the X-Pin value from NationStates and saves all information to the _authentication object. * Must be run before sending any requests. * @example const request = new PrivateRequestBuilder(api).authenticate('Testlandia', 'password'); * @param {string} nation The nation to retrieve the X-Pin for. * @param {string} password The password for the nation. */ authenticate(nation: string, password: string): Promise<PrivateRequestBuilder>; /** * Executes the request and saves the response to the RequestBuilder object. * Retrieve after awaiting it via .response, .body, or convert it to a JS object with convertToJSON(); * Polymorph of RequestBuilder. */ execute(): Promise<PrivateRequestBuilder>; }