PatchbayLogTailRequestWire.fromJson constructor

PatchbayLogTailRequestWire.fromJson(
  1. Map<String, Object?> json, {
  2. String path = r'$',
})

Decodes a strict JSON object at path.

Implementation

factory PatchbayLogTailRequestWire.fromJson(
  Map<String, Object?> json, {
  String path = r'$',
}) {
  _wireKeys(json, const <String>{
    'cursor',
    'limit',
    'timeoutMs',
    'levels',
    'categories',
  }, path);
  return PatchbayLogTailRequestWire(
    cursor: json['cursor'] == null
        ? null
        : _wireString(json['cursor'], '$path.cursor'),
    limit: json['limit'] == null
        ? null
        : _wireInt(json['limit'], '$path.limit'),
    timeoutMs: json['timeoutMs'] == null
        ? null
        : _wireInt(json['timeoutMs'], '$path.timeoutMs'),
    levels: json['levels'] == null
        ? const <PatchbayLogLevelWire>[]
        : _wireList(json['levels'], '$path.levels')
              .map(
                (item) => PatchbayLogLevelWire.fromJson(
                  item,
                  path: '$path.levels[]',
                ),
              )
              .toList(growable: false),
    categories: json['categories'] == null
        ? const <String>[]
        : _wireList(json['categories'], '$path.categories')
              .map((item) => _wireString(item, '$path.categories[]'))
              .toList(growable: false),
  );
}