/// /** * WCH credentials */ export declare interface Credentials { /** * The WCH username, typically an email or the string 'apikey' */ username: string; /** * The WCH password */ password: string; } /** * Checks if the URL is a valid WCH API URL by making a test call * * @param aUrl - the URL to test * * @returns true if the URL is valid, else false */ export declare function isValidApiUrl(aValue: any): Promise; /** * Checks if a password is valid * * @param aValue - the value to test * @returns true if the password is valid, else false */ export declare function isValidPassword(aValue: any): aValue is string; /** * Checks if the url is syntactically a valid URL * * @param aValue - the value * @returns true if the value is a valid URL, else false */ export declare function isValidUrl(aValue: any): aValue is string; /** * Checks if a username is valid, i.e. either an email or the term 'apikey' * * @param aValue - the value to test * @returns true if the name is valid, else false */ export declare function isValidUserName(aValue: any): aValue is string; /** * Validates the credentials by trying to login * * @param aCredentials - the credentials * @returns true if the credentials were correct, else false */ export declare function isValidWchToolsOptions(aCredentials: WchToolsOptions): Promise; /** * Simple logger interface that this library used to print debug logs */ export declare type Logger = (...optionalParams: any[]) => void; /** * Contextual options */ export declare interface Options { /** * If set to true, print debug logs */ debug?: boolean; /** * If provided, the logger to be used to print debug logs */ logger?: Logger; } /** Version and build number of the package */ export declare const VERSION: { version: { major: string; minor: string; patch: string; branch: string; }; build: Date; }; /** * Reads the credentials for the given API URL * * @param aApiUrl - the API URL * @param aOptions - options for debugging and logging * * @returns a promise of the loaded credentials */ export declare function wchGetCredentials(aApiUrl: string, aOptions?: Options): Promise; export declare function wchRemoveCredentials(aApiUrl: string, aOptions?: Options): Promise; export declare function wchStoreCredentials(aWchToolsOptions: WchToolsOptions, aOptions?: Options): Promise; /** * Extension of the credentials to also carry the API URL that the credentials apply to */ export declare interface WchToolsOptions extends Credentials { /** * The WCH AP URL */ baseUrl: string; } export { }