UNPKG

graphdb

Version:

Javascript client library supporting GraphDB and RDF4J REST API.

120 lines (119 loc) 3.4 kB
export = ClientConfig; /** * Abstract configuration wrapper used for initialization of concrete * Client instances. Concrete client configuration wrappers must extend * this class and override it's methods if necessary. * * @abstract * @author Mihail Radkov * @author Svilen Velikov * @author Teodossi Dossev */ declare class ClientConfig { /** * Client configuration constructor. * * @param {string} endpoint server base URL that will be prepend * to all server requests */ constructor(endpoint: string); /** * Sets the default headers map for each HTTP request. * * @param {Object<string, string>} headers the default headers * @return {this} the concrete configuration config for method chaining */ setHeaders(headers: { [x: string]: string; }): this; headers: { [x: string]: string; }; /** * Returns the default headers for each HTTP request. * * @return {Object<string, string>} the default headers map */ getHeaders(): { [x: string]: string; }; /** * @return {string} the username */ getUsername(): string; /** * @return {string} the user password */ getPass(): string; /** * @return {boolean} if the user should be re-logged in after token expires */ getKeepAlive(): boolean; /** * @param {boolean} keepAlive * @return {this} the concrete configuration config for method chaining */ setKeepAlive(keepAlive: boolean): this; keepAlive: boolean; /** * Username and password for user logging setter. * Sets basic authentication as client authentication type. * * @param {string} [username] * @param {string} [pass] * * @return {this} the concrete configuration config for method chaining */ useBasicAuthentication(username?: string, pass?: string): this; username: string; pass: string; /** * @return {boolean} [basicAuth] if use Basic Auth */ getBasicAuthentication(): boolean; /** * @private * @param {string} auth authentication type */ private switchAuthentication; basicAuth: boolean; gdbTokenAuth: boolean; /** * @return {boolean} [gdbTokenAuth] if use Gdb Token Auth */ getGdbTokenAuthentication(): boolean; /** * Username and password for user logging setter. * Sets gdb token authentication as client authentication type. * * * @param {string} [username] * @param {string} [pass] * * @return {this} the concrete configuration config for method chaining */ useGdbTokenAuthentication(username?: string, pass?: string): this; /** * Disables authentication. */ disableAuthentication(): void; /** * Sets the server's endpoint URL. * * @param {string} endpoint the endpoint URL * @return {this} the current config for method chaining */ setEndpoint(endpoint: string): this; endpoint: string; /** * Returns the server's endpoint URL. * @return {string} the endpoint URL */ getEndpoint(): string; /** * Returns <code>true</code> if basic or gdb token authentication * is enabled. <code>false</code> otherwise. * * @return {boolean} is authentication enabled */ shouldAuthenticate(): boolean; }