giphy-api- Giphy HTTP API wrapper and CLI search tool.

Safe HaskellNone




Provides a Giphy monad that can be used to issue selected API calls under a selected API key.

import qualified Web.Giphy as Giphy

let apiKey = Giphy.Key "dc6zaTOxFJmzC"
let config = Giphy.GiphyConfig apiKey
resp <- Giphy.runGiphy ( $ Giphy.query "puppies") config
let fstUrl = resp ^? _Right
                   . Giphy.searchItems
                   . _head
                   . Giphy.gifImages
                   . at "original"
                   . traverse
                   . Giphy.imageUrl
                   . traverse
print fstUrl


Request Data Types

These data types are used to encapsulate otherwise weakly typed arguments.

newtype Query Source

A search query.


Query Text 

newtype Phrase Source

A phrase or term used for translation.


Phrase Text 

newtype Tag Source

A tag to retrieve a random GIF for.


Tag Text 

Response Data Types

These data types contain are the parsed JSON responses from the Giphy API.

data Gif Source

A search response item.



type ImageMap = Map Text Image Source

Mapping from a Text identifier to an Image.

Giphy Monad

Use runGiphy to lift the Giphy monad into IO.

data GiphyConfig Source

Contains the key to access the API.




configApiKey :: Key

type Giphy = ReaderT GiphyConfig (EitherT ServantError IO) Source

The Giphy monad contains the execution context.

runGiphy :: MonadIO m => Giphy a -> GiphyConfig -> m (Either ServantError a) Source

You need to provide a GiphyConfig to lift a Giphy computation into MonadIO.


You can use these lenses if you prefer them to manually accessing record fields.

API calls

Functions that directly access the Giphy API. All these functions run in the Giphy monad.

search :: Query -> Giphy SearchResponse Source

Issue a search request for the given query without specifying an offset. E.g.

searchOffset :: Query -> PaginationOffset -> Giphy SearchResponse Source

Issue a search request for the given query by specifying a pagination offset. E.g.

gif :: GifId -> Giphy SingleGifResponse Source

Issue a request for a single GIF identified by its GifId. E.g.

random :: Maybe Tag -> Giphy RandomResponse Source

Issue a request for a random GIF for the given (optional) tag. E.g.