updateSession method
Update session
Implementation
Future<void> updateSession(
String sessionId, {
bool? resuming,
int? timeout,
}) async {
LavalinkLogger.debug('Updating session $sessionId', tag: 'REST');
try {
final uri = Uri.parse('$baseUrl/v4/sessions/$sessionId');
final body = <String, dynamic>{};
if (resuming != null) body['resuming'] = resuming;
if (timeout != null) body['timeout'] = timeout;
final request = await _httpClient.patchUrl(uri);
_addHeaders(request);
request.headers.set('Content-Type', 'application/json');
request.write(jsonEncode(body));
final response = await request.close();
await response.drain();
if (response.statusCode != 200) {
throw LavalinkException(
'Failed to update session: ${response.statusCode}',
statusCode: response.statusCode,
);
}
} catch (e) {
if (e is LavalinkException) rethrow;
throw LavalinkException('Failed to update session: $e', cause: e);
}
}