@barchart/common-js
Version:
Library of common JavaScript utilities
147 lines (146 loc) • 4.14 kB
TypeScript
/**
* @typedef {import('./Credentials.js').default} Credentials
*/
/**
* The definition of a web service endpoint.
*
* @public
*/
export default class Endpoint {
/**
* @param {string=} name
* @param {string=} description
* @param {VerbType=} verb
* @param {ProtocolType=} protocol
* @param {string=} host
* @param {number=} port
* @param {Parameters=} path
* @param {Parameters=} query
* @param {Parameters=} headers
* @param {Parameters=} body
* @param {Credentials=} credentials
* @param {RequestInterceptor=} requestInterceptor
* @param {ResponseInterceptor=} responseInterceptor
* @param {ErrorInterceptor=} errorInterceptor
*/
constructor(name?: string | undefined, description?: string | undefined, verb?: VerbType | undefined, protocol?: ProtocolType | undefined, host?: string | undefined, port?: number | undefined, path?: Parameters | undefined, query?: Parameters | undefined, headers?: Parameters | undefined, body?: Parameters | undefined, credentials?: Credentials | undefined, requestInterceptor?: RequestInterceptor | undefined, responseInterceptor?: ResponseInterceptor | undefined, errorInterceptor?: ErrorInterceptor | undefined);
/**
* The name of the endpoint (used for internal purposes only).
*
* @public
* @returns {string}
*/
public get name(): string;
/**
* A description of the action performed by the endpoint, suitable for display to users.
*
* @public
* @returns {string}
*/
public get description(): string;
/**
* The verb to use when making the request.
*
* @public
* @returns {VerbType}
*/
public get verb(): VerbType;
/**
* The protocol to use with the endpoint.
*
* @public
* @returns {ProtocolType}
*/
public get protocol(): ProtocolType;
/**
* The host of the endpoint.
*
* @public
* @returns {string}
*/
public get host(): string;
/**
* The host of the endpoint.
*
* @public
* @returns {number}
*/
public get port(): number;
/**
* The path definition of the endpoint.
*
* @public
* @returns {Parameters}
*/
public get path(): Parameters;
/**
* The query definition of the endpoint.
*
* @public
* @returns {Parameters}
*/
public get query(): Parameters;
/**
* The header definition of the endpoint.
*
* @public
* @returns {Parameters}
*/
public get headers(): Parameters;
/**
* The body definition of the endpoint.
*
* @public
* @returns {Parameters}
*/
public get body(): Parameters;
/**
* Credentials for the request.
*
* @public
* @return {Credentials}
*/
public get credentials(): Credentials;
/**
* The request interceptor of the endpoint.
*
* @public
* @returns {RequestInterceptor|null}
*/
public get requestInterceptor(): RequestInterceptor | null;
/**
* The response interceptor of the endpoint.
*
* @public
* @returns {ResponseInterceptor|null}
*/
public get responseInterceptor(): ResponseInterceptor | null;
/**
* The error interceptor of the endpoint.
*
* @public
* @returns {ErrorInterceptor|null}
*/
public get errorInterceptor(): ErrorInterceptor | null;
/**
* Throws an {@link Error} if the instance is invalid.
*
* @public
*/
public validate(): void;
/**
* Returns a string representation.
*
* @public
* @returns {string}
*/
public toString(): string;
#private;
}
export type Credentials = import("./Credentials.js").default;
import VerbType from './VerbType.js';
import ProtocolType from './ProtocolType.js';
import Parameters from './Parameters.js';
import RequestInterceptor from './../interceptors/RequestInterceptor.js';
import ResponseInterceptor from './../interceptors/ResponseInterceptor.js';
import ErrorInterceptor from './../interceptors/ErrorInterceptor.js';