2022-08-27 07:53:37 +02:00
|
|
|
//
|
|
|
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
|
|
|
//
|
|
|
|
// @dart=2.12
|
|
|
|
|
|
|
|
// ignore_for_file: unused_element, unused_import
|
|
|
|
// ignore_for_file: always_put_required_named_parameters_first
|
|
|
|
// ignore_for_file: constant_identifier_names
|
|
|
|
// ignore_for_file: lines_longer_than_80_chars
|
|
|
|
|
|
|
|
part of openapi.api;
|
|
|
|
|
|
|
|
|
2023-08-04 23:07:15 +02:00
|
|
|
class TimeBucketSize {
|
2022-08-27 07:53:37 +02:00
|
|
|
/// Instantiate a new enum with the provided [value].
|
2023-08-04 23:07:15 +02:00
|
|
|
const TimeBucketSize._(this.value);
|
2022-08-27 07:53:37 +02:00
|
|
|
|
|
|
|
/// The underlying value of this enum member.
|
|
|
|
final String value;
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() => value;
|
|
|
|
|
|
|
|
String toJson() => value;
|
|
|
|
|
2023-08-04 23:07:15 +02:00
|
|
|
static const DAY = TimeBucketSize._(r'DAY');
|
|
|
|
static const MONTH = TimeBucketSize._(r'MONTH');
|
2022-08-27 07:53:37 +02:00
|
|
|
|
2023-08-04 23:07:15 +02:00
|
|
|
/// List of all possible values in this [enum][TimeBucketSize].
|
|
|
|
static const values = <TimeBucketSize>[
|
|
|
|
DAY,
|
|
|
|
MONTH,
|
2022-08-27 07:53:37 +02:00
|
|
|
];
|
|
|
|
|
2023-08-04 23:07:15 +02:00
|
|
|
static TimeBucketSize? fromJson(dynamic value) => TimeBucketSizeTypeTransformer().decode(value);
|
2022-08-27 07:53:37 +02:00
|
|
|
|
2023-08-04 23:07:15 +02:00
|
|
|
static List<TimeBucketSize>? listFromJson(dynamic json, {bool growable = false,}) {
|
|
|
|
final result = <TimeBucketSize>[];
|
2022-08-27 07:53:37 +02:00
|
|
|
if (json is List && json.isNotEmpty) {
|
|
|
|
for (final row in json) {
|
2023-08-04 23:07:15 +02:00
|
|
|
final value = TimeBucketSize.fromJson(row);
|
2022-08-27 07:53:37 +02:00
|
|
|
if (value != null) {
|
|
|
|
result.add(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result.toList(growable: growable);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-08-04 23:07:15 +02:00
|
|
|
/// Transformation class that can [encode] an instance of [TimeBucketSize] to String,
|
|
|
|
/// and [decode] dynamic data back to [TimeBucketSize].
|
|
|
|
class TimeBucketSizeTypeTransformer {
|
|
|
|
factory TimeBucketSizeTypeTransformer() => _instance ??= const TimeBucketSizeTypeTransformer._();
|
2022-08-27 07:53:37 +02:00
|
|
|
|
2023-08-04 23:07:15 +02:00
|
|
|
const TimeBucketSizeTypeTransformer._();
|
2022-08-27 07:53:37 +02:00
|
|
|
|
2023-08-04 23:07:15 +02:00
|
|
|
String encode(TimeBucketSize data) => data.value;
|
2022-08-27 07:53:37 +02:00
|
|
|
|
2023-08-04 23:07:15 +02:00
|
|
|
/// Decodes a [dynamic value][data] to a TimeBucketSize.
|
2022-08-27 07:53:37 +02:00
|
|
|
///
|
|
|
|
/// 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.
|
2023-08-04 23:07:15 +02:00
|
|
|
TimeBucketSize? decode(dynamic data, {bool allowNull = true}) {
|
2022-08-27 07:53:37 +02:00
|
|
|
if (data != null) {
|
2023-04-09 04:26:09 +02:00
|
|
|
switch (data) {
|
2023-08-04 23:07:15 +02:00
|
|
|
case r'DAY': return TimeBucketSize.DAY;
|
|
|
|
case r'MONTH': return TimeBucketSize.MONTH;
|
2022-08-27 07:53:37 +02:00
|
|
|
default:
|
|
|
|
if (!allowNull) {
|
|
|
|
throw ArgumentError('Unknown enum value to decode: $data');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2023-08-04 23:07:15 +02:00
|
|
|
/// Singleton [TimeBucketSizeTypeTransformer] instance.
|
|
|
|
static TimeBucketSizeTypeTransformer? _instance;
|
2022-08-27 07:53:37 +02:00
|
|
|
}
|
|
|
|
|