APIResource.fromJson constructor

APIResource.fromJson(
  1. Map<String, dynamic> json
)

Creates a APIResource from JSON data.

Implementation

factory APIResource.fromJson(Map<String, dynamic> json) {
  final tempCategoriesJson = json['categories'];
  final tempGroupJson = json['group'];
  final tempKindJson = json['kind'];
  final tempNameJson = json['name'];
  final tempNamespacedJson = json['namespaced'];
  final tempShortNamesJson = json['shortNames'];
  final tempSingularNameJson = json['singularName'];
  final tempStorageVersionHashJson = json['storageVersionHash'];
  final tempVerbsJson = json['verbs'];
  final tempVersionJson = json['version'];

  final List<String>? tempCategories = tempCategoriesJson != null
      ? List<String>.from(tempCategoriesJson)
      : null;
  final String? tempGroup = tempGroupJson;
  final String tempKind = tempKindJson;
  final String tempName = tempNameJson;
  final bool tempNamespaced = tempNamespacedJson;
  final List<String>? tempShortNames = tempShortNamesJson != null
      ? List<String>.from(tempShortNamesJson)
      : null;
  final String tempSingularName = tempSingularNameJson;
  final String? tempStorageVersionHash = tempStorageVersionHashJson;
  final List<String> tempVerbs = List<String>.from(tempVerbsJson);
  final String? tempVersion = tempVersionJson;

  return APIResource(
    categories: tempCategories,
    group: tempGroup,
    kind: tempKind,
    name: tempName,
    namespaced: tempNamespaced,
    shortNames: tempShortNames,
    singularName: tempSingularName,
    storageVersionHash: tempStorageVersionHash,
    verbs: tempVerbs,
    version: tempVersion,
  );
}