403 lines
8.6 KiB
Dart
403 lines
8.6 KiB
Dart
import 'entity.dart';
|
|
|
|
/// 分类项
|
|
class CategoryItem extends Entity {
|
|
CategoryItem({
|
|
this.id,
|
|
this.name,
|
|
this.icon,
|
|
});
|
|
|
|
final int? id;
|
|
final String? name;
|
|
final String? icon;
|
|
|
|
@override
|
|
factory CategoryItem.fromJson(Map<String, dynamic> json) {
|
|
return CategoryItem(
|
|
id: json['id'] as int?,
|
|
name: json['name'] as String?,
|
|
icon: json['icon'] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'icon': icon,
|
|
};
|
|
}
|
|
|
|
/// 分类列表响应
|
|
class CategoryListResponse extends Entity {
|
|
CategoryListResponse({
|
|
this.categories,
|
|
});
|
|
|
|
final List<CategoryItem>? categories;
|
|
|
|
@override
|
|
factory CategoryListResponse.fromJson(Map<String, dynamic> json) {
|
|
final list = json['categories'] as List<dynamic>?;
|
|
return CategoryListResponse(
|
|
categories: list
|
|
?.map((e) => CategoryItem.fromJson(e as Map<String, dynamic>))
|
|
.toList(),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'categories': categories?.map((e) => e.toJson()).toList(),
|
|
};
|
|
}
|
|
|
|
/// 任务项
|
|
class TaskItem extends Entity {
|
|
TaskItem({
|
|
this.id,
|
|
this.name,
|
|
this.imageUrl,
|
|
this.categoryId,
|
|
});
|
|
|
|
final String? id;
|
|
final String? name;
|
|
final String? imageUrl;
|
|
final int? categoryId;
|
|
|
|
@override
|
|
factory TaskItem.fromJson(Map<String, dynamic> json) {
|
|
return TaskItem(
|
|
id: json['id'] as String?,
|
|
name: json['name'] as String?,
|
|
imageUrl: json['imageUrl'] as String?,
|
|
categoryId: json['categoryId'] as int?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'imageUrl': imageUrl,
|
|
'categoryId': categoryId,
|
|
};
|
|
}
|
|
|
|
/// 任务列表响应
|
|
class TasksResponse extends Entity {
|
|
TasksResponse({
|
|
this.tasks,
|
|
});
|
|
|
|
final List<TaskItem>? tasks;
|
|
|
|
@override
|
|
factory TasksResponse.fromJson(Map<String, dynamic> json) {
|
|
final list = json['tasks'] as List<dynamic>?;
|
|
return TasksResponse(
|
|
tasks: list
|
|
?.map((e) => TaskItem.fromJson(e as Map<String, dynamic>))
|
|
.toList(),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'tasks': tasks?.map((e) => e.toJson()).toList(),
|
|
};
|
|
}
|
|
|
|
/// 推荐提示词项
|
|
class PromptRecommendItem extends Entity {
|
|
PromptRecommendItem({
|
|
this.prompt,
|
|
this.icon,
|
|
});
|
|
|
|
final String? prompt;
|
|
final String? icon;
|
|
|
|
@override
|
|
factory PromptRecommendItem.fromJson(Map<String, dynamic> json) {
|
|
return PromptRecommendItem(
|
|
prompt: json['prompt'] as String?,
|
|
icon: json['icon'] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'prompt': prompt,
|
|
'icon': icon,
|
|
};
|
|
}
|
|
|
|
/// 推荐提示词响应
|
|
class PromptRecommendsResponse extends Entity {
|
|
PromptRecommendsResponse({
|
|
this.recommends,
|
|
});
|
|
|
|
final List<PromptRecommendItem>? recommends;
|
|
|
|
@override
|
|
factory PromptRecommendsResponse.fromJson(Map<String, dynamic> json) {
|
|
final list = json['recommends'] as List<dynamic>?;
|
|
return PromptRecommendsResponse(
|
|
recommends: list
|
|
?.map((e) => PromptRecommendItem.fromJson(e as Map<String, dynamic>))
|
|
.toList(),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'recommends': recommends?.map((e) => e.toJson()).toList(),
|
|
};
|
|
}
|
|
|
|
/// 任务进度响应
|
|
class ProgressResponse extends Entity {
|
|
ProgressResponse({
|
|
this.taskId,
|
|
this.status,
|
|
this.progress,
|
|
this.resultUrl,
|
|
});
|
|
|
|
final String? taskId;
|
|
final String? status;
|
|
final int? progress;
|
|
final String? resultUrl;
|
|
|
|
@override
|
|
factory ProgressResponse.fromJson(Map<String, dynamic> json) {
|
|
return ProgressResponse(
|
|
taskId: json['taskId'] as String?,
|
|
status: json['status'] as String?,
|
|
progress: json['progress'] as int?,
|
|
resultUrl: json['resultUrl'] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'taskId': taskId,
|
|
'status': status,
|
|
'progress': progress,
|
|
'resultUrl': resultUrl,
|
|
};
|
|
}
|
|
|
|
/// 姿态模板项
|
|
class PoseTemplateItem extends Entity {
|
|
PoseTemplateItem({
|
|
this.id,
|
|
this.name,
|
|
this.imageUrl,
|
|
});
|
|
|
|
final String? id;
|
|
final String? name;
|
|
final String? imageUrl;
|
|
|
|
@override
|
|
factory PoseTemplateItem.fromJson(Map<String, dynamic> json) {
|
|
return PoseTemplateItem(
|
|
id: json['id'] as String?,
|
|
name: json['name'] as String?,
|
|
imageUrl: json['imageUrl'] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'imageUrl': imageUrl,
|
|
};
|
|
}
|
|
|
|
/// 姿态模板列表响应
|
|
class PoseTemplatesResponse extends Entity {
|
|
PoseTemplatesResponse({
|
|
this.templates,
|
|
});
|
|
|
|
final List<PoseTemplateItem>? templates;
|
|
|
|
@override
|
|
factory PoseTemplatesResponse.fromJson(Map<String, dynamic> json) {
|
|
final list = json['templates'] as List<dynamic>?;
|
|
return PoseTemplatesResponse(
|
|
templates: list
|
|
?.map((e) => PoseTemplateItem.fromJson(e as Map<String, dynamic>))
|
|
.toList(),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'templates': templates?.map((e) => e.toJson()).toList(),
|
|
};
|
|
}
|
|
|
|
/// 预签名上传 URL 响应
|
|
class UploadPresignedUrlResponse extends Entity {
|
|
UploadPresignedUrlResponse({
|
|
this.uploadUrl,
|
|
this.filePath,
|
|
});
|
|
|
|
final String? uploadUrl;
|
|
final String? filePath;
|
|
|
|
@override
|
|
factory UploadPresignedUrlResponse.fromJson(Map<String, dynamic> json) {
|
|
return UploadPresignedUrlResponse(
|
|
uploadUrl: json['uploadUrl'] as String?,
|
|
filePath: json['filePath'] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'uploadUrl': uploadUrl,
|
|
'filePath': filePath,
|
|
};
|
|
}
|
|
|
|
/// 创建任务响应
|
|
class CreateTaskResponse extends Entity {
|
|
CreateTaskResponse({
|
|
this.taskId,
|
|
this.status,
|
|
});
|
|
|
|
final String? taskId;
|
|
final String? status;
|
|
|
|
@override
|
|
factory CreateTaskResponse.fromJson(Map<String, dynamic> json) {
|
|
return CreateTaskResponse(
|
|
taskId: json['taskId'] as String?,
|
|
status: json['status'] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'taskId': taskId,
|
|
'status': status,
|
|
};
|
|
}
|
|
|
|
/// 我的任务项
|
|
class MyTaskItem extends Entity {
|
|
MyTaskItem({
|
|
this.taskId,
|
|
this.status,
|
|
this.progress,
|
|
this.resultUrl,
|
|
this.createTime,
|
|
this.type,
|
|
});
|
|
|
|
final String? taskId;
|
|
final String? status;
|
|
final int? progress;
|
|
final String? resultUrl;
|
|
final String? createTime;
|
|
final String? type;
|
|
|
|
@override
|
|
factory MyTaskItem.fromJson(Map<String, dynamic> json) {
|
|
return MyTaskItem(
|
|
taskId: json['taskId'] as String?,
|
|
status: json['status'] as String?,
|
|
progress: json['progress'] as int?,
|
|
resultUrl: json['resultUrl'] as String?,
|
|
createTime: json['createTime'] as String?,
|
|
type: json['type'] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'taskId': taskId,
|
|
'status': status,
|
|
'progress': progress,
|
|
'resultUrl': resultUrl,
|
|
'createTime': createTime,
|
|
'type': type,
|
|
};
|
|
}
|
|
|
|
/// 我的任务列表响应
|
|
class MyTasksResponse extends Entity {
|
|
MyTasksResponse({
|
|
this.tasks,
|
|
this.total,
|
|
this.cursor,
|
|
});
|
|
|
|
final List<MyTaskItem>? tasks;
|
|
final int? total;
|
|
final String? cursor;
|
|
|
|
@override
|
|
factory MyTasksResponse.fromJson(Map<String, dynamic> json) {
|
|
final list = json['tasks'] as List<dynamic>?;
|
|
return MyTasksResponse(
|
|
tasks: list
|
|
?.map((e) => MyTaskItem.fromJson(e as Map<String, dynamic>))
|
|
.toList(),
|
|
total: json['total'] as int?,
|
|
cursor: json['cursor'] as String?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'tasks': tasks?.map((e) => e.toJson()).toList(),
|
|
'total': total,
|
|
'cursor': cursor,
|
|
};
|
|
}
|
|
|
|
/// 积分页面信息响应
|
|
class CreditsPageInfoResponse extends Entity {
|
|
CreditsPageInfoResponse({
|
|
this.credits,
|
|
this.freeTimes,
|
|
this.vipExpireTime,
|
|
this.isVip,
|
|
});
|
|
|
|
final int? credits;
|
|
final int? freeTimes;
|
|
final String? vipExpireTime;
|
|
final bool? isVip;
|
|
|
|
@override
|
|
factory CreditsPageInfoResponse.fromJson(Map<String, dynamic> json) {
|
|
return CreditsPageInfoResponse(
|
|
credits: json['credits'] as int?,
|
|
freeTimes: json['freeTimes'] as int?,
|
|
vipExpireTime: json['vipExpireTime'] as String?,
|
|
isVip: json['isVip'] as bool?,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson() => {
|
|
'credits': credits,
|
|
'freeTimes': freeTimes,
|
|
'vipExpireTime': vipExpireTime,
|
|
'isVip': isVip,
|
|
};
|
|
}
|