mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-12-25 03:03:50 +03:00
24 lines
736 B
Dart
Executable File
24 lines
736 B
Dart
Executable File
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'models.freezed.dart';
|
|
part 'models.g.dart';
|
|
|
|
@Freezed(unionKey: 'kind')
|
|
class RpcResponse with _$RpcResponse {
|
|
factory RpcResponse.success(Map<String, dynamic> body) = Success;
|
|
factory RpcResponse.signal(String status, Map<String, dynamic> body) = Signal;
|
|
factory RpcResponse.error(
|
|
String status, String message, Map<String, dynamic> body) = RpcError;
|
|
|
|
factory RpcResponse.fromJson(Map<String, dynamic> json) =>
|
|
_$RpcResponseFromJson(json);
|
|
}
|
|
|
|
@freezed
|
|
class RpcState with _$RpcState {
|
|
const factory RpcState(String version, bool isAdmin) = _RpcState;
|
|
|
|
factory RpcState.fromJson(Map<String, dynamic> json) =>
|
|
_$RpcStateFromJson(json);
|
|
}
|