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

Safe Haskell | Safe-Inferred
Language | Haskell2010

Web.Twitter.Conduit.Lens

Contents

- `Response`
- `TwitterErrorMessage`
- `WithCursor`
- Re-exports

Synopsis

- data Response responseType
- responseStatus :: forall responseType. Lens' (Response responseType) Status
- responseBody :: forall a b. Lens (Response a) (Response b) a b
- responseHeaders :: forall responseType. Lens' (Response responseType) ResponseHeaders
- data TwitterErrorMessage
- twitterErrorMessage :: Lens' TwitterErrorMessage Text
- twitterErrorCode :: Lens' TwitterErrorMessage Int
- data WithCursor cursorType (cursorKey :: Symbol) wrapped
- previousCursor :: forall cursorType cursorKey wrapped. Lens' (WithCursor cursorType cursorKey wrapped) (Maybe cursorType)
- nextCursor :: forall cursorType cursorKey wrapped. Lens' (WithCursor cursorType cursorKey wrapped) (Maybe cursorType)
- contents :: forall cursorType cursorKey a b. Lens (WithCursor cursorType cursorKey a) (WithCursor cursorType cursorKey b) [a] [b]
- data TwitterError
  - = FromJSONError String
  - | TwitterErrorResponse Status ResponseHeaders [TwitterErrorMessage]
  - | TwitterUnknownErrorResponse Status ResponseHeaders Value
  - | TwitterStatusError Status ResponseHeaders Value

# `Response`

data Response responseType Source #

#### Instances

Instances details

Foldable Response Source # |

Instance details

Defined in Web.Twitter.Conduit.Response

Methods

fold :: Monoid m => Response m -> m Source #

foldMap :: Monoid m => (a -> m) -> Response a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Response a -> m Source #

foldr :: (a -> b -> b) -> b -> Response a -> b Source #

foldr' :: (a -> b -> b) -> b -> Response a -> b Source #

foldl :: (b -> a -> b) -> b -> Response a -> b Source #

foldl' :: (b -> a -> b) -> b -> Response a -> b Source #

foldr1 :: (a -> a -> a) -> Response a -> a Source #

foldl1 :: (a -> a -> a) -> Response a -> a Source #

toList :: Response a -> [a] Source #

null :: Response a -> Bool Source #

length :: Response a -> Int Source #

elem :: Eq a => a -> Response a -> Bool Source #

maximum :: Ord a => Response a -> a Source #

minimum :: Ord a => Response a -> a Source #

sum :: Num a => Response a -> a Source #

product :: Num a => Response a -> a Source #

Traversable Response Source # |
Instance details Defined in Web.Twitter.Conduit.Response Methods traverse :: Applicative f => (a -> f b) -> Response a -> f (Response b) Source # sequenceA :: Applicative f => Response (f a) -> f (Response a) Source # mapM :: Monad m => (a -> m b) -> Response a -> m (Response b) Source # sequence :: Monad m => Response (m a) -> m (Response a) Source #
Functor Response Source # |
Instance details Defined in Web.Twitter.Conduit.Response Methods fmap :: (a -> b) -> Response a -> Response b Source # (<$) :: a -> Response b -> Response a Source #
Show responseType => Show (Response responseType) Source # |
Instance details Defined in Web.Twitter.Conduit.Response Methods showsPrec :: Int -> Response responseType -> ShowS Source # show :: Response responseType -> String Source # showList :: [Response responseType] -> ShowS Source #
Eq responseType => Eq (Response responseType) Source # |
Instance details Defined in Web.Twitter.Conduit.Response Methods (==) :: Response responseType -> Response responseType -> Bool Source # (/=) :: Response responseType -> Response responseType -> Bool Source #

responseStatus :: forall responseType. Lens' (Response responseType) Status Source #

responseBody :: forall a b. Lens (Response a) (Response b) a b Source #

responseHeaders :: forall responseType. Lens' (Response responseType) ResponseHeaders Source #

# `TwitterErrorMessage`

data TwitterErrorMessage Source #

Twitter Error Messages

see detail: https://dev.twitter.com/docs/error-codes-responses

#### Instances

Instances details

FromJSON TwitterErrorMessage Source # |
Instance details Defined in Web.Twitter.Conduit.Response Methods parseJSON :: Value -> Parser TwitterErrorMessage Source # parseJSONList :: Value -> Parser [TwitterErrorMessage] Source #
Data TwitterErrorMessage Source # |

