ContentTemplate.fromJson constructor

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

Implementation

factory ContentTemplate.fromJson(Map<String, Object?> json) {
  return ContentTemplate(
    templateId: json[r'templateId'] as String? ?? '',
    originalTemplate: json[r'originalTemplate'] != null
        ? ContentTemplateOriginalTemplate.fromJson(
            json[r'originalTemplate']! as Map<String, Object?>)
        : null,
    referencingBlueprint: json[r'referencingBlueprint'] as String?,
    name: json[r'name'] as String? ?? '',
    description: json[r'description'] as String? ?? '',
    space: json[r'space'] as Map<String, Object?>?,
    labels: (json[r'labels'] as List<Object?>?)
            ?.map(
                (i) => Label.fromJson(i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    templateType: json[r'templateType'] as String? ?? '',
    editorVersion: json[r'editorVersion'] as String?,
    body: json[r'body'] != null
        ? ContentTemplateBody.fromJson(json[r'body']! as Map<String, Object?>)
        : null,
    expandable: json[r'_expandable'] != null
        ? ContentTemplateExpandable.fromJson(
            json[r'_expandable']! as Map<String, Object?>)
        : null,
    links: GenericLinks.fromJson(
        json[r'_links'] as Map<String, Object?>? ?? const {}),
  );
}