toJson method

Map<String, dynamic> toJson()

Converts this configuration to JSON

Implementation

Map<String, dynamic> toJson() {
  final Map<String, dynamic> json = {
    'name': name,
    'version': version,
    'transportType': transportType,
  };

  if (capabilities != null) {
    json['capabilities'] = capabilities!.toJson();
  }

  if (transportCommand != null) {
    json['transportCommand'] = transportCommand;
  }

  if (transportArgs != null) {
    json['transportArgs'] = transportArgs;
  }

  if (serverUrl != null) {
    json['serverUrl'] = serverUrl;
  }

  if (authToken != null) {
    json['authToken'] = authToken;
  }

  if (endpoint != null) {
    json['endpoint'] = endpoint;
  }

  if (timeout != null) {
    json['timeout'] = timeout!.inMilliseconds;
  }

  if (sseReadTimeout != null) {
    json['sseReadTimeout'] = sseReadTimeout!.inMilliseconds;
  }

  if (maxConcurrentRequests != null) {
    json['maxConcurrentRequests'] = maxConcurrentRequests;
  }

  if (useHttp2 != null) {
    json['useHttp2'] = useHttp2;
  }

  if (terminateOnClose != null) {
    json['terminateOnClose'] = terminateOnClose;
  }

  if (headers != null) {
    json['headers'] = headers;
  }

  return json;
}