mirror of
https://github.com/gosticks/open-project-flutter-api.git
synced 2025-10-16 11:55:34 +00:00
fix: resolved type conversion
This commit is contained in:
parent
4a3123aa74
commit
064ffcd2c1
@ -30,22 +30,25 @@ class NotificationModelDetailsInner {
|
||||
ValuesPropertyModelLinks links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is NotificationModelDetailsInner &&
|
||||
other.type == type &&
|
||||
other.property == property &&
|
||||
other.value == value &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is NotificationModelDetailsInner &&
|
||||
other.type == type &&
|
||||
other.property == property &&
|
||||
other.value == value &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(property == null ? 0 : property!.hashCode) +
|
||||
(value == null ? 0 : value!.hashCode) +
|
||||
(links.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(property == null ? 0 : property!.hashCode) +
|
||||
(value == null ? 0 : value!.hashCode) +
|
||||
(links.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'NotificationModelDetailsInner[type=$type, property=$property, value=$value, links=$links]';
|
||||
String toString() =>
|
||||
'NotificationModelDetailsInner[type=$type, property=$property, value=$value, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -64,7 +67,7 @@ class NotificationModelDetailsInner {
|
||||
} else {
|
||||
json[r'value'] = null;
|
||||
}
|
||||
json[r'_links'] = this.links;
|
||||
json[r'_links'] = this.links;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -80,14 +83,16 @@ class NotificationModelDetailsInner {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "NotificationModelDetailsInner[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "NotificationModelDetailsInner[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "NotificationModelDetailsInner[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "NotificationModelDetailsInner[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return NotificationModelDetailsInner(
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: NotificationModelDetailsInnerTypeEnum.fromJson(json[r'_type']),
|
||||
property: mapValueOfType<Object>(json, r'property'),
|
||||
value: mapValueOfType<Object>(json, r'value'),
|
||||
links: ValuesPropertyModelLinks.fromJson(json[r'_links'])!,
|
||||
@ -96,7 +101,10 @@ class NotificationModelDetailsInner {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<NotificationModelDetailsInner> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<NotificationModelDetailsInner> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <NotificationModelDetailsInner>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -124,13 +132,19 @@ class NotificationModelDetailsInner {
|
||||
}
|
||||
|
||||
// maps a json object with a list of NotificationModelDetailsInner-objects as value to a dart map
|
||||
static Map<String, List<NotificationModelDetailsInner>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<NotificationModelDetailsInner>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<NotificationModelDetailsInner>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = NotificationModelDetailsInner.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = NotificationModelDetailsInner.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -145,7 +159,6 @@ class NotificationModelDetailsInner {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class NotificationModelDetailsInnerTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const NotificationModelDetailsInnerTypeEnum._(this.value);
|
||||
@ -158,16 +171,21 @@ class NotificationModelDetailsInnerTypeEnum {
|
||||
|
||||
Object toJson() => value;
|
||||
|
||||
static const valuesColonColonProperty = NotificationModelDetailsInnerTypeEnum._('Values::Property');
|
||||
static const valuesColonColonProperty =
|
||||
NotificationModelDetailsInnerTypeEnum._('Values::Property');
|
||||
|
||||
/// List of all possible values in this [enum][NotificationModelDetailsInnerTypeEnum].
|
||||
static const values = <NotificationModelDetailsInnerTypeEnum>[
|
||||
valuesColonColonProperty,
|
||||
];
|
||||
|
||||
static NotificationModelDetailsInnerTypeEnum? fromJson(dynamic value) => NotificationModelDetailsInnerTypeEnumTypeTransformer().decode(value);
|
||||
static NotificationModelDetailsInnerTypeEnum? fromJson(dynamic value) =>
|
||||
NotificationModelDetailsInnerTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<NotificationModelDetailsInnerTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<NotificationModelDetailsInnerTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <NotificationModelDetailsInnerTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -184,7 +202,9 @@ class NotificationModelDetailsInnerTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [NotificationModelDetailsInnerTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [NotificationModelDetailsInnerTypeEnum].
|
||||
class NotificationModelDetailsInnerTypeEnumTypeTransformer {
|
||||
factory NotificationModelDetailsInnerTypeEnumTypeTransformer() => _instance ??= const NotificationModelDetailsInnerTypeEnumTypeTransformer._();
|
||||
factory NotificationModelDetailsInnerTypeEnumTypeTransformer() =>
|
||||
_instance ??=
|
||||
const NotificationModelDetailsInnerTypeEnumTypeTransformer._();
|
||||
|
||||
const NotificationModelDetailsInnerTypeEnumTypeTransformer._();
|
||||
|
||||
@ -198,10 +218,12 @@ class NotificationModelDetailsInnerTypeEnumTypeTransformer {
|
||||
///
|
||||
/// 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.
|
||||
NotificationModelDetailsInnerTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
NotificationModelDetailsInnerTypeEnum? decode(dynamic data,
|
||||
{bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'Values::Property': return NotificationModelDetailsInnerTypeEnum.valuesColonColonProperty;
|
||||
case 'Values::Property':
|
||||
return NotificationModelDetailsInnerTypeEnum.valuesColonColonProperty;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -214,5 +236,3 @@ class NotificationModelDetailsInnerTypeEnumTypeTransformer {
|
||||
/// Singleton [NotificationModelDetailsInnerTypeEnumTypeTransformer] instance.
|
||||
static NotificationModelDetailsInnerTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -107,56 +107,59 @@ class NotificationModelEmbeddedResource {
|
||||
WorkPackageModelLinks links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is NotificationModelEmbeddedResource &&
|
||||
other.id == id &&
|
||||
other.lockVersion == lockVersion &&
|
||||
other.subject == subject &&
|
||||
other.type == type &&
|
||||
other.description == description &&
|
||||
other.scheduleManually == scheduleManually &&
|
||||
other.readonly == readonly &&
|
||||
other.startDate == startDate &&
|
||||
other.dueDate == dueDate &&
|
||||
other.date == date &&
|
||||
other.derivedStartDate == derivedStartDate &&
|
||||
other.derivedDueDate == derivedDueDate &&
|
||||
other.duration == duration &&
|
||||
other.estimatedTime == estimatedTime &&
|
||||
other.derivedEstimatedTime == derivedEstimatedTime &&
|
||||
other.ignoreNonWorkingDays == ignoreNonWorkingDays &&
|
||||
other.spentTime == spentTime &&
|
||||
other.percentageDone == percentageDone &&
|
||||
other.createdAt == createdAt &&
|
||||
other.updatedAt == updatedAt &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is NotificationModelEmbeddedResource &&
|
||||
other.id == id &&
|
||||
other.lockVersion == lockVersion &&
|
||||
other.subject == subject &&
|
||||
other.type == type &&
|
||||
other.description == description &&
|
||||
other.scheduleManually == scheduleManually &&
|
||||
other.readonly == readonly &&
|
||||
other.startDate == startDate &&
|
||||
other.dueDate == dueDate &&
|
||||
other.date == date &&
|
||||
other.derivedStartDate == derivedStartDate &&
|
||||
other.derivedDueDate == derivedDueDate &&
|
||||
other.duration == duration &&
|
||||
other.estimatedTime == estimatedTime &&
|
||||
other.derivedEstimatedTime == derivedEstimatedTime &&
|
||||
other.ignoreNonWorkingDays == ignoreNonWorkingDays &&
|
||||
other.spentTime == spentTime &&
|
||||
other.percentageDone == percentageDone &&
|
||||
other.createdAt == createdAt &&
|
||||
other.updatedAt == updatedAt &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(lockVersion == null ? 0 : lockVersion!.hashCode) +
|
||||
(subject == null ? 0 : subject!.hashCode) +
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(description == null ? 0 : description!.hashCode) +
|
||||
(scheduleManually == null ? 0 : scheduleManually!.hashCode) +
|
||||
(readonly == null ? 0 : readonly!.hashCode) +
|
||||
(startDate == null ? 0 : startDate!.hashCode) +
|
||||
(dueDate == null ? 0 : dueDate!.hashCode) +
|
||||
(date == null ? 0 : date!.hashCode) +
|
||||
(derivedStartDate == null ? 0 : derivedStartDate!.hashCode) +
|
||||
(derivedDueDate == null ? 0 : derivedDueDate!.hashCode) +
|
||||
(duration == null ? 0 : duration!.hashCode) +
|
||||
(estimatedTime == null ? 0 : estimatedTime!.hashCode) +
|
||||
(derivedEstimatedTime == null ? 0 : derivedEstimatedTime!.hashCode) +
|
||||
(ignoreNonWorkingDays == null ? 0 : ignoreNonWorkingDays!.hashCode) +
|
||||
(spentTime == null ? 0 : spentTime!.hashCode) +
|
||||
(percentageDone == null ? 0 : percentageDone!.hashCode) +
|
||||
(createdAt == null ? 0 : createdAt!.hashCode) +
|
||||
(updatedAt == null ? 0 : updatedAt!.hashCode) +
|
||||
(links.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(lockVersion == null ? 0 : lockVersion!.hashCode) +
|
||||
(subject == null ? 0 : subject!.hashCode) +
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(description == null ? 0 : description!.hashCode) +
|
||||
(scheduleManually == null ? 0 : scheduleManually!.hashCode) +
|
||||
(readonly == null ? 0 : readonly!.hashCode) +
|
||||
(startDate == null ? 0 : startDate!.hashCode) +
|
||||
(dueDate == null ? 0 : dueDate!.hashCode) +
|
||||
(date == null ? 0 : date!.hashCode) +
|
||||
(derivedStartDate == null ? 0 : derivedStartDate!.hashCode) +
|
||||
(derivedDueDate == null ? 0 : derivedDueDate!.hashCode) +
|
||||
(duration == null ? 0 : duration!.hashCode) +
|
||||
(estimatedTime == null ? 0 : estimatedTime!.hashCode) +
|
||||
(derivedEstimatedTime == null ? 0 : derivedEstimatedTime!.hashCode) +
|
||||
(ignoreNonWorkingDays == null ? 0 : ignoreNonWorkingDays!.hashCode) +
|
||||
(spentTime == null ? 0 : spentTime!.hashCode) +
|
||||
(percentageDone == null ? 0 : percentageDone!.hashCode) +
|
||||
(createdAt == null ? 0 : createdAt!.hashCode) +
|
||||
(updatedAt == null ? 0 : updatedAt!.hashCode) +
|
||||
(links.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'NotificationModelEmbeddedResource[id=$id, lockVersion=$lockVersion, subject=$subject, type=$type, description=$description, scheduleManually=$scheduleManually, readonly=$readonly, startDate=$startDate, dueDate=$dueDate, date=$date, derivedStartDate=$derivedStartDate, derivedDueDate=$derivedDueDate, duration=$duration, estimatedTime=$estimatedTime, derivedEstimatedTime=$derivedEstimatedTime, ignoreNonWorkingDays=$ignoreNonWorkingDays, spentTime=$spentTime, percentageDone=$percentageDone, createdAt=$createdAt, updatedAt=$updatedAt, links=$links]';
|
||||
String toString() =>
|
||||
'NotificationModelEmbeddedResource[id=$id, lockVersion=$lockVersion, subject=$subject, type=$type, description=$description, scheduleManually=$scheduleManually, readonly=$readonly, startDate=$startDate, dueDate=$dueDate, date=$date, derivedStartDate=$derivedStartDate, derivedDueDate=$derivedDueDate, duration=$duration, estimatedTime=$estimatedTime, derivedEstimatedTime=$derivedEstimatedTime, ignoreNonWorkingDays=$ignoreNonWorkingDays, spentTime=$spentTime, percentageDone=$percentageDone, createdAt=$createdAt, updatedAt=$updatedAt, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -260,7 +263,7 @@ class NotificationModelEmbeddedResource {
|
||||
} else {
|
||||
json[r'updatedAt'] = null;
|
||||
}
|
||||
json[r'_links'] = this.links;
|
||||
json[r'_links'] = this.links;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -276,8 +279,10 @@ class NotificationModelEmbeddedResource {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "NotificationModelEmbeddedResource[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "NotificationModelEmbeddedResource[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "NotificationModelEmbeddedResource[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "NotificationModelEmbeddedResource[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
@ -286,7 +291,8 @@ class NotificationModelEmbeddedResource {
|
||||
id: mapValueOfType<Object>(json, r'id'),
|
||||
lockVersion: mapValueOfType<Object>(json, r'lockVersion'),
|
||||
subject: mapValueOfType<Object>(json, r'subject'),
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type:
|
||||
NotificationModelEmbeddedResourceTypeEnum.fromJson(json[r'_type']),
|
||||
description: WorkPackageModelDescription.fromJson(json[r'description']),
|
||||
scheduleManually: mapValueOfType<Object>(json, r'scheduleManually'),
|
||||
readonly: mapValueOfType<Object>(json, r'readonly'),
|
||||
@ -297,8 +303,10 @@ class NotificationModelEmbeddedResource {
|
||||
derivedDueDate: mapValueOfType<Object>(json, r'derivedDueDate'),
|
||||
duration: mapValueOfType<Object>(json, r'duration'),
|
||||
estimatedTime: mapValueOfType<Object>(json, r'estimatedTime'),
|
||||
derivedEstimatedTime: mapValueOfType<Object>(json, r'derivedEstimatedTime'),
|
||||
ignoreNonWorkingDays: mapValueOfType<Object>(json, r'ignoreNonWorkingDays'),
|
||||
derivedEstimatedTime:
|
||||
mapValueOfType<Object>(json, r'derivedEstimatedTime'),
|
||||
ignoreNonWorkingDays:
|
||||
mapValueOfType<Object>(json, r'ignoreNonWorkingDays'),
|
||||
spentTime: mapValueOfType<Object>(json, r'spentTime'),
|
||||
percentageDone: mapValueOfType<Object>(json, r'percentageDone'),
|
||||
createdAt: mapValueOfType<Object>(json, r'createdAt'),
|
||||
@ -309,7 +317,10 @@ class NotificationModelEmbeddedResource {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<NotificationModelEmbeddedResource> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<NotificationModelEmbeddedResource> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <NotificationModelEmbeddedResource>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -322,7 +333,8 @@ class NotificationModelEmbeddedResource {
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, NotificationModelEmbeddedResource> mapFromJson(dynamic json) {
|
||||
static Map<String, NotificationModelEmbeddedResource> mapFromJson(
|
||||
dynamic json) {
|
||||
final map = <String, NotificationModelEmbeddedResource>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
@ -337,13 +349,19 @@ class NotificationModelEmbeddedResource {
|
||||
}
|
||||
|
||||
// maps a json object with a list of NotificationModelEmbeddedResource-objects as value to a dart map
|
||||
static Map<String, List<NotificationModelEmbeddedResource>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<NotificationModelEmbeddedResource>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<NotificationModelEmbeddedResource>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = NotificationModelEmbeddedResource.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = NotificationModelEmbeddedResource.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -356,7 +374,6 @@ class NotificationModelEmbeddedResource {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class NotificationModelEmbeddedResourceTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const NotificationModelEmbeddedResourceTypeEnum._(this.value);
|
||||
@ -369,16 +386,21 @@ class NotificationModelEmbeddedResourceTypeEnum {
|
||||
|
||||
Object toJson() => value;
|
||||
|
||||
static const workPackage = NotificationModelEmbeddedResourceTypeEnum._('WorkPackage');
|
||||
static const workPackage =
|
||||
NotificationModelEmbeddedResourceTypeEnum._('WorkPackage');
|
||||
|
||||
/// List of all possible values in this [enum][NotificationModelEmbeddedResourceTypeEnum].
|
||||
static const values = <NotificationModelEmbeddedResourceTypeEnum>[
|
||||
workPackage,
|
||||
];
|
||||
|
||||
static NotificationModelEmbeddedResourceTypeEnum? fromJson(dynamic value) => NotificationModelEmbeddedResourceTypeEnumTypeTransformer().decode(value);
|
||||
static NotificationModelEmbeddedResourceTypeEnum? fromJson(dynamic value) =>
|
||||
NotificationModelEmbeddedResourceTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<NotificationModelEmbeddedResourceTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<NotificationModelEmbeddedResourceTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <NotificationModelEmbeddedResourceTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -395,7 +417,9 @@ class NotificationModelEmbeddedResourceTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [NotificationModelEmbeddedResourceTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [NotificationModelEmbeddedResourceTypeEnum].
|
||||
class NotificationModelEmbeddedResourceTypeEnumTypeTransformer {
|
||||
factory NotificationModelEmbeddedResourceTypeEnumTypeTransformer() => _instance ??= const NotificationModelEmbeddedResourceTypeEnumTypeTransformer._();
|
||||
factory NotificationModelEmbeddedResourceTypeEnumTypeTransformer() =>
|
||||
_instance ??=
|
||||
const NotificationModelEmbeddedResourceTypeEnumTypeTransformer._();
|
||||
|
||||
const NotificationModelEmbeddedResourceTypeEnumTypeTransformer._();
|
||||
|
||||
@ -409,10 +433,12 @@ class NotificationModelEmbeddedResourceTypeEnumTypeTransformer {
|
||||
///
|
||||
/// 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.
|
||||
NotificationModelEmbeddedResourceTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
NotificationModelEmbeddedResourceTypeEnum? decode(dynamic data,
|
||||
{bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'WorkPackage': return NotificationModelEmbeddedResourceTypeEnum.workPackage;
|
||||
case 'WorkPackage':
|
||||
return NotificationModelEmbeddedResourceTypeEnum.workPackage;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -425,5 +451,3 @@ class NotificationModelEmbeddedResourceTypeEnumTypeTransformer {
|
||||
/// Singleton [NotificationModelEmbeddedResourceTypeEnumTypeTransformer] instance.
|
||||
static NotificationModelEmbeddedResourceTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -38,22 +38,25 @@ class RoleModel {
|
||||
RoleModelLinks? links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is RoleModel &&
|
||||
other.type == type &&
|
||||
other.id == id &&
|
||||
other.name == name &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is RoleModel &&
|
||||
other.type == type &&
|
||||
other.id == id &&
|
||||
other.name == name &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(links == null ? 0 : links!.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(links == null ? 0 : links!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'RoleModel[type=$type, id=$id, name=$name, links=$links]';
|
||||
String toString() =>
|
||||
'RoleModel[type=$type, id=$id, name=$name, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -92,14 +95,16 @@ class RoleModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "RoleModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "RoleModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "RoleModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "RoleModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return RoleModel(
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: RoleModelTypeEnum.fromJson(json[r'_type']),
|
||||
id: mapValueOfType<Object>(json, r'id'),
|
||||
name: mapValueOfType<Object>(json, r'name'),
|
||||
links: RoleModelLinks.fromJson(json[r'_links']),
|
||||
@ -108,7 +113,10 @@ class RoleModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<RoleModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<RoleModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <RoleModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -136,13 +144,19 @@ class RoleModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of RoleModel-objects as value to a dart map
|
||||
static Map<String, List<RoleModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<RoleModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<RoleModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = RoleModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = RoleModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -154,7 +168,6 @@ class RoleModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class RoleModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const RoleModelTypeEnum._(this.value);
|
||||
@ -174,9 +187,13 @@ class RoleModelTypeEnum {
|
||||
role,
|
||||
];
|
||||
|
||||
static RoleModelTypeEnum? fromJson(dynamic value) => RoleModelTypeEnumTypeTransformer().decode(value);
|
||||
static RoleModelTypeEnum? fromJson(dynamic value) =>
|
||||
RoleModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<RoleModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<RoleModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <RoleModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -193,7 +210,8 @@ class RoleModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [RoleModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [RoleModelTypeEnum].
|
||||
class RoleModelTypeEnumTypeTransformer {
|
||||
factory RoleModelTypeEnumTypeTransformer() => _instance ??= const RoleModelTypeEnumTypeTransformer._();
|
||||
factory RoleModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const RoleModelTypeEnumTypeTransformer._();
|
||||
|
||||
const RoleModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -210,7 +228,8 @@ class RoleModelTypeEnumTypeTransformer {
|
||||
RoleModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'Role': return RoleModelTypeEnum.role;
|
||||
case 'Role':
|
||||
return RoleModelTypeEnum.role;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -223,5 +242,3 @@ class RoleModelTypeEnumTypeTransformer {
|
||||
/// Singleton [RoleModelTypeEnumTypeTransformer] instance.
|
||||
static RoleModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -30,22 +30,25 @@ class RootModel {
|
||||
RootModelLinks links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is RootModel &&
|
||||
other.type == type &&
|
||||
other.instanceName == instanceName &&
|
||||
other.coreVersion == coreVersion &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is RootModel &&
|
||||
other.type == type &&
|
||||
other.instanceName == instanceName &&
|
||||
other.coreVersion == coreVersion &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(instanceName == null ? 0 : instanceName!.hashCode) +
|
||||
(coreVersion == null ? 0 : coreVersion!.hashCode) +
|
||||
(links.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(instanceName == null ? 0 : instanceName!.hashCode) +
|
||||
(coreVersion == null ? 0 : coreVersion!.hashCode) +
|
||||
(links.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'RootModel[type=$type, instanceName=$instanceName, coreVersion=$coreVersion, links=$links]';
|
||||
String toString() =>
|
||||
'RootModel[type=$type, instanceName=$instanceName, coreVersion=$coreVersion, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -64,7 +67,7 @@ class RootModel {
|
||||
} else {
|
||||
json[r'coreVersion'] = null;
|
||||
}
|
||||
json[r'_links'] = this.links;
|
||||
json[r'_links'] = this.links;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -80,14 +83,16 @@ class RootModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "RootModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "RootModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "RootModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "RootModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return RootModel(
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: RootModelTypeEnum.fromJson(json[r'_type']),
|
||||
instanceName: mapValueOfType<Object>(json, r'instanceName'),
|
||||
coreVersion: mapValueOfType<Object>(json, r'coreVersion'),
|
||||
links: RootModelLinks.fromJson(json[r'_links'])!,
|
||||
@ -96,7 +101,10 @@ class RootModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<RootModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<RootModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <RootModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -124,13 +132,19 @@ class RootModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of RootModel-objects as value to a dart map
|
||||
static Map<String, List<RootModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<RootModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<RootModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = RootModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = RootModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -144,7 +158,6 @@ class RootModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class RootModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const RootModelTypeEnum._(this.value);
|
||||
@ -164,9 +177,13 @@ class RootModelTypeEnum {
|
||||
root,
|
||||
];
|
||||
|
||||
static RootModelTypeEnum? fromJson(dynamic value) => RootModelTypeEnumTypeTransformer().decode(value);
|
||||
static RootModelTypeEnum? fromJson(dynamic value) =>
|
||||
RootModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<RootModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<RootModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <RootModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -183,7 +200,8 @@ class RootModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [RootModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [RootModelTypeEnum].
|
||||
class RootModelTypeEnumTypeTransformer {
|
||||
factory RootModelTypeEnumTypeTransformer() => _instance ??= const RootModelTypeEnumTypeTransformer._();
|
||||
factory RootModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const RootModelTypeEnumTypeTransformer._();
|
||||
|
||||
const RootModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -200,7 +218,8 @@ class RootModelTypeEnumTypeTransformer {
|
||||
RootModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'Root': return RootModelTypeEnum.root;
|
||||
case 'Root':
|
||||
return RootModelTypeEnum.root;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -213,5 +232,3 @@ class RootModelTypeEnumTypeTransformer {
|
||||
/// Singleton [RootModelTypeEnumTypeTransformer] instance.
|
||||
static RootModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -26,20 +26,23 @@ class SchemaModel {
|
||||
SchemaModelLinks links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is SchemaModel &&
|
||||
other.type == type &&
|
||||
other.dependencies == dependencies &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is SchemaModel &&
|
||||
other.type == type &&
|
||||
other.dependencies == dependencies &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(dependencies == null ? 0 : dependencies!.hashCode) +
|
||||
(links.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(dependencies == null ? 0 : dependencies!.hashCode) +
|
||||
(links.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SchemaModel[type=$type, dependencies=$dependencies, links=$links]';
|
||||
String toString() =>
|
||||
'SchemaModel[type=$type, dependencies=$dependencies, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -53,7 +56,7 @@ class SchemaModel {
|
||||
} else {
|
||||
json[r'_dependencies'] = null;
|
||||
}
|
||||
json[r'_links'] = this.links;
|
||||
json[r'_links'] = this.links;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -69,14 +72,16 @@ class SchemaModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "SchemaModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "SchemaModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "SchemaModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "SchemaModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return SchemaModel(
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: SchemaModelTypeEnum.fromJson(json[r'_type']),
|
||||
dependencies: mapValueOfType<Object>(json, r'_dependencies'),
|
||||
links: SchemaModelLinks.fromJson(json[r'_links'])!,
|
||||
);
|
||||
@ -84,7 +89,10 @@ class SchemaModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<SchemaModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<SchemaModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <SchemaModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -112,13 +120,19 @@ class SchemaModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of SchemaModel-objects as value to a dart map
|
||||
static Map<String, List<SchemaModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<SchemaModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<SchemaModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = SchemaModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = SchemaModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -131,7 +145,6 @@ class SchemaModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class SchemaModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const SchemaModelTypeEnum._(this.value);
|
||||
@ -151,9 +164,13 @@ class SchemaModelTypeEnum {
|
||||
schema,
|
||||
];
|
||||
|
||||
static SchemaModelTypeEnum? fromJson(dynamic value) => SchemaModelTypeEnumTypeTransformer().decode(value);
|
||||
static SchemaModelTypeEnum? fromJson(dynamic value) =>
|
||||
SchemaModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<SchemaModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<SchemaModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <SchemaModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -170,7 +187,8 @@ class SchemaModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [SchemaModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [SchemaModelTypeEnum].
|
||||
class SchemaModelTypeEnumTypeTransformer {
|
||||
factory SchemaModelTypeEnumTypeTransformer() => _instance ??= const SchemaModelTypeEnumTypeTransformer._();
|
||||
factory SchemaModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const SchemaModelTypeEnumTypeTransformer._();
|
||||
|
||||
const SchemaModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -187,7 +205,8 @@ class SchemaModelTypeEnumTypeTransformer {
|
||||
SchemaModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'Schema': return SchemaModelTypeEnum.schema;
|
||||
case 'Schema':
|
||||
return SchemaModelTypeEnum.schema;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -200,5 +219,3 @@ class SchemaModelTypeEnumTypeTransformer {
|
||||
/// Singleton [SchemaModelTypeEnumTypeTransformer] instance.
|
||||
static SchemaModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -59,32 +59,35 @@ class StatusModel {
|
||||
StatusModelLinks? links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is StatusModel &&
|
||||
other.type == type &&
|
||||
other.id == id &&
|
||||
other.name == name &&
|
||||
other.position == position &&
|
||||
other.isDefault == isDefault &&
|
||||
other.isClosed == isClosed &&
|
||||
other.isReadonly == isReadonly &&
|
||||
other.defaultDoneRatio == defaultDoneRatio &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is StatusModel &&
|
||||
other.type == type &&
|
||||
other.id == id &&
|
||||
other.name == name &&
|
||||
other.position == position &&
|
||||
other.isDefault == isDefault &&
|
||||
other.isClosed == isClosed &&
|
||||
other.isReadonly == isReadonly &&
|
||||
other.defaultDoneRatio == defaultDoneRatio &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(position == null ? 0 : position!.hashCode) +
|
||||
(isDefault == null ? 0 : isDefault!.hashCode) +
|
||||
(isClosed == null ? 0 : isClosed!.hashCode) +
|
||||
(isReadonly == null ? 0 : isReadonly!.hashCode) +
|
||||
(defaultDoneRatio == null ? 0 : defaultDoneRatio!.hashCode) +
|
||||
(links == null ? 0 : links!.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(position == null ? 0 : position!.hashCode) +
|
||||
(isDefault == null ? 0 : isDefault!.hashCode) +
|
||||
(isClosed == null ? 0 : isClosed!.hashCode) +
|
||||
(isReadonly == null ? 0 : isReadonly!.hashCode) +
|
||||
(defaultDoneRatio == null ? 0 : defaultDoneRatio!.hashCode) +
|
||||
(links == null ? 0 : links!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'StatusModel[type=$type, id=$id, name=$name, position=$position, isDefault=$isDefault, isClosed=$isClosed, isReadonly=$isReadonly, defaultDoneRatio=$defaultDoneRatio, links=$links]';
|
||||
String toString() =>
|
||||
'StatusModel[type=$type, id=$id, name=$name, position=$position, isDefault=$isDefault, isClosed=$isClosed, isReadonly=$isReadonly, defaultDoneRatio=$defaultDoneRatio, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -148,14 +151,16 @@ class StatusModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "StatusModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "StatusModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "StatusModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "StatusModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return StatusModel(
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: StatusModelTypeEnum.fromJson(json[r'_type']),
|
||||
id: mapValueOfType<Object>(json, r'id'),
|
||||
name: mapValueOfType<Object>(json, r'name'),
|
||||
position: mapValueOfType<Object>(json, r'position'),
|
||||
@ -169,7 +174,10 @@ class StatusModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<StatusModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<StatusModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <StatusModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -197,24 +205,28 @@ class StatusModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of StatusModel-objects as value to a dart map
|
||||
static Map<String, List<StatusModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<StatusModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<StatusModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = StatusModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = StatusModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
};
|
||||
static const requiredKeys = <String>{};
|
||||
}
|
||||
|
||||
|
||||
class StatusModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const StatusModelTypeEnum._(this.value);
|
||||
@ -234,9 +246,13 @@ class StatusModelTypeEnum {
|
||||
status,
|
||||
];
|
||||
|
||||
static StatusModelTypeEnum? fromJson(dynamic value) => StatusModelTypeEnumTypeTransformer().decode(value);
|
||||
static StatusModelTypeEnum? fromJson(dynamic value) =>
|
||||
StatusModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<StatusModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<StatusModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <StatusModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -253,7 +269,8 @@ class StatusModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [StatusModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [StatusModelTypeEnum].
|
||||
class StatusModelTypeEnumTypeTransformer {
|
||||
factory StatusModelTypeEnumTypeTransformer() => _instance ??= const StatusModelTypeEnumTypeTransformer._();
|
||||
factory StatusModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const StatusModelTypeEnumTypeTransformer._();
|
||||
|
||||
const StatusModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -270,7 +287,8 @@ class StatusModelTypeEnumTypeTransformer {
|
||||
StatusModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'Status': return StatusModelTypeEnum.status;
|
||||
case 'Status':
|
||||
return StatusModelTypeEnum.status;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -283,5 +301,3 @@ class StatusModelTypeEnumTypeTransformer {
|
||||
/// Singleton [StatusModelTypeEnumTypeTransformer] instance.
|
||||
static StatusModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -96,41 +96,44 @@ class StorageFileModel {
|
||||
StorageFileModelAllOfLinks links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is StorageFileModel &&
|
||||
other.id == id &&
|
||||
other.name == name &&
|
||||
other.mimeType == mimeType &&
|
||||
other.size == size &&
|
||||
other.createdAt == createdAt &&
|
||||
other.lastModifiedAt == lastModifiedAt &&
|
||||
other.createdByName == createdByName &&
|
||||
other.lastModifiedByName == lastModifiedByName &&
|
||||
other.type == type &&
|
||||
other.location == location &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is StorageFileModel &&
|
||||
other.id == id &&
|
||||
other.name == name &&
|
||||
other.mimeType == mimeType &&
|
||||
other.size == size &&
|
||||
other.createdAt == createdAt &&
|
||||
other.lastModifiedAt == lastModifiedAt &&
|
||||
other.createdByName == createdByName &&
|
||||
other.lastModifiedByName == lastModifiedByName &&
|
||||
other.type == type &&
|
||||
other.location == location &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id.hashCode) +
|
||||
(name.hashCode) +
|
||||
(mimeType == null ? 0 : mimeType!.hashCode) +
|
||||
(size == null ? 0 : size!.hashCode) +
|
||||
(createdAt == null ? 0 : createdAt!.hashCode) +
|
||||
(lastModifiedAt == null ? 0 : lastModifiedAt!.hashCode) +
|
||||
(createdByName == null ? 0 : createdByName!.hashCode) +
|
||||
(lastModifiedByName == null ? 0 : lastModifiedByName!.hashCode) +
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(location == null ? 0 : location!.hashCode) +
|
||||
(links.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id.hashCode) +
|
||||
(name.hashCode) +
|
||||
(mimeType == null ? 0 : mimeType!.hashCode) +
|
||||
(size == null ? 0 : size!.hashCode) +
|
||||
(createdAt == null ? 0 : createdAt!.hashCode) +
|
||||
(lastModifiedAt == null ? 0 : lastModifiedAt!.hashCode) +
|
||||
(createdByName == null ? 0 : createdByName!.hashCode) +
|
||||
(lastModifiedByName == null ? 0 : lastModifiedByName!.hashCode) +
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(location == null ? 0 : location!.hashCode) +
|
||||
(links.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'StorageFileModel[id=$id, name=$name, mimeType=$mimeType, size=$size, createdAt=$createdAt, lastModifiedAt=$lastModifiedAt, createdByName=$createdByName, lastModifiedByName=$lastModifiedByName, type=$type, location=$location, links=$links]';
|
||||
String toString() =>
|
||||
'StorageFileModel[id=$id, name=$name, mimeType=$mimeType, size=$size, createdAt=$createdAt, lastModifiedAt=$lastModifiedAt, createdByName=$createdByName, lastModifiedByName=$lastModifiedByName, type=$type, location=$location, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'id'] = this.id;
|
||||
json[r'name'] = this.name;
|
||||
json[r'id'] = this.id;
|
||||
json[r'name'] = this.name;
|
||||
if (this.mimeType != null) {
|
||||
json[r'mimeType'] = this.mimeType;
|
||||
} else {
|
||||
@ -171,7 +174,7 @@ class StorageFileModel {
|
||||
} else {
|
||||
json[r'location'] = null;
|
||||
}
|
||||
json[r'_links'] = this.links;
|
||||
json[r'_links'] = this.links;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -187,8 +190,10 @@ class StorageFileModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "StorageFileModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "StorageFileModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "StorageFileModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "StorageFileModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
@ -202,7 +207,7 @@ class StorageFileModel {
|
||||
lastModifiedAt: mapDateTime(json, r'lastModifiedAt', r''),
|
||||
createdByName: mapValueOfType<String>(json, r'createdByName'),
|
||||
lastModifiedByName: mapValueOfType<String>(json, r'lastModifiedByName'),
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: StorageFileModelTypeEnum.fromJson(json[r'_type']),
|
||||
location: mapValueOfType<Object>(json, r'location'),
|
||||
links: StorageFileModelAllOfLinks.fromJson(json[r'_links'])!,
|
||||
);
|
||||
@ -210,7 +215,10 @@ class StorageFileModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<StorageFileModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<StorageFileModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <StorageFileModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -238,13 +246,19 @@ class StorageFileModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of StorageFileModel-objects as value to a dart map
|
||||
static Map<String, List<StorageFileModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<StorageFileModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<StorageFileModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = StorageFileModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = StorageFileModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -260,7 +274,6 @@ class StorageFileModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class StorageFileModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const StorageFileModelTypeEnum._(this.value);
|
||||
@ -280,9 +293,13 @@ class StorageFileModelTypeEnum {
|
||||
storageFile,
|
||||
];
|
||||
|
||||
static StorageFileModelTypeEnum? fromJson(dynamic value) => StorageFileModelTypeEnumTypeTransformer().decode(value);
|
||||
static StorageFileModelTypeEnum? fromJson(dynamic value) =>
|
||||
StorageFileModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<StorageFileModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<StorageFileModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <StorageFileModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -299,7 +316,8 @@ class StorageFileModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [StorageFileModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [StorageFileModelTypeEnum].
|
||||
class StorageFileModelTypeEnumTypeTransformer {
|
||||
factory StorageFileModelTypeEnumTypeTransformer() => _instance ??= const StorageFileModelTypeEnumTypeTransformer._();
|
||||
factory StorageFileModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const StorageFileModelTypeEnumTypeTransformer._();
|
||||
|
||||
const StorageFileModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -316,7 +334,8 @@ class StorageFileModelTypeEnumTypeTransformer {
|
||||
StorageFileModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'StorageFile': return StorageFileModelTypeEnum.storageFile;
|
||||
case 'StorageFile':
|
||||
return StorageFileModelTypeEnum.storageFile;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -329,5 +348,3 @@ class StorageFileModelTypeEnumTypeTransformer {
|
||||
/// Singleton [StorageFileModelTypeEnumTypeTransformer] instance.
|
||||
static StorageFileModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,15 +22,16 @@ class StorageFileUploadLinkModel {
|
||||
StorageFileUploadLinkModelLinks links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is StorageFileUploadLinkModel &&
|
||||
other.type == type &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is StorageFileUploadLinkModel &&
|
||||
other.type == type &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(links.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) + (links.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'StorageFileUploadLinkModel[type=$type, links=$links]';
|
||||
@ -42,7 +43,7 @@ class StorageFileUploadLinkModel {
|
||||
} else {
|
||||
json[r'_type'] = null;
|
||||
}
|
||||
json[r'_links'] = this.links;
|
||||
json[r'_links'] = this.links;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -58,21 +59,26 @@ class StorageFileUploadLinkModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "StorageFileUploadLinkModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "StorageFileUploadLinkModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "StorageFileUploadLinkModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "StorageFileUploadLinkModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return StorageFileUploadLinkModel(
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: StorageFileUploadLinkModelTypeEnum.fromJson(json[r'_type']),
|
||||
links: StorageFileUploadLinkModelLinks.fromJson(json[r'_links'])!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<StorageFileUploadLinkModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<StorageFileUploadLinkModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <StorageFileUploadLinkModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -100,13 +106,19 @@ class StorageFileUploadLinkModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of StorageFileUploadLinkModel-objects as value to a dart map
|
||||
static Map<String, List<StorageFileUploadLinkModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<StorageFileUploadLinkModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<StorageFileUploadLinkModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = StorageFileUploadLinkModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = StorageFileUploadLinkModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -119,7 +131,6 @@ class StorageFileUploadLinkModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class StorageFileUploadLinkModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const StorageFileUploadLinkModelTypeEnum._(this.value);
|
||||
@ -139,9 +150,13 @@ class StorageFileUploadLinkModelTypeEnum {
|
||||
uploadLink,
|
||||
];
|
||||
|
||||
static StorageFileUploadLinkModelTypeEnum? fromJson(dynamic value) => StorageFileUploadLinkModelTypeEnumTypeTransformer().decode(value);
|
||||
static StorageFileUploadLinkModelTypeEnum? fromJson(dynamic value) =>
|
||||
StorageFileUploadLinkModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<StorageFileUploadLinkModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<StorageFileUploadLinkModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <StorageFileUploadLinkModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -158,7 +173,8 @@ class StorageFileUploadLinkModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [StorageFileUploadLinkModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [StorageFileUploadLinkModelTypeEnum].
|
||||
class StorageFileUploadLinkModelTypeEnumTypeTransformer {
|
||||
factory StorageFileUploadLinkModelTypeEnumTypeTransformer() => _instance ??= const StorageFileUploadLinkModelTypeEnumTypeTransformer._();
|
||||
factory StorageFileUploadLinkModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const StorageFileUploadLinkModelTypeEnumTypeTransformer._();
|
||||
|
||||
const StorageFileUploadLinkModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -172,10 +188,12 @@ class StorageFileUploadLinkModelTypeEnumTypeTransformer {
|
||||
///
|
||||
/// 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.
|
||||
StorageFileUploadLinkModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
StorageFileUploadLinkModelTypeEnum? decode(dynamic data,
|
||||
{bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'UploadLink': return StorageFileUploadLinkModelTypeEnum.uploadLink;
|
||||
case 'UploadLink':
|
||||
return StorageFileUploadLinkModelTypeEnum.uploadLink;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -188,5 +206,3 @@ class StorageFileUploadLinkModelTypeEnumTypeTransformer {
|
||||
/// Singleton [StorageFileUploadLinkModelTypeEnumTypeTransformer] instance.
|
||||
static StorageFileUploadLinkModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -33,24 +33,27 @@ class StorageFilesModel {
|
||||
StorageFileModelAllOfLinks links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is StorageFilesModel &&
|
||||
other.type == type &&
|
||||
other.files == files &&
|
||||
other.parent == parent &&
|
||||
other.ancestors == ancestors &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is StorageFilesModel &&
|
||||
other.type == type &&
|
||||
other.files == files &&
|
||||
other.parent == parent &&
|
||||
other.ancestors == ancestors &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(files == null ? 0 : files!.hashCode) +
|
||||
(parent.hashCode) +
|
||||
(ancestors == null ? 0 : ancestors!.hashCode) +
|
||||
(links.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(files == null ? 0 : files!.hashCode) +
|
||||
(parent.hashCode) +
|
||||
(ancestors == null ? 0 : ancestors!.hashCode) +
|
||||
(links.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'StorageFilesModel[type=$type, files=$files, parent=$parent, ancestors=$ancestors, links=$links]';
|
||||
String toString() =>
|
||||
'StorageFilesModel[type=$type, files=$files, parent=$parent, ancestors=$ancestors, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -64,13 +67,13 @@ class StorageFilesModel {
|
||||
} else {
|
||||
json[r'files'] = null;
|
||||
}
|
||||
json[r'parent'] = this.parent;
|
||||
json[r'parent'] = this.parent;
|
||||
if (this.ancestors != null) {
|
||||
json[r'ancestors'] = this.ancestors;
|
||||
} else {
|
||||
json[r'ancestors'] = null;
|
||||
}
|
||||
json[r'_links'] = this.links;
|
||||
json[r'_links'] = this.links;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -86,14 +89,16 @@ class StorageFilesModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "StorageFilesModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "StorageFilesModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "StorageFilesModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "StorageFilesModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return StorageFilesModel(
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: StorageFilesModelTypeEnum.fromJson(json[r'_type']),
|
||||
files: mapValueOfType<Object>(json, r'files'),
|
||||
parent: StorageFilesModelParent.fromJson(json[r'parent'])!,
|
||||
ancestors: mapValueOfType<Object>(json, r'ancestors'),
|
||||
@ -103,7 +108,10 @@ class StorageFilesModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<StorageFilesModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<StorageFilesModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <StorageFilesModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -131,13 +139,19 @@ class StorageFilesModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of StorageFilesModel-objects as value to a dart map
|
||||
static Map<String, List<StorageFilesModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<StorageFilesModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<StorageFilesModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = StorageFilesModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = StorageFilesModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -153,7 +167,6 @@ class StorageFilesModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class StorageFilesModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const StorageFilesModelTypeEnum._(this.value);
|
||||
@ -173,9 +186,13 @@ class StorageFilesModelTypeEnum {
|
||||
storageFiles,
|
||||
];
|
||||
|
||||
static StorageFilesModelTypeEnum? fromJson(dynamic value) => StorageFilesModelTypeEnumTypeTransformer().decode(value);
|
||||
static StorageFilesModelTypeEnum? fromJson(dynamic value) =>
|
||||
StorageFilesModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<StorageFilesModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<StorageFilesModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <StorageFilesModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -192,7 +209,8 @@ class StorageFilesModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [StorageFilesModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [StorageFilesModelTypeEnum].
|
||||
class StorageFilesModelTypeEnumTypeTransformer {
|
||||
factory StorageFilesModelTypeEnumTypeTransformer() => _instance ??= const StorageFilesModelTypeEnumTypeTransformer._();
|
||||
factory StorageFilesModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const StorageFilesModelTypeEnumTypeTransformer._();
|
||||
|
||||
const StorageFilesModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -209,7 +227,8 @@ class StorageFilesModelTypeEnumTypeTransformer {
|
||||
StorageFilesModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'StorageFiles': return StorageFilesModelTypeEnum.storageFiles;
|
||||
case 'StorageFiles':
|
||||
return StorageFilesModelTypeEnum.storageFiles;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -222,5 +241,3 @@ class StorageFilesModelTypeEnumTypeTransformer {
|
||||
/// Singleton [StorageFilesModelTypeEnumTypeTransformer] instance.
|
||||
static StorageFilesModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -96,41 +96,44 @@ class StorageFilesModelParent {
|
||||
StorageFileModelAllOfLinks links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is StorageFilesModelParent &&
|
||||
other.id == id &&
|
||||
other.name == name &&
|
||||
other.mimeType == mimeType &&
|
||||
other.size == size &&
|
||||
other.createdAt == createdAt &&
|
||||
other.lastModifiedAt == lastModifiedAt &&
|
||||
other.createdByName == createdByName &&
|
||||
other.lastModifiedByName == lastModifiedByName &&
|
||||
other.type == type &&
|
||||
other.location == location &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is StorageFilesModelParent &&
|
||||
other.id == id &&
|
||||
other.name == name &&
|
||||
other.mimeType == mimeType &&
|
||||
other.size == size &&
|
||||
other.createdAt == createdAt &&
|
||||
other.lastModifiedAt == lastModifiedAt &&
|
||||
other.createdByName == createdByName &&
|
||||
other.lastModifiedByName == lastModifiedByName &&
|
||||
other.type == type &&
|
||||
other.location == location &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id.hashCode) +
|
||||
(name.hashCode) +
|
||||
(mimeType == null ? 0 : mimeType!.hashCode) +
|
||||
(size == null ? 0 : size!.hashCode) +
|
||||
(createdAt == null ? 0 : createdAt!.hashCode) +
|
||||
(lastModifiedAt == null ? 0 : lastModifiedAt!.hashCode) +
|
||||
(createdByName == null ? 0 : createdByName!.hashCode) +
|
||||
(lastModifiedByName == null ? 0 : lastModifiedByName!.hashCode) +
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(location == null ? 0 : location!.hashCode) +
|
||||
(links.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id.hashCode) +
|
||||
(name.hashCode) +
|
||||
(mimeType == null ? 0 : mimeType!.hashCode) +
|
||||
(size == null ? 0 : size!.hashCode) +
|
||||
(createdAt == null ? 0 : createdAt!.hashCode) +
|
||||
(lastModifiedAt == null ? 0 : lastModifiedAt!.hashCode) +
|
||||
(createdByName == null ? 0 : createdByName!.hashCode) +
|
||||
(lastModifiedByName == null ? 0 : lastModifiedByName!.hashCode) +
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(location == null ? 0 : location!.hashCode) +
|
||||
(links.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'StorageFilesModelParent[id=$id, name=$name, mimeType=$mimeType, size=$size, createdAt=$createdAt, lastModifiedAt=$lastModifiedAt, createdByName=$createdByName, lastModifiedByName=$lastModifiedByName, type=$type, location=$location, links=$links]';
|
||||
String toString() =>
|
||||
'StorageFilesModelParent[id=$id, name=$name, mimeType=$mimeType, size=$size, createdAt=$createdAt, lastModifiedAt=$lastModifiedAt, createdByName=$createdByName, lastModifiedByName=$lastModifiedByName, type=$type, location=$location, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
json[r'id'] = this.id;
|
||||
json[r'name'] = this.name;
|
||||
json[r'id'] = this.id;
|
||||
json[r'name'] = this.name;
|
||||
if (this.mimeType != null) {
|
||||
json[r'mimeType'] = this.mimeType;
|
||||
} else {
|
||||
@ -171,7 +174,7 @@ class StorageFilesModelParent {
|
||||
} else {
|
||||
json[r'location'] = null;
|
||||
}
|
||||
json[r'_links'] = this.links;
|
||||
json[r'_links'] = this.links;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -187,8 +190,10 @@ class StorageFilesModelParent {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "StorageFilesModelParent[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "StorageFilesModelParent[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "StorageFilesModelParent[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "StorageFilesModelParent[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
@ -202,7 +207,7 @@ class StorageFilesModelParent {
|
||||
lastModifiedAt: mapDateTime(json, r'lastModifiedAt', r''),
|
||||
createdByName: mapValueOfType<String>(json, r'createdByName'),
|
||||
lastModifiedByName: mapValueOfType<String>(json, r'lastModifiedByName'),
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: StorageFilesModelParentTypeEnum.fromJson(json[r'_type']),
|
||||
location: mapValueOfType<Object>(json, r'location'),
|
||||
links: StorageFileModelAllOfLinks.fromJson(json[r'_links'])!,
|
||||
);
|
||||
@ -210,7 +215,10 @@ class StorageFilesModelParent {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<StorageFilesModelParent> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<StorageFilesModelParent> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <StorageFilesModelParent>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -238,13 +246,19 @@ class StorageFilesModelParent {
|
||||
}
|
||||
|
||||
// maps a json object with a list of StorageFilesModelParent-objects as value to a dart map
|
||||
static Map<String, List<StorageFilesModelParent>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<StorageFilesModelParent>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<StorageFilesModelParent>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = StorageFilesModelParent.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = StorageFilesModelParent.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -260,7 +274,6 @@ class StorageFilesModelParent {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class StorageFilesModelParentTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const StorageFilesModelParentTypeEnum._(this.value);
|
||||
@ -280,9 +293,13 @@ class StorageFilesModelParentTypeEnum {
|
||||
storageFile,
|
||||
];
|
||||
|
||||
static StorageFilesModelParentTypeEnum? fromJson(dynamic value) => StorageFilesModelParentTypeEnumTypeTransformer().decode(value);
|
||||
static StorageFilesModelParentTypeEnum? fromJson(dynamic value) =>
|
||||
StorageFilesModelParentTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<StorageFilesModelParentTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<StorageFilesModelParentTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <StorageFilesModelParentTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -299,7 +316,8 @@ class StorageFilesModelParentTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [StorageFilesModelParentTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [StorageFilesModelParentTypeEnum].
|
||||
class StorageFilesModelParentTypeEnumTypeTransformer {
|
||||
factory StorageFilesModelParentTypeEnumTypeTransformer() => _instance ??= const StorageFilesModelParentTypeEnumTypeTransformer._();
|
||||
factory StorageFilesModelParentTypeEnumTypeTransformer() =>
|
||||
_instance ??= const StorageFilesModelParentTypeEnumTypeTransformer._();
|
||||
|
||||
const StorageFilesModelParentTypeEnumTypeTransformer._();
|
||||
|
||||
@ -313,10 +331,12 @@ class StorageFilesModelParentTypeEnumTypeTransformer {
|
||||
///
|
||||
/// 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.
|
||||
StorageFilesModelParentTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
StorageFilesModelParentTypeEnum? decode(dynamic data,
|
||||
{bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'StorageFile': return StorageFilesModelParentTypeEnum.storageFile;
|
||||
case 'StorageFile':
|
||||
return StorageFilesModelParentTypeEnum.storageFile;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -329,5 +349,3 @@ class StorageFilesModelParentTypeEnumTypeTransformer {
|
||||
/// Singleton [StorageFilesModelParentTypeEnumTypeTransformer] instance.
|
||||
static StorageFilesModelParentTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -51,30 +51,33 @@ class StorageReadModel {
|
||||
StorageReadModelLinks links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is StorageReadModel &&
|
||||
other.id == id &&
|
||||
other.type == type &&
|
||||
other.name == name &&
|
||||
other.hasApplicationPassword == hasApplicationPassword &&
|
||||
other.createdAt == createdAt &&
|
||||
other.updatedAt == updatedAt &&
|
||||
other.embedded == embedded &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is StorageReadModel &&
|
||||
other.id == id &&
|
||||
other.type == type &&
|
||||
other.name == name &&
|
||||
other.hasApplicationPassword == hasApplicationPassword &&
|
||||
other.createdAt == createdAt &&
|
||||
other.updatedAt == updatedAt &&
|
||||
other.embedded == embedded &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(hasApplicationPassword == null ? 0 : hasApplicationPassword!.hashCode) +
|
||||
(createdAt == null ? 0 : createdAt!.hashCode) +
|
||||
(updatedAt == null ? 0 : updatedAt!.hashCode) +
|
||||
(embedded == null ? 0 : embedded!.hashCode) +
|
||||
(links.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(hasApplicationPassword == null ? 0 : hasApplicationPassword!.hashCode) +
|
||||
(createdAt == null ? 0 : createdAt!.hashCode) +
|
||||
(updatedAt == null ? 0 : updatedAt!.hashCode) +
|
||||
(embedded == null ? 0 : embedded!.hashCode) +
|
||||
(links.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'StorageReadModel[id=$id, type=$type, name=$name, hasApplicationPassword=$hasApplicationPassword, createdAt=$createdAt, updatedAt=$updatedAt, embedded=$embedded, links=$links]';
|
||||
String toString() =>
|
||||
'StorageReadModel[id=$id, type=$type, name=$name, hasApplicationPassword=$hasApplicationPassword, createdAt=$createdAt, updatedAt=$updatedAt, embedded=$embedded, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -113,7 +116,7 @@ class StorageReadModel {
|
||||
} else {
|
||||
json[r'_embedded'] = null;
|
||||
}
|
||||
json[r'_links'] = this.links;
|
||||
json[r'_links'] = this.links;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -129,17 +132,20 @@ class StorageReadModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "StorageReadModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "StorageReadModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "StorageReadModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "StorageReadModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return StorageReadModel(
|
||||
id: mapValueOfType<Object>(json, r'id'),
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: StorageReadModelTypeEnum.fromJson(json[r'_type']),
|
||||
name: mapValueOfType<Object>(json, r'name'),
|
||||
hasApplicationPassword: mapValueOfType<Object>(json, r'hasApplicationPassword'),
|
||||
hasApplicationPassword:
|
||||
mapValueOfType<Object>(json, r'hasApplicationPassword'),
|
||||
createdAt: mapValueOfType<Object>(json, r'createdAt'),
|
||||
updatedAt: mapValueOfType<Object>(json, r'updatedAt'),
|
||||
embedded: StorageReadModelEmbedded.fromJson(json[r'_embedded']),
|
||||
@ -149,7 +155,10 @@ class StorageReadModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<StorageReadModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<StorageReadModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <StorageReadModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -177,13 +186,19 @@ class StorageReadModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of StorageReadModel-objects as value to a dart map
|
||||
static Map<String, List<StorageReadModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<StorageReadModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<StorageReadModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = StorageReadModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = StorageReadModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -198,7 +213,6 @@ class StorageReadModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class StorageReadModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const StorageReadModelTypeEnum._(this.value);
|
||||
@ -218,9 +232,13 @@ class StorageReadModelTypeEnum {
|
||||
storage,
|
||||
];
|
||||
|
||||
static StorageReadModelTypeEnum? fromJson(dynamic value) => StorageReadModelTypeEnumTypeTransformer().decode(value);
|
||||
static StorageReadModelTypeEnum? fromJson(dynamic value) =>
|
||||
StorageReadModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<StorageReadModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<StorageReadModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <StorageReadModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -237,7 +255,8 @@ class StorageReadModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [StorageReadModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [StorageReadModelTypeEnum].
|
||||
class StorageReadModelTypeEnumTypeTransformer {
|
||||
factory StorageReadModelTypeEnumTypeTransformer() => _instance ??= const StorageReadModelTypeEnumTypeTransformer._();
|
||||
factory StorageReadModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const StorageReadModelTypeEnumTypeTransformer._();
|
||||
|
||||
const StorageReadModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -254,7 +273,8 @@ class StorageReadModelTypeEnumTypeTransformer {
|
||||
StorageReadModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'Storage': return StorageReadModelTypeEnum.storage;
|
||||
case 'Storage':
|
||||
return StorageReadModelTypeEnum.storage;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -267,5 +287,3 @@ class StorageReadModelTypeEnumTypeTransformer {
|
||||
/// Singleton [StorageReadModelTypeEnumTypeTransformer] instance.
|
||||
static StorageReadModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -43,28 +43,31 @@ class TimeEntryActivityModel {
|
||||
TimeEntryActivityModelLinks links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is TimeEntryActivityModel &&
|
||||
other.type == type &&
|
||||
other.id == id &&
|
||||
other.name == name &&
|
||||
other.position == position &&
|
||||
other.default_ == default_ &&
|
||||
other.embedded == embedded &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is TimeEntryActivityModel &&
|
||||
other.type == type &&
|
||||
other.id == id &&
|
||||
other.name == name &&
|
||||
other.position == position &&
|
||||
other.default_ == default_ &&
|
||||
other.embedded == embedded &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(position == null ? 0 : position!.hashCode) +
|
||||
(default_ == null ? 0 : default_!.hashCode) +
|
||||
(embedded.hashCode) +
|
||||
(links.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(position == null ? 0 : position!.hashCode) +
|
||||
(default_ == null ? 0 : default_!.hashCode) +
|
||||
(embedded.hashCode) +
|
||||
(links.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'TimeEntryActivityModel[type=$type, id=$id, name=$name, position=$position, default_=$default_, embedded=$embedded, links=$links]';
|
||||
String toString() =>
|
||||
'TimeEntryActivityModel[type=$type, id=$id, name=$name, position=$position, default_=$default_, embedded=$embedded, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -93,8 +96,8 @@ class TimeEntryActivityModel {
|
||||
} else {
|
||||
json[r'default'] = null;
|
||||
}
|
||||
json[r'_embedded'] = this.embedded;
|
||||
json[r'_links'] = this.links;
|
||||
json[r'_embedded'] = this.embedded;
|
||||
json[r'_links'] = this.links;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -110,14 +113,16 @@ class TimeEntryActivityModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "TimeEntryActivityModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "TimeEntryActivityModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "TimeEntryActivityModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "TimeEntryActivityModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return TimeEntryActivityModel(
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: TimeEntryActivityModelTypeEnum.fromJson(json[r'_type']),
|
||||
id: mapValueOfType<Object>(json, r'id'),
|
||||
name: mapValueOfType<Object>(json, r'name'),
|
||||
position: mapValueOfType<Object>(json, r'position'),
|
||||
@ -129,7 +134,10 @@ class TimeEntryActivityModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<TimeEntryActivityModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<TimeEntryActivityModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <TimeEntryActivityModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -157,13 +165,19 @@ class TimeEntryActivityModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of TimeEntryActivityModel-objects as value to a dart map
|
||||
static Map<String, List<TimeEntryActivityModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<TimeEntryActivityModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<TimeEntryActivityModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = TimeEntryActivityModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = TimeEntryActivityModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -181,7 +195,6 @@ class TimeEntryActivityModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class TimeEntryActivityModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const TimeEntryActivityModelTypeEnum._(this.value);
|
||||
@ -194,16 +207,21 @@ class TimeEntryActivityModelTypeEnum {
|
||||
|
||||
Object toJson() => value;
|
||||
|
||||
static const timeEntriesActivity = TimeEntryActivityModelTypeEnum._('TimeEntriesActivity');
|
||||
static const timeEntriesActivity =
|
||||
TimeEntryActivityModelTypeEnum._('TimeEntriesActivity');
|
||||
|
||||
/// List of all possible values in this [enum][TimeEntryActivityModelTypeEnum].
|
||||
static const values = <TimeEntryActivityModelTypeEnum>[
|
||||
timeEntriesActivity,
|
||||
];
|
||||
|
||||
static TimeEntryActivityModelTypeEnum? fromJson(dynamic value) => TimeEntryActivityModelTypeEnumTypeTransformer().decode(value);
|
||||
static TimeEntryActivityModelTypeEnum? fromJson(dynamic value) =>
|
||||
TimeEntryActivityModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<TimeEntryActivityModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<TimeEntryActivityModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <TimeEntryActivityModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -220,7 +238,8 @@ class TimeEntryActivityModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [TimeEntryActivityModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [TimeEntryActivityModelTypeEnum].
|
||||
class TimeEntryActivityModelTypeEnumTypeTransformer {
|
||||
factory TimeEntryActivityModelTypeEnumTypeTransformer() => _instance ??= const TimeEntryActivityModelTypeEnumTypeTransformer._();
|
||||
factory TimeEntryActivityModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const TimeEntryActivityModelTypeEnumTypeTransformer._();
|
||||
|
||||
const TimeEntryActivityModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -234,10 +253,12 @@ class TimeEntryActivityModelTypeEnumTypeTransformer {
|
||||
///
|
||||
/// 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.
|
||||
TimeEntryActivityModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
TimeEntryActivityModelTypeEnum? decode(dynamic data,
|
||||
{bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'TimeEntriesActivity': return TimeEntryActivityModelTypeEnum.timeEntriesActivity;
|
||||
case 'TimeEntriesActivity':
|
||||
return TimeEntryActivityModelTypeEnum.timeEntriesActivity;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -250,5 +271,3 @@ class TimeEntryActivityModelTypeEnumTypeTransformer {
|
||||
/// Singleton [TimeEntryActivityModelTypeEnumTypeTransformer] instance.
|
||||
static TimeEntryActivityModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -76,44 +76,47 @@ class UserModel {
|
||||
UserModelLinks links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is UserModel &&
|
||||
other.type == type &&
|
||||
other.id == id &&
|
||||
other.login == login &&
|
||||
other.firstName == firstName &&
|
||||
other.lastName == lastName &&
|
||||
other.name == name &&
|
||||
other.email == email &&
|
||||
other.admin == admin &&
|
||||
other.avatar == avatar &&
|
||||
other.status == status &&
|
||||
other.language == language &&
|
||||
other.identityUrl == identityUrl &&
|
||||
other.createdAt == createdAt &&
|
||||
other.updatedAt == updatedAt &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is UserModel &&
|
||||
other.type == type &&
|
||||
other.id == id &&
|
||||
other.login == login &&
|
||||
other.firstName == firstName &&
|
||||
other.lastName == lastName &&
|
||||
other.name == name &&
|
||||
other.email == email &&
|
||||
other.admin == admin &&
|
||||
other.avatar == avatar &&
|
||||
other.status == status &&
|
||||
other.language == language &&
|
||||
other.identityUrl == identityUrl &&
|
||||
other.createdAt == createdAt &&
|
||||
other.updatedAt == updatedAt &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(login == null ? 0 : login!.hashCode) +
|
||||
(firstName == null ? 0 : firstName!.hashCode) +
|
||||
(lastName == null ? 0 : lastName!.hashCode) +
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(email == null ? 0 : email!.hashCode) +
|
||||
(admin == null ? 0 : admin!.hashCode) +
|
||||
(avatar == null ? 0 : avatar!.hashCode) +
|
||||
(status == null ? 0 : status!.hashCode) +
|
||||
(language == null ? 0 : language!.hashCode) +
|
||||
(identityUrl == null ? 0 : identityUrl!.hashCode) +
|
||||
(createdAt == null ? 0 : createdAt!.hashCode) +
|
||||
(updatedAt == null ? 0 : updatedAt!.hashCode) +
|
||||
(links.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(login == null ? 0 : login!.hashCode) +
|
||||
(firstName == null ? 0 : firstName!.hashCode) +
|
||||
(lastName == null ? 0 : lastName!.hashCode) +
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(email == null ? 0 : email!.hashCode) +
|
||||
(admin == null ? 0 : admin!.hashCode) +
|
||||
(avatar == null ? 0 : avatar!.hashCode) +
|
||||
(status == null ? 0 : status!.hashCode) +
|
||||
(language == null ? 0 : language!.hashCode) +
|
||||
(identityUrl == null ? 0 : identityUrl!.hashCode) +
|
||||
(createdAt == null ? 0 : createdAt!.hashCode) +
|
||||
(updatedAt == null ? 0 : updatedAt!.hashCode) +
|
||||
(links.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'UserModel[type=$type, id=$id, login=$login, firstName=$firstName, lastName=$lastName, name=$name, email=$email, admin=$admin, avatar=$avatar, status=$status, language=$language, identityUrl=$identityUrl, createdAt=$createdAt, updatedAt=$updatedAt, links=$links]';
|
||||
String toString() =>
|
||||
'UserModel[type=$type, id=$id, login=$login, firstName=$firstName, lastName=$lastName, name=$name, email=$email, admin=$admin, avatar=$avatar, status=$status, language=$language, identityUrl=$identityUrl, createdAt=$createdAt, updatedAt=$updatedAt, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -187,7 +190,7 @@ class UserModel {
|
||||
} else {
|
||||
json[r'updatedAt'] = null;
|
||||
}
|
||||
json[r'_links'] = this.links;
|
||||
json[r'_links'] = this.links;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -203,14 +206,16 @@ class UserModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "UserModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "UserModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "UserModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "UserModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return UserModel(
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: UserModelTypeEnum.fromJson(json[r'_type']),
|
||||
id: mapValueOfType<Object>(json, r'id'),
|
||||
login: mapValueOfType<Object>(json, r'login'),
|
||||
firstName: mapValueOfType<Object>(json, r'firstName'),
|
||||
@ -230,7 +235,10 @@ class UserModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<UserModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<UserModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <UserModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -258,13 +266,19 @@ class UserModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of UserModel-objects as value to a dart map
|
||||
static Map<String, List<UserModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<UserModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<UserModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = UserModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = UserModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -280,7 +294,6 @@ class UserModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class UserModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const UserModelTypeEnum._(this.value);
|
||||
@ -300,9 +313,13 @@ class UserModelTypeEnum {
|
||||
user,
|
||||
];
|
||||
|
||||
static UserModelTypeEnum? fromJson(dynamic value) => UserModelTypeEnumTypeTransformer().decode(value);
|
||||
static UserModelTypeEnum? fromJson(dynamic value) =>
|
||||
UserModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<UserModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<UserModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <UserModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -319,7 +336,8 @@ class UserModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [UserModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [UserModelTypeEnum].
|
||||
class UserModelTypeEnumTypeTransformer {
|
||||
factory UserModelTypeEnumTypeTransformer() => _instance ??= const UserModelTypeEnumTypeTransformer._();
|
||||
factory UserModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const UserModelTypeEnumTypeTransformer._();
|
||||
|
||||
const UserModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -336,7 +354,8 @@ class UserModelTypeEnumTypeTransformer {
|
||||
UserModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'User': return UserModelTypeEnum.user;
|
||||
case 'User':
|
||||
return UserModelTypeEnum.user;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -349,5 +368,3 @@ class UserModelTypeEnumTypeTransformer {
|
||||
/// Singleton [UserModelTypeEnumTypeTransformer] instance.
|
||||
static UserModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -30,22 +30,25 @@ class ValuesPropertyModel {
|
||||
ValuesPropertyModelLinks links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is ValuesPropertyModel &&
|
||||
other.type == type &&
|
||||
other.property == property &&
|
||||
other.value == value &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is ValuesPropertyModel &&
|
||||
other.type == type &&
|
||||
other.property == property &&
|
||||
other.value == value &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(property == null ? 0 : property!.hashCode) +
|
||||
(value == null ? 0 : value!.hashCode) +
|
||||
(links.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(property == null ? 0 : property!.hashCode) +
|
||||
(value == null ? 0 : value!.hashCode) +
|
||||
(links.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'ValuesPropertyModel[type=$type, property=$property, value=$value, links=$links]';
|
||||
String toString() =>
|
||||
'ValuesPropertyModel[type=$type, property=$property, value=$value, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -64,7 +67,7 @@ class ValuesPropertyModel {
|
||||
} else {
|
||||
json[r'value'] = null;
|
||||
}
|
||||
json[r'_links'] = this.links;
|
||||
json[r'_links'] = this.links;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -80,14 +83,16 @@ class ValuesPropertyModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "ValuesPropertyModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "ValuesPropertyModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "ValuesPropertyModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "ValuesPropertyModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return ValuesPropertyModel(
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: ValuesPropertyModelTypeEnum.fromJson(json[r'_type']),
|
||||
property: mapValueOfType<Object>(json, r'property'),
|
||||
value: mapValueOfType<Object>(json, r'value'),
|
||||
links: ValuesPropertyModelLinks.fromJson(json[r'_links'])!,
|
||||
@ -96,7 +101,10 @@ class ValuesPropertyModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<ValuesPropertyModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<ValuesPropertyModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <ValuesPropertyModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -124,13 +132,19 @@ class ValuesPropertyModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of ValuesPropertyModel-objects as value to a dart map
|
||||
static Map<String, List<ValuesPropertyModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<ValuesPropertyModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<ValuesPropertyModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = ValuesPropertyModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = ValuesPropertyModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -145,7 +159,6 @@ class ValuesPropertyModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class ValuesPropertyModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const ValuesPropertyModelTypeEnum._(this.value);
|
||||
@ -158,16 +171,21 @@ class ValuesPropertyModelTypeEnum {
|
||||
|
||||
Object toJson() => value;
|
||||
|
||||
static const valuesColonColonProperty = ValuesPropertyModelTypeEnum._('Values::Property');
|
||||
static const valuesColonColonProperty =
|
||||
ValuesPropertyModelTypeEnum._('Values::Property');
|
||||
|
||||
/// List of all possible values in this [enum][ValuesPropertyModelTypeEnum].
|
||||
static const values = <ValuesPropertyModelTypeEnum>[
|
||||
valuesColonColonProperty,
|
||||
];
|
||||
|
||||
static ValuesPropertyModelTypeEnum? fromJson(dynamic value) => ValuesPropertyModelTypeEnumTypeTransformer().decode(value);
|
||||
static ValuesPropertyModelTypeEnum? fromJson(dynamic value) =>
|
||||
ValuesPropertyModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<ValuesPropertyModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<ValuesPropertyModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <ValuesPropertyModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -184,7 +202,8 @@ class ValuesPropertyModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [ValuesPropertyModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [ValuesPropertyModelTypeEnum].
|
||||
class ValuesPropertyModelTypeEnumTypeTransformer {
|
||||
factory ValuesPropertyModelTypeEnumTypeTransformer() => _instance ??= const ValuesPropertyModelTypeEnumTypeTransformer._();
|
||||
factory ValuesPropertyModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const ValuesPropertyModelTypeEnumTypeTransformer._();
|
||||
|
||||
const ValuesPropertyModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -201,7 +220,8 @@ class ValuesPropertyModelTypeEnumTypeTransformer {
|
||||
ValuesPropertyModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'Values::Property': return ValuesPropertyModelTypeEnum.valuesColonColonProperty;
|
||||
case 'Values::Property':
|
||||
return ValuesPropertyModelTypeEnum.valuesColonColonProperty;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -214,5 +234,3 @@ class ValuesPropertyModelTypeEnumTypeTransformer {
|
||||
/// Singleton [ValuesPropertyModelTypeEnumTypeTransformer] instance.
|
||||
static ValuesPropertyModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -22,18 +22,20 @@ class WeekDayCollectionWriteModel {
|
||||
WeekDayCollectionWriteModelEmbedded embedded;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is WeekDayCollectionWriteModel &&
|
||||
other.type == type &&
|
||||
other.embedded == embedded;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is WeekDayCollectionWriteModel &&
|
||||
other.type == type &&
|
||||
other.embedded == embedded;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(embedded.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) + (embedded.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'WeekDayCollectionWriteModel[type=$type, embedded=$embedded]';
|
||||
String toString() =>
|
||||
'WeekDayCollectionWriteModel[type=$type, embedded=$embedded]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -42,7 +44,7 @@ class WeekDayCollectionWriteModel {
|
||||
} else {
|
||||
json[r'_type'] = null;
|
||||
}
|
||||
json[r'_embedded'] = this.embedded;
|
||||
json[r'_embedded'] = this.embedded;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -58,21 +60,27 @@ class WeekDayCollectionWriteModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "WeekDayCollectionWriteModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "WeekDayCollectionWriteModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "WeekDayCollectionWriteModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "WeekDayCollectionWriteModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return WeekDayCollectionWriteModel(
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
embedded: WeekDayCollectionWriteModelEmbedded.fromJson(json[r'_embedded'])!,
|
||||
type: WeekDayCollectionWriteModelTypeEnum.fromJson(json[r'_type']),
|
||||
embedded:
|
||||
WeekDayCollectionWriteModelEmbedded.fromJson(json[r'_embedded'])!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<WeekDayCollectionWriteModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<WeekDayCollectionWriteModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <WeekDayCollectionWriteModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -100,13 +108,19 @@ class WeekDayCollectionWriteModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of WeekDayCollectionWriteModel-objects as value to a dart map
|
||||
static Map<String, List<WeekDayCollectionWriteModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<WeekDayCollectionWriteModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<WeekDayCollectionWriteModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = WeekDayCollectionWriteModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = WeekDayCollectionWriteModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -119,7 +133,6 @@ class WeekDayCollectionWriteModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class WeekDayCollectionWriteModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const WeekDayCollectionWriteModelTypeEnum._(this.value);
|
||||
@ -139,9 +152,13 @@ class WeekDayCollectionWriteModelTypeEnum {
|
||||
collection,
|
||||
];
|
||||
|
||||
static WeekDayCollectionWriteModelTypeEnum? fromJson(dynamic value) => WeekDayCollectionWriteModelTypeEnumTypeTransformer().decode(value);
|
||||
static WeekDayCollectionWriteModelTypeEnum? fromJson(dynamic value) =>
|
||||
WeekDayCollectionWriteModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<WeekDayCollectionWriteModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<WeekDayCollectionWriteModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <WeekDayCollectionWriteModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -158,7 +175,8 @@ class WeekDayCollectionWriteModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [WeekDayCollectionWriteModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [WeekDayCollectionWriteModelTypeEnum].
|
||||
class WeekDayCollectionWriteModelTypeEnumTypeTransformer {
|
||||
factory WeekDayCollectionWriteModelTypeEnumTypeTransformer() => _instance ??= const WeekDayCollectionWriteModelTypeEnumTypeTransformer._();
|
||||
factory WeekDayCollectionWriteModelTypeEnumTypeTransformer() => _instance ??=
|
||||
const WeekDayCollectionWriteModelTypeEnumTypeTransformer._();
|
||||
|
||||
const WeekDayCollectionWriteModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -172,10 +190,12 @@ class WeekDayCollectionWriteModelTypeEnumTypeTransformer {
|
||||
///
|
||||
/// 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.
|
||||
WeekDayCollectionWriteModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
WeekDayCollectionWriteModelTypeEnum? decode(dynamic data,
|
||||
{bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'Collection': return WeekDayCollectionWriteModelTypeEnum.collection;
|
||||
case 'Collection':
|
||||
return WeekDayCollectionWriteModelTypeEnum.collection;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -188,5 +208,3 @@ class WeekDayCollectionWriteModelTypeEnumTypeTransformer {
|
||||
/// Singleton [WeekDayCollectionWriteModelTypeEnumTypeTransformer] instance.
|
||||
static WeekDayCollectionWriteModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -43,24 +43,27 @@ class WeekDayModel {
|
||||
WeekDaySelfLinkModel? links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is WeekDayModel &&
|
||||
other.type == type &&
|
||||
other.day == day &&
|
||||
other.name == name &&
|
||||
other.working == working &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is WeekDayModel &&
|
||||
other.type == type &&
|
||||
other.day == day &&
|
||||
other.name == name &&
|
||||
other.working == working &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(day == null ? 0 : day!.hashCode) +
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(working == null ? 0 : working!.hashCode) +
|
||||
(links == null ? 0 : links!.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(day == null ? 0 : day!.hashCode) +
|
||||
(name == null ? 0 : name!.hashCode) +
|
||||
(working == null ? 0 : working!.hashCode) +
|
||||
(links == null ? 0 : links!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'WeekDayModel[type=$type, day=$day, name=$name, working=$working, links=$links]';
|
||||
String toString() =>
|
||||
'WeekDayModel[type=$type, day=$day, name=$name, working=$working, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -104,14 +107,16 @@ class WeekDayModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "WeekDayModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "WeekDayModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "WeekDayModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "WeekDayModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return WeekDayModel(
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: WeekDayModelTypeEnum.fromJson(json[r'_type']),
|
||||
day: mapValueOfType<Object>(json, r'day'),
|
||||
name: mapValueOfType<Object>(json, r'name'),
|
||||
working: mapValueOfType<Object>(json, r'working'),
|
||||
@ -121,7 +126,10 @@ class WeekDayModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<WeekDayModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<WeekDayModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <WeekDayModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -149,13 +157,19 @@ class WeekDayModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of WeekDayModel-objects as value to a dart map
|
||||
static Map<String, List<WeekDayModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<WeekDayModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<WeekDayModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = WeekDayModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = WeekDayModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -170,7 +184,6 @@ class WeekDayModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class WeekDayModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const WeekDayModelTypeEnum._(this.value);
|
||||
@ -190,9 +203,13 @@ class WeekDayModelTypeEnum {
|
||||
weekDay,
|
||||
];
|
||||
|
||||
static WeekDayModelTypeEnum? fromJson(dynamic value) => WeekDayModelTypeEnumTypeTransformer().decode(value);
|
||||
static WeekDayModelTypeEnum? fromJson(dynamic value) =>
|
||||
WeekDayModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<WeekDayModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<WeekDayModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <WeekDayModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -209,7 +226,8 @@ class WeekDayModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [WeekDayModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [WeekDayModelTypeEnum].
|
||||
class WeekDayModelTypeEnumTypeTransformer {
|
||||
factory WeekDayModelTypeEnumTypeTransformer() => _instance ??= const WeekDayModelTypeEnumTypeTransformer._();
|
||||
factory WeekDayModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const WeekDayModelTypeEnumTypeTransformer._();
|
||||
|
||||
const WeekDayModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -226,7 +244,8 @@ class WeekDayModelTypeEnumTypeTransformer {
|
||||
WeekDayModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'WeekDay': return WeekDayModelTypeEnum.weekDay;
|
||||
case 'WeekDay':
|
||||
return WeekDayModelTypeEnum.weekDay;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -239,5 +258,3 @@ class WeekDayModelTypeEnumTypeTransformer {
|
||||
/// Singleton [WeekDayModelTypeEnumTypeTransformer] instance.
|
||||
static WeekDayModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -23,15 +23,17 @@ class WeekDayWriteModel {
|
||||
Object? working;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is WeekDayWriteModel &&
|
||||
other.type == type &&
|
||||
other.working == working;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is WeekDayWriteModel &&
|
||||
other.type == type &&
|
||||
other.working == working;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(working == null ? 0 : working!.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(working == null ? 0 : working!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'WeekDayWriteModel[type=$type, working=$working]';
|
||||
@ -63,21 +65,26 @@ class WeekDayWriteModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "WeekDayWriteModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "WeekDayWriteModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "WeekDayWriteModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "WeekDayWriteModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
|
||||
return WeekDayWriteModel(
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: WeekDayWriteModelTypeEnum.fromJson(json[r'_type']),
|
||||
working: mapValueOfType<Object>(json, r'working'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<WeekDayWriteModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<WeekDayWriteModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <WeekDayWriteModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -105,13 +112,19 @@ class WeekDayWriteModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of WeekDayWriteModel-objects as value to a dart map
|
||||
static Map<String, List<WeekDayWriteModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<WeekDayWriteModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<WeekDayWriteModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = WeekDayWriteModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = WeekDayWriteModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -124,7 +137,6 @@ class WeekDayWriteModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class WeekDayWriteModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const WeekDayWriteModelTypeEnum._(this.value);
|
||||
@ -144,9 +156,13 @@ class WeekDayWriteModelTypeEnum {
|
||||
weekDay,
|
||||
];
|
||||
|
||||
static WeekDayWriteModelTypeEnum? fromJson(dynamic value) => WeekDayWriteModelTypeEnumTypeTransformer().decode(value);
|
||||
static WeekDayWriteModelTypeEnum? fromJson(dynamic value) =>
|
||||
WeekDayWriteModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<WeekDayWriteModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<WeekDayWriteModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <WeekDayWriteModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -163,7 +179,8 @@ class WeekDayWriteModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [WeekDayWriteModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [WeekDayWriteModelTypeEnum].
|
||||
class WeekDayWriteModelTypeEnumTypeTransformer {
|
||||
factory WeekDayWriteModelTypeEnumTypeTransformer() => _instance ??= const WeekDayWriteModelTypeEnumTypeTransformer._();
|
||||
factory WeekDayWriteModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const WeekDayWriteModelTypeEnumTypeTransformer._();
|
||||
|
||||
const WeekDayWriteModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -180,7 +197,8 @@ class WeekDayWriteModelTypeEnumTypeTransformer {
|
||||
WeekDayWriteModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'WeekDay': return WeekDayWriteModelTypeEnum.weekDay;
|
||||
case 'WeekDay':
|
||||
return WeekDayWriteModelTypeEnum.weekDay;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -193,5 +211,3 @@ class WeekDayWriteModelTypeEnumTypeTransformer {
|
||||
/// Singleton [WeekDayWriteModelTypeEnumTypeTransformer] instance.
|
||||
static WeekDayWriteModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -107,56 +107,59 @@ class WorkPackageModel {
|
||||
WorkPackageModelLinks links;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is WorkPackageModel &&
|
||||
other.id == id &&
|
||||
other.lockVersion == lockVersion &&
|
||||
other.subject == subject &&
|
||||
other.type == type &&
|
||||
other.description == description &&
|
||||
other.scheduleManually == scheduleManually &&
|
||||
other.readonly == readonly &&
|
||||
other.startDate == startDate &&
|
||||
other.dueDate == dueDate &&
|
||||
other.date == date &&
|
||||
other.derivedStartDate == derivedStartDate &&
|
||||
other.derivedDueDate == derivedDueDate &&
|
||||
other.duration == duration &&
|
||||
other.estimatedTime == estimatedTime &&
|
||||
other.derivedEstimatedTime == derivedEstimatedTime &&
|
||||
other.ignoreNonWorkingDays == ignoreNonWorkingDays &&
|
||||
other.spentTime == spentTime &&
|
||||
other.percentageDone == percentageDone &&
|
||||
other.createdAt == createdAt &&
|
||||
other.updatedAt == updatedAt &&
|
||||
other.links == links;
|
||||
bool operator ==(Object other) =>
|
||||
identical(this, other) ||
|
||||
other is WorkPackageModel &&
|
||||
other.id == id &&
|
||||
other.lockVersion == lockVersion &&
|
||||
other.subject == subject &&
|
||||
other.type == type &&
|
||||
other.description == description &&
|
||||
other.scheduleManually == scheduleManually &&
|
||||
other.readonly == readonly &&
|
||||
other.startDate == startDate &&
|
||||
other.dueDate == dueDate &&
|
||||
other.date == date &&
|
||||
other.derivedStartDate == derivedStartDate &&
|
||||
other.derivedDueDate == derivedDueDate &&
|
||||
other.duration == duration &&
|
||||
other.estimatedTime == estimatedTime &&
|
||||
other.derivedEstimatedTime == derivedEstimatedTime &&
|
||||
other.ignoreNonWorkingDays == ignoreNonWorkingDays &&
|
||||
other.spentTime == spentTime &&
|
||||
other.percentageDone == percentageDone &&
|
||||
other.createdAt == createdAt &&
|
||||
other.updatedAt == updatedAt &&
|
||||
other.links == links;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(lockVersion == null ? 0 : lockVersion!.hashCode) +
|
||||
(subject == null ? 0 : subject!.hashCode) +
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(description == null ? 0 : description!.hashCode) +
|
||||
(scheduleManually == null ? 0 : scheduleManually!.hashCode) +
|
||||
(readonly == null ? 0 : readonly!.hashCode) +
|
||||
(startDate == null ? 0 : startDate!.hashCode) +
|
||||
(dueDate == null ? 0 : dueDate!.hashCode) +
|
||||
(date == null ? 0 : date!.hashCode) +
|
||||
(derivedStartDate == null ? 0 : derivedStartDate!.hashCode) +
|
||||
(derivedDueDate == null ? 0 : derivedDueDate!.hashCode) +
|
||||
(duration == null ? 0 : duration!.hashCode) +
|
||||
(estimatedTime == null ? 0 : estimatedTime!.hashCode) +
|
||||
(derivedEstimatedTime == null ? 0 : derivedEstimatedTime!.hashCode) +
|
||||
(ignoreNonWorkingDays == null ? 0 : ignoreNonWorkingDays!.hashCode) +
|
||||
(spentTime == null ? 0 : spentTime!.hashCode) +
|
||||
(percentageDone == null ? 0 : percentageDone!.hashCode) +
|
||||
(createdAt == null ? 0 : createdAt!.hashCode) +
|
||||
(updatedAt == null ? 0 : updatedAt!.hashCode) +
|
||||
(links.hashCode);
|
||||
// ignore: unnecessary_parenthesis
|
||||
(id == null ? 0 : id!.hashCode) +
|
||||
(lockVersion == null ? 0 : lockVersion!.hashCode) +
|
||||
(subject == null ? 0 : subject!.hashCode) +
|
||||
(type == null ? 0 : type!.hashCode) +
|
||||
(description == null ? 0 : description!.hashCode) +
|
||||
(scheduleManually == null ? 0 : scheduleManually!.hashCode) +
|
||||
(readonly == null ? 0 : readonly!.hashCode) +
|
||||
(startDate == null ? 0 : startDate!.hashCode) +
|
||||
(dueDate == null ? 0 : dueDate!.hashCode) +
|
||||
(date == null ? 0 : date!.hashCode) +
|
||||
(derivedStartDate == null ? 0 : derivedStartDate!.hashCode) +
|
||||
(derivedDueDate == null ? 0 : derivedDueDate!.hashCode) +
|
||||
(duration == null ? 0 : duration!.hashCode) +
|
||||
(estimatedTime == null ? 0 : estimatedTime!.hashCode) +
|
||||
(derivedEstimatedTime == null ? 0 : derivedEstimatedTime!.hashCode) +
|
||||
(ignoreNonWorkingDays == null ? 0 : ignoreNonWorkingDays!.hashCode) +
|
||||
(spentTime == null ? 0 : spentTime!.hashCode) +
|
||||
(percentageDone == null ? 0 : percentageDone!.hashCode) +
|
||||
(createdAt == null ? 0 : createdAt!.hashCode) +
|
||||
(updatedAt == null ? 0 : updatedAt!.hashCode) +
|
||||
(links.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'WorkPackageModel[id=$id, lockVersion=$lockVersion, subject=$subject, type=$type, description=$description, scheduleManually=$scheduleManually, readonly=$readonly, startDate=$startDate, dueDate=$dueDate, date=$date, derivedStartDate=$derivedStartDate, derivedDueDate=$derivedDueDate, duration=$duration, estimatedTime=$estimatedTime, derivedEstimatedTime=$derivedEstimatedTime, ignoreNonWorkingDays=$ignoreNonWorkingDays, spentTime=$spentTime, percentageDone=$percentageDone, createdAt=$createdAt, updatedAt=$updatedAt, links=$links]';
|
||||
String toString() =>
|
||||
'WorkPackageModel[id=$id, lockVersion=$lockVersion, subject=$subject, type=$type, description=$description, scheduleManually=$scheduleManually, readonly=$readonly, startDate=$startDate, dueDate=$dueDate, date=$date, derivedStartDate=$derivedStartDate, derivedDueDate=$derivedDueDate, duration=$duration, estimatedTime=$estimatedTime, derivedEstimatedTime=$derivedEstimatedTime, ignoreNonWorkingDays=$ignoreNonWorkingDays, spentTime=$spentTime, percentageDone=$percentageDone, createdAt=$createdAt, updatedAt=$updatedAt, links=$links]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -260,7 +263,7 @@ class WorkPackageModel {
|
||||
} else {
|
||||
json[r'updatedAt'] = null;
|
||||
}
|
||||
json[r'_links'] = this.links;
|
||||
json[r'_links'] = this.links;
|
||||
return json;
|
||||
}
|
||||
|
||||
@ -276,8 +279,10 @@ class WorkPackageModel {
|
||||
// Note 2: this code is stripped in release mode!
|
||||
assert(() {
|
||||
requiredKeys.forEach((key) {
|
||||
assert(json.containsKey(key), 'Required key "WorkPackageModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null, 'Required key "WorkPackageModel[$key]" has a null value in JSON.');
|
||||
assert(json.containsKey(key),
|
||||
'Required key "WorkPackageModel[$key]" is missing from JSON.');
|
||||
assert(json[key] != null,
|
||||
'Required key "WorkPackageModel[$key]" has a null value in JSON.');
|
||||
});
|
||||
return true;
|
||||
}());
|
||||
@ -286,7 +291,7 @@ class WorkPackageModel {
|
||||
id: mapValueOfType<Object>(json, r'id'),
|
||||
lockVersion: mapValueOfType<Object>(json, r'lockVersion'),
|
||||
subject: mapValueOfType<Object>(json, r'subject'),
|
||||
type: Object.fromJson(json[r'_type']),
|
||||
type: WorkPackageModelTypeEnum.fromJson(json[r'_type']),
|
||||
description: WorkPackageModelDescription.fromJson(json[r'description']),
|
||||
scheduleManually: mapValueOfType<Object>(json, r'scheduleManually'),
|
||||
readonly: mapValueOfType<Object>(json, r'readonly'),
|
||||
@ -297,8 +302,10 @@ class WorkPackageModel {
|
||||
derivedDueDate: mapValueOfType<Object>(json, r'derivedDueDate'),
|
||||
duration: mapValueOfType<Object>(json, r'duration'),
|
||||
estimatedTime: mapValueOfType<Object>(json, r'estimatedTime'),
|
||||
derivedEstimatedTime: mapValueOfType<Object>(json, r'derivedEstimatedTime'),
|
||||
ignoreNonWorkingDays: mapValueOfType<Object>(json, r'ignoreNonWorkingDays'),
|
||||
derivedEstimatedTime:
|
||||
mapValueOfType<Object>(json, r'derivedEstimatedTime'),
|
||||
ignoreNonWorkingDays:
|
||||
mapValueOfType<Object>(json, r'ignoreNonWorkingDays'),
|
||||
spentTime: mapValueOfType<Object>(json, r'spentTime'),
|
||||
percentageDone: mapValueOfType<Object>(json, r'percentageDone'),
|
||||
createdAt: mapValueOfType<Object>(json, r'createdAt'),
|
||||
@ -309,7 +316,10 @@ class WorkPackageModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<WorkPackageModel> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<WorkPackageModel> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <WorkPackageModel>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -337,13 +347,19 @@ class WorkPackageModel {
|
||||
}
|
||||
|
||||
// maps a json object with a list of WorkPackageModel-objects as value to a dart map
|
||||
static Map<String, List<WorkPackageModel>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
static Map<String, List<WorkPackageModel>> mapListFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final map = <String, List<WorkPackageModel>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = WorkPackageModel.listFromJson(entry.value, growable: growable,);
|
||||
map[entry.key] = WorkPackageModel.listFromJson(
|
||||
entry.value,
|
||||
growable: growable,
|
||||
);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
@ -356,7 +372,6 @@ class WorkPackageModel {
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
class WorkPackageModelTypeEnum {
|
||||
/// Instantiate a new enum with the provided [value].
|
||||
const WorkPackageModelTypeEnum._(this.value);
|
||||
@ -376,9 +391,13 @@ class WorkPackageModelTypeEnum {
|
||||
workPackage,
|
||||
];
|
||||
|
||||
static WorkPackageModelTypeEnum? fromJson(dynamic value) => WorkPackageModelTypeEnumTypeTransformer().decode(value);
|
||||
static WorkPackageModelTypeEnum? fromJson(dynamic value) =>
|
||||
WorkPackageModelTypeEnumTypeTransformer().decode(value);
|
||||
|
||||
static List<WorkPackageModelTypeEnum> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
static List<WorkPackageModelTypeEnum> listFromJson(
|
||||
dynamic json, {
|
||||
bool growable = false,
|
||||
}) {
|
||||
final result = <WorkPackageModelTypeEnum>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
@ -395,7 +414,8 @@ class WorkPackageModelTypeEnum {
|
||||
/// Transformation class that can [encode] an instance of [WorkPackageModelTypeEnum] to Object,
|
||||
/// and [decode] dynamic data back to [WorkPackageModelTypeEnum].
|
||||
class WorkPackageModelTypeEnumTypeTransformer {
|
||||
factory WorkPackageModelTypeEnumTypeTransformer() => _instance ??= const WorkPackageModelTypeEnumTypeTransformer._();
|
||||
factory WorkPackageModelTypeEnumTypeTransformer() =>
|
||||
_instance ??= const WorkPackageModelTypeEnumTypeTransformer._();
|
||||
|
||||
const WorkPackageModelTypeEnumTypeTransformer._();
|
||||
|
||||
@ -412,7 +432,8 @@ class WorkPackageModelTypeEnumTypeTransformer {
|
||||
WorkPackageModelTypeEnum? decode(dynamic data, {bool allowNull = true}) {
|
||||
if (data != null) {
|
||||
switch (data) {
|
||||
case 'WorkPackage': return WorkPackageModelTypeEnum.workPackage;
|
||||
case 'WorkPackage':
|
||||
return WorkPackageModelTypeEnum.workPackage;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
@ -425,5 +446,3 @@ class WorkPackageModelTypeEnumTypeTransformer {
|
||||
/// Singleton [WorkPackageModelTypeEnumTypeTransformer] instance.
|
||||
static WorkPackageModelTypeEnumTypeTransformer? _instance;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user