import { ScryptedStatic } from "@scrypted/types"; import { RpcPeer } from '../../../server/src/rpc'; export * as rpc from '../../../server/src/rpc'; export * as rpc_serializer from '../../../server/src/rpc-serializer'; /** * The type of connection used by the Scrypted client. * http-cloud is through Scrypted Cloud * http-direct is a direct connection to the Scrypted server via one of the local network interfaces or public IP addresses. * http is a direct connection with the base url or browser url. */ export type ScryptedClientConnectionType = 'http-cloud' | 'http-direct' | 'http'; export interface ScryptedClientStatic extends ScryptedStatic { userId?: string; username?: string; admin: boolean; disconnect(): void; onClose?: Function; address?: string; connectionType: ScryptedClientConnectionType; rpcPeer: RpcPeer; loginResult: ScryptedClientLoginResult; } export interface ScryptedConnectionOptions { direct?: boolean; local?: boolean; baseUrl?: string; previousLoginResult?: ScryptedClientLoginResult; } export interface ScryptedLoginOptions extends ScryptedConnectionOptions { username: string; /** * The password, or preferably, login token for logging into Scrypted. * The login token can be retrieved with "npx scrypted login". */ password: string; change_password?: string; maxAge?: number; } export interface ScryptedClientOptions extends Partial { pluginId: string; clientName?: string; transports?: string[]; } export declare function logoutScryptedClient(baseUrl?: string): Promise; export declare function getCurrentBaseUrl(): string; export declare function loginScryptedClient(options: ScryptedLoginOptions): Promise<{ error: string; authorization: string; queryToken: any; token: string; addresses: string[]; externalAddresses: string[]; hostname: any; scryptedCloud: boolean; directAddress: string; cloudAddress: string; serverId: string; }>; export declare function checkScryptedClientLogin(options?: ScryptedConnectionOptions): Promise<{ baseUrl: string; hostname: string; redirect: string; username: string; expiration: number; hasLogin: boolean; error: string; authorization: string; queryToken: any; token: string; addresses: string[]; externalAddresses: string[]; scryptedCloud: boolean; directAddress: string; cloudAddress: string; serverId: string; }>; export interface ScryptedClientLoginResult { username: string; token: string; authorization: string; queryToken: { [parameter: string]: string; }; localAddresses: string[]; externalAddresses: string[]; scryptedCloud: boolean; directAddress: string; cloudAddress: string; hostname: string; serverId: string; } export declare class ScryptedClientLoginError extends Error { result: Awaited>; constructor(result: Awaited>); } export declare function redirectScryptedLogin(options?: { redirect?: string; baseUrl?: string; }): void; export declare function combineBaseUrl(baseUrl: string, rootPath: string): string; export declare function redirectScryptedLogout(baseUrl?: string): Promise; export declare function connectScryptedClient(options: ScryptedClientOptions): Promise;