Breaking changes for the Delivery API (#14745)

* Use interfaces for API media return values + introduce dedicated models for crops and focal points

* Move content and media controllers to their own namespaces
This commit is contained in:
Kenn Jacobsen
2023-09-06 09:49:44 +02:00
committed by GitHub
parent c21530e17a
commit 280d0a236b
30 changed files with 162 additions and 75 deletions

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; }
}