Files
sdk/lib/model/reference_version.dart

191 lines
6.4 KiB
Dart

//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// 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 hanzoai.cloud;
class ReferenceVersion {
/// Returns a new [ReferenceVersion] instance.
ReferenceVersion({
this.asOf,
this.refusal,
this.set_,
this.stale,
this.version,
});
/// AsOf is when the oldest of them was current, RFC 3339.
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
String? asOf;
/// Refusal is why it could not be consulted, when it could not.
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
String? refusal;
/// Set is the name the consulted set is addressed by.
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
String? set_;
/// Stale is whether it is past its freshness bound.
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
bool? stale;
/// Version is every contributing publisher and its content digest.
///
/// Please note: This property should have been non-nullable! Since the specification file
/// does not include a default value (using the "default:" property), however, the generated
/// source code must fall back to having a nullable type.
/// Consider adding a "default:" property in the specification file to hide this note.
///
String? version;
@override
bool operator ==(Object other) => identical(this, other) || other is ReferenceVersion &&
other.asOf == asOf &&
other.refusal == refusal &&
other.set_ == set_ &&
other.stale == stale &&
other.version == version;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(asOf == null ? 0 : asOf!.hashCode) +
(refusal == null ? 0 : refusal!.hashCode) +
(set_ == null ? 0 : set_!.hashCode) +
(stale == null ? 0 : stale!.hashCode) +
(version == null ? 0 : version!.hashCode);
@override
String toString() => 'ReferenceVersion[asOf=$asOf, refusal=$refusal, set_=$set_, stale=$stale, version=$version]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (this.asOf != null) {
json[r'asOf'] = this.asOf;
} else {
json[r'asOf'] = null;
}
if (this.refusal != null) {
json[r'refusal'] = this.refusal;
} else {
json[r'refusal'] = null;
}
if (this.set_ != null) {
json[r'set'] = this.set_;
} else {
json[r'set'] = null;
}
if (this.stale != null) {
json[r'stale'] = this.stale;
} else {
json[r'stale'] = null;
}
if (this.version != null) {
json[r'version'] = this.version;
} else {
json[r'version'] = null;
}
return json;
}
/// Returns a new [ReferenceVersion] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static ReferenceVersion? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
// Ensure that the map contains the required keys.
// Note 1: the values aren't checked for validity beyond being non-null.
// Note 2: this code is stripped in release mode!
assert(() {
requiredKeys.forEach((key) {
assert(json.containsKey(key), 'Required key "ReferenceVersion[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "ReferenceVersion[$key]" has a null value in JSON.');
});
return true;
}());
return ReferenceVersion(
asOf: mapValueOfType<String>(json, r'asOf'),
refusal: mapValueOfType<String>(json, r'refusal'),
set_: mapValueOfType<String>(json, r'set'),
stale: mapValueOfType<bool>(json, r'stale'),
version: mapValueOfType<String>(json, r'version'),
);
}
return null;
}
static List<ReferenceVersion> listFromJson(dynamic json, {bool growable = false,}) {
final result = <ReferenceVersion>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = ReferenceVersion.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, ReferenceVersion> mapFromJson(dynamic json) {
final map = <String, ReferenceVersion>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = ReferenceVersion.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of ReferenceVersion-objects as value to a dart map
static Map<String, List<ReferenceVersion>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<ReferenceVersion>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = ReferenceVersion.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
};
}