using Microsoft.AspNetCore.Mvc; using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Web.BackOffice.Filters; using Umbraco.Cms.Web.Common.Attributes; using Umbraco.Cms.Web.Common.Controllers; namespace Umbraco.Cms.Web.BackOffice.Controllers; [PluginController("UmbracoApi")] [IsBackOffice] [UmbracoRequireHttps] [MiddlewareFilter(typeof(UnhandledExceptionLoggerFilter))] public class IconController : UmbracoApiController { private readonly IIconService _iconService; public IconController(IIconService iconService) => _iconService = iconService; /// /// Gets an IconModel containing the icon name and SvgString according to an icon name found at the global icons path /// /// /// public IconModel? GetIcon(string iconName) => _iconService.GetIcon(iconName); /// /// Gets a list of all svg icons found at at the global icons path. /// /// public IReadOnlyDictionary? GetIcons() => _iconService.GetIcons(); }