///
import { EventEmitter } from 'events';
import { HttpClient, IRequest, IResponse } from '../http/http-client.class';
import { Catalog } from './catalog.class';
import { Collection } from './collection.class';
export declare type IAuth = {
type: 'basic';
user: string;
pass: string;
} | {
type: 'token';
token: string;
authUrl: string;
};
export interface IProgressInfo {
UserInfo: string;
SessionCount: number;
Title: string;
CanInterrupt: string;
}
export interface ISessionInfo {
sessionID: string;
lifeTime: number;
expiration: string;
userName: string;
}
export interface IServerInfo {
cacheSize: number;
usedCache: number;
entitySetCount: number;
ProgressInfo: IProgressInfo[];
sessionInfo: ISessionInfo[];
}
export interface IClientOptions {
url?: string;
auth?: IAuth;
httpClient?: HttpClient;
}
export interface IContext {
req: {
get: (headerName: string) => string;
headers: {
[headerName: string]: string;
};
};
res: {
headersSent: boolean;
header: (headerName: string, headerValue: string) => string;
headers: {
[headerName: string]: string;
};
};
}
declare type RetryFn = (times?: number) => Promise;
export declare class Client extends EventEmitter {
private readonly url;
private readonly auth;
private readonly http;
private retryFn;
private ctx;
private parsedUrl;
private collections;
private _catalog;
private hashPwd;
constructor(url: string, auth: IAuth, options: {
http?: HttpClient;
timeout?: number;
ctx: IContext;
retry?: RetryFn;
hashPwd?: boolean;
});
/**
* Return the connector version
*/
version(): string;
/**
* Get remote catalog
*/
getCatalog(...names: string[]): Promise;
/**
* Get the server info
* @param isSession Force the creation of a session
*/
info(filter?: 'ProgressInfo' | 'sessionInfo' | 'HTTPConnections', isSession?: boolean, cookie?: string): Promise;
authenticate(): Promise;
private updateCookies;
/**
* Save the collection into the client
* @param collection Collection to save
*/
addCollection(collection: Collection): boolean;
/**
* Release saved collections
*/
releaseCollections(): Promise;
isAuthenticated(): boolean;
/**
* Send a request
* @param req Request object
*/
request(req: IRequest, isSession?: boolean, retries?: number): Promise>;
/**
* Remove the current session
*/
logout(): Promise;
}
export {};
//# sourceMappingURL=client.class.d.ts.map