google-translate 0.1.0.1 → 0.1.1.1
raw patch · 2 files changed
+15/−8 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Web.Google.Translate: api :: Proxy GoogleTranslateAPI
+ Web.Google.Translate: type GoogleTranslateAPI = ("language" :> ("translate" :> ("v2" :> (QueryParam "key" Key :> (QueryParam "source" Source :> (QueryParam "target" Target :> (QueryParam "q" Body :> Get '[JSON] TranslationResponse))))))) :<|> (("language" :> ("translate" :> ("v2" :> ("detect" :> (QueryParam "key" Key :> (QueryParam "q" Body :> Get '[JSON] DetectionResponse)))))) :<|> ("language" :> ("translate" :> ("v2" :> ("languages" :> (QueryParam "key" Key :> (QueryParam "target" Target :> Get '[JSON] LanguageResponse)))))))
Files
- google-translate.cabal +1/−1
- src/Web/Google/Translate.hs +14/−7
google-translate.cabal view
@@ -1,5 +1,5 @@ name: google-translate-version: 0.1.0.1+version: 0.1.1.1 synopsis: Google Translate API bindings license: BSD3 license-file: LICENSE
src/Web/Google/Translate.hs view
@@ -1,3 +1,7 @@+{-# LANGUAGE PolyKinds #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE KindSignatures #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-}@@ -17,6 +21,9 @@ detect , getLanguages , translate+ -- * API+ , GoogleTranslateAPI+ , api -- * Types , Key (..) , Source (..)@@ -39,10 +46,12 @@ import Control.Monad.Trans.Either import Data.Aeson import Data.Aeson.Types+import Data.Maybe import Data.Proxy import Data.Text (Text) import qualified Data.Text as T import GHC.Generics+import GHC.TypeLits import Servant.API import Servant.Client ------------------------------------------------------------------------------@@ -84,7 +93,7 @@ ------------------------------------------------------------------------------ instance FromJSON Translation --------------------------------------------------------------------------------- | Deletion Response+-- | Detection Response data DetectionResponse = DetectionResponse { detections :: [ [Detection] ] } deriving (Show, Eq, Ord, Generic)@@ -132,7 +141,7 @@ newtype LanguageName = LanguageName Text deriving (Show, Eq, Ord, FromJSON) ------------------------------------------------------------------------------ -- | Google Translate API-type API = "language"+type GoogleTranslateAPI = "language" :> "translate" :> "v2" :> QueryParam "key" Key@@ -140,16 +149,14 @@ :> QueryParam "target" Target :> QueryParam "q" Body :> Get '[JSON] TranslationResponse- :<|>- "language"+ :<|> "language" :> "translate" :> "v2" :> "detect" :> QueryParam "key" Key :> QueryParam "q" Body :> Get '[JSON] DetectionResponse- :<|>- "language"+ :<|> "language" :> "translate" :> "v2" :> "languages"@@ -157,7 +164,7 @@ :> QueryParam "target" Target :> Get '[JSON] LanguageResponse -------------------------------------------------------------------------------api :: Proxy API+api :: Proxy GoogleTranslateAPI api = Proxy ------------------------------------------------------------------------------ translate'