76 lines
1.9 KiB
Dart
76 lines
1.9 KiB
Dart
class BotsModel {
|
|
int? id;
|
|
String? name;
|
|
String? image;
|
|
String? responseType;
|
|
String? description;
|
|
String? short;
|
|
List<String>? attachmentType;
|
|
int? attachment;
|
|
bool? editable;
|
|
|
|
BotsModel(
|
|
{this.id,
|
|
this.name,
|
|
this.image,
|
|
this.attachment,
|
|
this.attachmentType,
|
|
this.description,
|
|
this.editable,
|
|
this.responseType});
|
|
|
|
BotsModel.fromJson(Map<String, dynamic> json) {
|
|
id = json['id'];
|
|
name = json['name'];
|
|
image = json['image'];
|
|
description = json['description'];
|
|
short = json['short'];
|
|
if (json['attachmentType'] != null) {
|
|
attachmentType = <String>[];
|
|
json['attachmentType'].forEach((v) {
|
|
attachmentType!.add(v);
|
|
});
|
|
}
|
|
attachment = json['attachment'];
|
|
editable = json['editable'];
|
|
responseType = json['responseType'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['id'] = id;
|
|
data['name'] = name;
|
|
data['image'] = image;
|
|
data['description'] = description;
|
|
data['short'] = short;
|
|
if (attachmentType != null) {
|
|
data['attachmentType'] = attachmentType!.map((v) => v).toList();
|
|
}
|
|
data['attachment'] = attachment;
|
|
data['editable'] = editable;
|
|
data['responseType'] = responseType;
|
|
return data;
|
|
}
|
|
|
|
BotsModel copyWith(
|
|
{int? id,
|
|
String? name,
|
|
String? image,
|
|
String? responseType,
|
|
String? description,
|
|
List<String>? attachmentType,
|
|
int? attachment,
|
|
bool? editable}) {
|
|
return BotsModel(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
image: image ?? this.image,
|
|
responseType: responseType ?? this.responseType,
|
|
description: description ?? this.description,
|
|
attachmentType: attachmentType ?? this.attachmentType,
|
|
attachment: attachment ?? this.attachment,
|
|
editable: editable ?? this.editable,
|
|
);
|
|
}
|
|
}
|