restoreDocumentVersion method
Make a kept version of one of your own documents current again. It is
written as a new version (DocumentPutResponse.version), so with
history on the version it replaces is kept and the restore can be
undone. ifMatch makes it conditional on the current ETag (409 if it
changed); 404 if the version is not kept. Null if the request failed.
Implementation
Future<DocumentPutResponse?> restoreDocumentVersion({
required String path,
required int versionNumber,
String? ifMatch,
PeerId? toServer,
}) async {
final response = await _documentCall(
toServer,
'RESTORE',
(stream) => DocumentHandler.restoreDocumentVersion(stream,
ownerPeerId: host.id, path: path, versionNumber: versionNumber, ifMatch: ifMatch),
);
if (response == null) return null;
return DocumentPutResponse(
status: response.status,
etag: response.etag,
lastModified: response.lastModified,
created: false,
version: response.version,
);
}