mirror of
https://github.com/hanzo-dart/sdk.git
synced 2026-10-30 19:32:47 +00:00
Projected from hanzo-inc/cloud@59ec4deb4 openapi.yaml, sha256 e7e90d5445aeccfe332d942d0edd7a77df14336d97a445b71fb2f3047db65192. This client had emitted NOTHING for four releases: openapi-generator 7.14.0, the version the fleet pins, dies in AbstractDartCodegen.fromProperty with `JsonSchema cannot be cast to ComposedSchema` on our polymorphic request bodies. hanzoai/openapi now lets one language pin past the fleet, and dart is pinned at 7.19.0, which emits it cleanly.
291 lines
11 KiB
Dart
291 lines
11 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 Endpoint {
|
|
/// Returns a new [Endpoint] instance.
|
|
Endpoint({
|
|
this.created,
|
|
this.deliveries7d,
|
|
this.description,
|
|
this.events = const [],
|
|
this.failures7d,
|
|
this.id,
|
|
this.org,
|
|
this.secret,
|
|
this.status,
|
|
this.updated,
|
|
this.url,
|
|
});
|
|
/// CreatedAt is when the endpoint was registered, RFC3339 in UTC — stored in that spelling because it sorts as a string.
|
|
///
|
|
/// 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? created;
|
|
|
|
/// Deliveries7d is how many deliveries SETTLED in the trailing 7 days — the attempts that ended ok or failed, so a delivery still retrying is in neither counter yet. It is counted from the log at read time rather than stored, and it is filled only on a list or a get; a create answers 0 because there is no history, which is why it is never omitted.
|
|
///
|
|
/// 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? deliveries7d;
|
|
|
|
/// Description is the operator's own label for the endpoint. Never sent anywhere.
|
|
///
|
|
/// 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;
|
|
|
|
/// Events are the subject patterns this endpoint subscribes to (\"commerce.order.>\"). An EMPTY list means every event, not none.
|
|
List<String> events;
|
|
|
|
/// Failures7d is how many of those settled as failed — the subscriber never accepted it and no further attempt will be made. It is the numerator to Deliveries7d, over the same window.
|
|
///
|
|
/// 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? failures7d;
|
|
|
|
/// ID is the endpoint's handle, server-minted and stable for its life. It is what every other route here addresses.
|
|
///
|
|
/// 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;
|
|
|
|
/// Org is the tenant that owns the endpoint, taken from the validated principal rather than from any request field.
|
|
///
|
|
/// 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;
|
|
|
|
/// Secret is the HMAC-SHA256 signing key a subscriber recomputes the signature with. It is returned exactly ONCE, on create: a later read of the endpoint omits it, so a lost secret is replaced rather than recovered.
|
|
///
|
|
/// 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? secret;
|
|
|
|
/// Status is \"active\" or \"disabled\" — nothing else is accepted. A disabled endpoint keeps its subscription and receives no deliveries, except a manual test send, which goes out anyway.
|
|
///
|
|
/// 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? status;
|
|
|
|
/// UpdatedAt is when its url, events, status or description last changed.
|
|
///
|
|
/// 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? updated;
|
|
|
|
/// URL is where the POST goes. Changing it is the one edit that redirects an org's events, which is why it is never bindable from a query string.
|
|
///
|
|
/// 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? url;
|
|
|
|
@override
|
|
bool operator ==(Object other) => identical(this, other) || other is Endpoint &&
|
|
other.created == created &&
|
|
other.deliveries7d == deliveries7d &&
|
|
other.description == description &&
|
|
_deepEquality.equals(other.events, events) &&
|
|
other.failures7d == failures7d &&
|
|
other.id == id &&
|
|
other.org == org &&
|
|
other.secret == secret &&
|
|
other.status == status &&
|
|
other.updated == updated &&
|
|
other.url == url;
|
|
|
|
@override
|
|
int get hashCode =>
|
|
// ignore: unnecessary_parenthesis
|
|
(created == null ? 0 : created!.hashCode) +
|
|
(deliveries7d == null ? 0 : deliveries7d!.hashCode) +
|
|
(description == null ? 0 : description!.hashCode) +
|
|
(events.hashCode) +
|
|
(failures7d == null ? 0 : failures7d!.hashCode) +
|
|
(id == null ? 0 : id!.hashCode) +
|
|
(org == null ? 0 : org!.hashCode) +
|
|
(secret == null ? 0 : secret!.hashCode) +
|
|
(status == null ? 0 : status!.hashCode) +
|
|
(updated == null ? 0 : updated!.hashCode) +
|
|
(url == null ? 0 : url!.hashCode);
|
|
|
|
@override
|
|
String toString() => 'Endpoint[created=$created, deliveries7d=$deliveries7d, description=$description, events=$events, failures7d=$failures7d, id=$id, org=$org, secret=$secret, status=$status, updated=$updated, url=$url]';
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final json = <String, dynamic>{};
|
|
if (this.created != null) {
|
|
json[r'created'] = this.created;
|
|
} else {
|
|
json[r'created'] = null;
|
|
}
|
|
if (this.deliveries7d != null) {
|
|
json[r'deliveries7d'] = this.deliveries7d;
|
|
} else {
|
|
json[r'deliveries7d'] = null;
|
|
}
|
|
if (this.description != null) {
|
|
json[r'description'] = this.description;
|
|
} else {
|
|
json[r'description'] = null;
|
|
}
|
|
json[r'events'] = this.events;
|
|
if (this.failures7d != null) {
|
|
json[r'failures7d'] = this.failures7d;
|
|
} else {
|
|
json[r'failures7d'] = null;
|
|
}
|
|
if (this.id != null) {
|
|
json[r'id'] = this.id;
|
|
} else {
|
|
json[r'id'] = null;
|
|
}
|
|
if (this.org != null) {
|
|
json[r'org'] = this.org;
|
|
} else {
|
|
json[r'org'] = null;
|
|
}
|
|
if (this.secret != null) {
|
|
json[r'secret'] = this.secret;
|
|
} else {
|
|
json[r'secret'] = null;
|
|
}
|
|
if (this.status != null) {
|
|
json[r'status'] = this.status;
|
|
} else {
|
|
json[r'status'] = null;
|
|
}
|
|
if (this.updated != null) {
|
|
json[r'updated'] = this.updated;
|
|
} else {
|
|
json[r'updated'] = null;
|
|
}
|
|
if (this.url != null) {
|
|
json[r'url'] = this.url;
|
|
} else {
|
|
json[r'url'] = null;
|
|
}
|
|
return json;
|
|
}
|
|
|
|
/// Returns a new [Endpoint] instance and imports its values from
|
|
/// [value] if it's a [Map], null otherwise.
|
|
// ignore: prefer_constructors_over_static_methods
|
|
static Endpoint? 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 "Endpoint[$key]" is missing from JSON.');
|
|
assert(json[key] != null, 'Required key "Endpoint[$key]" has a null value in JSON.');
|
|
});
|
|
return true;
|
|
}());
|
|
|
|
return Endpoint(
|
|
created: mapValueOfType<String>(json, r'created'),
|
|
deliveries7d: mapValueOfType<int>(json, r'deliveries7d'),
|
|
description: mapValueOfType<String>(json, r'description'),
|
|
events: json[r'events'] is Iterable
|
|
? (json[r'events'] as Iterable).cast<String>().toList(growable: false)
|
|
: const [],
|
|
failures7d: mapValueOfType<int>(json, r'failures7d'),
|
|
id: mapValueOfType<String>(json, r'id'),
|
|
org: mapValueOfType<String>(json, r'org'),
|
|
secret: mapValueOfType<String>(json, r'secret'),
|
|
status: mapValueOfType<String>(json, r'status'),
|
|
updated: mapValueOfType<String>(json, r'updated'),
|
|
url: mapValueOfType<String>(json, r'url'),
|
|
);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
static List<Endpoint> listFromJson(dynamic json, {bool growable = false,}) {
|
|
final result = <Endpoint>[];
|
|
if (json is List && json.isNotEmpty) {
|
|
for (final row in json) {
|
|
final value = Endpoint.fromJson(row);
|
|
if (value != null) {
|
|
result.add(value);
|
|
}
|
|
}
|
|
}
|
|
return result.toList(growable: growable);
|
|
}
|
|
|
|
static Map<String, Endpoint> mapFromJson(dynamic json) {
|
|
final map = <String, Endpoint>{};
|
|
if (json is Map && json.isNotEmpty) {
|
|
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
|
for (final entry in json.entries) {
|
|
final value = Endpoint.fromJson(entry.value);
|
|
if (value != null) {
|
|
map[entry.key] = value;
|
|
}
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
// maps a json object with a list of Endpoint-objects as value to a dart map
|
|
static Map<String, List<Endpoint>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
|
final map = <String, List<Endpoint>>{};
|
|
if (json is Map && json.isNotEmpty) {
|
|
// ignore: parameter_assignments
|
|
json = json.cast<String, dynamic>();
|
|
for (final entry in json.entries) {
|
|
map[entry.key] = Endpoint.listFromJson(entry.value, growable: growable,);
|
|
}
|
|
}
|
|
return map;
|
|
}
|
|
|
|
/// The list of required keys that must be present in a JSON.
|
|
static const requiredKeys = <String>{
|
|
};
|
|
}
|
|
|