Service.fromJson constructor

Service.fromJson(
  1. Object? j
)

Implementation

factory Service.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Service(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    title: switch (json['title']) {
      null => '',
      Object $1 => decodeString($1),
    },
    producerProjectId: switch (json['producerProjectId']) {
      null => '',
      Object $1 => decodeString($1),
    },
    id: switch (json['id']) {
      null => '',
      Object $1 => decodeString($1),
    },
    apis: switch (json['apis']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Api.fromJson(i)],
      _ => throw const FormatException('"apis" is not a list'),
    },
    types: switch (json['types']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Type.fromJson(i)],
      _ => throw const FormatException('"types" is not a list'),
    },
    enums: switch (json['enums']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Enum.fromJson(i)],
      _ => throw const FormatException('"enums" is not a list'),
    },
    documentation: switch (json['documentation']) {
      null => null,
      Object $1 => Documentation.fromJson($1),
    },
    backend: switch (json['backend']) {
      null => null,
      Object $1 => Backend.fromJson($1),
    },
    http: switch (json['http']) {
      null => null,
      Object $1 => Http.fromJson($1),
    },
    quota: switch (json['quota']) {
      null => null,
      Object $1 => Quota.fromJson($1),
    },
    authentication: switch (json['authentication']) {
      null => null,
      Object $1 => Authentication.fromJson($1),
    },
    context: switch (json['context']) {
      null => null,
      Object $1 => Context.fromJson($1),
    },
    usage: switch (json['usage']) {
      null => null,
      Object $1 => Usage.fromJson($1),
    },
    endpoints: switch (json['endpoints']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) Endpoint.fromJson(i)],
      _ => throw const FormatException('"endpoints" is not a list'),
    },
    control: switch (json['control']) {
      null => null,
      Object $1 => Control.fromJson($1),
    },
    logs: switch (json['logs']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) LogDescriptor.fromJson(i)],
      _ => throw const FormatException('"logs" is not a list'),
    },
    metrics: switch (json['metrics']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) MetricDescriptor.fromJson(i)],
      _ => throw const FormatException('"metrics" is not a list'),
    },
    monitoredResources: switch (json['monitoredResources']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) MonitoredResourceDescriptor.fromJson(i),
      ],
      _ => throw const FormatException('"monitoredResources" is not a list'),
    },
    billing: switch (json['billing']) {
      null => null,
      Object $1 => Billing.fromJson($1),
    },
    logging: switch (json['logging']) {
      null => null,
      Object $1 => Logging.fromJson($1),
    },
    monitoring: switch (json['monitoring']) {
      null => null,
      Object $1 => Monitoring.fromJson($1),
    },
    systemParameters: switch (json['systemParameters']) {
      null => null,
      Object $1 => SystemParameters.fromJson($1),
    },
    sourceInfo: switch (json['sourceInfo']) {
      null => null,
      Object $1 => SourceInfo.fromJson($1),
    },
    publishing: switch (json['publishing']) {
      null => null,
      Object $1 => Publishing.fromJson($1),
    },
    configVersion: switch (json['configVersion']) {
      null => null,
      Object $1 => Uint32Value.fromJson($1),
    },
  );
}