mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.4 KiB
39 lines
1.4 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Squidex.Infrastructure.EventSourcing;
|
|
using Squidex.Web;
|
|
|
|
namespace Squidex.Areas.Api.Controllers.EventConsumers.Models
|
|
{
|
|
public sealed class EventConsumersDto : Resource
|
|
{
|
|
/// <summary>
|
|
/// The event consumers.
|
|
/// </summary>
|
|
public EventConsumerDto[] Items { get; set; }
|
|
|
|
public static EventConsumersDto FromResults(IEnumerable<EventConsumerInfo> items, ApiController controller)
|
|
{
|
|
var result = new EventConsumersDto
|
|
{
|
|
Items = items.Select(x => EventConsumerDto.FromEventConsumerInfo(x, controller)).ToArray()
|
|
};
|
|
|
|
return CreateLinks(result, controller);
|
|
}
|
|
|
|
private static EventConsumersDto CreateLinks(EventConsumersDto result, ApiController controller)
|
|
{
|
|
result.AddSelfLink(controller.Url<EventConsumersController>(c => nameof(c.GetEventConsumers)));
|
|
|
|
return result;
|
|
}
|
|
}
|
|
}
|
|
|