import 'dart:core'; import 'package:fis_jsonrpc/client_base.dart'; import 'package:fis_common/json_convert.dart'; import 'vinnoServer.m.dart'; class VinnoServerService extends JsonRpcClientBase { VinnoServerService( String host, { String serviceName = "IVinnoServerService", Map? headers, int? timeout, }) : super( host, serviceName, headers: headers, timeout: timeout, ) { /// 注册响应实体反序列化处理器 FJsonConvert.setDecoder((map) => ServerInfoDTO.fromJson(map)); FJsonConvert.setDecoder((map) => EchoResult.fromJson(map)); FJsonConvert.setDecoder((map) => PasswordRuleResult.fromJson(map)); } Future updateServerInfoAsync(UpdateServerInfoRequest request) async { var rpcRst = await call("UpdateServerInfoAsync", request); return rpcRst; } Future> getServerInfoListAsync(QueryServerInfoRequest request) async { var rpcRst = await call("GetServerInfoListAsync", request); var result = (rpcRst as List).map((e)=>ServerInfoDTO.fromJson(e as Map)).toList(); return result; } Future echoAsync() async { var rpcRst = await call("EchoAsync", ); var result = EchoResult.fromJson(rpcRst as Map); return result; } Future updateServerIPListAsync(UpdateServerIPListRequest request) async { var rpcRst = await call("UpdateServerIPListAsync", request); return rpcRst; } Future getPasswordRuleAsync() async { var rpcRst = await call("GetPasswordRuleAsync", ); var result = PasswordRuleResult.fromJson(rpcRst as Map); return result; } }