google-translate-0.4.1: Google Translate API bindings

Copyright(c) David Johnson 2016
Maintainerdjohnson.m@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Web.Google.Translate

Contents

Description

 

Synopsis

Functions

detect :: Manager -> Key -> Body -> IO (Either ServantError DetectionResponse) #

Detect target language

getLanguages :: Manager -> Key -> Maybe Target -> IO (Either ServantError LanguageResponse) #

Retrieve all languages If Target specified, return langauge name in Target langauge.

translate :: Manager -> Key -> Maybe Source -> Target -> Body -> IO (Either ServantError TranslationResponse) #

Perform translation from Source language to Target langauge. If Source not specified, attempt detection of Lang

API

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))))))) #

Google Translate API

Types

newtype Key #

API Key

Constructors

Key Text 

Instances

newtype Body #

Text for translation

Constructors

Body Text 

data Lang #

Languages for translation

data TranslationResponse #

Translation Reponse

Constructors

TranslationResponse 

Instances

Eq TranslationResponse # 
Ord TranslationResponse # 
Show TranslationResponse # 
Generic TranslationResponse # 
FromJSON TranslationResponse # 
type Rep TranslationResponse # 
type Rep TranslationResponse = D1 (MetaData "TranslationResponse" "Web.Google.Translate" "google-translate-0.4.1-5YA0ziVyKgD9UBwEfTSFHK" False) (C1 (MetaCons "TranslationResponse" PrefixI True) (S1 (MetaSel (Just Symbol "translations") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [Translation])))

data DetectionResponse #

Detection Response

Constructors

DetectionResponse 

Fields

data Language #

Language

Constructors

Language