DataLabelingJob.fromJson constructor

DataLabelingJob.fromJson(
  1. Object? j
)

Implementation

factory DataLabelingJob.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return DataLabelingJob(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    displayName: switch (json['displayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    datasets: switch (json['datasets']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"datasets" is not a list'),
    },
    annotationLabels: switch (json['annotationLabels']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"annotationLabels" is not an object'),
    },
    labelerCount: switch (json['labelerCount']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    instructionUri: switch (json['instructionUri']) {
      null => '',
      Object $1 => decodeString($1),
    },
    inputsSchemaUri: switch (json['inputsSchemaUri']) {
      null => '',
      Object $1 => decodeString($1),
    },
    inputs: switch (json['inputs']) {
      null => null,
      Object $1 => protobuf.Value.fromJson($1),
    },
    state: switch (json['state']) {
      null => JobState.$default,
      Object $1 => JobState.fromJson($1),
    },
    labelingProgress: switch (json['labelingProgress']) {
      null => 0,
      Object $1 => decodeInt($1),
    },
    currentSpend: switch (json['currentSpend']) {
      null => null,
      Object $1 => Money.fromJson($1),
    },
    createTime: switch (json['createTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    updateTime: switch (json['updateTime']) {
      null => null,
      Object $1 => protobuf.Timestamp.fromJson($1),
    },
    error: switch (json['error']) {
      null => null,
      Object $1 => Status.fromJson($1),
    },
    labels: switch (json['labels']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException('"labels" is not an object'),
    },
    specialistPools: switch (json['specialistPools']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"specialistPools" is not a list'),
    },
    encryptionSpec: switch (json['encryptionSpec']) {
      null => null,
      Object $1 => EncryptionSpec.fromJson($1),
    },
    activeLearningConfig: switch (json['activeLearningConfig']) {
      null => null,
      Object $1 => ActiveLearningConfig.fromJson($1),
    },
  );
}