121 lines
2.7 KiB
Dart
121 lines
2.7 KiB
Dart
import 'package:didvan/models/ai/bots_model.dart';
|
|
|
|
class BotAssistantsModel {
|
|
List<BotAssistants>? botAssistants;
|
|
|
|
BotAssistantsModel({this.botAssistants});
|
|
|
|
BotAssistantsModel.fromJson(Map<String, dynamic> json) {
|
|
if (json['bots'] != null) {
|
|
botAssistants = <BotAssistants>[];
|
|
json['bots'].forEach((v) {
|
|
botAssistants!.add(BotAssistants.fromJson(v));
|
|
});
|
|
}
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
if (botAssistants != null) {
|
|
data['bots'] = botAssistants!.map((v) => v.toJson()).toList();
|
|
}
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class BotAssistants {
|
|
int? id;
|
|
int? userId;
|
|
int? botId;
|
|
String? name;
|
|
String? description;
|
|
String? createdAt;
|
|
String? image;
|
|
String? type;
|
|
String? prompt;
|
|
bool? private;
|
|
BotsModel? bot;
|
|
User? user;
|
|
List<String>? files;
|
|
List<String>? websites;
|
|
|
|
BotAssistants(
|
|
{this.id,
|
|
this.name,
|
|
this.description,
|
|
this.createdAt,
|
|
this.image,
|
|
this.bot,
|
|
this.private,
|
|
this.user,
|
|
this.botId,
|
|
this.prompt,
|
|
this.type,
|
|
this.websites,
|
|
this.files,
|
|
this.userId});
|
|
|
|
BotAssistants.fromJson(Map<String, dynamic> json) {
|
|
id = json['id'];
|
|
userId = json['userId'];
|
|
botId = json['botId'];
|
|
name = json['name'];
|
|
description = json['description'];
|
|
createdAt = json['createdAt'];
|
|
image = json['image'];
|
|
type = json['type'];
|
|
prompt = json['prompt'];
|
|
private = json['private'];
|
|
bot = json['bot'] != null ? BotsModel.fromJson(json['bot']) : null;
|
|
user = json['user'] != null ? User.fromJson(json['user']) : null;
|
|
if (json['files'] != null) {
|
|
files = <String>[];
|
|
json['files'].forEach((v) {
|
|
files!.add(v);
|
|
});
|
|
}
|
|
if (json['websites'] != null) {
|
|
websites = <String>[];
|
|
json['websites'].forEach((v) {
|
|
websites!.add(v);
|
|
});
|
|
}
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['id'] = id;
|
|
data['name'] = name;
|
|
data['description'] = description;
|
|
data['createdAt'] = createdAt;
|
|
data['image'] = image;
|
|
data['private'] = private;
|
|
if (bot != null) {
|
|
data['bot'] = bot!.toJson();
|
|
}
|
|
if (user != null) {
|
|
data['user'] = user!.toJson();
|
|
}
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class User {
|
|
String? fullName;
|
|
String? photo;
|
|
|
|
User({this.fullName, this.photo});
|
|
|
|
User.fromJson(Map<String, dynamic> json) {
|
|
fullName = json['fullName'];
|
|
photo = json['photo'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = <String, dynamic>{};
|
|
data['fullName'] = fullName;
|
|
data['photo'] = photo;
|
|
return data;
|
|
}
|
|
}
|