Safe Haskell | None |
---|---|
Language | Haskell2010 |
Documentation
type HasParam (label :: Symbol) (paramType :: *) (params :: [Param Symbol *]) = ParamType label params ~ paramType Source #
data APIRequest (supports :: [Param Symbol *]) responseType Source #
API request. You should use specific builder functions instead of building this directly.
For example, if there were a SampleApi
type and a builder function which named sampleApiRequest
.
type SampleId =Integer
sampleApiRequest ::APIRequest
SampleApi [SampleId] sampleApiRequest =APIRequest
"GET" "https://api.twitter.com/sample/api.json" [] type SampleApi = '[ "count" ':= Integer , "max_id" ':= Integer ]
We can obtain request params from
:APIRequest
SampleApi [SampleId]
>>>
sampleApiRequest ^. params
[]
The second type parameter of the APIRequest represents the allowed parameters for the APIRequest.
For example, sampleApiRequest
has 2 Integer
parameters, that is "count" and "max_id".
You can update those parameters by label lenses (#count
and #max_id
respectively)
>>>
(sampleApiRequest & #count ?~ 100 & #max_id ?~ 1234567890) ^. params
[("max_id",PVInteger {unPVInteger = 1234567890}),("count",PVInteger {unPVInteger = 100})]>>>
(sampleApiRequest & #count ?~ 100 & #max_id ?~ 1234567890 & #count .~ Nothing) ^. params
[("max_id",PVInteger {unPVInteger = 1234567890})]
Instances
Show (APIRequest apiName responseType) Source # | |
Defined in Web.Twitter.Conduit.Request showsPrec :: Int -> APIRequest apiName responseType -> ShowS # show :: APIRequest apiName responseType -> String # showList :: [APIRequest apiName responseType] -> ShowS # | |
Parameters (APIRequest supports responseType) Source # | |
Defined in Web.Twitter.Conduit.Request type SupportParameters (APIRequest supports responseType) :: [Param Symbol Type] Source # | |
type SupportParameters (APIRequest supports responseType) Source # | |
Defined in Web.Twitter.Conduit.Request |