mirror of
https://github.com/hanzo-dart/sdk.git
synced 2026-10-30 19:32:47 +00:00
227 lines
8.0 KiB
Dart
227 lines
8.0 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 Skill {
|
|
/// Returns a new [Skill] instance.
|
|
Skill({
|
|
this.content,
|
|
this.createdAt,
|
|
this.description,
|
|
this.id,
|
|
this.name,
|
|
this.org,
|
|
this.source_,
|
|
});
|
|
/// Content is the SKILL.md body, markdown.
|
|
///
|
|
/// 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? content;
|
|
|
|
/// CreatedAt is when the skill was last written, Unix seconds.
|
|
///
|
|
/// 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? createdAt;
|
|
|
|
/// Description is the one-line summary discovery shows for the skill.
|
|
///
|
|
/// 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;
|
|
|
|
/// ID is the skill's id within the org. It is DERIVED from Name, so writing the same name again revises that skill rather than adding another.
|
|
///
|
|
/// 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? id;
|
|
|
|
/// Name is the skill's name: one lowercase path segment (a-z0-9, _ or -).
|
|
///
|
|
/// 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;
|
|
|
|
/// Org is the org that authored the skill — the validated caller's, never a value the body supplied.
|
|
///
|
|
/// 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? org;
|
|
|
|
/// Source is the repository the skill was read from, \"<project>/<name>\" or \"<name>\"; empty for a skill written through the API. A push replaces every skill of its source at once, so a skill leaves when its file does.
|
|
///
|
|
/// 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? source_;
|
|
|
|
@override
|
|
bool operator ==(Object other) => identical(this, other) || other is Skill &&
|
|
other.content == content &&
|
|
other.createdAt == createdAt &&
|
|
other.description == description &&
|
|
other.id == id &&
|
|
other.name == name &&
|
|
other.org == org &&
|
|
other.source_ == source_;
|
|
|
|
@override
|
|
int get hashCode =>
|
|
// ignore: unnecessary_parenthesis
|
|
(content == null ? 0 : content!.hashCode) +
|
|
(createdAt == null ? 0 : createdAt!.hashCode) +
|
|
(description == null ? 0 : description!.hashCode) +
|
|
(id == null ? 0 : id!.hashCode) +
|
|
(name == null ? 0 : name!.hashCode) +
|
|
(org == null ? 0 : org!.hashCode) +
|
|
(source_ == null ? 0 : source_!.hashCode);
|
|
|
|
@override
|
|
String toString() => 'Skill[content=$content, createdAt=$createdAt, description=$description, id=$id, name=$name, org=$org, source_=$source_]';
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final json = <String, dynamic>{};
|
|
if (this.content != null) {
|
|
json[r'content'] = this.content;
|
|
} else {
|
|
json[r'content'] = null;
|
|
}
|
|
if (this.createdAt != null) {
|
|
json[r'createdAt'] = this.createdAt;
|
|
} else {
|
|
json[r'createdAt'] = null;
|
|
}
|
|
if (this.description != null) {
|
|
json[r'description'] = this.description;
|
|
} else {
|
|
json[r'description'] = null;
|
|
}
|
|
if (this.id != null) {
|
|
json[r'id'] = this.id;
|
|
} else {
|
|
json[r'id'] = null;
|
|
}
|
|
if (this.name != null) {
|
|
json[r'name'] = this.name;
|
|
} else {
|
|
json[r'name'] = null;
|
|
}
|
|
if (this.org != null) {
|
|
json[r'org'] = this.org;
|
|
} else {
|
|
json[r'org'] = null;
|
|
}
|
|
if (this.source_ != null) {
|
|
json[r'source'] = this.source_;
|
|
} else {
|
|
json[r'source'] = null;
|
|
}
|
|
return json;
|
|
}
|
|
|
|
/// Returns a new [Skill] instance and imports its values from
|
|
/// [value] if it's a [Map], null otherwise.
|
|
// ignore: prefer_constructors_over_static_methods
|
|
static Skill? 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 "Skill[$key]" is missing from JSON.');
|
|
assert(json[key] != null, 'Required key "Skill[$key]" has a null value in JSON.');
|
|
});
|
|
return true;
|
|
}());
|
|
|
|
return Skill(
|
|
content: mapValueOfType<String>(json, r'content'),
|
|
createdAt: mapValueOfType<int>(json, r'createdAt'),
|
|
description: mapValueOfType<String>(json, r'description'),
|
|
id: mapValueOfType<String>(json, r'id'),
|
|
name: mapValueOfType<String>(json, r'name'),
|
|
org: mapValueOfType<String>(json, r'org'),
|
|
source_: mapValueOfType<String>(json, r'source'),
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
static List<Skill> listFromJson(dynamic json, {bool growable = false,}) {
|
|
final result = <Skill>[];
|
|
if (json is List && json.isNotEmpty) {
|
|
for (final row in json) {
|
|
final value = Skill.fromJson(row);
|
|
if (value != null) {
|
|
result.add(value);
|
|
}
|
|
}
|
|
}
|
|
return result.toList(growable: growable);
|
|
}
|
|
|
|
static Map<String, Skill> mapFromJson(dynamic json) {
|
|
final map = <String, Skill>{};
|
|
if (json is Map && json.isNotEmpty) {
|
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
|
for (final entry in json.entries) {
|
|
final value = Skill.fromJson(entry.value);
|
|
if (value != null) {
|
|
map[entry.key] = value;
|
|
}
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
// maps a json object with a list of Skill-objects as value to a dart map
|
|
static Map<String, List<Skill>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
|
final map = <String, List<Skill>>{};
|
|
if (json is Map && json.isNotEmpty) {
|
|
// ignore: parameter_assignments
|
|
json = json.cast<String, dynamic>();
|
|
for (final entry in json.entries) {
|
|
map[entry.key] = Skill.listFromJson(entry.value, growable: growable,);
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
/// The list of required keys that must be present in a JSON.
|
|
static const requiredKeys = <String>{
|
|
};
|
|
}
|
|
|