json-api-0.1.1.0: Utilities for generating JSON-API payloads

Safe HaskellNone
LanguageHaskell2010

Network.JSONApi.Document

Description

Entry-point module for this package.

Contains representations of the top-level JSON-API document structure.

Synopsis

Documentation

data Document a Source #

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 # 

Methods

(==) :: Document a -> Document a -> Bool #

(/=) :: Document a -> Document a -> Bool #

Show a => Show (Document a) Source # 

Methods

showsPrec :: Int -> Document a -> ShowS #

show :: Document a -> String #

showList :: [Document a] -> ShowS #

Generic (Document a) Source # 

Associated Types

type Rep (Document a) :: * -> * #

Methods

from :: Document a -> Rep (Document a) x #

to :: Rep (Document a) x -> Document a #

ToJSON a => ToJSON (Document a) Source # 
FromJSON a => FromJSON (Document a) Source # 

Methods

parseJSON :: Value -> Parser (Document a) #

type Rep (Document a) Source # 

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

Instances

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

Constructors

Singleton (Resource a) 
List [Resource a] 

Instances

Eq a => Eq (ResourceData a) Source # 
Show a => Show (ResourceData a) Source # 
Generic (ResourceData a) Source # 

Associated Types

type Rep (ResourceData a) :: * -> * #

Methods

from :: ResourceData a -> Rep (ResourceData a) x #

to :: Rep (ResourceData a) x -> ResourceData a #

ToJSON a => ToJSON (ResourceData a) Source # 
FromJSON a => FromJSON (ResourceData a) Source # 
type Rep (ResourceData a) Source # 
type Rep (ResourceData a) = D1 (MetaData "ResourceData" "Network.JSONApi.Document" "json-api-0.1.1.0-KjRUepAmpKl7VRM1GITF4C" False) ((:+:) (C1 (MetaCons "Singleton" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Resource a)))) (C1 (MetaCons "List" PrefixI False) (S1 (MetaSel (Nothing Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Resource a]))))

mkDocument :: ResourcefulEntity a => [a] -> Maybe Links -> Maybe Meta -> [Value] -> Document a Source #

Constructor function for the Document data type.