json property

HostJson get json

The host as the API returns it (Host).

Implementation

HostJson get json => {
  'id': id,
  'name': name,
  'state': state,
  'disabled_reason': ?disabledReason,
  if (reported != null) 'platform': 'linux',
  'assigned_user_id': ?assignedUserId,
  'llm_credentials': llmCredentials,
  'credential_holder_id': ?credentialHolderId,
  'declared_server_host': declaredServerHost,
  if (reported != null) 'reported_is_server_host': false,
  'noise_public_key': ?noisePublicKey,
  'key_fingerprint': ?fingerprint,
  'key_generation': keyGeneration,
  'profiles':
      profiles ??
      [
        if (reported != null)
          {'name': 'shell', 'display_name': 'Shell', 'kind': 'shell'},
      ],
  'doctor': doctor,
  if (sessionUsers.isNotEmpty)
    'session_users': [
      for (final MapEntry(key: user, value: (name, at))
          in sessionUsers.entries)
        {'user_id': user, 'os_user': name, 'created_at': at},
    ],
  if (reported != null)
    'reported_session_users': [
      for (final n in reported!)
        {'os_user': n, 'workdirs': workdirs[n] ?? const <Object?>[]},
    ],
  'connected': connected,
  if (reported != null) 'host_version': '1.0.0',
  'created_at': createdAt,
  'version': version,
};