export type ServiceAuthType = 'cookie' | 'token' | 'none'; export type ServiceErrorHandler = 'silent' | 'console.error' | 'console.warn' | 'throw'; export type ServiceErrorListener = (err: Error) => void; export interface ServiceHealth { readonly status: boolean; } export interface ServiceAuth { readonly type: ServiceAuthType; readonly token?: string | null; } export interface ServiceOptions { readonly gzip?: boolean | null; readonly tls?: boolean | null; readonly healthCheck?: boolean | null; readonly retry?: { readonly tries: number; }; readonly errorHandler?: ServiceErrorHandler | null; readonly errorListener?: ServiceErrorListener | null; readonly version?: number | null; } export interface ServiceConfig { readonly url: string; readonly options?: ServiceOptions | null; readonly auth?: ServiceAuth | null; } /** * Locked down, immutable version of ServiceConfig with defaults already set */ export interface LockedServiceConfig { readonly url: string; readonly options: { readonly version: string; readonly tls: boolean; readonly gzip: boolean; readonly errorHandler: ServiceErrorHandler; readonly errorListener: ServiceErrorListener; readonly retry: { readonly tries: number; }; }; readonly auth: { readonly type: ServiceAuthType; readonly token: string | null; }; } /** * Allows configuration of a connection service to an api-core based backend service */ export declare class Service { private static _defaultServiceInstance; private readonly _config; private _health; constructor(config: ServiceConfig); /** * Configure a new default service */ static config(config: ServiceConfig): Service; /** * Returns the default service object */ static get default(): Service; /** * Checks the health of this service by performing a DNS lookup * NOTE: This will always return `true` for non-nodeJS environments */ checkHealth(forced?: boolean): Promise; /** * Returns the currently locked, read-only Service Configuration */ get config(): LockedServiceConfig; /** * This returns the base url and versioning combined */ get url(): string; }