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<String, String>? 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<bool> updateServerInfoAsync(UpdateServerInfoRequest request) async { var rpcRst = await call("UpdateServerInfoAsync", request); return rpcRst; } Future<List<ServerInfoDTO>> getServerInfoListAsync(QueryServerInfoRequest request) async { var rpcRst = await call("GetServerInfoListAsync", request); var result = (rpcRst as List).map((e)=>ServerInfoDTO.fromJson(e as Map<String, dynamic>)).toList(); return result; } Future<EchoResult> echoAsync() async { var rpcRst = await call("EchoAsync", ); var result = EchoResult.fromJson(rpcRst as Map<String, dynamic>); return result; } Future<bool> updateServerIPListAsync(UpdateServerIPListRequest request) async { var rpcRst = await call("UpdateServerIPListAsync", request); return rpcRst; } Future<PasswordRuleResult> getPasswordRuleAsync() async { var rpcRst = await call("GetPasswordRuleAsync", ); var result = PasswordRuleResult.fromJson(rpcRst as Map<String, dynamic>); return result; } Future<bool> reloadConfig() async { var rpcRst = await call("ReloadConfig", ); return rpcRst; } }