Rename management API from Umbraco.Cms.ManagementApi to Umbraco.Cms.Api.Management (#13512)

This commit is contained in:
Kenn Jacobsen
2022-12-02 11:33:02 +01:00
committed by GitHub
parent 0b95d5e1e5
commit bc94b2e16c
232 changed files with 480 additions and 478 deletions

View File

@@ -0,0 +1,39 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Api.Management.Services.Paging;
using Umbraco.Cms.Api.Management.ViewModels.Pagination;
using Umbraco.Cms.Api.Management.ViewModels.Tree;
namespace Umbraco.Cms.Api.Management.Controllers.Dictionary.Tree;
public class ChildrenDictionaryTreeController : DictionaryTreeControllerBase
{
public ChildrenDictionaryTreeController(IEntityService entityService, ILocalizationService localizationService)
: base(entityService, localizationService)
{
}
[HttpGet("children")]
[MapToApiVersion("1.0")]
[ProducesResponseType(typeof(PagedViewModel<EntityTreeItemViewModel>), StatusCodes.Status200OK)]
public async Task<ActionResult<PagedViewModel<EntityTreeItemViewModel>>> Children(Guid parentKey, int skip = 0, int take = 100)
{
if (PaginationService.ConvertSkipTakeToPaging(skip, take, out var pageNumber, out var pageSize, out ProblemDetails? error) == false)
{
return BadRequest(error);
}
IDictionaryItem[] dictionaryItems = PaginatedDictionaryItems(
pageNumber,
pageSize,
LocalizationService.GetDictionaryItemChildren(parentKey),
out var totalItems);
EntityTreeItemViewModel[] viewModels = MapTreeItemViewModels(null, dictionaryItems);
PagedViewModel<EntityTreeItemViewModel> result = PagedViewModel(viewModels, totalItems);
return await Task.FromResult(Ok(result));
}
}