-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Giphy HTTP API wrapper and CLI search tool.
--   
--   Please see README.md
@package giphy-api
@version 0.5.2.0


-- | Provides a Giphy monad that can be used to issue selected API calls
--   under a selected API key.
--   
--   <pre>
--   import qualified Web.Giphy as Giphy
--   
--   let apiKey = Giphy.<a>Key</a> "dc6zaTOxFJmzC"
--   let config = Giphy.<a>GiphyConfig</a> apiKey
--   resp &lt;- Giphy.<a>runGiphy</a> (Giphy.<a>search</a> $ Giphy.<tt>query</tt> "puppies") config
--   let fstUrl = resp ^? _Right
--                      . Giphy.<a>searchItems</a>
--                      . _head
--                      . Giphy.<a>gifImages</a>
--                      . at "original"
--                      . traverse
--                      . Giphy.<a>imageUrl</a>
--                      . traverse
--   print fstUrl
--   </pre>
module Web.Giphy

-- | The API Key. See <a>https://github.com/Giphy/GiphyAPI</a>
newtype Key
Key :: Text -> Key

-- | A search query.
newtype Query
Query :: Text -> Query

-- | A phrase or term used for translation.
newtype Phrase
Phrase :: Text -> Phrase

-- | A tag to retrieve a random GIF for.
newtype Tag
Tag :: Text -> Tag

-- | Metadata about pagination in a response.
data Pagination
Pagination :: Int -> Int -> Int -> Pagination
[_paginationTotalCount] :: Pagination -> Int
[_paginationCount] :: Pagination -> Int
[_paginationOffset] :: Pagination -> Int

-- | A unique gif identifier.
newtype GifId
GifId :: Text -> GifId

-- | A search response item.
data Gif
Gif :: Text -> Text -> URI -> ImageMap -> Gif
[_gifId] :: Gif -> Text
[_gifSlug] :: Gif -> Text
[_gifUrl] :: Gif -> URI
[_gifImages] :: Gif -> ImageMap

-- | An image contained in a Giphy response.
data Image
Image :: Maybe URI -> Maybe Int -> Maybe URI -> Maybe Int -> Maybe URI -> Maybe Int -> Maybe Int -> Maybe Int -> Image
[_imageUrl] :: Image -> Maybe URI
[_imageSize] :: Image -> Maybe Int
[_imageMp4Url] :: Image -> Maybe URI
[_imageMp4Size] :: Image -> Maybe Int
[_imageWebpUrl] :: Image -> Maybe URI
[_imageWebpSize] :: Image -> Maybe Int
[_imageWidth] :: Image -> Maybe Int
[_imageHeight] :: Image -> Maybe Int

-- | Mapping from a <a>Text</a> identifier to an <a>Image</a>.
type ImageMap = Map Text Image

-- | Offset for paginated requests.
newtype PaginationOffset
PaginationOffset :: Int -> PaginationOffset

-- | A collection of GIFs as part of a search response.
data SearchResponse
SearchResponse :: [Gif] -> Pagination -> SearchResponse
[_searchItems] :: SearchResponse -> [Gif]
[_searchPagination] :: SearchResponse -> Pagination

-- | A single gif as part of a response.
newtype SingleGifResponse
SingleGifResponse :: Gif -> SingleGifResponse
[_singleGifItem] :: SingleGifResponse -> Gif

-- | A single GIF as part of a translate response.
newtype TranslateResponse
TranslateResponse :: Gif -> TranslateResponse
[_translateItem] :: TranslateResponse -> Gif

-- | A single gif as part of a response.
newtype RandomResponse
RandomResponse :: Gif -> RandomResponse
[_randomGifItem] :: RandomResponse -> Gif

-- | Contains the key to access the API.
newtype GiphyConfig
GiphyConfig :: Key -> GiphyConfig
[configApiKey] :: GiphyConfig -> Key

-- | The Giphy monad contains the execution context.
type Giphy = ReaderT GiphyContext ClientM

-- | You need to provide a <a>GiphyConfig</a> to lift a <a>Giphy</a>
--   computation into <a>MonadIO</a>.
runGiphy :: MonadIO m => Giphy a -> GiphyConfig -> m (Either ServantError a)

-- | Same as <a>runGiphy</a> but accepts an explicit <a>Manager</a> instead
--   of implicitly creating one for you.
runGiphy' :: MonadIO m => Manager -> Giphy a -> GiphyConfig -> m (Either ServantError a)
gifId :: Lens' Gif Text
gifImages :: Lens' Gif ImageMap
gifSlug :: Lens' Gif Text
gifUrl :: Lens' Gif URI
imageHeight :: Lens' Image (Maybe Int)
imageUrl :: Lens' Image (Maybe URI)
imageSize :: Lens' Image (Maybe Int)
imageWidth :: Lens' Image (Maybe Int)
imageMp4Url :: Lens' Image (Maybe URI)
imageMp4Size :: Lens' Image (Maybe Int)
imageWebpUrl :: Lens' Image (Maybe URI)
imageWebpSize :: Lens' Image (Maybe Int)
paginationCount :: Lens' Pagination Int
paginationOffset :: Lens' Pagination Int
paginationTotalCount :: Lens' Pagination Int
searchItems :: Lens' SearchResponse [Gif]
searchPagination :: Lens' SearchResponse Pagination
singleGifItem :: Lens' SingleGifResponse Gif
translateItem :: Lens' TranslateResponse Gif
randomGifItem :: Lens' RandomResponse Gif

-- | Issue a search request for the given query without specifying an
--   offset. E.g.
--   <a>https://api.giphy.com/v1/gifs/search?q=funny+cat&amp;api_key=dc6zaTOxFJmzC</a>
search :: Query -> Giphy SearchResponse

