import type { AnyDevice , SendOptions } from '../client' ; import { extractResponse , isObjectLike , HasErrCode , hasErrCode , } from '../utils' ; export type CloudInfo = { username ? : string ; server ? : string ; binded ? : number ; cld_connection ? : number ; illegalType ? : number ; tcspStatus ? : number ; fwDlPage ? : string ; tcspInfo ? : string ; stopConnect ? : number ; fwNotifyType ? : number ; } ; export function isCloudInfo ( candidate ) { return isObjectLike ( candidate ) ; } export default class Cloud { info : ( CloudInfo & HasErrCode ) | undefined ; constructor ( readonly device , readonly apiModuleName ) { } returns throws ResponseError async getInfo ( sendOptions ? ) { this . info = extractResponse < CloudInfo & HasErrCode > ( await this . device . sendCommand ( { [ this . apiModuleName ] : { get_info : { } } , } , undefined , sendOptions ) , '' , ( c ) => isCloudInfo ( c ) && hasErrCode ( c ) ) ; return this . info ; } param username param password param sendOptions returns async bind ( username , password , sendOptions ? ) { return this . device . sendCommand ( { [ this . apiModuleName ] : { bind : { username , password } } , } , undefined , sendOptions ) ; } param sendOptions returns async unbind ( sendOptions ? ) { return this . device . sendCommand ( { [ this . apiModuleName ] : { unbind : { } } , } , undefined , sendOptions ) ; } param sendOptions returns async getFirmwareList ( sendOptions ? ) { return this . device . sendCommand ( { [ this . apiModuleName ] : { get_intl_fw_list : { } } , } , undefined , sendOptions ) ; } param server param sendOptions returns async setServerUrl ( server , sendOptions ? ) { return this . device . sendCommand ( { [ this . apiModuleName ] : { set_server_url : { server } } , } , undefined , sendOptions ) ; } }