twitter-conduit-0.5.0: Twitter API package with conduit interface and Streaming API support.

Safe Haskell | None
Language | Haskell2010

Web.Twitter.Conduit.Request

Synopsis

- type HasParam (label :: Symbol) (paramType :: *) (params :: [Param Symbol *]) = ParamType label params ~ paramType
- data APIRequest (supports :: [Param Symbol *]) responseType
  - = APIRequest {
    - _method :: Method
    - _url :: String
    - _params :: APIQuery
    }
  - | APIRequestMultipart {
    - _method :: Method
    - _url :: String
    - _params :: APIQuery
    - _part :: [Part]
    }
  - | APIRequestJSON {
    - _method :: Method
    - _url :: String
    - _params :: APIQuery
    - _body :: Value
    }

# 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})]

Constructors

APIRequest |

Fields

- _method :: Method
- _url :: String
- _params :: APIQuery

APIRequestMultipart |

Fields

- _method :: Method
- _url :: String
- _params :: APIQuery
- _part :: [Part]

APIRequestJSON |

Fields

- _method :: Method
- _url :: String
- _params :: APIQuery
- _body :: Value

#### Instances

Instances details

Show (APIRequest apiName responseType) Source # |
Instance details Defined in Web.Twitter.Conduit.Request Methods showsPrec :: Int -> APIRequest apiName responseType -> ShowS show :: APIRequest apiName responseType -> String showList :: [APIRequest apiName responseType] -> ShowS
Parameters (APIRequest supports responseType) Source # |
Instance details Defined in Web.Twitter.Conduit.Request Associated Types type SupportParameters (APIRequest supports responseType) :: [Param Symbol Type] Source # Methods params :: Lens' (APIRequest supports responseType) APIQuery Source #
type SupportParameters (APIRequest supports responseType) Source # |
Instance details Defined in Web.Twitter.Conduit.Request type SupportParameters (APIRequest supports responseType) = supports