Instance details

Defined in Web.Twitter.Conduit.Response

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TwitterErrorMessage -> c TwitterErrorMessage Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TwitterErrorMessage Source #

toConstr :: TwitterErrorMessage -> Constr Source #

dataTypeOf :: TwitterErrorMessage -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TwitterErrorMessage) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TwitterErrorMessage) Source #

gmapT :: (forall b. Data b => b -> b) -> TwitterErrorMessage -> TwitterErrorMessage Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TwitterErrorMessage -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TwitterErrorMessage -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> TwitterErrorMessage -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> TwitterErrorMessage -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> TwitterErrorMessage -> m TwitterErrorMessage Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TwitterErrorMessage -> m TwitterErrorMessage Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TwitterErrorMessage -> m TwitterErrorMessage Source #

Enum TwitterErrorMessage Source # |

Instance details

Defined in Web.Twitter.Conduit.Response

Methods

succ :: TwitterErrorMessage -> TwitterErrorMessage Source #

pred :: TwitterErrorMessage -> TwitterErrorMessage Source #

toEnum :: Int -> TwitterErrorMessage Source #

fromEnum :: TwitterErrorMessage -> Int Source #

enumFrom :: TwitterErrorMessage -> [TwitterErrorMessage] Source #

enumFromThen :: TwitterErrorMessage -> TwitterErrorMessage -> [TwitterErrorMessage] Source #

enumFromTo :: TwitterErrorMessage -> TwitterErrorMessage -> [TwitterErrorMessage] Source #

enumFromThenTo :: TwitterErrorMessage -> TwitterErrorMessage -> TwitterErrorMessage -> [TwitterErrorMessage] Source #

Show TwitterErrorMessage Source # |
Instance details Defined in Web.Twitter.Conduit.Response Methods showsPrec :: Int -> TwitterErrorMessage -> ShowS Source # show :: TwitterErrorMessage -> String Source # showList :: [TwitterErrorMessage] -> ShowS Source #
Eq TwitterErrorMessage Source # |
Instance details Defined in Web.Twitter.Conduit.Response Methods (==) :: TwitterErrorMessage -> TwitterErrorMessage -> Bool Source # (/=) :: TwitterErrorMessage -> TwitterErrorMessage -> Bool Source #
Ord TwitterErrorMessage Source # |

Instance details

Defined in Web.Twitter.Conduit.Response

Methods

compare :: TwitterErrorMessage -> TwitterErrorMessage -> Ordering Source #

(<) :: TwitterErrorMessage -> TwitterErrorMessage -> Bool Source #

(<=) :: TwitterErrorMessage -> TwitterErrorMessage -> Bool Source #

(>) :: TwitterErrorMessage -> TwitterErrorMessage -> Bool Source #

(>=) :: TwitterErrorMessage -> TwitterErrorMessage -> Bool Source #

max :: TwitterErrorMessage -> TwitterErrorMessage -> TwitterErrorMessage Source #

min :: TwitterErrorMessage -> TwitterErrorMessage -> TwitterErrorMessage Source #

twitterErrorMessage :: Lens' TwitterErrorMessage Text Source #

twitterErrorCode :: Lens' TwitterErrorMessage Int Source #

# `WithCursor`

data WithCursor cursorType (cursorKey :: Symbol) wrapped Source #

A wrapper for API responses which have "next_cursor" field.

The first type parameter of `WithCursor` specifies the field name of contents.

    >>> let Just res = decode "{\"previous_cursor\": 0, \"next_cursor\": 1234567890, \"ids\": [1111111111]}" :: Maybe (WithCursor Integer "ids" UserId)
    >>> nextCursor res
    Just 1234567890
    >>> contents res
    [1111111111]

    >>> let Just res = decode "{\"previous_cursor\": 0, \"next_cursor\": 0, \"users\": [1000]}" :: Maybe (WithCursor Integer "users" UserId)
    >>> nextCursor res
    Just 0
    >>> contents res
    [1000]

    >>> let Just res = decode "{\"next_cursor\": \"hogehoge\", \"events\": [1000]}" :: Maybe (WithCursor Text "events" UserId)
    >>> nextCursor res
    Just "hogehoge"
    >>> contents res
    [1000]

#### Instances

Instances details

