Safe Haskell | None |
---|---|
Language | Haskell2010 |
Contains representations of the top-level JSON-API document structure.
Synopsis
- data Document a = Document {}
- data ResourceData a
- data ErrorDocument a = ErrorDocument {
- _error :: Error a
- _errorLinks :: Maybe Links
- _errorMeta :: Maybe Meta
- data Included
- mkDocument :: ResourcefulEntity a => a -> Maybe Links -> Maybe Meta -> Document a
- mkDocuments :: ResourcefulEntity a => [a] -> Maybe Links -> Maybe Meta -> Document a
- mkDocument' :: ResourceData a -> Maybe Links -> Maybe Meta -> Document a
- mkSimpleDocument :: ResourcefulEntity a => a -> Document a
- mkSimpleDocuments :: ResourcefulEntity a => [a] -> Document a
- mkSimpleDocument' :: ResourceData a -> Document a
- singleton :: ResourcefulEntity a => a -> ResourceData a
- list :: ResourcefulEntity a => [a] -> ResourceData a
- mkCompoundDocument :: ResourcefulEntity a => a -> Maybe Links -> Maybe Meta -> Included -> Document a
- mkCompoundDocuments :: ResourcefulEntity a => [a] -> Maybe Links -> Maybe Meta -> Included -> Document a
- mkCompoundDocument' :: ResourceData a -> Maybe Links -> Maybe Meta -> Included -> Document a
- mkIncludedResource :: ResourcefulEntity a => a -> Included
Documentation
The Document
type represents the top-level JSON-API requirement.
data
attribute - the resulting JSON may be either a singleton resource
or a list of resources. See Resource
for the construction.
For more information see: http://jsonapi.org/format/#document-top-level
Instances
Eq a => Eq (Document a) Source # | |
Show a => Show (Document a) Source # | |
Generic (Document a) Source # | |
ToJSON a => ToJSON (Document a) Source # | |
Defined in Network.JSONApi.Document | |
FromJSON a => FromJSON (Document a) Source # | |
NFData a => NFData (Document a) Source # | |
Defined in Network.JSONApi.Document | |
type Rep (Document a) Source # | |
Defined in Network.JSONApi.Document type Rep (Document a) = D1 (MetaData "Document" "Network.JSONApi.Document" "json-api-lib-0.2.0.0-CIYDoTtBA9V1pU3j2B9t69" False) (C1 (MetaCons "Document" PrefixI True) ((S1 (MetaSel (Just "_data") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (ResourceData a)) :*: S1 (MetaSel (Just "_links") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Links))) :*: (S1 (MetaSel (Just "_meta") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Meta)) :*: S1 (MetaSel (Just "_included") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Value])))) |
data ResourceData a Source #
The Resource
type encapsulates the underlying Resource
Included in the top-level Document
, the Resource
may be either
a singleton resource or a list.
For more information see: http://jsonapi.org/format/#document-top-level
Instances
data ErrorDocument a Source #
The ErrorDocument
type represents the alternative form of the top-level
JSON-API requirement.
error
attribute - a descriptive object encapsulating application-specific
error detail.
For more information see: http://jsonapi.org/format/#errors
ErrorDocument | |
|
Instances
The Included
type is an abstraction used to constrain the included
section of the Document to JSON serializable Resource objects while
enabling a heterogeneous list of Resource types.
No data constructors for this type are exported as we need to
constrain the Value
to a heterogeneous list of Resource types.
See mkIncludedResource
for creating Included
types.
mkDocument :: ResourcefulEntity a => a -> Maybe Links -> Maybe Meta -> Document a Source #
Constructor function for the Document data type which takes a single ResourcefulEntity.
See mkCompoundDocument
for constructing compound Document
including 'side-loaded' resources
mkDocuments :: ResourcefulEntity a => [a] -> Maybe Links -> Maybe Meta -> Document a Source #
Constructor function for the Document data type which takes a list of Resourceful entities.
See mkCompoundDocument
for constructing compound Document
including 'side-loaded' resources
mkDocument' :: ResourceData a -> Maybe Links -> Maybe Meta -> Document a Source #
mkSimpleDocument :: ResourcefulEntity a => a -> Document a Source #
A function for a single resourceful entity and document which do not require links or Meta data.
mkSimpleDocuments :: ResourcefulEntity a => [a] -> Document a Source #
A function for a multiple resourceful entities and document which do not require links or Meta data.
mkSimpleDocument' :: ResourceData a -> Document a Source #
A function for document which do not require links or Meta data.
singleton :: ResourcefulEntity a => a -> ResourceData a Source #
list :: ResourcefulEntity a => [a] -> ResourceData a Source #
mkCompoundDocument :: ResourcefulEntity a => a -> Maybe Links -> Maybe Meta -> Included -> Document a Source #
Constructor function for the Document data type.
See mkIncludedResource
for constructing the Included
type.
Supports building compound documents http://jsonapi.org/format/#document-compound-documents
mkCompoundDocuments :: ResourcefulEntity a => [a] -> Maybe Links -> Maybe Meta -> Included -> Document a Source #
Constructor function for the Document data type.
See mkIncludedResource
for constructing the Included
type.
Supports building compound documents http://jsonapi.org/format/#document-compound-documents
mkCompoundDocument' :: ResourceData a -> Maybe Links -> Maybe Meta -> Included -> Document a Source #
mkIncludedResource :: ResourcefulEntity a => a -> Included Source #
Constructor function for the Document data type.
Supports building compound documents http://jsonapi.org/format/#document-compound-documents