toJson method
Converts a Event instance to JSON data.
Implementation
Map<String, Object> toJson() {
final jsonData = <String, Object>{};
final tempAction = action;
final tempApiVersion = apiVersion;
final tempCount = count;
final tempEventTime = eventTime;
final tempFirstTimestamp = firstTimestamp;
final tempInvolvedObject = involvedObject;
final tempKind = kind;
final tempLastTimestamp = lastTimestamp;
final tempMessage = message;
final tempMetadata = metadata;
final tempReason = reason;
final tempRelated = related;
final tempReportingComponent = reportingComponent;
final tempReportingInstance = reportingInstance;
final tempSeries = series;
final tempSource = source;
final tempType = type;
if (tempAction != null) {
jsonData['action'] = tempAction;
}
if (tempApiVersion != null) {
jsonData['apiVersion'] = tempApiVersion;
}
if (tempCount != null) {
jsonData['count'] = tempCount;
}
if (tempEventTime != null) {
jsonData['eventTime'] = tempEventTime;
}
if (tempFirstTimestamp != null) {
jsonData['firstTimestamp'] = tempFirstTimestamp;
}
jsonData['involvedObject'] = tempInvolvedObject.toJson();
if (tempKind != null) {
jsonData['kind'] = tempKind;
}
if (tempLastTimestamp != null) {
jsonData['lastTimestamp'] = tempLastTimestamp;
}
if (tempMessage != null) {
jsonData['message'] = tempMessage;
}
jsonData['metadata'] = tempMetadata.toJson();
if (tempReason != null) {
jsonData['reason'] = tempReason;
}
if (tempRelated != null) {
jsonData['related'] = tempRelated.toJson();
}
if (tempReportingComponent != null) {
jsonData['reportingComponent'] = tempReportingComponent;
}
if (tempReportingInstance != null) {
jsonData['reportingInstance'] = tempReportingInstance;
}
if (tempSeries != null) {
jsonData['series'] = tempSeries.toJson();
}
if (tempSource != null) {
jsonData['source'] = tempSource.toJson();
}
if (tempType != null) {
jsonData['type'] = tempType;
}
return jsonData;
}