patchFoldersAdd method
Future<RestApiResponse>
patchFoldersAdd(
- RestApiDOCUframeFolderType folderType,
- String folderId,
- List<
String> documentOids, { - String className = "",
Fügt Dokumente zu einem Ordner hinzu
Verknüpft eine Liste von Dokumenten mit einem bestimmten Ordner. Die Dokumente bleiben an ihrem ursprünglichen Speicherort.
folderType - Der Typ des Zielordners
folderId - Die ID des Zielordners
documentOids - Liste der Dokument-OIDs zum Hinzufügen
className - Klassenname für spezielle Ordnertypen (Favoriten, Historie)
Returns: RestApiResponse mit dem Hinzufügungsstatus
Beispiel:
RestApiResponse response = await manager.patchFoldersAdd(
RestApiFolderType.path,
"/Projekte/Projekt1",
["doc-123", "doc-456", "doc-789"]
);
Implementation
Future<RestApiResponse> patchFoldersAdd(
RestApiDOCUframeFolderType folderType,
String folderId,
List<String> documentOids, {
String className = "",
}) async {
try {
Map<String, dynamic> documentsMap = {};
String body;
String folderTypeEncoded = Uri.encodeComponent(folderType.value);
String folderIdEncoded = Uri.encodeComponent(folderId);
String function = "v1/folders/add";
String uriPath =
"${_config.alias.isEmpty ? "" : "/${_config.alias}"}/$function/$folderTypeEncoded/$folderIdEncoded";
Map<String, String> params = {};
// class: In case one would like to add something from favorite or history it is necessary to provide the class of objects you would like to add
if (className.isNotEmpty) params['class'] = className;
Uri requestUri = _getUri(uriPath, params: params);
documentsMap['documents'] = documentOids;
body = json.encode(documentsMap);
final response = RestApiResponse(
await _http(HttpMethod.patch, requestUri, function, body: body),
);
return response;
} catch (_) {
rethrow;
}
}