public static async Task <WorkItemClassificationNode> CreateAreaAsync(this WorkItemTrackingHttpClient source, NodePath areaPath, CancellationToken cancellationToken) { //Get the parent area, if any if (areaPath.Parent != null) { var parentArea = await source.GetAreaAsync(areaPath.Parent, false, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); if (parentArea == null) { parentArea = await source.CreateAreaAsync(areaPath.Parent, cancellationToken).ConfigureAwait(false); } } ; var newArea = new WorkItemClassificationNode() { Name = areaPath.Name }; newArea = await source.CreateOrUpdateClassificationNodeAsync(newArea, areaPath.Project, TreeStructureGroup.Areas, path : areaPath.Parent?.RelativePath, cancellationToken : cancellationToken).ConfigureAwait(false); Logger.Debug($"Created area '{areaPath}' with Id {newArea.Id}"); return(newArea); }
public static async Task DeleteAreaAsync(this WorkItemTrackingHttpClient source, NodePath existingPath, string newPath, CancellationToken cancellationToken) { var newNode = await source.GetAreaAsync(new NodePath(newPath), true, cancellationToken).ConfigureAwait(false); await source.DeleteClassificationNodeAsync(existingPath.Project, TreeStructureGroup.Areas, path : existingPath.RelativePath, reclassifyId : newNode.Id, cancellationToken : cancellationToken).ConfigureAwait(false); Logger.Debug($"Deleted area '{existingPath}"); }