108 lines
3.0 KiB
Dart

//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.0
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class Trigger {
/// Returns a new [Trigger] instance.
Trigger({
this.providerId,
this.deviceId,
this.stateName,
this.stateValue,
this.type,
});
String providerId;
String deviceId;
String stateName;
String stateValue;
TriggerType type;
@override
bool operator ==(Object other) => identical(this, other) || other is Trigger &&
other.providerId == providerId &&
other.deviceId == deviceId &&
other.stateName == stateName &&
other.stateValue == stateValue &&
other.type == type;
@override
int get hashCode =>
(providerId == null ? 0 : providerId.hashCode) +
(deviceId == null ? 0 : deviceId.hashCode) +
(stateName == null ? 0 : stateName.hashCode) +
(stateValue == null ? 0 : stateValue.hashCode) +
(type == null ? 0 : type.hashCode);
@override
String toString() => 'Trigger[providerId=$providerId, deviceId=$deviceId, stateName=$stateName, stateValue=$stateValue, type=$type]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
if (providerId != null) {
json[r'providerId'] = providerId;
}
if (deviceId != null) {
json[r'deviceId'] = deviceId;
}
if (stateName != null) {
json[r'stateName'] = stateName;
}
if (stateValue != null) {
json[r'stateValue'] = stateValue;
}
if (type != null) {
json[r'type'] = type;
}
return json;
}
/// Returns a new [Trigger] instance and imports its values from
/// [json] if it's non-null, null if [json] is null.
static Trigger fromJson(Map<String, dynamic> json) => json == null
? null
: Trigger(
providerId: json[r'providerId'],
deviceId: json[r'deviceId'],
stateName: json[r'stateName'],
stateValue: json[r'stateValue'],
type: TriggerType.fromJson(json[r'type']),
);
static List<Trigger> listFromJson(List<dynamic> json, {bool emptyIsNull, bool growable,}) =>
json == null || json.isEmpty
? true == emptyIsNull ? null : <Trigger>[]
: json.map((v) => Trigger.fromJson(v)).toList(growable: true == growable);
static Map<String, Trigger> mapFromJson(Map<String, dynamic> json) {
final map = <String, Trigger>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) => map[key] = Trigger.fromJson(v));
}
return map;
}
// maps a json object with a list of Trigger-objects as value to a dart map
static Map<String, List<Trigger>> mapListFromJson(Map<String, dynamic> json, {bool emptyIsNull, bool growable,}) {
final map = <String, List<Trigger>>{};
if (json != null && json.isNotEmpty) {
json.forEach((String key, dynamic v) {
map[key] = Trigger.listFromJson(v, emptyIsNull: emptyIsNull, growable: growable);
});
}
return map;
}
}