30 lines
859 B
Dart
30 lines
859 B
Dart
import 'package:json_annotation/json_annotation.dart';
|
|
|
|
part 'response.g.dart';
|
|
|
|
|
|
@JsonSerializable()
|
|
class VerificationResponse {
|
|
@JsonKey(name: 'ttl_seconds', defaultValue: 0)
|
|
final int ttlSeconds;
|
|
@JsonKey(name: 'cooldown_seconds', defaultValue: 0)
|
|
final int cooldownSeconds;
|
|
@JsonKey(defaultValue: '')
|
|
final String destination;
|
|
final String idempotencyKey;
|
|
|
|
const VerificationResponse({
|
|
required this.ttlSeconds,
|
|
required this.cooldownSeconds,
|
|
required this.destination,
|
|
required this.idempotencyKey,
|
|
});
|
|
|
|
Duration get cooldownDuration => Duration(seconds: cooldownSeconds);
|
|
Duration get ttlDuration => Duration(seconds: ttlSeconds);
|
|
|
|
factory VerificationResponse.fromJson(Map<String, dynamic> json) => _$VerificationResponseFromJson(json);
|
|
|
|
Map<String, dynamic> toJson() => _$VerificationResponseToJson(this);
|
|
}
|