toJson method
Converts a APIResource instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempCategories = categories;
final tempGroup = group;
final tempKind = kind;
final tempName = name;
final tempNamespaced = namespaced;
final tempShortNames = shortNames;
final tempSingularName = singularName;
final tempStorageVersionHash = storageVersionHash;
final tempVerbs = verbs;
final tempVersion = version;
if (tempCategories != null) {
jsonData['categories'] = tempCategories;
}
if (tempGroup != null) {
jsonData['group'] = tempGroup;
}
jsonData['kind'] = tempKind;
jsonData['name'] = tempName;
jsonData['namespaced'] = tempNamespaced;
if (tempShortNames != null) {
jsonData['shortNames'] = tempShortNames;
}
jsonData['singularName'] = tempSingularName;
if (tempStorageVersionHash != null) {
jsonData['storageVersionHash'] = tempStorageVersionHash;
}
jsonData['verbs'] = tempVerbs;
if (tempVersion != null) {
jsonData['version'] = tempVersion;
}
return jsonData;
}