Content.fromJson constructor

Content.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory Content.fromJson(Map<String, Object?> json) {
  return Content(
    id: json[r'id'] as String?,
    type: json[r'type'] as String? ?? '',
    status: json[r'status'] as String? ?? '',
    title: json[r'title'] as String?,
    space: json[r'space'] != null
        ? Space.fromJson(json[r'space']! as Map<String, Object?>)
        : null,
    history: json[r'history'] != null
        ? ContentHistory.fromJson(json[r'history']! as Map<String, Object?>)
        : null,
    version: json[r'version'] != null
        ? Version.fromJson(json[r'version']! as Map<String, Object?>)
        : null,
    ancestors: (json[r'ancestors'] as List<Object?>?)
            ?.map((i) =>
                Content.fromJson(i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    operations: (json[r'operations'] as List<Object?>?)
            ?.map((i) => OperationCheckResult.fromJson(
                i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    children: json[r'children'] != null
        ? ContentChildren.fromJson(json[r'children']! as Map<String, Object?>)
        : null,
    childTypes: json[r'childTypes'] != null
        ? ContentChildType.fromJson(
            json[r'childTypes']! as Map<String, Object?>)
        : null,
    descendants: json[r'descendants'] != null
        ? ContentChildren.fromJson(
            json[r'descendants']! as Map<String, Object?>)
        : null,
    container: json[r'container'] != null
        ? Container.fromJson(json[r'container']! as Map<String, Object?>)
        : null,
    body: json[r'body'] != null
        ? ContentBodyValue.fromJson(json[r'body']! as Map<String, Object?>)
        : null,
    restrictions: json[r'restrictions'] != null
        ? ContentRestrictions.fromJson(
            json[r'restrictions']! as Map<String, Object?>)
        : null,
    metadata: json[r'metadata'] != null
        ? ContentMetadata.fromJson(json[r'metadata']! as Map<String, Object?>)
        : null,
    macroRenderedOutput:
        json[r'macroRenderedOutput'] as Map<String, Object?>?,
    extensions: json[r'extensions'] as Map<String, Object?>?,
    expandable: json[r'_expandable'] != null
        ? ContentExpandable.fromJson(
            json[r'_expandable']! as Map<String, Object?>)
        : null,
    links: json[r'_links'] != null
        ? GenericLinks.fromJson(json[r'_links']! as Map<String, Object?>)
        : null,
  );
}