getDatabases method
Get databases from the server.
Throws DaapImproperlyConfiguredException in case of calling without
supplied sessionId
before connect call.
Implementation
Future<DaapObject> getDatabases({int? sessionId}) async {
var url = _baseUrl;
if (sessionId != null) {
url = url.replace(
path: databasesUrlPath,
queryParameters: {"session-id": sessionId.toString()});
} else {
if (sessionInfo != null) {
return await getDatabases(
sessionId: sessionInfo!.getAtom(dmapCodeDmapSessionId));
} else {
throw DaapImproperlyConfiguredException(
// ignore: lines_longer_than_80_chars
"Can't get 'sessionId' from 'sessionInfo'. First, try to connect to the server.");
}
}
return DaapObject(await request(url));
}