1234567891011121314151617181920212223242526272829303132333435 |
- import 'dart:core';
- import '../client_base.dart';
- import 'package:fis_common/json_convert.dart';
- import 'session.m.dart';
- class SessionService extends JsonRpcClientBase {
- SessionService(
- String host, {
- String serviceName = "ISessionService",
- Map<String, String>? headers,
- int? timeout,
- }) : super(
- host,
- serviceName,
- headers: headers,
- timeout: timeout,
- ) {
- /// 注册响应实体反序列化处理器
- FJsonConvert.setDecoder((map) => SessionInfo.fromJson(map));
- }
- Future<SessionInfo> createSessionAsync(
- String userCode, SessionClientInfo clientInfo) async {
- var rpcRst = await call("CreateSessionAsync", [userCode, clientInfo]);
- var result = SessionInfo.fromJson(rpcRst as Map<String, dynamic>);
- return result;
- }
- Future<bool> removeSessionAsync(String sessionId) async {
- var rpcRst = await call("RemoveSessionAsync", sessionId);
- return rpcRst;
- }
- }
|