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