mirror of
https://github.com/hanzo-dart/sdk.git
synced 2026-10-30 19:32:47 +00:00
288 of hanzoai/ai's 294 operations now declare a response, against 1 before. GET /v1/models, POST /v1/chat/completions, /v1/embeddings, /v1/messages — every address a client actually calls — used to reach this client untyped, because cloud's relay carried an operation's sentence and dropped the shapes it named. It carries both now. Fleet-wide the document goes from 69% to 81% of operations declaring what comes back, which is where the ~208 new models here come from.
749 lines
28 KiB
Dart
749 lines
28 KiB
Dart
//
|
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
|
//
|
|
// @dart=2.18
|
|
|
|
// ignore_for_file: unused_element, unused_import
|
|
// ignore_for_file: always_put_required_named_parameters_first
|
|
// ignore_for_file: constant_identifier_names
|
|
// ignore_for_file: lines_longer_than_80_chars
|
|
|
|
part of hanzoai.cloud;
|
|
|
|
class Video {
|
|
/// Returns a new [Video] instance.
|
|
Video({
|
|
this.audioUrl,
|
|
this.class_,
|
|
this.coverUrl,
|
|
this.createdTime,
|
|
this.dataUrl,
|
|
this.dataUrls = const [],
|
|
this.description,
|
|
this.displayName,
|
|
this.downloadUrl,
|
|
this.editMode,
|
|
this.excellentCount,
|
|
this.grade,
|
|
this.grade2,
|
|
this.isPublic,
|
|
this.keywords = const [],
|
|
this.labelCount,
|
|
this.labels = const [],
|
|
this.lesson,
|
|
this.name,
|
|
this.owner,
|
|
this.playAuth,
|
|
this.remarks = const [],
|
|
this.remarks2 = const [],
|
|
this.reviewState,
|
|
this.school,
|
|
this.segmentCount,
|
|
this.segments = const [],
|
|
this.stage,
|
|
this.state,
|
|
this.subject,
|
|
this.tag,
|
|
this.tagOnPause,
|
|
this.task1,
|
|
this.task2,
|
|
this.task3,
|
|
this.template,
|
|
this.topic,
|
|
this.type,
|
|
this.unit,
|
|
this.videoId,
|
|
this.videoLength,
|
|
this.wordCountMap = const {},
|
|
});
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? audioUrl;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? class_;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? coverUrl;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? createdTime;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? dataUrl;
|
|
|
|
List<String> dataUrls;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? description;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? displayName;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? downloadUrl;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? editMode;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
int? excellentCount;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? grade;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? grade2;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
bool? isPublic;
|
|
|
|
List<String> keywords;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
int? labelCount;
|
|
|
|
List<Label> labels;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? lesson;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? name;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? owner;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? playAuth;
|
|
|
|
List<Remark> remarks;
|
|
|
|
List<Remark> remarks2;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? reviewState;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? school;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
int? segmentCount;
|
|
|
|
List<Label> segments;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? stage;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? state;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? subject;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? tag;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
bool? tagOnPause;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? task1;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? task2;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? task3;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? template;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? topic;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? type;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? unit;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? videoId;
|
|
|
|
///
|
|
/// Please note: This property should have been non-nullable! Since the specification file
|
|
/// does not include a default value (using the "default:" property), however, the generated
|
|
/// source code must fall back to having a nullable type.
|
|
/// Consider adding a "default:" property in the specification file to hide this note.
|
|
///
|
|
String? videoLength;
|
|
|
|
Map<String, int> wordCountMap;
|
|
|
|
@override
|
|
bool operator ==(Object other) => identical(this, other) || other is Video &&
|
|
other.audioUrl == audioUrl &&
|
|
other.class_ == class_ &&
|
|
other.coverUrl == coverUrl &&
|
|
other.createdTime == createdTime &&
|
|
other.dataUrl == dataUrl &&
|
|
_deepEquality.equals(other.dataUrls, dataUrls) &&
|
|
other.description == description &&
|
|
other.displayName == displayName &&
|
|
other.downloadUrl == downloadUrl &&
|
|
other.editMode == editMode &&
|
|
other.excellentCount == excellentCount &&
|
|
other.grade == grade &&
|
|
other.grade2 == grade2 &&
|
|
other.isPublic == isPublic &&
|
|
_deepEquality.equals(other.keywords, keywords) &&
|
|
other.labelCount == labelCount &&
|
|
_deepEquality.equals(other.labels, labels) &&
|
|
other.lesson == lesson &&
|
|
other.name == name &&
|
|
other.owner == owner &&
|
|
other.playAuth == playAuth &&
|
|
_deepEquality.equals(other.remarks, remarks) &&
|
|
_deepEquality.equals(other.remarks2, remarks2) &&
|
|
other.reviewState == reviewState &&
|
|
other.school == school &&
|
|
other.segmentCount == segmentCount &&
|
|
_deepEquality.equals(other.segments, segments) &&
|
|
other.stage == stage &&
|
|
other.state == state &&
|
|
other.subject == subject &&
|
|
other.tag == tag &&
|
|
other.tagOnPause == tagOnPause &&
|
|
other.task1 == task1 &&
|
|
other.task2 == task2 &&
|
|
other.task3 == task3 &&
|
|
other.template == template &&
|
|
other.topic == topic &&
|
|
other.type == type &&
|
|
other.unit == unit &&
|
|
other.videoId == videoId &&
|
|
other.videoLength == videoLength &&
|
|
_deepEquality.equals(other.wordCountMap, wordCountMap);
|
|
|
|
@override
|
|
int get hashCode =>
|
|
// ignore: unnecessary_parenthesis
|
|
(audioUrl == null ? 0 : audioUrl!.hashCode) +
|
|
(class_ == null ? 0 : class_!.hashCode) +
|
|
(coverUrl == null ? 0 : coverUrl!.hashCode) +
|
|
(createdTime == null ? 0 : createdTime!.hashCode) +
|
|
(dataUrl == null ? 0 : dataUrl!.hashCode) +
|
|
(dataUrls.hashCode) +
|
|
(description == null ? 0 : description!.hashCode) +
|
|
(displayName == null ? 0 : displayName!.hashCode) +
|
|
(downloadUrl == null ? 0 : downloadUrl!.hashCode) +
|
|
(editMode == null ? 0 : editMode!.hashCode) +
|
|
(excellentCount == null ? 0 : excellentCount!.hashCode) +
|
|
(grade == null ? 0 : grade!.hashCode) +
|
|
(grade2 == null ? 0 : grade2!.hashCode) +
|
|
(isPublic == null ? 0 : isPublic!.hashCode) +
|
|
(keywords.hashCode) +
|
|
(labelCount == null ? 0 : labelCount!.hashCode) +
|
|
(labels.hashCode) +
|
|
(lesson == null ? 0 : lesson!.hashCode) +
|
|
(name == null ? 0 : name!.hashCode) +
|
|
(owner == null ? 0 : owner!.hashCode) +
|
|
(playAuth == null ? 0 : playAuth!.hashCode) +
|
|
(remarks.hashCode) +
|
|
(remarks2.hashCode) +
|
|
(reviewState == null ? 0 : reviewState!.hashCode) +
|
|
(school == null ? 0 : school!.hashCode) +
|
|
(segmentCount == null ? 0 : segmentCount!.hashCode) +
|
|
(segments.hashCode) +
|
|
(stage == null ? 0 : stage!.hashCode) +
|
|
(state == null ? 0 : state!.hashCode) +
|
|
(subject == null ? 0 : subject!.hashCode) +
|
|
(tag == null ? 0 : tag!.hashCode) +
|
|
(tagOnPause == null ? 0 : tagOnPause!.hashCode) +
|
|
(task1 == null ? 0 : task1!.hashCode) +
|
|
(task2 == null ? 0 : task2!.hashCode) +
|
|
(task3 == null ? 0 : task3!.hashCode) +
|
|
(template == null ? 0 : template!.hashCode) +
|
|
(topic == null ? 0 : topic!.hashCode) +
|
|
(type == null ? 0 : type!.hashCode) +
|
|
(unit == null ? 0 : unit!.hashCode) +
|
|
(videoId == null ? 0 : videoId!.hashCode) +
|
|
(videoLength == null ? 0 : videoLength!.hashCode) +
|
|
(wordCountMap.hashCode);
|
|
|
|
@override
|
|
String toString() => 'Video[audioUrl=$audioUrl, class_=$class_, coverUrl=$coverUrl, createdTime=$createdTime, dataUrl=$dataUrl, dataUrls=$dataUrls, description=$description, displayName=$displayName, downloadUrl=$downloadUrl, editMode=$editMode, excellentCount=$excellentCount, grade=$grade, grade2=$grade2, isPublic=$isPublic, keywords=$keywords, labelCount=$labelCount, labels=$labels, lesson=$lesson, name=$name, owner=$owner, playAuth=$playAuth, remarks=$remarks, remarks2=$remarks2, reviewState=$reviewState, school=$school, segmentCount=$segmentCount, segments=$segments, stage=$stage, state=$state, subject=$subject, tag=$tag, tagOnPause=$tagOnPause, task1=$task1, task2=$task2, task3=$task3, template=$template, topic=$topic, type=$type, unit=$unit, videoId=$videoId, videoLength=$videoLength, wordCountMap=$wordCountMap]';
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final json = <String, dynamic>{};
|
|
if (this.audioUrl != null) {
|
|
json[r'audioUrl'] = this.audioUrl;
|
|
} else {
|
|
json[r'audioUrl'] = null;
|
|
}
|
|
if (this.class_ != null) {
|
|
json[r'class'] = this.class_;
|
|
} else {
|
|
json[r'class'] = null;
|
|
}
|
|
if (this.coverUrl != null) {
|
|
json[r'coverUrl'] = this.coverUrl;
|
|
} else {
|
|
json[r'coverUrl'] = null;
|
|
}
|
|
if (this.createdTime != null) {
|
|
json[r'createdTime'] = this.createdTime;
|
|
} else {
|
|
json[r'createdTime'] = null;
|
|
}
|
|
if (this.dataUrl != null) {
|
|
json[r'dataUrl'] = this.dataUrl;
|
|
} else {
|
|
json[r'dataUrl'] = null;
|
|
}
|
|
json[r'dataUrls'] = this.dataUrls;
|
|
if (this.description != null) {
|
|
json[r'description'] = this.description;
|
|
} else {
|
|
json[r'description'] = null;
|
|
}
|
|
if (this.displayName != null) {
|
|
json[r'displayName'] = this.displayName;
|
|
} else {
|
|
json[r'displayName'] = null;
|
|
}
|
|
if (this.downloadUrl != null) {
|
|
json[r'downloadUrl'] = this.downloadUrl;
|
|
} else {
|
|
json[r'downloadUrl'] = null;
|
|
}
|
|
if (this.editMode != null) {
|
|
json[r'editMode'] = this.editMode;
|
|
} else {
|
|
json[r'editMode'] = null;
|
|
}
|
|
if (this.excellentCount != null) {
|
|
json[r'excellentCount'] = this.excellentCount;
|
|
} else {
|
|
json[r'excellentCount'] = null;
|
|
}
|
|
if (this.grade != null) {
|
|
json[r'grade'] = this.grade;
|
|
} else {
|
|
json[r'grade'] = null;
|
|
}
|
|
if (this.grade2 != null) {
|
|
json[r'grade2'] = this.grade2;
|
|
} else {
|
|
json[r'grade2'] = null;
|
|
}
|
|
if (this.isPublic != null) {
|
|
json[r'isPublic'] = this.isPublic;
|
|
} else {
|
|
json[r'isPublic'] = null;
|
|
}
|
|
json[r'keywords'] = this.keywords;
|
|
if (this.labelCount != null) {
|
|
json[r'labelCount'] = this.labelCount;
|
|
} else {
|
|
json[r'labelCount'] = null;
|
|
}
|
|
json[r'labels'] = this.labels;
|
|
if (this.lesson != null) {
|
|
json[r'lesson'] = this.lesson;
|
|
} else {
|
|
json[r'lesson'] = null;
|
|
}
|
|
if (this.name != null) {
|
|
json[r'name'] = this.name;
|
|
} else {
|
|
json[r'name'] = null;
|
|
}
|
|
if (this.owner != null) {
|
|
json[r'owner'] = this.owner;
|
|
} else {
|
|
json[r'owner'] = null;
|
|
}
|
|
if (this.playAuth != null) {
|
|
json[r'playAuth'] = this.playAuth;
|
|
} else {
|
|
json[r'playAuth'] = null;
|
|
}
|
|
json[r'remarks'] = this.remarks;
|
|
json[r'remarks2'] = this.remarks2;
|
|
if (this.reviewState != null) {
|
|
json[r'reviewState'] = this.reviewState;
|
|
} else {
|
|
json[r'reviewState'] = null;
|
|
}
|
|
if (this.school != null) {
|
|
json[r'school'] = this.school;
|
|
} else {
|
|
json[r'school'] = null;
|
|
}
|
|
if (this.segmentCount != null) {
|
|
json[r'segmentCount'] = this.segmentCount;
|
|
} else {
|
|
json[r'segmentCount'] = null;
|
|
}
|
|
json[r'segments'] = this.segments;
|
|
if (this.stage != null) {
|
|
json[r'stage'] = this.stage;
|
|
} else {
|
|
json[r'stage'] = null;
|
|
}
|
|
if (this.state != null) {
|
|
json[r'state'] = this.state;
|
|
} else {
|
|
json[r'state'] = null;
|
|
}
|
|
if (this.subject != null) {
|
|
json[r'subject'] = this.subject;
|
|
} else {
|
|
json[r'subject'] = null;
|
|
}
|
|
if (this.tag != null) {
|
|
json[r'tag'] = this.tag;
|
|
} else {
|
|
json[r'tag'] = null;
|
|
}
|
|
if (this.tagOnPause != null) {
|
|
json[r'tagOnPause'] = this.tagOnPause;
|
|
} else {
|
|
json[r'tagOnPause'] = null;
|
|
}
|
|
if (this.task1 != null) {
|
|
json[r'task1'] = this.task1;
|
|
} else {
|
|
json[r'task1'] = null;
|
|
}
|
|
if (this.task2 != null) {
|
|
json[r'task2'] = this.task2;
|
|
} else {
|
|
json[r'task2'] = null;
|
|
}
|
|
if (this.task3 != null) {
|
|
json[r'task3'] = this.task3;
|
|
} else {
|
|
json[r'task3'] = null;
|
|
}
|
|
if (this.template != null) {
|
|
json[r'template'] = this.template;
|
|
} else {
|
|
json[r'template'] = null;
|
|
}
|
|
if (this.topic != null) {
|
|
json[r'topic'] = this.topic;
|
|
} else {
|
|
json[r'topic'] = null;
|
|
}
|
|
if (this.type != null) {
|
|
json[r'type'] = this.type;
|
|
} else {
|
|
json[r'type'] = null;
|
|
}
|
|
if (this.unit != null) {
|
|
json[r'unit'] = this.unit;
|
|
} else {
|
|
json[r'unit'] = null;
|
|
}
|
|
if (this.videoId != null) {
|
|
json[r'videoId'] = this.videoId;
|
|
} else {
|
|
json[r'videoId'] = null;
|
|
}
|
|
if (this.videoLength != null) {
|
|
json[r'videoLength'] = this.videoLength;
|
|
} else {
|
|
json[r'videoLength'] = null;
|
|
}
|
|
json[r'wordCountMap'] = this.wordCountMap;
|
|
return json;
|
|
}
|
|
|
|
/// Returns a new [Video] instance and imports its values from
|
|
/// [value] if it's a [Map], null otherwise.
|
|
// ignore: prefer_constructors_over_static_methods
|
|
static Video? fromJson(dynamic value) {
|
|
if (value is Map) {
|
|
final json = value.cast<String, dynamic>();
|
|
|
|
// Ensure that the map contains the required keys.
|
|
// Note 1: the values aren't checked for validity beyond being non-null.
|
|
// Note 2: this code is stripped in release mode!
|
|
assert(() {
|
|
requiredKeys.forEach((key) {
|
|
assert(json.containsKey(key), 'Required key "Video[$key]" is missing from JSON.');
|
|
assert(json[key] != null, 'Required key "Video[$key]" has a null value in JSON.');
|
|
});
|
|
return true;
|
|
}());
|
|
|
|
return Video(
|
|
audioUrl: mapValueOfType<String>(json, r'audioUrl'),
|
|
class_: mapValueOfType<String>(json, r'class'),
|
|
coverUrl: mapValueOfType<String>(json, r'coverUrl'),
|
|
createdTime: mapValueOfType<String>(json, r'createdTime'),
|
|
dataUrl: mapValueOfType<String>(json, r'dataUrl'),
|
|
dataUrls: json[r'dataUrls'] is Iterable
|
|
? (json[r'dataUrls'] as Iterable).cast<String>().toList(growable: false)
|
|
: const [],
|
|
description: mapValueOfType<String>(json, r'description'),
|
|
displayName: mapValueOfType<String>(json, r'displayName'),
|
|
downloadUrl: mapValueOfType<String>(json, r'downloadUrl'),
|
|
editMode: mapValueOfType<String>(json, r'editMode'),
|
|
excellentCount: mapValueOfType<int>(json, r'excellentCount'),
|
|
grade: mapValueOfType<String>(json, r'grade'),
|
|
grade2: mapValueOfType<String>(json, r'grade2'),
|
|
isPublic: mapValueOfType<bool>(json, r'isPublic'),
|
|
keywords: json[r'keywords'] is Iterable
|
|
? (json[r'keywords'] as Iterable).cast<String>().toList(growable: false)
|
|
: const [],
|
|
labelCount: mapValueOfType<int>(json, r'labelCount'),
|
|
labels: Label.listFromJson(json[r'labels']),
|
|
lesson: mapValueOfType<String>(json, r'lesson'),
|
|
name: mapValueOfType<String>(json, r'name'),
|
|
owner: mapValueOfType<String>(json, r'owner'),
|
|
playAuth: mapValueOfType<String>(json, r'playAuth'),
|
|
remarks: Remark.listFromJson(json[r'remarks']),
|
|
remarks2: Remark.listFromJson(json[r'remarks2']),
|
|
reviewState: mapValueOfType<String>(json, r'reviewState'),
|
|
school: mapValueOfType<String>(json, r'school'),
|
|
segmentCount: mapValueOfType<int>(json, r'segmentCount'),
|
|
segments: Label.listFromJson(json[r'segments']),
|
|
stage: mapValueOfType<String>(json, r'stage'),
|
|
state: mapValueOfType<String>(json, r'state'),
|
|
subject: mapValueOfType<String>(json, r'subject'),
|
|
tag: mapValueOfType<String>(json, r'tag'),
|
|
tagOnPause: mapValueOfType<bool>(json, r'tagOnPause'),
|
|
task1: mapValueOfType<String>(json, r'task1'),
|
|
task2: mapValueOfType<String>(json, r'task2'),
|
|
task3: mapValueOfType<String>(json, r'task3'),
|
|
template: mapValueOfType<String>(json, r'template'),
|
|
topic: mapValueOfType<String>(json, r'topic'),
|
|
type: mapValueOfType<String>(json, r'type'),
|
|
unit: mapValueOfType<String>(json, r'unit'),
|
|
videoId: mapValueOfType<String>(json, r'videoId'),
|
|
videoLength: mapValueOfType<String>(json, r'videoLength'),
|
|
wordCountMap: mapCastOfType<String, int>(json, r'wordCountMap') ?? const {},
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
static List<Video> listFromJson(dynamic json, {bool growable = false,}) {
|
|
final result = <Video>[];
|
|
if (json is List && json.isNotEmpty) {
|
|
for (final row in json) {
|
|
final value = Video.fromJson(row);
|
|
if (value != null) {
|
|
result.add(value);
|
|
}
|
|
}
|
|
}
|
|
return result.toList(growable: growable);
|
|
}
|
|
|
|
static Map<String, Video> mapFromJson(dynamic json) {
|
|
final map = <String, Video>{};
|
|
if (json is Map && json.isNotEmpty) {
|
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
|
for (final entry in json.entries) {
|
|
final value = Video.fromJson(entry.value);
|
|
if (value != null) {
|
|
map[entry.key] = value;
|
|
}
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
// maps a json object with a list of Video-objects as value to a dart map
|
|
static Map<String, List<Video>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
|
final map = <String, List<Video>>{};
|
|
if (json is Map && json.isNotEmpty) {
|
|
// ignore: parameter_assignments
|
|
json = json.cast<String, dynamic>();
|
|
for (final entry in json.entries) {
|
|
map[entry.key] = Video.listFromJson(entry.value, growable: growable,);
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
/// The list of required keys that must be present in a JSON.
|
|
static const requiredKeys = <String>{
|
|
};
|
|
}
|
|
|