mirror of
https://github.com/hanzo-dart/sdk.git
synced 2026-10-30 19:32:47 +00:00
443 lines
17 KiB
Dart
443 lines
17 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 ReadingView {
|
|
/// Returns a new [ReadingView] instance.
|
|
ReadingView({
|
|
this.account,
|
|
this.cachedInputTokens,
|
|
this.confidence,
|
|
this.costCents,
|
|
this.costLimitCents,
|
|
this.currency,
|
|
this.inputTokens,
|
|
this.lane,
|
|
this.machine,
|
|
this.outputTokens,
|
|
this.plan,
|
|
this.requests,
|
|
this.resetsAt,
|
|
this.synthetic,
|
|
this.totalTokens,
|
|
this.usedPct,
|
|
this.window,
|
|
this.windowMinutes,
|
|
this.windowStart,
|
|
});
|
|
/// Account is the provider-side account the sample belongs to.
|
|
///
|
|
/// 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? account;
|
|
|
|
/// CachedInputTokens is the window's cached-prompt-token count.
|
|
///
|
|
/// 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? cachedInputTokens;
|
|
|
|
/// Confidence says whether the counters that remain mean anything, as the meter graded itself.
|
|
///
|
|
/// 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? confidence;
|
|
|
|
/// CostCents is the window's spend in cents, as the provider's meter states it.
|
|
///
|
|
/// 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? costCents;
|
|
|
|
/// CostLimitCents is the window's spend cap in cents, when the meter knows one.
|
|
///
|
|
/// 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? costLimitCents;
|
|
|
|
/// Currency is the ISO currency the cost fields are stated in.
|
|
///
|
|
/// 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;
|
|
|
|
/// InputTokens is the window's prompt-token count.
|
|
///
|
|
/// 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? inputTokens;
|
|
|
|
/// Lane names the meter's own lane label for this measurement.
|
|
///
|
|
/// 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? lane;
|
|
|
|
/// Machine is the machine the collector observed the account on.
|
|
///
|
|
/// 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? machine;
|
|
|
|
/// OutputTokens is the window's completion-token count.
|
|
///
|
|
/// 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? outputTokens;
|
|
|
|
/// Plan is the provider plan label the account is on.
|
|
///
|
|
/// 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? plan;
|
|
|
|
/// Requests is the window's request count.
|
|
///
|
|
/// 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? requests;
|
|
|
|
/// ResetsAt is when the window resets, RFC 3339 UTC.
|
|
///
|
|
/// 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? resetsAt;
|
|
|
|
/// Synthetic marks a sample the collector derived rather than observed.
|
|
///
|
|
/// 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? synthetic;
|
|
|
|
/// TotalTokens is the window's total token count.
|
|
///
|
|
/// 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? totalTokens;
|
|
|
|
/// UsedPct is how much of the window's allowance is consumed, 0..100.
|
|
///
|
|
/// 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.
|
|
///
|
|
double? usedPct;
|
|
|
|
/// Window is the window class: 6h, day, week or month.
|
|
///
|
|
/// 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? window;
|
|
|
|
/// WindowMinutes is the window's length as the meter reported it.
|
|
///
|
|
/// 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? windowMinutes;
|
|
|
|
/// WindowStart is when the measured window opened, RFC 3339 UTC.
|
|
///
|
|
/// 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? windowStart;
|
|
|
|
@override
|
|
bool operator ==(Object other) => identical(this, other) || other is ReadingView &&
|
|
other.account == account &&
|
|
other.cachedInputTokens == cachedInputTokens &&
|
|
other.confidence == confidence &&
|
|
other.costCents == costCents &&
|
|
other.costLimitCents == costLimitCents &&
|
|
other.currency == currency &&
|
|
other.inputTokens == inputTokens &&
|
|
other.lane == lane &&
|
|
other.machine == machine &&
|
|
other.outputTokens == outputTokens &&
|
|
other.plan == plan &&
|
|
other.requests == requests &&
|
|
other.resetsAt == resetsAt &&
|
|
other.synthetic == synthetic &&
|
|
other.totalTokens == totalTokens &&
|
|
other.usedPct == usedPct &&
|
|
other.window == window &&
|
|
other.windowMinutes == windowMinutes &&
|
|
other.windowStart == windowStart;
|
|
|
|
@override
|
|
int get hashCode =>
|
|
// ignore: unnecessary_parenthesis
|
|
(account == null ? 0 : account!.hashCode) +
|
|
(cachedInputTokens == null ? 0 : cachedInputTokens!.hashCode) +
|
|
(confidence == null ? 0 : confidence!.hashCode) +
|
|
(costCents == null ? 0 : costCents!.hashCode) +
|
|
(costLimitCents == null ? 0 : costLimitCents!.hashCode) +
|
|
(currency == null ? 0 : currency!.hashCode) +
|
|
(inputTokens == null ? 0 : inputTokens!.hashCode) +
|
|
(lane == null ? 0 : lane!.hashCode) +
|
|
(machine == null ? 0 : machine!.hashCode) +
|
|
(outputTokens == null ? 0 : outputTokens!.hashCode) +
|
|
(plan == null ? 0 : plan!.hashCode) +
|
|
(requests == null ? 0 : requests!.hashCode) +
|
|
(resetsAt == null ? 0 : resetsAt!.hashCode) +
|
|
(synthetic == null ? 0 : synthetic!.hashCode) +
|
|
(totalTokens == null ? 0 : totalTokens!.hashCode) +
|
|
(usedPct == null ? 0 : usedPct!.hashCode) +
|
|
(window == null ? 0 : window!.hashCode) +
|
|
(windowMinutes == null ? 0 : windowMinutes!.hashCode) +
|
|
(windowStart == null ? 0 : windowStart!.hashCode);
|
|
|
|
@override
|
|
String toString() => 'ReadingView[account=$account, cachedInputTokens=$cachedInputTokens, confidence=$confidence, costCents=$costCents, costLimitCents=$costLimitCents, currency=$currency, inputTokens=$inputTokens, lane=$lane, machine=$machine, outputTokens=$outputTokens, plan=$plan, requests=$requests, resetsAt=$resetsAt, synthetic=$synthetic, totalTokens=$totalTokens, usedPct=$usedPct, window=$window, windowMinutes=$windowMinutes, windowStart=$windowStart]';
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final json = <String, dynamic>{};
|
|
if (this.account != null) {
|
|
json[r'account'] = this.account;
|
|
} else {
|
|
json[r'account'] = null;
|
|
}
|
|
if (this.cachedInputTokens != null) {
|
|
json[r'cachedInputTokens'] = this.cachedInputTokens;
|
|
} else {
|
|
json[r'cachedInputTokens'] = null;
|
|
}
|
|
if (this.confidence != null) {
|
|
json[r'confidence'] = this.confidence;
|
|
} else {
|
|
json[r'confidence'] = null;
|
|
}
|
|
if (this.costCents != null) {
|
|
json[r'costCents'] = this.costCents;
|
|
} else {
|
|
json[r'costCents'] = null;
|
|
}
|
|
if (this.costLimitCents != null) {
|
|
json[r'costLimitCents'] = this.costLimitCents;
|
|
} else {
|
|
json[r'costLimitCents'] = null;
|
|
}
|
|
if (this.currency != null) {
|
|
json[r'currency'] = this.currency;
|
|
} else {
|
|
json[r'currency'] = null;
|
|
}
|
|
if (this.inputTokens != null) {
|
|
json[r'inputTokens'] = this.inputTokens;
|
|
} else {
|
|
json[r'inputTokens'] = null;
|
|
}
|
|
if (this.lane != null) {
|
|
json[r'lane'] = this.lane;
|
|
} else {
|
|
json[r'lane'] = null;
|
|
}
|
|
if (this.machine != null) {
|
|
json[r'machine'] = this.machine;
|
|
} else {
|
|
json[r'machine'] = null;
|
|
}
|
|
if (this.outputTokens != null) {
|
|
json[r'outputTokens'] = this.outputTokens;
|
|
} else {
|
|
json[r'outputTokens'] = null;
|
|
}
|
|
if (this.plan != null) {
|
|
json[r'plan'] = this.plan;
|
|
} else {
|
|
json[r'plan'] = null;
|
|
}
|
|
if (this.requests != null) {
|
|
json[r'requests'] = this.requests;
|
|
} else {
|
|
json[r'requests'] = null;
|
|
}
|
|
if (this.resetsAt != null) {
|
|
json[r'resetsAt'] = this.resetsAt;
|
|
} else {
|
|
json[r'resetsAt'] = null;
|
|
}
|
|
if (this.synthetic != null) {
|
|
json[r'synthetic'] = this.synthetic;
|
|
} else {
|
|
json[r'synthetic'] = null;
|
|
}
|
|
if (this.totalTokens != null) {
|
|
json[r'totalTokens'] = this.totalTokens;
|
|
} else {
|
|
json[r'totalTokens'] = null;
|
|
}
|
|
if (this.usedPct != null) {
|
|
json[r'usedPct'] = this.usedPct;
|
|
} else {
|
|
json[r'usedPct'] = null;
|
|
}
|
|
if (this.window != null) {
|
|
json[r'window'] = this.window;
|
|
} else {
|
|
json[r'window'] = null;
|
|
}
|
|
if (this.windowMinutes != null) {
|
|
json[r'windowMinutes'] = this.windowMinutes;
|
|
} else {
|
|
json[r'windowMinutes'] = null;
|
|
}
|
|
if (this.windowStart != null) {
|
|
json[r'windowStart'] = this.windowStart;
|
|
} else {
|
|
json[r'windowStart'] = null;
|
|
}
|
|
return json;
|
|
}
|
|
|
|
/// Returns a new [ReadingView] instance and imports its values from
|
|
/// [value] if it's a [Map], null otherwise.
|
|
// ignore: prefer_constructors_over_static_methods
|
|
static ReadingView? 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 "ReadingView[$key]" is missing from JSON.');
|
|
assert(json[key] != null, 'Required key "ReadingView[$key]" has a null value in JSON.');
|
|
});
|
|
return true;
|
|
}());
|
|
|
|
return ReadingView(
|
|
account: mapValueOfType<String>(json, r'account'),
|
|
cachedInputTokens: mapValueOfType<int>(json, r'cachedInputTokens'),
|
|
confidence: mapValueOfType<String>(json, r'confidence'),
|
|
costCents: mapValueOfType<int>(json, r'costCents'),
|
|
costLimitCents: mapValueOfType<int>(json, r'costLimitCents'),
|
|
currency: mapValueOfType<String>(json, r'currency'),
|
|
inputTokens: mapValueOfType<int>(json, r'inputTokens'),
|
|
lane: mapValueOfType<String>(json, r'lane'),
|
|
machine: mapValueOfType<String>(json, r'machine'),
|
|
outputTokens: mapValueOfType<int>(json, r'outputTokens'),
|
|
plan: mapValueOfType<String>(json, r'plan'),
|
|
requests: mapValueOfType<int>(json, r'requests'),
|
|
resetsAt: mapValueOfType<String>(json, r'resetsAt'),
|
|
synthetic: mapValueOfType<bool>(json, r'synthetic'),
|
|
totalTokens: mapValueOfType<int>(json, r'totalTokens'),
|
|
usedPct: mapValueOfType<double>(json, r'usedPct'),
|
|
window: mapValueOfType<String>(json, r'window'),
|
|
windowMinutes: mapValueOfType<int>(json, r'windowMinutes'),
|
|
windowStart: mapValueOfType<String>(json, r'windowStart'),
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
static List<ReadingView> listFromJson(dynamic json, {bool growable = false,}) {
|
|
final result = <ReadingView>[];
|
|
if (json is List && json.isNotEmpty) {
|
|
for (final row in json) {
|
|
final value = ReadingView.fromJson(row);
|
|
if (value != null) {
|
|
result.add(value);
|
|
}
|
|
}
|
|
}
|
|
return result.toList(growable: growable);
|
|
}
|
|
|
|
static Map<String, ReadingView> mapFromJson(dynamic json) {
|
|
final map = <String, ReadingView>{};
|
|
if (json is Map && json.isNotEmpty) {
|
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
|
for (final entry in json.entries) {
|
|
final value = ReadingView.fromJson(entry.value);
|
|
if (value != null) {
|
|
map[entry.key] = value;
|
|
}
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
// maps a json object with a list of ReadingView-objects as value to a dart map
|
|
static Map<String, List<ReadingView>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
|
final map = <String, List<ReadingView>>{};
|
|
if (json is Map && json.isNotEmpty) {
|
|
// ignore: parameter_assignments
|
|
json = json.cast<String, dynamic>();
|
|
for (final entry in json.entries) {
|
|
map[entry.key] = ReadingView.listFromJson(entry.value, growable: growable,);
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
/// The list of required keys that must be present in a JSON.
|
|
static const requiredKeys = <String>{
|
|
};
|
|
}
|
|
|