mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 17:51:20 +00:00
89 lines
2.9 KiB
Dart
89 lines
2.9 KiB
Dart
//
|
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
|
//
|
|
// @dart=2.0
|
|
|
|
// ignore_for_file: unused_element, unused_import
|
|
// ignore_for_file: always_put_required_named_parameters_first
|
|
// ignore_for_file: lines_longer_than_80_chars
|
|
|
|
part of openapi.api;
|
|
|
|
|
|
class ConditionValue {
|
|
/// Instantiate a new enum with the provided [value].
|
|
const ConditionValue._(this.value);
|
|
|
|
/// The underlying value of this enum member.
|
|
final String value;
|
|
|
|
@override
|
|
String toString() => value;
|
|
|
|
String toJson() => value;
|
|
|
|
static const EQUAL = ConditionValue._(r'EQUAL');
|
|
static const NOT_EQUAL = ConditionValue._(r'NOT_EQUAL');
|
|
static const BIGGER = ConditionValue._(r'BIGGER');
|
|
static const BIGGEST = ConditionValue._(r'BIGGEST');
|
|
static const SMALLER = ConditionValue._(r'SMALLER');
|
|
static const SMALLEST = ConditionValue._(r'SMALLEST');
|
|
|
|
/// List of all possible values in this [enum][ConditionValue].
|
|
static const values = <ConditionValue>[
|
|
EQUAL,
|
|
NOT_EQUAL,
|
|
BIGGER,
|
|
BIGGEST,
|
|
SMALLER,
|
|
SMALLEST,
|
|
];
|
|
|
|
static ConditionValue fromJson(dynamic value) =>
|
|
ConditionValueTypeTransformer().decode(value);
|
|
|
|
static List<ConditionValue> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
|
|
json == null || json.isEmpty
|
|
? true == emptyIsNull ? null : <ConditionValue>[]
|
|
: json
|
|
.map((value) => ConditionValue.fromJson(value))
|
|
.toList(growable: true == growable);
|
|
}
|
|
|
|
/// Transformation class that can [encode] an instance of [ConditionValue] to String,
|
|
/// and [decode] dynamic data back to [ConditionValue].
|
|
class ConditionValueTypeTransformer {
|
|
const ConditionValueTypeTransformer._();
|
|
|
|
factory ConditionValueTypeTransformer() => _instance ??= ConditionValueTypeTransformer._();
|
|
|
|
String encode(ConditionValue data) => data.value;
|
|
|
|
/// Decodes a [dynamic value][data] to a ConditionValue.
|
|
///
|
|
/// If [allowNull] is true and the [dynamic value][data] cannot be decoded successfully,
|
|
/// then null is returned. However, if [allowNull] is false and the [dynamic value][data]
|
|
/// cannot be decoded successfully, then an [UnimplementedError] is thrown.
|
|
///
|
|
/// The [allowNull] is very handy when an API changes and a new enum value is added or removed,
|
|
/// and users are still using an old app with the old code.
|
|
ConditionValue decode(dynamic data, {bool allowNull}) {
|
|
switch (data) {
|
|
case r'EQUAL': return ConditionValue.EQUAL;
|
|
case r'NOT_EQUAL': return ConditionValue.NOT_EQUAL;
|
|
case r'BIGGER': return ConditionValue.BIGGER;
|
|
case r'BIGGEST': return ConditionValue.BIGGEST;
|
|
case r'SMALLER': return ConditionValue.SMALLER;
|
|
case r'SMALLEST': return ConditionValue.SMALLEST;
|
|
default:
|
|
if (allowNull == false) {
|
|
throw ArgumentError('Unknown enum value to decode: $data');
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/// Singleton [ConditionValueTypeTransformer] instance.
|
|
static ConditionValueTypeTransformer _instance;
|
|
}
|