google-translate-0.5: Google Translate API bindings

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

Web.Google.Translate

Contents

Description

 

Synopsis

Functions

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

Detect target language

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

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

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

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

Google Translate API

Types

newtype Key Source #

API Key

Constructors

Key Text 

data Lang Source #

Languages for translation

data TranslationResponse Source #

Translation Reponse

Constructors

TranslationResponse 

Instances

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

data Translation Source #

Translation

data DetectionResponse Source #

Detection Response

Constructors

DetectionResponse 

Fields

data Detection Source #

Detection

data LanguageResponse Source #

Language Response

Constructors

LanguageResponse 

Fields