galeforce-tmp-sea
Version:
A customizable, promise-based, and command-oriented TypeScript library for the Riot Games API.
48 lines • 1.95 kB
TypeScript
/**
The base Action class that all other composite actions should
inherit from.
@packageDocumentation
*/
import { Payload, ModifiablePayload } from './payload';
import SubmoduleMap from '../interfaces/submodule-map';
/**
* @template TResult The return type of the Action.
*/
export default class Action<TResult> {
protected submodules: SubmoduleMap;
/**
* The payload containing the data (endpoint, request type, parameters, etc.) related to the
* associated Action. The type guards associated with setting certain properties of the payload
* are checked at runtime and may throw errors when provided invalid values.
*/
payload: Payload;
/**
*
* @param submodules The reference to the submodules ({@link RiotAPI}, {@link Cache}). Passed into the action.
*/
constructor(submodules: SubmoduleMap);
/**
* Sets multiple values in the Action payload simultaneously.
*
* @param payload The payload with which the Action's payload is overwritten
* @returns The current Action (with the updated payload state).
*/
set(payload: ModifiablePayload): this;
/**
* Executes the action, sending an HTTP request to the Riot API servers
* and retrieving the associated data from the appropriate endpoint.
* @throws Will throw an error if a required payload value (*region*,
* *body* on POST or PUT requests, etc.) is missing or the HTTP request
* fails with an error.
*/
exec(): Promise<TResult>;
protected inferEndpoint(): void;
/**
* Returns the **encoded** target URL for the action without executing an HTTP request.
* Useful if the URL string is needed for custom actions outside the scope of the library.
* @throws Will throw an error if a required payload value (*region*,
* *body* on POST or PUT requests, etc.) is missing.
*/
URL(): string;
}
//# sourceMappingURL=action.d.ts.map