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:
@@ -0,0 +1,8 @@
|
||||
namespace Umbraco.Cms.Core.Models.DeliveryApi;
|
||||
|
||||
public interface IApiMediaWithCrops : IApiMedia
|
||||
{
|
||||
public ImageFocalPoint? FocalPoint { get; }
|
||||
|
||||
public IEnumerable<ImageCrop>? Crops { get; }
|
||||
}
|
||||
@@ -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; }
|
||||
}
|
||||
20
src/Umbraco.Core/Models/DeliveryApi/ImageCrop.cs
Normal file
20
src/Umbraco.Core/Models/DeliveryApi/ImageCrop.cs
Normal 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; }
|
||||
}
|
||||
20
src/Umbraco.Core/Models/DeliveryApi/ImageCropCoordinates.cs
Normal file
20
src/Umbraco.Core/Models/DeliveryApi/ImageCropCoordinates.cs
Normal 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; }
|
||||
}
|
||||
14
src/Umbraco.Core/Models/DeliveryApi/ImageFocalPoint.cs
Normal file
14
src/Umbraco.Core/Models/DeliveryApi/ImageFocalPoint.cs
Normal 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; }
|
||||
}
|
||||
Reference in New Issue
Block a user