Description
Currently the Media
objects used to represent assets from Contentful are plain Javascript objects without any functionality, however for certain media types (e.g. images) there exist rich Contentful APIs that provide transforms on the underlying image before serving it up to the client.
I would like to propose changing the Media
interface / type to a class hierarchy that has additional functions which would support the broader image API features, such as:
- Progressive JPEG
- Image resizing
- Image cropping
- etc.
This change would not break compatibility assuming we had a base interface for Media
that still looks the same, but then had classes for specific media types such as ImageMedia
that then implemented the interface. You could also just have a base class Media
that was subclassed - these are minor implementation details.