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