Generic1 (WithCursor cursorType cursorKey :: Type -> Type) Source # |
Instance details Defined in Web.Twitter.Conduit.Cursor Associated Types type Rep1 (WithCursor cursorType cursorKey) :: k -> Type Source # Methods from1 :: forall (a :: k). WithCursor cursorType cursorKey a -> Rep1 (WithCursor cursorType cursorKey) a Source # to1 :: forall (a :: k). Rep1 (WithCursor cursorType cursorKey) a -> WithCursor cursorType cursorKey a Source #
(KnownSymbol cursorKey, FromJSON cursorType) => FromJSON1 (WithCursor cursorType cursorKey) Source # |
Instance details Defined in Web.Twitter.Conduit.Cursor Methods liftParseJSON :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser (WithCursor cursorType cursorKey a) Source # liftParseJSONList :: (Value -> Parser a) -> (Value -> Parser [a]) -> Value -> Parser [WithCursor cursorType cursorKey a] Source #
Foldable (WithCursor cursorType cursorKey) Source # |

Instance details

Defined in Web.Twitter.Conduit.Cursor

Methods

fold :: Monoid m => WithCursor cursorType cursorKey m -> m Source #

foldMap :: Monoid m => (a -> m) -> WithCursor cursorType cursorKey a -> m Source #

foldMap' :: Monoid m => (a -> m) -> WithCursor cursorType cursorKey a -> m Source #

foldr :: (a -> b -> b) -> b -> WithCursor cursorType cursorKey a -> b Source #

foldr' :: (a -> b -> b) -> b -> WithCursor cursorType cursorKey a -> b Source #

foldl :: (b -> a -> b) -> b -> WithCursor cursorType cursorKey a -> b Source #

foldl' :: (b -> a -> b) -> b -> WithCursor cursorType cursorKey a -> b Source #

foldr1 :: (a -> a -> a) -> WithCursor cursorType cursorKey a -> a Source #

foldl1 :: (a -> a -> a) -> WithCursor cursorType cursorKey a -> a Source #

toList :: WithCursor cursorType cursorKey a -> [a] Source #

null :: WithCursor cursorType cursorKey a -> Bool Source #

length :: WithCursor cursorType cursorKey a -> Int Source #

elem :: Eq a => a -> WithCursor cursorType cursorKey a -> Bool Source #

maximum :: Ord a => WithCursor cursorType cursorKey a -> a Source #

minimum :: Ord a => WithCursor cursorType cursorKey a -> a Source #

sum :: Num a => WithCursor cursorType cursorKey a -> a Source #

product :: Num a => WithCursor cursorType cursorKey a -> a Source #

Traversable (WithCursor cursorType cursorKey) Source # |

Instance details

Defined in Web.Twitter.Conduit.Cursor

Methods

traverse :: Applicative f => (a -> f b) -> WithCursor cursorType cursorKey a -> f (WithCursor cursorType cursorKey b) Source #

sequenceA :: Applicative f => WithCursor cursorType cursorKey (f a) -> f (WithCursor cursorType cursorKey a) Source #

mapM :: Monad m => (a -> m b) -> WithCursor cursorType cursorKey a -> m (WithCursor cursorType cursorKey b) Source #

sequence :: Monad m => WithCursor cursorType cursorKey (m a) -> m (WithCursor cursorType cursorKey a) Source #

