Initial commit
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'auth.freezed.dart';
|
||||
part 'auth.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class AuthByNameReq with _$AuthByNameReq {
|
||||
const factory AuthByNameReq({
|
||||
required String serverId,
|
||||
required String username,
|
||||
required String password,
|
||||
}) = _AuthByNameReq;
|
||||
|
||||
factory AuthByNameReq.fromJson(Map<String, dynamic> json) =>
|
||||
_$AuthByNameReqFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class SessionData with _$SessionData {
|
||||
const factory SessionData({
|
||||
required String serverId,
|
||||
required String token,
|
||||
required String userId,
|
||||
required String userName,
|
||||
@JsonKey(includeIfNull: false) String? password,
|
||||
required String createdAt,
|
||||
}) = _SessionData;
|
||||
|
||||
factory SessionData.fromJson(Map<String, dynamic> json) =>
|
||||
_$SessionDataFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class AuthedSession with _$AuthedSession {
|
||||
const factory AuthedSession({
|
||||
required String serverId,
|
||||
required String serverName,
|
||||
required String serverUrl,
|
||||
required String token,
|
||||
required String userId,
|
||||
required String userName,
|
||||
@JsonKey(includeIfNull: false) String? password,
|
||||
required bool isActive,
|
||||
}) = _AuthedSession;
|
||||
|
||||
factory AuthedSession.fromJson(Map<String, dynamic> json) =>
|
||||
_$AuthedSessionFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class SessionListRes with _$SessionListRes {
|
||||
const factory SessionListRes({
|
||||
required List<AuthedSession> sessions,
|
||||
|
||||
|
||||
String? activeServerId,
|
||||
}) = _SessionListRes;
|
||||
|
||||
factory SessionListRes.fromJson(Map<String, dynamic> json) =>
|
||||
_$SessionListResFromJson(json);
|
||||
}
|
||||
Reference in New Issue
Block a user