json-api-lib-0.1.1.1: Utilities for generating JSON-API payloads

Safe HaskellNone
LanguageHaskell2010

Network.JSONApi.Meta

Description

Module representing a JSON-API meta object.

Specification: http://jsonapi.org/format/#document-meta

Synopsis

Documentation

data Meta Source #

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

Instances
Eq Meta Source # 
Instance details

Defined in Network.JSONApi.Meta

Methods

(==) :: Meta -> Meta -> Bool #

(/=) :: Meta -> Meta -> Bool #

Show Meta Source # 
Instance details

Defined in Network.JSONApi.Meta

Methods

showsPrec :: Int -> Meta -> ShowS #

show :: Meta -> String #

showList :: [Meta] -> ShowS #

Generic Meta Source # 
Instance details

Defined in Network.JSONApi.Meta

Associated Types

type Rep Meta :: Type -> Type #

Methods

from :: Meta -> Rep Meta x #

to :: Rep Meta x -> Meta #

ToJSON Meta Source # 
Instance details

Defined in Network.JSONApi.Meta

FromJSON Meta Source # 
Instance details

Defined in Network.JSONApi.Meta

type Rep Meta Source # 
Instance details

Defined in Network.JSONApi.Meta

type Rep Meta = D1 (MetaData "Meta" "Network.JSONApi.Meta" "json-api-lib-0.1.1.1-Hn5ub1A05S41aavcUBD9m0" True) (C1 (MetaCons "Meta" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Object)))

class ToJSON a => MetaObject a where Source #

Convienience class for constructing a Meta type

Example usage: @ data Pagination = Pagination { currentPage :: Int , totalPages :: Int } deriving (Show, Generic)

instance ToJSON Pagination instance MetaObject Pagination where typeName _ = "pagination" @

Methods

typeName :: a -> Text Source #

Instances
MetaObject Pagination Source #

Pagination can be used as a meta object if required in addition to the links generated for paging.

Instance details

Defined in Network.JSONApi.Pagination

mkMeta :: MetaObject a => a -> Meta Source #

Convienience constructor function for the Meta type

Useful on its own or in combination with Meta's monoid instance

Example usage: See MetaSpec.hs for an example