2025-04-28 14:10:43 +02:00
|
|
|
using Microsoft.AspNetCore.Authorization;
|
2025-02-04 06:36:38 +01:00
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Umbraco.Cms.Api.Common.ViewModels.Pagination;
|
|
|
|
|
using Umbraco.Cms.Api.Management.Factories;
|
2025-01-07 11:18:32 +01:00
|
|
|
using Umbraco.Cms.Api.Management.Routing;
|
2025-02-04 06:36:38 +01:00
|
|
|
using Umbraco.Cms.Api.Management.ViewModels.Webhook.Logs;
|
2025-01-07 11:18:32 +01:00
|
|
|
using Umbraco.Cms.Core;
|
2025-02-04 06:36:38 +01:00
|
|
|
using Umbraco.Cms.Core.Models;
|
2025-04-28 14:10:43 +02:00
|
|
|
using Umbraco.Cms.Web.Common.Authorization;
|
2025-01-07 11:18:32 +01:00
|
|
|
|
|
|
|
|
namespace Umbraco.Cms.Api.Management.Controllers.Webhook.Logs;
|
|
|
|
|
|
|
|
|
|
[VersionedApiBackOfficeRoute($"{Constants.UdiEntityType.Webhook}")]
|
|
|
|
|
[ApiExplorerSettings(GroupName = "Webhook")]
|
2025-04-28 14:10:43 +02:00
|
|
|
[Authorize(Policy = AuthorizationPolicies.TreeAccessWebhooks)]
|
2025-02-04 06:36:38 +01:00
|
|
|
public class WebhookLogControllerBase : ManagementApiControllerBase
|
|
|
|
|
{
|
|
|
|
|
protected PagedViewModel<WebhookLogResponseModel> CreatePagedWebhookLogResponseModel(PagedModel<WebhookLog> logs, IWebhookPresentationFactory webhookPresentationFactory)
|
|
|
|
|
{
|
|
|
|
|
WebhookLogResponseModel[] logResponseModels = logs.Items.Select(webhookPresentationFactory.CreateResponseModel).ToArray();
|
|
|
|
|
|
|
|
|
|
return new PagedViewModel<WebhookLogResponseModel>
|
|
|
|
|
{
|
|
|
|
|
Total = logs.Total,
|
|
|
|
|
Items = logResponseModels,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|