Extension.fromJson constructor

Extension.fromJson(
  1. Object? j
)

Implementation

factory Extension.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Extension(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    displayName: switch (json['displayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    description: switch (json['description']) {
      null => '',
      Object $1 => decodeString($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),
    },
    etag: switch (json['etag']) {
      null => '',
      Object $1 => decodeString($1),
    },
    manifest: switch (json['manifest']) {
      null => null,
      Object $1 => ExtensionManifest.fromJson($1),
    },
    extensionOperations: switch (json['extensionOperations']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) ExtensionOperation.fromJson(i),
      ],
      _ => throw const FormatException('"extensionOperations" is not a list'),
    },
    runtimeConfig: switch (json['runtimeConfig']) {
      null => null,
      Object $1 => RuntimeConfig.fromJson($1),
    },
    toolUseExamples: switch (json['toolUseExamples']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) ToolUseExample.fromJson(i)],
      _ => throw const FormatException('"toolUseExamples" is not a list'),
    },
    privateServiceConnectConfig:
        switch (json['privateServiceConnectConfig']) {
          null => null,
          Object $1 => ExtensionPrivateServiceConnectConfig.fromJson($1),
        },
  );
}