toJson method

Map<String, Object> toJson()

Converts a APIServiceSpec instance to JSON data.

Implementation

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

  final tempCaBundle = caBundle;
  final tempGroup = group;
  final tempGroupPriorityMinimum = groupPriorityMinimum;
  final tempInsecureSkipTLSVerify = insecureSkipTLSVerify;
  final tempService = service;
  final tempVersion = version;
  final tempVersionPriority = versionPriority;

  if (tempCaBundle != null) {
    jsonData['caBundle'] = tempCaBundle;
  }

  if (tempGroup != null) {
    jsonData['group'] = tempGroup;
  }

  jsonData['groupPriorityMinimum'] = tempGroupPriorityMinimum;

  if (tempInsecureSkipTLSVerify != null) {
    jsonData['insecureSkipTLSVerify'] = tempInsecureSkipTLSVerify;
  }

  if (tempService != null) {
    jsonData['service'] = tempService.toJson();
  }

  if (tempVersion != null) {
    jsonData['version'] = tempVersion;
  }

  jsonData['versionPriority'] = tempVersionPriority;

  return jsonData;
}