toJson method

Map<String, Object> toJson()

Converts a APIResourceList instance to JSON data.

Implementation

Map<String, Object> toJson() {
  final jsonData = <String, Object>{};

  final tempApiVersion = apiVersion;
  final tempGroupVersion = groupVersion;
  final tempKind = kind;
  final tempResources = resources;

  if (tempApiVersion != null) {
    jsonData['apiVersion'] = tempApiVersion;
  }

  jsonData['groupVersion'] = tempGroupVersion;

  if (tempKind != null) {
    jsonData['kind'] = tempKind;
  }

  jsonData['resources'] =
      tempResources.map((e) => e.toJson()).toList(growable: false);

  return jsonData;
}