connect method

Future<void> connect()

Verifies the connection to the Nextcloud server using the provided configuration. Throws an exception if the connection fails or credentials are invalid.

Implementation

Future<void> connect() async {
  try {
    // First try OCS API to verify credentials independently of WebDAV path
    await _checkAuth();
    // Then try to list the root directory to verify WebDAV access
    await listDirectory('/');
  } catch (e) {
    throw Exception('Failed to connect to Nextcloud server: $e');
  }
}