themoviedb 1.1.2.0 → 1.1.3.0
raw patch · 7 files changed
+41/−32 lines, 7 filesdep ~aesondep ~binarydep ~http-client
Dependency ranges changed: aeson, binary, http-client, http-client-tls, time, transformers
Files
- CHANGES.md +8/−0
- LICENSE +1/−1
- README.md +3/−1
- src/Network/API/TheMovieDB/Internal/Date.hs +4/−5
- src/Network/API/TheMovieDB/Internal/HTTP.hs +4/−4
- src/Network/API/TheMovieDB/Internal/TheMovieDB.hs +4/−4
- themoviedb.cabal +17/−17
CHANGES.md view
@@ -1,5 +1,13 @@ # Version History +## 1.1.3.0 (March 19, 2017)++ - Widen dependencies for LTS-7.20++ - Build with latest Hackage too!++ - Add Travis CI build status for supported versions of GHC+ ## 1.1.2.0 (June 9, 2016) - Widen dependencies for LTS-5.15
LICENSE view
@@ -1,6 +1,6 @@ # Copyright and Authors - Copyright (C) 2012-2016 Peter Jones <pjones@devalot.com>+ Copyright (C) 2012-2017 Peter Jones <pjones@devalot.com> # License (MIT)
README.md view
@@ -1,5 +1,7 @@ # TheMovieDB API for Haskell +[](https://travis-ci.org/pjones/themoviedb)+ This is a simple library that provides functions for retrieving movie metadata from [TheMovieDB][] API. To use this library you need to request an API key from TheMovieDB. Follow the directions on the@@ -12,7 +14,7 @@ See the [Network.API.TheMovieDB][] module for complete documentation. -[Network.API.TheMovieDB]: https://github.com/pjones/themoviedb/blob/master/Network/API/TheMovieDB.hs+[Network.API.TheMovieDB]: https://github.com/pjones/themoviedb/blob/master/src/Network/API/TheMovieDB.hs # Example
src/Network/API/TheMovieDB/Internal/Date.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_GHC -Wwarn #-} -- Kludge to not error out on parseTime deprecation. {-# LANGUAGE OverloadedStrings #-} {-@@ -26,7 +25,7 @@ import Data.Aeson.Types (Parser, typeMismatch) import Data.Text (Text) import qualified Data.Text as T-import Data.Time (Day(..), parseTime)+import Data.Time (Day(..), parseTimeM) import Data.Time.Locale.Compat (defaultTimeLocale) --------------------------------------------------------------------------------@@ -56,7 +55,7 @@ parseJSON Null = return (Date Nothing) parseJSON (String t) | T.null t = return (Date Nothing)- | otherwise = case parseTime defaultTimeLocale "%Y-%m-%d" (T.unpack t) of- Just d -> return $ Date (Just d)- _ -> fail "could not parse TheMovieDB date field"+ | otherwise = do d <- parseTimeM True defaultTimeLocale "%Y-%m-%d" (T.unpack t)+ return $ Date (Just d)+ parseJSON v = typeMismatch "Date" v
src/Network/API/TheMovieDB/Internal/HTTP.hs view
@@ -39,7 +39,7 @@ -- | Build a HTTP request that can be used to access the API. mkAPIRequest :: Key -> Path -> QueryText -> IO HC.Request mkAPIRequest key path params = do- req <- HC.parseUrl (apiBaseURL ++ path)+ req <- HC.parseRequest (apiBaseURL ++ path) return $ req { HC.queryString = query , HC.requestHeaders = headers@@ -57,6 +57,7 @@ request <- mkAPIRequest key path params response <- catch (Right <$> HC.httpLbs request manager) httpError + return $ case response of Left e -> Left e Right r@@ -64,7 +65,6 @@ | otherwise -> Left (ServiceError . show $ HC.responseStatus r) where+ -- This should only be called for non-200 codes now. httpError :: HC.HttpException -> IO (Either Error (HC.Response Body))- httpError e = return $ case e of- HC.StatusCodeException (Status 401 _) _ _ -> Left InvalidKeyError- _ -> Left (HttpExceptionError e)+ httpError _ = return $ Left InvalidKeyError
src/Network/API/TheMovieDB/Internal/TheMovieDB.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_GHC -Wwarn #-} -- Kludge to not error out on withManager deprecation. {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-@@ -30,7 +29,7 @@ import Data.Aeson import Network.API.TheMovieDB.Internal.HTTP import Network.API.TheMovieDB.Internal.Types-import Network.HTTP.Client (Manager, withManager)+import Network.HTTP.Client (Manager, newManager) import Network.HTTP.Client.TLS (tlsManagerSettings) import Network.HTTP.Types @@ -86,8 +85,9 @@ :: Key -- ^ The API key to include in all requests. -> TheMovieDB a -- ^ The API calls to make. -> IO (Either Error a) -- ^ Response or error.-runTheMovieDB k t = -- TODO: replace withManager with newManager.- withManager tlsManagerSettings (\m -> runTheMovieDBWithManager m k t)+runTheMovieDB k t = do m <- newManager tlsManagerSettings+ runTheMovieDBWithManager m k t+ -- No need to closeManager anymore. -------------------------------------------------------------------------------- -- | Execute requests for TheMovieDB with the given API key and produce
themoviedb.cabal view
@@ -1,6 +1,6 @@ -------------------------------------------------------------------------------- name: themoviedb-version: 1.1.2.0+version: 1.1.3.0 synopsis: Haskell API bindings for http://themoviedb.org homepage: http://github.com/pjones/themoviedb bug-reports: http://github.com/pjones/themoviedb/issues@@ -8,10 +8,10 @@ license-file: LICENSE author: Peter Jones <pjones@devalot.com> maintainer: Peter Jones <pjones@devalot.com>-copyright: Copyright: (c) 2012-2015 Peter Jones+copyright: Copyright: (c) 2012-2017 Peter Jones category: Network, API stability: experimental-tested-with: GHC == 7.8.4, GHC == 7.10.1+tested-with: GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1 build-type: Simple cabal-version: >=1.10 description: This library provides functions for retrieving metadata@@ -60,20 +60,20 @@ if flag(maintainer) ghc-options: -Werror - build-depends: aeson >= 0.6 && < 0.10- , base >= 4.6 && < 5.0- , binary >= 0.7 && < 0.8- , bytestring >= 0.9 && < 0.11- , either >= 4.3 && < 4.5- , http-client >= 0.4 && < 0.5- , http-client-tls >= 0.2.2 && < 0.3- , http-types >= 0.8 && < 0.10- , mtl >= 2.1 && < 2.3- , text >= 0.11 && < 1.3- , text-binary >= 0.1 && < 0.3- , time >= 1.2 && < 1.6- , time-locale-compat >= 0.1 && < 0.2- , transformers >= 0.3 && < 0.5+ build-depends: aeson >= 0.6 && < 1.2+ , base >= 4.6 && < 5.0+ , binary >= 0.7 && < 0.10+ , bytestring >= 0.9 && < 0.11+ , either >= 4.3 && < 4.5+ , http-client >= 0.4.31 && < 0.6+ , http-client-tls >= 0.2.2 && < 0.4+ , http-types >= 0.8 && < 0.10+ , mtl >= 2.1 && < 2.3+ , text >= 0.11 && < 1.3+ , text-binary >= 0.1 && < 0.3+ , time >= 1.5 && < 1.9+ , time-locale-compat >= 0.1 && < 0.2+ , transformers >= 0.3 && < 0.6 -------------------------------------------------------------------------------- executable tmdb