2023-08-01 08:20:38 +00:00
|
|
|
|
|
|
|
import 'dart:convert';
|
|
|
|
|
|
|
|
Attachment attachmentFromJson(String str) =>
|
|
|
|
Attachment.fromJson(json.decode(str));
|
|
|
|
|
|
|
|
String attachmentToJson(Attachment data) => json.encode(data.toJson());
|
|
|
|
|
|
|
|
class Attachment {
|
|
|
|
final int? id;
|
|
|
|
final String? source;
|
|
|
|
final AttachmentCategory? category;
|
|
|
|
final String? filename;
|
|
|
|
final Subclass? subclass;
|
|
|
|
final DateTime? createdAt;
|
|
|
|
|
|
|
|
Attachment({
|
|
|
|
required this.id,
|
|
|
|
required this.source,
|
|
|
|
required this.category,
|
|
|
|
required this.filename,
|
|
|
|
required this.subclass,
|
|
|
|
required this.createdAt,
|
|
|
|
});
|
|
|
|
|
|
|
|
factory Attachment.fromJson(Map<String, dynamic> json) => Attachment(
|
|
|
|
id: json["id"],
|
|
|
|
source: json["source"],
|
|
|
|
category: json['category'] == null
|
|
|
|
? null
|
|
|
|
: AttachmentCategory.fromJson(json["category"]),
|
|
|
|
filename: json["filename"],
|
|
|
|
subclass: json['subclass'] == null
|
|
|
|
? null
|
|
|
|
: Subclass.fromJson(json["subclass"]),
|
|
|
|
createdAt: json['created_at'] == null
|
|
|
|
? null
|
|
|
|
: DateTime.parse(json["created_at"]),
|
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"id": id,
|
|
|
|
"source": source,
|
|
|
|
"category": category?.toJson(),
|
|
|
|
"filename": filename,
|
|
|
|
"subclass": subclass?.toJson(),
|
|
|
|
"created_at": createdAt?.toIso8601String(),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
class AttachmentCategory {
|
2023-08-07 06:33:38 +00:00
|
|
|
final int? id;
|
|
|
|
final Subclass? subclass;
|
|
|
|
final String? description;
|
2023-08-01 08:20:38 +00:00
|
|
|
|
|
|
|
AttachmentCategory({
|
|
|
|
required this.id,
|
|
|
|
required this.subclass,
|
|
|
|
required this.description,
|
|
|
|
});
|
|
|
|
|
|
|
|
factory AttachmentCategory.fromJson(Map<String, dynamic> json) => AttachmentCategory(
|
|
|
|
id: json["id"],
|
2023-08-07 06:33:38 +00:00
|
|
|
subclass:json['subclass'] == null? null: Subclass.fromJson(json["subclass"]),
|
2023-08-01 08:20:38 +00:00
|
|
|
description: json["description"],
|
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"id": id,
|
2023-08-07 06:33:38 +00:00
|
|
|
"subclass": subclass?.toJson(),
|
2023-08-01 08:20:38 +00:00
|
|
|
"description": description,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
class Subclass {
|
2023-08-07 06:33:38 +00:00
|
|
|
final int? id;
|
|
|
|
final String? name;
|
|
|
|
final AttachmentClass? attachmentClass;
|
2023-08-01 08:20:38 +00:00
|
|
|
|
|
|
|
Subclass({
|
|
|
|
required this.id,
|
|
|
|
required this.name,
|
|
|
|
required this.attachmentClass,
|
|
|
|
});
|
|
|
|
|
|
|
|
factory Subclass.fromJson(Map<String, dynamic> json) => Subclass(
|
|
|
|
id: json["id"],
|
|
|
|
name: json["name"],
|
2023-08-07 06:33:38 +00:00
|
|
|
attachmentClass: json['attachment_class'] == null? null: AttachmentClass.fromJson(json["attachment_class"]),
|
2023-08-01 08:20:38 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"id": id,
|
|
|
|
"name": name,
|
2023-08-07 06:33:38 +00:00
|
|
|
"attachment_class": attachmentClass?.toJson(),
|
2023-08-01 08:20:38 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
class AttachmentClass {
|
2023-08-07 06:33:38 +00:00
|
|
|
final int? id;
|
|
|
|
final String? name;
|
2023-08-01 08:20:38 +00:00
|
|
|
|
|
|
|
AttachmentClass({
|
|
|
|
required this.id,
|
|
|
|
required this.name,
|
|
|
|
});
|
|
|
|
|
|
|
|
factory AttachmentClass.fromJson(Map<String, dynamic> json) =>
|
|
|
|
AttachmentClass(
|
|
|
|
id: json["id"],
|
|
|
|
name: json["name"],
|
|
|
|
);
|
|
|
|
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
"id": id,
|
|
|
|
"name": name,
|
|
|
|
};
|
|
|
|
}
|