Safe Haskell | None |
---|---|
Language | Haskell2010 |
Entry-point module for this package.
Contains representations of the top-level JSON-API document structure.
- data Document a b c = Document {}
- data ErrorDocument a b = ErrorDocument {
- _error :: Error a
- _errorLinks :: Maybe Links
- _errorMeta :: Maybe (Meta b)
- data Error a = Error {}
- data Resource a b
- = Singleton (ResourceObject a b)
- | List [ResourceObject a b]
- newtype ResourceId = ResourceId Text
- data ResourceObject a b = ResourceObject {
- getResourceId :: ResourceId
- getResourceType :: ResourceType
- getResource :: a
- getLinks :: Maybe Links
- getMetaData :: Maybe (Meta b)
- newtype ResourceType = ResourceType Text
- data Links
- data Meta a = Meta (Map Text a)
- toLinks :: [(Rel, URL)] -> Links
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
(Eq a, Eq b, Eq c) => Eq (Document a b c) Source # | |
(Show a, Show b, Show c) => Show (Document a b c) Source # | |
Generic (Document a b c) Source # | |
(ToJSON a, ToJSON b, ToJSON c) => ToJSON (Document a b c) Source # | |
(FromJSON a, FromJSON b, FromJSON c) => FromJSON (Document a b c) Source # | |
type Rep (Document a b c) Source # | |
data ErrorDocument a b 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 | |
|
(Eq a, Eq b) => Eq (ErrorDocument a b) Source # | |
(Show a, Show b) => Show (ErrorDocument a b) Source # | |
Generic (ErrorDocument a b) Source # | |
(ToJSON a, ToJSON b) => ToJSON (ErrorDocument a b) Source # | |
(FromJSON a, FromJSON b) => FromJSON (ErrorDocument a b) Source # | |
type Rep (ErrorDocument a b) Source # | |
Type for providing application-specific detail to unsuccessful API responses.
Specification: http://jsonapi.org/format/#error-objects
The Resource
type encapsulates the underlying ResourceObject
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
Singleton (ResourceObject a b) | |
List [ResourceObject a b] |
newtype ResourceId Source #
data ResourceObject a b Source #
Type representing a JSON-API resource object.
A ResourceObject supplies standardized data and metadata about a resource.
Specification: http://jsonapi.org/format/#document-resource-objects
ResourceObject | |
|
(Eq a, Eq b) => Eq (ResourceObject a b) Source # | |
(Ord a, Ord b) => Ord (ResourceObject a b) Source # | |
(Show a, Show b) => Show (ResourceObject a b) Source # | |
Generic (ResourceObject a b) Source # | |
(ToJSON a, ToJSON b) => ToJSON (ResourceObject a b) Source # | |
(FromJSON a, FromJSON b) => FromJSON (ResourceObject a b) Source # | |
type Rep (ResourceObject a b) Source # | |
newtype ResourceType Source #
Type representing a JSON-API link object.
Links are an abstraction around an underlying Map consisting of relevance identifiers as keys and URIs as values.
Example JSON:
"links": {
"self": "http://example.com/posts/1"
}
Specification: http://jsonapi.org/format/#document-links
Type representing a JSON-API meta object.
Meta is an abstraction around an underlying Map consisting of resource-specific metadata.
Example JSON:
"meta": {
"copyright": "Copyright 2015 Example Corp.",
"authors": [
"Andre Dawson",
"Kirby Puckett",
"Don Mattingly",
"Ozzie Guillen"
]
}
Specification: http://jsonapi.org/format/#document-meta