servant-hateoas 0.2.0 → 0.2.1
raw patch · 4 files changed
+17/−11 lines, 4 files
Files
- CHANGELOG.md +6/−1
- servant-hateoas.cabal +1/−1
- src/Servant/Hateoas/ContentType/Collection.hs +6/−5
- src/Servant/Hateoas/ContentType/HAL.hs +4/−4
CHANGELOG.md view
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [PVP versioning](https://pvp.haskell.org/). +## v0.2.1 _(2024-10-25)_++### Changed+- Export `CollectionItem`+- Improved documentation+ ## v0.2.0 _(2024-10-29)_ ### Added@@ -13,7 +19,6 @@ - Classes `EmbeddingResource res` & `CollectingResource res` for resource-modification ### Changed- - *(breaking change)* Renamed class `HasResource` to `Resource`, removed associated type and Content-Type param ## v0.1.1 _(2024-10-25)_
servant-hateoas.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: servant-hateoas-version: 0.2.0+version: 0.2.1 synopsis: HATEOAS extension for servant description: Create Resource-Representations for your types and make your API HATEOAS-compliant. Resource construction is generic where possible and manually adjustable where required.
src/Servant/Hateoas/ContentType/Collection.hs view
@@ -6,6 +6,7 @@ module Servant.Hateoas.ContentType.Collection ( Collection , CollectionResource(..)+, CollectionItem(..) ) where @@ -28,15 +29,15 @@ -- | Resource wrapper for 'Collection'. data CollectionResource a = CollectionResource- { href :: Maybe Link- , items :: [CollectionItem a]- , links :: [(String, Link)]+ { href :: Maybe Link -- ^ Link to the collection+ , items :: [CollectionItem a] -- ^ All items in the collection+ , links :: [(String, Link)] -- ^ Pairs @(rel, link)@ for relations } deriving (Show, Generic) -- | A single item inside a 'CollectionResource'. data CollectionItem a = CollectionItem- { item :: a- , itemLinks :: [(String, Link)]+ { item :: a -- ^ Wrapped item+ , itemLinks :: [(String, Link)] -- ^ Links for the wrapped item } deriving (Show, Generic) instance Resource CollectionResource where
src/Servant/Hateoas/ContentType/HAL.hs view
@@ -23,16 +23,16 @@ import GHC.Generics import GHC.Records --- | Data-Kind representing Content-Types with Hypertext Application Language (HAL).+-- | Data-Kind representing Content-Types of Hypertext Application Language (HAL). -- -- Type parameter @t@ is the mime type suffix in @application/hal+t@. data HAL (t :: Type) -- | Resource wrapper for HAL. data HALResource a = HALResource- { resource :: a- , links :: [(String, Link)]- , embedded :: [(String, SomeToJSON HALResource)]+ { resource :: a -- ^ Wrapped resource+ , links :: [(String, Link)] -- ^ Pairs @(rel, link)@ for relations+ , embedded :: [(String, SomeToJSON HALResource)] -- ^ Pairs @(rel, resource)@ for embedded resources } deriving (Generic) instance Resource HALResource where