-- | Issue a search request for the given query by specifying a pagination
--   offset. E.g.
--   <a>https://api.giphy.com/v1/gifs/search?q=funny+cat&amp;api_key=dc6zaTOxFJmzC&amp;offset=25</a>
searchOffset :: Query -> PaginationOffset -> Giphy SearchResponse

-- | Issue a translate request for a given phrase or term. E.g.
--   <a>https://api.giphy.com/v1/gifs/translate?s=superman&amp;api_key=dc6zaTOxFJmzC</a>
translate :: Phrase -> Giphy TranslateResponse

-- | Issue a request for a single GIF identified by its <a>GifId</a>. E.g.
--   <a>https://api.giphy.com/v1/gifs/feqkVgjJpYtjy?api_key=dc6zaTOxFJmzC</a>
gif :: GifId -> Giphy SingleGifResponse

-- | Issue a request for a random GIF for the given (optional) tag. E.g.
--   <a>https://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&amp;tag=american+psycho</a>
random :: Maybe Tag -> Giphy RandomResponse
instance GHC.Classes.Eq Web.Giphy.GiphyConfig
instance GHC.Show.Show Web.Giphy.GiphyConfig
instance Data.Aeson.Types.FromJSON.FromJSON Web.Giphy.RandomResponse
instance GHC.Generics.Generic Web.Giphy.RandomResponse
instance GHC.Classes.Ord Web.Giphy.RandomResponse
instance GHC.Classes.Eq Web.Giphy.RandomResponse
instance GHC.Show.Show Web.Giphy.RandomResponse
instance Data.Aeson.Types.FromJSON.FromJSON Web.Giphy.SingleGifResponse
instance GHC.Generics.Generic Web.Giphy.SingleGifResponse
instance GHC.Classes.Ord Web.Giphy.SingleGifResponse
instance GHC.Classes.Eq Web.Giphy.SingleGifResponse
instance GHC.Show.Show Web.Giphy.SingleGifResponse
instance Data.Aeson.Types.FromJSON.FromJSON Web.Giphy.TranslateResponse
instance GHC.Generics.Generic Web.Giphy.TranslateResponse
instance GHC.Classes.Ord Web.Giphy.TranslateResponse
instance GHC.Classes.Eq Web.Giphy.TranslateResponse
instance GHC.Show.Show Web.Giphy.TranslateResponse
instance Data.Aeson.Types.FromJSON.FromJSON Web.Giphy.SearchResponse
instance GHC.Generics.Generic Web.Giphy.SearchResponse
instance GHC.Classes.Ord Web.Giphy.SearchResponse
instance GHC.Classes.Eq Web.Giphy.SearchResponse
instance GHC.Show.Show Web.Giphy.SearchResponse
instance Data.Aeson.Types.FromJSON.FromJSON Web.Giphy.Pagination
instance GHC.Generics.Generic Web.Giphy.Pagination
instance GHC.Classes.Ord Web.Giphy.Pagination
instance GHC.Classes.Eq Web.Giphy.Pagination
instance GHC.Show.Show Web.Giphy.Pagination
instance Data.Aeson.Types.FromJSON.FromJSON Web.Giphy.Gif
instance GHC.Generics.Generic Web.Giphy.Gif
instance GHC.Classes.Ord Web.Giphy.Gif
instance GHC.Classes.Eq Web.Giphy.Gif
instance GHC.Show.Show Web.Giphy.Gif
instance Data.Aeson.Types.FromJSON.FromJSON Web.Giphy.Image
instance GHC.Generics.Generic Web.Giphy.Image
instance GHC.Classes.Ord Web.Giphy.Image
instance GHC.Classes.Eq Web.Giphy.Image
instance GHC.Show.Show Web.Giphy.Image
instance GHC.Classes.Eq Web.Giphy.PaginationOffset
instance GHC.Show.Show Web.Giphy.PaginationOffset
instance Web.Internal.HttpApiData.FromHttpApiData Web.Giphy.PaginationOffset
instance Web.Internal.HttpApiData.ToHttpApiData Web.Giphy.PaginationOffset
instance GHC.Classes.Eq Web.Giphy.GifId
instance GHC.Show.Show Web.Giphy.GifId
instance Web.Internal.HttpApiData.FromHttpApiData Web.Giphy.GifId
instance Web.Internal.HttpApiData.ToHttpApiData Web.Giphy.GifId
instance GHC.Classes.Eq Web.Giphy.Tag
instance GHC.Show.Show Web.Giphy.Tag
instance Web.Internal.HttpApiData.FromHttpApiData Web.Giphy.Tag
instance Web.Internal.HttpApiData.ToHttpApiData Web.Giphy.Tag
instance GHC.Classes.Eq Web.Giphy.Phrase
instance GHC.Show.Show Web.Giphy.Phrase
instance Web.Internal.HttpApiData.FromHttpApiData Web.Giphy.Phrase
instance Web.Internal.HttpApiData.ToHttpApiData Web.Giphy.Phrase
instance GHC.Classes.Eq Web.Giphy.Query
instance GHC.Show.Show Web.Giphy.Query
instance Web.Internal.HttpApiData.FromHttpApiData Web.Giphy.Query
instance Web.Internal.HttpApiData.ToHttpApiData Web.Giphy.Query
instance GHC.Classes.Eq Web.Giphy.Key
instance GHC.Show.Show Web.Giphy.Key
instance Web.Internal.HttpApiData.FromHttpApiData Web.Giphy.Key
instance Web.Internal.HttpApiData.ToHttpApiData Web.Giphy.Key
