Copyright | (c) David Johnson 2016 |
---|---|
Maintainer | djohnson.m@gmail.com |
Stability | experimental |
Portability | POSIX |
Safe Haskell | None |
Language | Haskell2010 |
- detect :: Manager -> Key -> Body -> IO (Either ServantError DetectionResponse)
- getLanguages :: Manager -> Key -> Maybe Target -> IO (Either ServantError LanguageResponse)
- translate :: Manager -> Key -> Maybe Source -> Target -> Body -> IO (Either ServantError TranslationResponse)
- 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)))))))
- api :: Proxy GoogleTranslateAPI
- newtype Key = Key Text
- newtype Source = Source Lang
- newtype Target = Target Lang
- newtype Body = Body Text
- data Lang
- = Afrikaans
- | Albanian
- | Arabic
- | Armenian
- | Azerbaijani
- | Basque
- | Belarusian
- | Bengali
- | Bosnian
- | Bulgarian
- | Catalan
- | Cebuano
- | Chichewa
- | ChineseSimplified
- | ChineseTraditional
- | Croatian
- | Czech
- | Danish
- | Dutch
- | English
- | Esperanto
- | Estonian
- | Filipino
- | Finnish
- | French
- | Galician
- | Georgian
- | German
- | Greek
- | Gujarati
- | HaitianCreole
- | Hausa
- | Hebrew
- | Hindi
- | Hmong
- | Hungarian
- | Icelandic
- | Igbo
- | Indonesian
- | Irish
- | Italian
- | Japanese
- | Javanese
- | Kannada
- | Kazakh
- | Khmer
- | Korean
- | Lao
- | Latin
- | Latvian
- | Lithuanian
- | Macedonian
- | Malagasy
- | Malay
- | Malayalam
- | Maltese
- | Maori
- | Marathi
- | Mongolian
- | MyanmarBurmese
- | Nepali
- | Norwegian
- | Persian
- | Polish
- | Portuguese
- | Punjabi
- | Romanian
- | Russian
- | Serbian
- | Sesotho
- | Sinhala
- | Slovak
- | Slovenian
- | Somali
- | Spanish
- | Sundanese
- | Swahili
- | Swedish
- | Tajik
- | Tamil
- | Telugu
- | Thai
- | Turkish
- | Ukrainian
- | Urdu
- | Uzbek
- | Vietnamese
- | Welsh
- | Yiddish
- | Yoruba
- | Zulu
- newtype Confidence = Confidence Double
- newtype IsReliable = IsReliable Bool
- newtype TranslatedText = TranslatedText Text
- data TranslationResponse = TranslationResponse {
- translations :: [Translation]
- data Translation = Translation {}
- data DetectionResponse = DetectionResponse {
- detections :: [[Detection]]
- data Detection = Detection {}
- data LanguageResponse = LanguageResponse {}
- newtype LanguageName = LanguageName Text
- data Language = Language {
- lang :: Lang
- name :: Maybe LanguageName
Functions
detect :: Manager -> Key -> Body -> IO (Either ServantError DetectionResponse) Source #
Detect target language
getLanguages :: Manager -> Key -> Maybe Target -> IO (Either ServantError LanguageResponse) Source #
translate :: Manager -> Key -> Maybe Source -> Target -> Body -> IO (Either ServantError TranslationResponse) Source #
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
api :: Proxy GoogleTranslateAPI Source #
API type
Types
API Key
Source Language
Target Language
Text for translation
Languages for translation
newtype Confidence Source #
Confidence
newtype IsReliable Source #
IsReliable
newtype TranslatedText Source #
Translated Text
data TranslationResponse Source #
Translation Reponse
data Translation Source #
Translation
Detection
data LanguageResponse Source #
Language Response
newtype LanguageName Source #
Language Name