Add project files.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
namespace Elsa.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a count response that offers a unified format for returning count of things from API endpoints.
|
||||
/// </summary>
|
||||
/// <param name="Count">The number of items found for a given query.</param>
|
||||
public record CountResponse(long Count);
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Elsa.Models;
|
||||
|
||||
public record LinkedResource(Link[] Links)
|
||||
{
|
||||
public LinkedResource() : this([]) { }
|
||||
}
|
||||
|
||||
public record Link(string Href, string Rel, string Method);
|
||||
@@ -0,0 +1,33 @@
|
||||
namespace Elsa.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a generic list response that offers a unified format for returning list of things from API endpoints.
|
||||
/// </summary>
|
||||
public class ListResponse<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public ListResponse()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor accepting a list of items.
|
||||
/// </summary>
|
||||
public ListResponse(ICollection<T> items)
|
||||
{
|
||||
Items = items;
|
||||
Count = items.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A list of items.
|
||||
/// </summary>
|
||||
public ICollection<T> Items { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The number of items in the list.
|
||||
/// </summary>
|
||||
public long Count { get; set; }
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using Elsa.Common.Models;
|
||||
|
||||
namespace Elsa.Models;
|
||||
|
||||
public record PagedListResponse<T>: LinkedResource
|
||||
{
|
||||
public PagedListResponse()
|
||||
{
|
||||
}
|
||||
|
||||
public PagedListResponse(Page<T> page)
|
||||
{
|
||||
Items = page.Items;
|
||||
TotalCount = page.TotalCount;
|
||||
}
|
||||
|
||||
public ICollection<T> Items { get; set; } = default!;
|
||||
public long TotalCount { get; set; }
|
||||
|
||||
public static PagedListResponse<T> From(Page<T> page) => new(page);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Elsa.Models;
|
||||
|
||||
public record ValidateCredentialsResult(bool IsValid, object? Context = null)
|
||||
{
|
||||
public static ValidateCredentialsResult Invalid() => new(false);
|
||||
public static ValidateCredentialsResult Valid(object? context = null) => new(true, context);
|
||||
}
|
||||
Reference in New Issue
Block a user