Merge remote-tracking branch 'origin/v13/dev' into v14/dev

This commit is contained in:
Bjarke Berg
2023-09-12 10:22:37 +02:00
39 changed files with 222 additions and 97 deletions

View File

@@ -1,3 +1,5 @@
using System.Text.Json.Serialization;
namespace Umbraco.Cms.Core.Models.DeliveryApi;
public class ApiElement : IApiElement
@@ -11,6 +13,9 @@ public class ApiElement : IApiElement
public Guid Id { get; }
// Ensure the ContentType property is serialized first
// This is needed so it can be used as a discriminator field by System.Text.Json
[JsonPropertyOrder(-100)]
public string ContentType { get; }
public IDictionary<string, object?> Properties { get; }

View File

@@ -1,9 +1,14 @@
using System.Text.Json.Serialization;
namespace Umbraco.Cms.Core.Models.DeliveryApi;
public interface IApiElement
{
Guid Id { get; }
// Ensure the ContentType property is serialized first
// This is needed so it can be used as a discriminator field by System.Text.Json
[JsonPropertyOrder(-100)]
string ContentType { get; }
IDictionary<string, object?> Properties { get; }

View File

@@ -0,0 +1,8 @@
namespace Umbraco.Cms.Core.Models.DeliveryApi;
public interface IApiMediaWithCrops : IApiMedia
{
public ImageFocalPoint? FocalPoint { get; }
public IEnumerable<ImageCrop>? Crops { get; }
}

View File

@@ -0,0 +1,10 @@
namespace Umbraco.Cms.Core.Models.DeliveryApi;
public interface IApiMediaWithCropsResponse : IApiMediaWithCrops
{
public string Path { get; }
public DateTime CreateDate { get; }
public DateTime UpdateDate { get; }
}

View File

@@ -0,0 +1,20 @@
namespace Umbraco.Cms.Core.Models.DeliveryApi;
public class ImageCrop
{
public ImageCrop(string? alias, int width, int height, ImageCropCoordinates? coordinates)
{
Alias = alias;
Width = width;
Height = height;
Coordinates = coordinates;
}
public string? Alias { get; }
public int Width { get; }
public int Height { get; }
public ImageCropCoordinates? Coordinates { get; }
}

View File

@@ -0,0 +1,20 @@
namespace Umbraco.Cms.Core.Models.DeliveryApi;
public class ImageCropCoordinates
{
public ImageCropCoordinates(decimal x1, decimal y1, decimal x2, decimal y2)
{
X1 = x1;
Y1 = y1;
X2 = x2;
Y2 = y2;
}
public decimal X1 { get; }
public decimal Y1 { get; }
public decimal X2 { get; }
public decimal Y2 { get; }
}

View File

@@ -0,0 +1,14 @@
namespace Umbraco.Cms.Core.Models.DeliveryApi;
public class ImageFocalPoint
{
public ImageFocalPoint(decimal left, decimal top)
{
Left = left;
Top = top;
}
public decimal Left { get; }
public decimal Top { get; }
}