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.
640 lines
24 KiB
Dart
640 lines
24 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 Message {
|
|
/// Returns a new [Message] instance.
|
|
Message({
|
|
this.answeredTime,
|
|
this.author,
|
|
this.chat,
|
|
this.claimedTime,
|
|
this.comment,
|
|
this.createdTime,
|
|
this.currency,
|
|
this.dislikeUsers = const [],
|
|
this.embeddingProvider,
|
|
this.errorText,
|
|
this.fileName,
|
|
this.isAlerted,
|
|
this.isDeleted,
|
|
this.isHidden,
|
|
this.isRegenerated,
|
|
this.likeUsers = const [],
|
|
this.modelProvider,
|
|
this.name,
|
|
this.needNotify,
|
|
this.organization,
|
|
this.owner,
|
|
this.price,
|
|
this.reasonText,
|
|
this.replyTo,
|
|
this.searchResults = const [],
|
|
this.store,
|
|
this.suggestions = const [],
|
|
this.text,
|
|
this.textTokenCount,
|
|
this.tokenCount,
|
|
this.toolCalls = const [],
|
|
this.transactionId,
|
|
this.user,
|
|
this.vectorScores = const [],
|
|
this.webSearchEnabled,
|
|
});
|
|
///
|
|
/// 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? answeredTime;
|
|
|
|
///
|
|
/// 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? author;
|
|
|
|
///
|
|
/// 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? chat;
|
|
|
|
///
|
|
/// 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? claimedTime;
|
|
|
|
///
|
|
/// 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? comment;
|
|
|
|
///
|
|
/// 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? currency;
|
|
|
|
List<String> dislikeUsers;
|
|
|
|
///
|
|
/// 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? embeddingProvider;
|
|
|
|
///
|
|
/// 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? errorText;
|
|
|
|
///
|
|
/// 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? fileName;
|
|
|
|
///
|
|
/// 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? isAlerted;
|
|
|
|
///
|
|
/// 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? isDeleted;
|
|
|
|
///
|
|
/// 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? isHidden;
|
|
|
|
///
|
|
/// 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? isRegenerated;
|
|
|
|
List<String> likeUsers;
|
|
|
|
///
|
|
/// 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? modelProvider;
|
|
|
|
///
|
|
/// 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.
|
|
///
|
|
bool? needNotify;
|
|
|
|
///
|
|
/// 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? organization;
|
|
|
|
///
|
|
/// 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.
|
|
///
|
|
num? price;
|
|
|
|
///
|
|
/// 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? reasonText;
|
|
|
|
///
|
|
/// 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? replyTo;
|
|
|
|
List<ModelSearchResult> searchResults;
|
|
|
|
///
|
|
/// 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? store;
|
|
|
|
List<Candidate> suggestions;
|
|
|
|
///
|
|
/// 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? text;
|
|
|
|
///
|
|
/// 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? textTokenCount;
|
|
|
|
///
|
|
/// 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? tokenCount;
|
|
|
|
List<ModelToolCall> toolCalls;
|
|
|
|
///
|
|
/// 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? transactionId;
|
|
|
|
///
|
|
/// 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? user;
|
|
|
|
List<VectorScore> vectorScores;
|
|
|
|
///
|
|
/// 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? webSearchEnabled;
|
|
|
|
@override
|
|
bool operator ==(Object other) => identical(this, other) || other is Message &&
|
|
other.answeredTime == answeredTime &&
|
|
other.author == author &&
|
|
other.chat == chat &&
|
|
other.claimedTime == claimedTime &&
|
|
other.comment == comment &&
|
|
other.createdTime == createdTime &&
|
|
other.currency == currency &&
|
|
_deepEquality.equals(other.dislikeUsers, dislikeUsers) &&
|
|
other.embeddingProvider == embeddingProvider &&
|
|
other.errorText == errorText &&
|
|
other.fileName == fileName &&
|
|
other.isAlerted == isAlerted &&
|
|
other.isDeleted == isDeleted &&
|
|
other.isHidden == isHidden &&
|
|
other.isRegenerated == isRegenerated &&
|
|
_deepEquality.equals(other.likeUsers, likeUsers) &&
|
|
other.modelProvider == modelProvider &&
|
|
other.name == name &&
|
|
other.needNotify == needNotify &&
|
|
other.organization == organization &&
|
|
other.owner == owner &&
|
|
other.price == price &&
|
|
other.reasonText == reasonText &&
|
|
other.replyTo == replyTo &&
|
|
_deepEquality.equals(other.searchResults, searchResults) &&
|
|
other.store == store &&
|
|
_deepEquality.equals(other.suggestions, suggestions) &&
|
|
other.text == text &&
|
|
other.textTokenCount == textTokenCount &&
|
|
other.tokenCount == tokenCount &&
|
|
_deepEquality.equals(other.toolCalls, toolCalls) &&
|
|
other.transactionId == transactionId &&
|
|
other.user == user &&
|
|
_deepEquality.equals(other.vectorScores, vectorScores) &&
|
|
other.webSearchEnabled == webSearchEnabled;
|
|
|
|
@override
|
|
int get hashCode =>
|
|
// ignore: unnecessary_parenthesis
|
|
(answeredTime == null ? 0 : answeredTime!.hashCode) +
|
|
(author == null ? 0 : author!.hashCode) +
|
|
(chat == null ? 0 : chat!.hashCode) +
|
|
(claimedTime == null ? 0 : claimedTime!.hashCode) +
|
|
(comment == null ? 0 : comment!.hashCode) +
|
|
(createdTime == null ? 0 : createdTime!.hashCode) +
|
|
(currency == null ? 0 : currency!.hashCode) +
|
|
(dislikeUsers.hashCode) +
|
|
(embeddingProvider == null ? 0 : embeddingProvider!.hashCode) +
|
|
(errorText == null ? 0 : errorText!.hashCode) +
|
|
(fileName == null ? 0 : fileName!.hashCode) +
|
|
(isAlerted == null ? 0 : isAlerted!.hashCode) +
|
|
(isDeleted == null ? 0 : isDeleted!.hashCode) +
|
|
(isHidden == null ? 0 : isHidden!.hashCode) +
|
|
(isRegenerated == null ? 0 : isRegenerated!.hashCode) +
|
|
(likeUsers.hashCode) +
|
|
(modelProvider == null ? 0 : modelProvider!.hashCode) +
|
|
(name == null ? 0 : name!.hashCode) +
|
|
(needNotify == null ? 0 : needNotify!.hashCode) +
|
|
(organization == null ? 0 : organization!.hashCode) +
|
|
(owner == null ? 0 : owner!.hashCode) +
|
|
(price == null ? 0 : price!.hashCode) +
|
|
(reasonText == null ? 0 : reasonText!.hashCode) +
|
|
(replyTo == null ? 0 : replyTo!.hashCode) +
|
|
(searchResults.hashCode) +
|
|
(store == null ? 0 : store!.hashCode) +
|
|
(suggestions.hashCode) +
|
|
(text == null ? 0 : text!.hashCode) +
|
|
(textTokenCount == null ? 0 : textTokenCount!.hashCode) +
|
|
(tokenCount == null ? 0 : tokenCount!.hashCode) +
|
|
(toolCalls.hashCode) +
|
|
(transactionId == null ? 0 : transactionId!.hashCode) +
|
|
(user == null ? 0 : user!.hashCode) +
|
|
(vectorScores.hashCode) +
|
|
(webSearchEnabled == null ? 0 : webSearchEnabled!.hashCode);
|
|
|
|
@override
|
|
String toString() => 'Message[answeredTime=$answeredTime, author=$author, chat=$chat, claimedTime=$claimedTime, comment=$comment, createdTime=$createdTime, currency=$currency, dislikeUsers=$dislikeUsers, embeddingProvider=$embeddingProvider, errorText=$errorText, fileName=$fileName, isAlerted=$isAlerted, isDeleted=$isDeleted, isHidden=$isHidden, isRegenerated=$isRegenerated, likeUsers=$likeUsers, modelProvider=$modelProvider, name=$name, needNotify=$needNotify, organization=$organization, owner=$owner, price=$price, reasonText=$reasonText, replyTo=$replyTo, searchResults=$searchResults, store=$store, suggestions=$suggestions, text=$text, textTokenCount=$textTokenCount, tokenCount=$tokenCount, toolCalls=$toolCalls, transactionId=$transactionId, user=$user, vectorScores=$vectorScores, webSearchEnabled=$webSearchEnabled]';
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final json = <String, dynamic>{};
|
|
if (this.answeredTime != null) {
|
|
json[r'answeredTime'] = this.answeredTime;
|
|
} else {
|
|
json[r'answeredTime'] = null;
|
|
}
|
|
if (this.author != null) {
|
|
json[r'author'] = this.author;
|
|
} else {
|
|
json[r'author'] = null;
|
|
}
|
|
if (this.chat != null) {
|
|
json[r'chat'] = this.chat;
|
|
} else {
|
|
json[r'chat'] = null;
|
|
}
|
|
if (this.claimedTime != null) {
|
|
json[r'claimedTime'] = this.claimedTime;
|
|
} else {
|
|
json[r'claimedTime'] = null;
|
|
}
|
|
if (this.comment != null) {
|
|
json[r'comment'] = this.comment;
|
|
} else {
|
|
json[r'comment'] = null;
|
|
}
|
|
if (this.createdTime != null) {
|
|
json[r'createdTime'] = this.createdTime;
|
|
} else {
|
|
json[r'createdTime'] = null;
|
|
}
|
|
if (this.currency != null) {
|
|
json[r'currency'] = this.currency;
|
|
} else {
|
|
json[r'currency'] = null;
|
|
}
|
|
json[r'dislikeUsers'] = this.dislikeUsers;
|
|
if (this.embeddingProvider != null) {
|
|
json[r'embeddingProvider'] = this.embeddingProvider;
|
|
} else {
|
|
json[r'embeddingProvider'] = null;
|
|
}
|
|
if (this.errorText != null) {
|
|
json[r'errorText'] = this.errorText;
|
|
} else {
|
|
json[r'errorText'] = null;
|
|
}
|
|
if (this.fileName != null) {
|
|
json[r'fileName'] = this.fileName;
|
|
} else {
|
|
json[r'fileName'] = null;
|
|
}
|
|
if (this.isAlerted != null) {
|
|
json[r'isAlerted'] = this.isAlerted;
|
|
} else {
|
|
json[r'isAlerted'] = null;
|
|
}
|
|
if (this.isDeleted != null) {
|
|
json[r'isDeleted'] = this.isDeleted;
|
|
} else {
|
|
json[r'isDeleted'] = null;
|
|
}
|
|
if (this.isHidden != null) {
|
|
json[r'isHidden'] = this.isHidden;
|
|
} else {
|
|
json[r'isHidden'] = null;
|
|
}
|
|
if (this.isRegenerated != null) {
|
|
json[r'isRegenerated'] = this.isRegenerated;
|
|
} else {
|
|
json[r'isRegenerated'] = null;
|
|
}
|
|
json[r'likeUsers'] = this.likeUsers;
|
|
if (this.modelProvider != null) {
|
|
json[r'modelProvider'] = this.modelProvider;
|
|
} else {
|
|
json[r'modelProvider'] = null;
|
|
}
|
|
if (this.name != null) {
|
|
json[r'name'] = this.name;
|
|
} else {
|
|
json[r'name'] = null;
|
|
}
|
|
if (this.needNotify != null) {
|
|
json[r'needNotify'] = this.needNotify;
|
|
} else {
|
|
json[r'needNotify'] = null;
|
|
}
|
|
if (this.organization != null) {
|
|
json[r'organization'] = this.organization;
|
|
} else {
|
|
json[r'organization'] = null;
|
|
}
|
|
if (this.owner != null) {
|
|
json[r'owner'] = this.owner;
|
|
} else {
|
|
json[r'owner'] = null;
|
|
}
|
|
if (this.price != null) {
|
|
json[r'price'] = this.price;
|
|
} else {
|
|
json[r'price'] = null;
|
|
}
|
|
if (this.reasonText != null) {
|
|
json[r'reasonText'] = this.reasonText;
|
|
} else {
|
|
json[r'reasonText'] = null;
|
|
}
|
|
if (this.replyTo != null) {
|
|
json[r'replyTo'] = this.replyTo;
|
|
} else {
|
|
json[r'replyTo'] = null;
|
|
}
|
|
json[r'searchResults'] = this.searchResults;
|
|
if (this.store != null) {
|
|
json[r'store'] = this.store;
|
|
} else {
|
|
json[r'store'] = null;
|
|
}
|
|
json[r'suggestions'] = this.suggestions;
|
|
if (this.text != null) {
|
|
json[r'text'] = this.text;
|
|
} else {
|
|
json[r'text'] = null;
|
|
}
|
|
if (this.textTokenCount != null) {
|
|
json[r'textTokenCount'] = this.textTokenCount;
|
|
} else {
|
|
json[r'textTokenCount'] = null;
|
|
}
|
|
if (this.tokenCount != null) {
|
|
json[r'tokenCount'] = this.tokenCount;
|
|
} else {
|
|
json[r'tokenCount'] = null;
|
|
}
|
|
json[r'toolCalls'] = this.toolCalls;
|
|
if (this.transactionId != null) {
|
|
json[r'transactionId'] = this.transactionId;
|
|
} else {
|
|
json[r'transactionId'] = null;
|
|
}
|
|
if (this.user != null) {
|
|
json[r'user'] = this.user;
|
|
} else {
|
|
json[r'user'] = null;
|
|
}
|
|
json[r'vectorScores'] = this.vectorScores;
|
|
if (this.webSearchEnabled != null) {
|
|
json[r'webSearchEnabled'] = this.webSearchEnabled;
|
|
} else {
|
|
json[r'webSearchEnabled'] = null;
|
|
}
|
|
return json;
|
|
}
|
|
|
|
/// Returns a new [Message] instance and imports its values from
|
|
/// [value] if it's a [Map], null otherwise.
|
|
// ignore: prefer_constructors_over_static_methods
|
|
static Message? 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 "Message[$key]" is missing from JSON.');
|
|
assert(json[key] != null, 'Required key "Message[$key]" has a null value in JSON.');
|
|
});
|
|
return true;
|
|
}());
|
|
|
|
return Message(
|
|
answeredTime: mapValueOfType<String>(json, r'answeredTime'),
|
|
author: mapValueOfType<String>(json, r'author'),
|
|
chat: mapValueOfType<String>(json, r'chat'),
|
|
claimedTime: mapValueOfType<String>(json, r'claimedTime'),
|
|
comment: mapValueOfType<String>(json, r'comment'),
|
|
createdTime: mapValueOfType<String>(json, r'createdTime'),
|
|
currency: mapValueOfType<String>(json, r'currency'),
|
|
dislikeUsers: json[r'dislikeUsers'] is Iterable
|
|
? (json[r'dislikeUsers'] as Iterable).cast<String>().toList(growable: false)
|
|
: const [],
|
|
embeddingProvider: mapValueOfType<String>(json, r'embeddingProvider'),
|
|
errorText: mapValueOfType<String>(json, r'errorText'),
|
|
fileName: mapValueOfType<String>(json, r'fileName'),
|
|
isAlerted: mapValueOfType<bool>(json, r'isAlerted'),
|
|
isDeleted: mapValueOfType<bool>(json, r'isDeleted'),
|
|
isHidden: mapValueOfType<bool>(json, r'isHidden'),
|
|
isRegenerated: mapValueOfType<bool>(json, r'isRegenerated'),
|
|
likeUsers: json[r'likeUsers'] is Iterable
|
|
? (json[r'likeUsers'] as Iterable).cast<String>().toList(growable: false)
|
|
: const [],
|
|
modelProvider: mapValueOfType<String>(json, r'modelProvider'),
|
|
name: mapValueOfType<String>(json, r'name'),
|
|
needNotify: mapValueOfType<bool>(json, r'needNotify'),
|
|
organization: mapValueOfType<String>(json, r'organization'),
|
|
owner: mapValueOfType<String>(json, r'owner'),
|
|
price: num.parse('${json[r'price']}'),
|
|
reasonText: mapValueOfType<String>(json, r'reasonText'),
|
|
replyTo: mapValueOfType<String>(json, r'replyTo'),
|
|
searchResults: ModelSearchResult.listFromJson(json[r'searchResults']),
|
|
store: mapValueOfType<String>(json, r'store'),
|
|
suggestions: Candidate.listFromJson(json[r'suggestions']),
|
|
text: mapValueOfType<String>(json, r'text'),
|
|
textTokenCount: mapValueOfType<int>(json, r'textTokenCount'),
|
|
tokenCount: mapValueOfType<int>(json, r'tokenCount'),
|
|
toolCalls: ModelToolCall.listFromJson(json[r'toolCalls']),
|
|
transactionId: mapValueOfType<String>(json, r'transactionId'),
|
|
user: mapValueOfType<String>(json, r'user'),
|
|
vectorScores: VectorScore.listFromJson(json[r'vectorScores']),
|
|
webSearchEnabled: mapValueOfType<bool>(json, r'webSearchEnabled'),
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
static List<Message> listFromJson(dynamic json, {bool growable = false,}) {
|
|
final result = <Message>[];
|
|
if (json is List && json.isNotEmpty) {
|
|
for (final row in json) {
|
|
final value = Message.fromJson(row);
|
|
if (value != null) {
|
|
result.add(value);
|
|
}
|
|
}
|
|
}
|
|
return result.toList(growable: growable);
|
|
}
|
|
|
|
static Map<String, Message> mapFromJson(dynamic json) {
|
|
final map = <String, Message>{};
|
|
if (json is Map && json.isNotEmpty) {
|
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
|
for (final entry in json.entries) {
|
|
final value = Message.fromJson(entry.value);
|
|
if (value != null) {
|
|
map[entry.key] = value;
|
|
}
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
// maps a json object with a list of Message-objects as value to a dart map
|
|
static Map<String, List<Message>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
|
final map = <String, List<Message>>{};
|
|
if (json is Map && json.isNotEmpty) {
|
|
// ignore: parameter_assignments
|
|
json = json.cast<String, dynamic>();
|
|
for (final entry in json.entries) {
|
|
map[entry.key] = Message.listFromJson(entry.value, growable: growable,);
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
/// The list of required keys that must be present in a JSON.
|
|
static const requiredKeys = <String>{
|
|
};
|
|
}
|
|
|