deleteDocument static method
Delete a document (client-side)
Implementation
static Future<DocumentFrameResponse> deleteDocument(
P2PStream stream, {
required PeerId ownerPeerId,
required String path,
String? ifMatch,
}) async {
try {
final headers = <String, String>{};
if (ifMatch != null) {
headers['If-Match'] = ifMatch;
}
final requestBytes = DocumentFrame.encodeRequest(
operation: 'DELETE',
ownerPeerId: ownerPeerId,
path: path,
headers: headers,
);
await _writeFrameStatic(stream, requestBytes);
// Read response
final responseBytes = await _readFrameStatic(stream);
return DocumentFrame.decodeResponse(responseBytes);
} catch (e, stackTrace) {
_logger.severe('Error deleting document: $e', e, stackTrace);
rethrow;
}
}