updateDocument method

  1. @override
Future<DeskDocument?> updateDocument(
  1. String documentId, {
  2. String? title,
  3. String? slug,
  4. bool? isDefault,
})
override

Updates document metadata (title, slug, isDefault). To update document data, use createDocumentVersion instead.

documentId - The ID of the document to update title - Optional new title slug - Optional new slug isDefault - Optional new default status

Returns the updated DeskDocument, or null if the document was not found.

Throws DeskDataSourceException if the operation fails. Throws DeskAuthenticationException if authentication is required.

Implementation

@override
Future<DeskDocument?> updateDocument(
  String documentId, {
  String? title,
  String? slug,
  bool? isDefault,
}) async {
  final doc = _documents[documentId];
  if (doc == null) return null;

  _documents[documentId] = doc.copyWith(
    title: title ?? doc.title,
    slug: slug ?? doc.slug,
    isDefault: isDefault ?? doc.isDefault,
    updatedAt: DateTime.now(),
  );

  return _documents[documentId];
}