Files
sdk/lib/model/reading_req.dart

479 lines
18 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 ReadingReq {
/// Returns a new [ReadingReq] instance.
ReadingReq({
this.account,
this.cachedInputTokens,
this.confidence,
this.costCents,
this.costLimitCents,
this.currency,
this.inputTokens,
this.kind,
this.lane,
this.machine,
this.outputTokens,
this.plan,
this.provider,
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 how real the counters are, 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;
/// Kind is subscription or apikey; anything else is refused.
///
/// 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? kind;
/// 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. Required.
///
/// 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;
/// Provider is the AI provider whose meter reported this sample. Required.
///
/// 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? provider;
/// 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, bounded.
///
/// 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, clamped 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, one of 6h, day, week, month; anything else is refused rather than silently reclassified.
///
/// 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, bounded to a sane interval around now.
///
/// 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 ReadingReq &&
other.account == account &&
other.cachedInputTokens == cachedInputTokens &&
other.confidence == confidence &&
other.costCents == costCents &&
other.costLimitCents == costLimitCents &&
other.currency == currency &&
other.inputTokens == inputTokens &&
other.kind == kind &&
other.lane == lane &&
other.machine == machine &&
other.outputTokens == outputTokens &&
other.plan == plan &&
other.provider == provider &&
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) +
(kind == null ? 0 : kind!.hashCode) +
(lane == null ? 0 : lane!.hashCode) +
(machine == null ? 0 : machine!.hashCode) +
(outputTokens == null ? 0 : outputTokens!.hashCode) +
(plan == null ? 0 : plan!.hashCode) +
(provider == null ? 0 : provider!.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() => 'ReadingReq[account=$account, cachedInputTokens=$cachedInputTokens, confidence=$confidence, costCents=$costCents, costLimitCents=$costLimitCents, currency=$currency, inputTokens=$inputTokens, kind=$kind, lane=$lane, machine=$machine, outputTokens=$outputTokens, plan=$plan, provider=$provider, 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.kind != null) {
json[r'kind'] = this.kind;
} else {
json[r'kind'] = 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.provider != null) {
json[r'provider'] = this.provider;
} else {
json[r'provider'] = 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 [ReadingReq] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static ReadingReq? 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 "ReadingReq[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "ReadingReq[$key]" has a null value in JSON.');
});
return true;
}());
return ReadingReq(
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'),
kind: mapValueOfType<String>(json, r'kind'),
lane: mapValueOfType<String>(json, r'lane'),
machine: mapValueOfType<String>(json, r'machine'),
outputTokens: mapValueOfType<int>(json, r'outputTokens'),
plan: mapValueOfType<String>(json, r'plan'),
provider: mapValueOfType<String>(json, r'provider'),
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<ReadingReq> listFromJson(dynamic json, {bool growable = false,}) {
final result = <ReadingReq>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = ReadingReq.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, ReadingReq> mapFromJson(dynamic json) {
final map = <String, ReadingReq>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = ReadingReq.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of ReadingReq-objects as value to a dart map
static Map<String, List<ReadingReq>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<ReadingReq>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = ReadingReq.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
};
}