Safe Haskell | None |
---|---|
Language | Haskell2010 |
Module representing a JSON-API resource object.
Specification: http://jsonapi.org/format/#document-resource-objects
Synopsis
- data Resource a = Resource {}
- data Relationships
- class (ToJSON a, FromJSON a) => ResourcefulEntity a where
- resourceIdentifier :: a -> Text
- resourceType :: a -> Text
- resourceLinks :: a -> Maybe Links
- resourceMetaData :: a -> Maybe Meta
- resourceRelationships :: a -> Maybe Relationships
- fromResource :: Resource a -> a
- toResource :: a -> Resource a
- data Relationship
- mkRelationship :: Maybe Identifier -> Maybe Links -> Maybe Relationship
- mkRelationships :: Relationship -> Relationships
Documentation
Type representing a JSON-API resource object.
A Resource supplies standardized data and metadata about a resource.
Specification: http://jsonapi.org/format/#document-resource-objects
Resource | |
|
Instances
data Relationships Source #
Instances
class (ToJSON a, FromJSON a) => ResourcefulEntity a where Source #
A typeclass for decorating an entity with JSON API properties
resourceIdentifier :: a -> Text Source #
resourceType :: a -> Text Source #
resourceLinks :: a -> Maybe Links Source #
resourceMetaData :: a -> Maybe Meta Source #
resourceRelationships :: a -> Maybe Relationships Source #
fromResource :: Resource a -> a Source #
toResource :: a -> Resource a Source #
data Relationship Source #
A type representing the Relationship between 2 entities
A Relationship provides basic information for fetching further information about a related resource.
Specification: http://jsonapi.org/format/#document-resource-object-relationships
Instances
mkRelationship :: Maybe Identifier -> Maybe Links -> Maybe Relationship Source #
Constructor function for creating a Relationship record
A relationship must contain either an Identifier or a Links record