Functor (WithCursor cursorType cursorKey) Source # |
Instance details Defined in Web.Twitter.Conduit.Cursor Methods fmap :: (a -> b) -> WithCursor cursorType cursorKey a -> WithCursor cursorType cursorKey b Source # (<$) :: a -> WithCursor cursorType cursorKey b -> WithCursor cursorType cursorKey a Source #
(KnownSymbol cursorKey, FromJSON cursorType, FromJSON wrapped) => FromJSON (WithCursor cursorType cursorKey wrapped) Source # |
Instance details Defined in Web.Twitter.Conduit.Cursor Methods parseJSON :: Value -> Parser (WithCursor cursorType cursorKey wrapped) Source # parseJSONList :: Value -> Parser [WithCursor cursorType cursorKey wrapped] Source #
Generic (WithCursor cursorType cursorKey wrapped) Source # |
Instance details Defined in Web.Twitter.Conduit.Cursor Associated Types type Rep (WithCursor cursorType cursorKey wrapped) :: Type -> Type Source # Methods from :: WithCursor cursorType cursorKey wrapped -> Rep (WithCursor cursorType cursorKey wrapped) x Source # to :: Rep (WithCursor cursorType cursorKey wrapped) x -> WithCursor cursorType cursorKey wrapped Source #
(Show cursorType, Show wrapped) => Show (WithCursor cursorType cursorKey wrapped) Source # |
Instance details Defined in Web.Twitter.Conduit.Cursor Methods showsPrec :: Int -> WithCursor cursorType cursorKey wrapped -> ShowS Source # show :: WithCursor cursorType cursorKey wrapped -> String Source # showList :: [WithCursor cursorType cursorKey wrapped] -> ShowS Source #
(NFData cursorType, NFData wrapped) => NFData (WithCursor cursorType cursorKey wrapped) Source # |
Instance details Defined in Web.Twitter.Conduit.Cursor Methods rnf :: WithCursor cursorType cursorKey wrapped -> () Source #
(Eq cursorType, Eq wrapped) => Eq (WithCursor cursorType cursorKey wrapped) Source # |
Instance details Defined in Web.Twitter.Conduit.Cursor Methods (==) :: WithCursor cursorType cursorKey wrapped -> WithCursor cursorType cursorKey wrapped -> Bool Source # (/=) :: WithCursor cursorType cursorKey wrapped -> WithCursor cursorType cursorKey wrapped -> Bool Source #
type Rep1 (WithCursor cursorType cursorKey :: Type -> Type) Source # |

Instance details

Defined in Web.Twitter.Conduit.Cursor

type Rep1 (WithCursor cursorType cursorKey :: Type -> Type) = D1 ('MetaData "WithCursor" "Web.Twitter.Conduit.Cursor" "twitter-conduit-0.6.1-9sN30spntkxCsUJACstU7O" 'False) (C1 ('MetaCons "WithCursor" 'PrefixI 'True) (S1 ('MetaSel ('Just "previousCursor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe cursorType)) :*: (S1 ('MetaSel ('Just "nextCursor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe cursorType)) :*: S1 ('MetaSel ('Just "contents") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 []))))

type Rep (WithCursor cursorType cursorKey wrapped) Source # |

Instance details

Defined in Web.Twitter.Conduit.Cursor

type Rep (WithCursor cursorType cursorKey wrapped) = D1 ('MetaData "WithCursor" "Web.Twitter.Conduit.Cursor" "twitter-conduit-0.6.1-9sN30spntkxCsUJACstU7O" 'False) (C1 ('MetaCons "WithCursor" 'PrefixI 'True) (S1 ('MetaSel ('Just "previousCursor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe cursorType)) :*: (S1 ('MetaSel ('Just "nextCursor") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe cursorType)) :*: S1 ('MetaSel ('Just "contents") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [wrapped]))))

previousCursor :: forall cursorType cursorKey wrapped. Lens' (WithCursor cursorType cursorKey wrapped) (Maybe cursorType) Source #

nextCursor :: forall cursorType cursorKey wrapped. Lens' (WithCursor cursorType cursorKey wrapped) (Maybe cursorType) Source #

contents :: forall cursorType cursorKey a b. Lens (WithCursor cursorType cursorKey a) (WithCursor cursorType cursorKey b) [a] [b] Source #

# Re-exports

data TwitterError Source #

Constructors

FromJSONError String |
TwitterErrorResponse Status ResponseHeaders [TwitterErrorMessage] |
TwitterUnknownErrorResponse Status ResponseHeaders Value |
TwitterStatusError Status ResponseHeaders Value |

#### Instances

Instances details

Exception TwitterError Source # |
Instance details Defined in Web.Twitter.Conduit.Response Methods toException :: TwitterError -> SomeException Source # fromException :: SomeException -> Maybe TwitterError Source # displayException :: TwitterError -> String Source #
Show TwitterError Source # |
Instance details Defined in Web.Twitter.Conduit.Response Methods showsPrec :: Int -> TwitterError -> ShowS Source # show :: TwitterError -> String Source # showList :: [TwitterError] -> ShowS Source #
Eq TwitterError Source # |
Instance details Defined in Web.Twitter.Conduit.Response Methods (==) :: TwitterError -> TwitterError -> Bool Source # (/=) :: TwitterError -> TwitterError -> Bool Source #