mymuseum-visitapp/manager_api/lib/model/ressource_dto.dart

90 lines
2.4 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 RessourceDTO {
/// Returns a new [RessourceDTO] instance.
RessourceDTO({
this.id,
this.type,
this.label,
});
String id;
RessourceType type;
String label;
@override
bool operator ==(Object other) => identical(this, other) || other is RessourceDTO &&
other.id == id &&
other.type == type &&
other.label == label;
@override
int get hashCode =>
(id == null ? 0 : id.hashCode) +
(type == null ? 0 : type.hashCode) +
(label == null ? 0 : label.hashCode);
@override
String toString() => 'RessourceDTO[id=$id, type=$type, label=$label]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (id != null) {
json[r'id'] = id;
}
if (type != null) {
json[r'type'] = type;
}
if (label != null) {
json[r'label'] = label;
}
return json;
}
/// Returns a new [RessourceDTO] instance and imports its values from
/// [json] if it's non-null, null if [json] is null.
static RessourceDTO fromJson(Map<String, dynamic> json) => json == null
? null
: RessourceDTO(
id: json[r'id'],
type: RessourceType.fromJson(json[r'type']),
label: json[r'label'],
);
static List<RessourceDTO> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <RessourceDTO>[]
: json.map((v) => RessourceDTO.fromJson(v)).toList(growable: true == growable);
static Map<String, RessourceDTO> mapFromJson(Map<String, dynamic> json) {
final map = <String, RessourceDTO>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) => map[key] = RessourceDTO.fromJson(v));
}
return map;
}
// maps a json object with a list of RessourceDTO-objects as value to a dart map
static Map<String, List<RessourceDTO>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
final map = <String, List<RessourceDTO>>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) {
map[key] = RessourceDTO.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
});
}
return map;
}
}