28 lines
1.0 KiB
C#
28 lines
1.0 KiB
C#
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Umbraco.Cms.Core.Models;
|
|
using Umbraco.Cms.Core.Services;
|
|
using Umbraco.Cms.Api.Management.ViewModels.Tree;
|
|
|
|
namespace Umbraco.Cms.Api.Management.Controllers.Dictionary.Tree;
|
|
|
|
public class ItemsDictionaryTreeController : DictionaryTreeControllerBase
|
|
{
|
|
public ItemsDictionaryTreeController(IEntityService entityService, ILocalizationService localizationService)
|
|
: base(entityService, localizationService)
|
|
{
|
|
}
|
|
|
|
[HttpGet("item")]
|
|
[MapToApiVersion("1.0")]
|
|
[ProducesResponseType(typeof(IEnumerable<FolderTreeItemViewModel>), StatusCodes.Status200OK)]
|
|
public async Task<ActionResult<IEnumerable<FolderTreeItemViewModel>>> Items([FromQuery(Name = "key")] Guid[] keys)
|
|
{
|
|
IDictionaryItem[] dictionaryItems = LocalizationService.GetDictionaryItemsByIds(keys).ToArray();
|
|
|
|
EntityTreeItemViewModel[] viewModels = MapTreeItemViewModels(null, dictionaryItems);
|
|
|
|
return await Task.FromResult(Ok(viewModels));
|
|
}
|
|
}
|