19 lines
552 B
Dart
19 lines
552 B
Dart
import 'package:term_remote_ctl/core/network/agent_api_client.dart';
|
|
import 'package:term_remote_ctl/features/sessions/session.dart';
|
|
|
|
class SessionRepository {
|
|
SessionRepository(this._client);
|
|
|
|
final AgentApiClient _client;
|
|
|
|
Future<List<Session>> listSessions() async {
|
|
final sessions = await _client.listSessions();
|
|
return sessions.map(Session.fromJson).toList(growable: false);
|
|
}
|
|
|
|
Future<Session> createSession(String name) async {
|
|
final session = await _client.createSession(name);
|
|
return Session.fromJson(session);
|
|
}
|
|
}
|