unifi-client
Version:
NodeJs client for Unifi products (https://www.ui.com/)
39 lines (38 loc) • 1.26 kB
TypeScript
import { AxiosInstance } from 'axios';
import { IUser } from './User';
import { CookieSerializeOptions } from 'cookie';
import { ObjectWithPrivateValues } from './commons/ObjectWithPrivateValues';
export interface IUnifiAuthProps {
rememberMe?: boolean;
username: string;
password: string;
}
export declare class UnifiAuth extends ObjectWithPrivateValues {
private readonly rememberMe;
unifiOs: boolean;
autoReLogin: boolean;
private get username();
private set username(value);
private get password();
private set password(value);
private getCookieTokenName;
private token?;
private csrfToken?;
private controllerInstance;
constructor(props: IUnifiAuthProps, instance: AxiosInstance);
getCookies(authenticationRequest?: boolean): Promise<Array<CookieSerializeOptions & {
name: string;
value: string;
}>>;
private addInterceptors;
private getCookiesFromResponse;
/**
*
* @param token2FA - 2FA token, will disable re-login
*/
login(token2FA?: string): Promise<IUser>;
logout(): Promise<void>;
getVersion(site?: string): Promise<string | undefined>;
private getToken;
addInterceptorsToInstance(instance: AxiosInstance): void;
}