getVersion method
Fetch metadata for a single version by id. Works against both the
current row and any history row — the response's isCurrent tells
you which.
Implementation
Future<KoolbaseObjectVersion> getVersion({
required String bucket,
required String path,
required String versionId,
}) async {
final res = await http
.get(
Uri.parse(
'$baseUrl/v1/sdk/storage/object-versions/$versionId?bucket=$bucket&path=$path'),
headers: await _headers(),
)
.timeout(const Duration(seconds: 10));
if (res.statusCode != 200) {
throw koolbaseStorageErrorFromResponse(res,
fallbackMessage: 'Failed to fetch version');
}
return KoolbaseObjectVersion.fromJson(
jsonDecode(res.body) as Map<String, dynamic>);
}