{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Translate.TranslateText
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Translates input text from the source language to the target language.
-- For a list of available languages and language codes, see
-- what-is-languages.
module Amazonka.Translate.TranslateText
  ( -- * Creating a Request
    TranslateText (..),
    newTranslateText,

    -- * Request Lenses
    translateText_terminologyNames,
    translateText_text,
    translateText_sourceLanguageCode,
    translateText_targetLanguageCode,

    -- * Destructuring the Response
    TranslateTextResponse (..),
    newTranslateTextResponse,

    -- * Response Lenses
    translateTextResponse_appliedTerminologies,
    translateTextResponse_httpStatus,
    translateTextResponse_translatedText,
    translateTextResponse_sourceLanguageCode,
    translateTextResponse_targetLanguageCode,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Translate.Types

-- | /See:/ 'newTranslateText' smart constructor.
data TranslateText = TranslateText'
  { -- | The name of the terminology list file to be used in the TranslateText
    -- request. You can use 1 terminology list at most in a @TranslateText@
    -- request. Terminology lists can contain a maximum of 256 terms.
    TranslateText -> Maybe [Text]
terminologyNames :: Prelude.Maybe [Prelude.Text],
    -- | The text to translate. The text string can be a maximum of 5,000 bytes
    -- long. Depending on your character set, this may be fewer than 5,000
    -- characters.
    TranslateText -> Text
text :: Prelude.Text,
    -- | The language code for the language of the source text. The language must
    -- be a language supported by Amazon Translate. For a list of language
    -- codes, see what-is-languages.
    --
    -- To have Amazon Translate determine the source language of your text, you
    -- can specify @auto@ in the @SourceLanguageCode@ field. If you specify
    -- @auto@, Amazon Translate will call
    -- <https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-general.html Amazon Comprehend>
    -- to determine the source language.
    TranslateText -> Text
sourceLanguageCode :: Prelude.Text,
    -- | The language code requested for the language of the target text. The
    -- language must be a language supported by Amazon Translate.
    TranslateText -> Text
targetLanguageCode :: Prelude.Text
  }
  deriving (TranslateText -> TranslateText -> Bool
(TranslateText -> TranslateText -> Bool)
-> (TranslateText -> TranslateText -> Bool) -> Eq TranslateText
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TranslateText -> TranslateText -> Bool
$c/= :: TranslateText -> TranslateText -> Bool
== :: TranslateText -> TranslateText -> Bool
$c== :: TranslateText -> TranslateText -> Bool
Prelude.Eq, ReadPrec [TranslateText]
ReadPrec TranslateText
Int -> ReadS TranslateText
ReadS [TranslateText]
(Int -> ReadS TranslateText)
-> ReadS [TranslateText]
-> ReadPrec TranslateText
-> ReadPrec [TranslateText]
-> Read TranslateText
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TranslateText]
$creadListPrec :: ReadPrec [TranslateText]
readPrec :: ReadPrec TranslateText
$creadPrec :: ReadPrec TranslateText
readList :: ReadS [TranslateText]
$creadList :: ReadS [TranslateText]
readsPrec :: Int -> ReadS TranslateText
$creadsPrec :: Int -> ReadS TranslateText
Prelude.Read, Int -> TranslateText -> ShowS
[TranslateText] -> ShowS
TranslateText -> String
(Int -> TranslateText -> ShowS)
-> (TranslateText -> String)
-> ([TranslateText] -> ShowS)
-> Show TranslateText
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TranslateText] -> ShowS
$cshowList :: [TranslateText] -> ShowS
show :: TranslateText -> String
$cshow :: TranslateText -> String
showsPrec :: Int -> TranslateText -> ShowS
$cshowsPrec :: Int -> TranslateText -> ShowS
Prelude.Show, (forall x. TranslateText -> Rep TranslateText x)
-> (forall x. Rep TranslateText x -> TranslateText)
-> Generic TranslateText
forall x. Rep TranslateText x -> TranslateText
forall x. TranslateText -> Rep TranslateText x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TranslateText x -> TranslateText
$cfrom :: forall x. TranslateText -> Rep TranslateText x
Prelude.Generic)

-- |
-- Create a value of 'TranslateText' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'terminologyNames', 'translateText_terminologyNames' - The name of the terminology list file to be used in the TranslateText
-- request. You can use 1 terminology list at most in a @TranslateText@
-- request. Terminology lists can contain a maximum of 256 terms.
--
-- 'text', 'translateText_text' - The text to translate. The text string can be a maximum of 5,000 bytes
-- long. Depending on your character set, this may be fewer than 5,000
-- characters.
--
-- 'sourceLanguageCode', 'translateText_sourceLanguageCode' - The language code for the language of the source text. The language must
-- be a language supported by Amazon Translate. For a list of language
-- codes, see what-is-languages.
--
-- To have Amazon Translate determine the source language of your text, you
-- can specify @auto@ in the @SourceLanguageCode@ field. If you specify
-- @auto@, Amazon Translate will call
-- <https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-general.html Amazon Comprehend>
-- to determine the source language.
--
-- 'targetLanguageCode', 'translateText_targetLanguageCode' - The language code requested for the language of the target text. The
-- language must be a language supported by Amazon Translate.
newTranslateText ::
  -- | 'text'
  Prelude.Text ->
  -- | 'sourceLanguageCode'
  Prelude.Text ->
  -- | 'targetLanguageCode'
  Prelude.Text ->
  TranslateText
newTranslateText :: Text -> Text -> Text -> TranslateText
newTranslateText
  Text
pText_
  Text
pSourceLanguageCode_
  Text
pTargetLanguageCode_ =
    TranslateText' :: Maybe [Text] -> Text -> Text -> Text -> TranslateText
TranslateText'
      { $sel:terminologyNames:TranslateText' :: Maybe [Text]
terminologyNames = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
        $sel:text:TranslateText' :: Text
text = Text
pText_,
        $sel:sourceLanguageCode:TranslateText' :: Text
sourceLanguageCode = Text
pSourceLanguageCode_,
        $sel:targetLanguageCode:TranslateText' :: Text
targetLanguageCode = Text
pTargetLanguageCode_
      }

-- | The name of the terminology list file to be used in the TranslateText
-- request. You can use 1 terminology list at most in a @TranslateText@
-- request. Terminology lists can contain a maximum of 256 terms.
translateText_terminologyNames :: Lens.Lens' TranslateText (Prelude.Maybe [Prelude.Text])
translateText_terminologyNames :: (Maybe [Text] -> f (Maybe [Text]))
-> TranslateText -> f TranslateText
translateText_terminologyNames = (TranslateText -> Maybe [Text])
-> (TranslateText -> Maybe [Text] -> TranslateText)
-> Lens TranslateText TranslateText (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TranslateText' {Maybe [Text]
terminologyNames :: Maybe [Text]
$sel:terminologyNames:TranslateText' :: TranslateText -> Maybe [Text]
terminologyNames} -> Maybe [Text]
terminologyNames) (\s :: TranslateText
s@TranslateText' {} Maybe [Text]
a -> TranslateText
s {$sel:terminologyNames:TranslateText' :: Maybe [Text]
terminologyNames = Maybe [Text]
a} :: TranslateText) ((Maybe [Text] -> f (Maybe [Text]))
 -> TranslateText -> f TranslateText)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> TranslateText
-> f TranslateText
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The text to translate. The text string can be a maximum of 5,000 bytes
-- long. Depending on your character set, this may be fewer than 5,000
-- characters.
translateText_text :: Lens.Lens' TranslateText Prelude.Text
translateText_text :: (Text -> f Text) -> TranslateText -> f TranslateText
translateText_text = (TranslateText -> Text)
-> (TranslateText -> Text -> TranslateText)
-> Lens TranslateText TranslateText Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TranslateText' {Text
text :: Text
$sel:text:TranslateText' :: TranslateText -> Text
text} -> Text
text) (\s :: TranslateText
s@TranslateText' {} Text
a -> TranslateText
s {$sel:text:TranslateText' :: Text
text = Text
a} :: TranslateText)

-- | The language code for the language of the source text. The language must
-- be a language supported by Amazon Translate. For a list of language
-- codes, see what-is-languages.
--
-- To have Amazon Translate determine the source language of your text, you
-- can specify @auto@ in the @SourceLanguageCode@ field. If you specify
-- @auto@, Amazon Translate will call
-- <https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-general.html Amazon Comprehend>
-- to determine the source language.
translateText_sourceLanguageCode :: Lens.Lens' TranslateText Prelude.Text
translateText_sourceLanguageCode :: (Text -> f Text) -> TranslateText -> f TranslateText
translateText_sourceLanguageCode = (TranslateText -> Text)
-> (TranslateText -> Text -> TranslateText)
-> Lens TranslateText TranslateText Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TranslateText' {Text
sourceLanguageCode :: Text
$sel:sourceLanguageCode:TranslateText' :: TranslateText -> Text
sourceLanguageCode} -> Text
sourceLanguageCode) (\s :: TranslateText
s@TranslateText' {} Text
a -> TranslateText
s {$sel:sourceLanguageCode:TranslateText' :: Text
sourceLanguageCode = Text
a} :: TranslateText)

-- | The language code requested for the language of the target text. The
-- language must be a language supported by Amazon Translate.
translateText_targetLanguageCode :: Lens.Lens' TranslateText Prelude.Text
translateText_targetLanguageCode :: (Text -> f Text) -> TranslateText -> f TranslateText
translateText_targetLanguageCode = (TranslateText -> Text)
-> (TranslateText -> Text -> TranslateText)
-> Lens TranslateText TranslateText Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TranslateText' {Text
targetLanguageCode :: Text
$sel:targetLanguageCode:TranslateText' :: TranslateText -> Text
targetLanguageCode} -> Text
targetLanguageCode) (\s :: TranslateText
s@TranslateText' {} Text
a -> TranslateText
s {$sel:targetLanguageCode:TranslateText' :: Text
targetLanguageCode = Text
a} :: TranslateText)

instance Core.AWSRequest TranslateText where
  type
    AWSResponse TranslateText =
      TranslateTextResponse
  request :: TranslateText -> Request TranslateText
request = Service -> TranslateText -> Request TranslateText
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy TranslateText
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TranslateText)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse TranslateText))
-> Logger
-> Service
-> Proxy TranslateText
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse TranslateText)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [AppliedTerminology]
-> Int -> Text -> Text -> Text -> TranslateTextResponse
TranslateTextResponse'
            (Maybe [AppliedTerminology]
 -> Int -> Text -> Text -> Text -> TranslateTextResponse)
-> Either String (Maybe [AppliedTerminology])
-> Either
     String (Int -> Text -> Text -> Text -> TranslateTextResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [AppliedTerminology]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"AppliedTerminologies"
                            Either String (Maybe (Maybe [AppliedTerminology]))
-> Maybe [AppliedTerminology]
-> Either String (Maybe [AppliedTerminology])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [AppliedTerminology]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either
  String (Int -> Text -> Text -> Text -> TranslateTextResponse)
-> Either String Int
-> Either String (Text -> Text -> Text -> TranslateTextResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String (Text -> Text -> Text -> TranslateTextResponse)
-> Either String Text
-> Either String (Text -> Text -> TranslateTextResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"TranslatedText")
            Either String (Text -> Text -> TranslateTextResponse)
-> Either String Text
-> Either String (Text -> TranslateTextResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"SourceLanguageCode")
            Either String (Text -> TranslateTextResponse)
-> Either String Text -> Either String TranslateTextResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"TargetLanguageCode")
      )

instance Prelude.Hashable TranslateText

instance Prelude.NFData TranslateText

instance Core.ToHeaders TranslateText where
  toHeaders :: TranslateText -> ResponseHeaders
toHeaders =
    ResponseHeaders -> TranslateText -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSShineFrontendService_20170701.TranslateText" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON TranslateText where
  toJSON :: TranslateText -> Value
toJSON TranslateText' {Maybe [Text]
Text
targetLanguageCode :: Text
sourceLanguageCode :: Text
text :: Text
terminologyNames :: Maybe [Text]
$sel:targetLanguageCode:TranslateText' :: TranslateText -> Text
$sel:sourceLanguageCode:TranslateText' :: TranslateText -> Text
$sel:text:TranslateText' :: TranslateText -> Text
$sel:terminologyNames:TranslateText' :: TranslateText -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"TerminologyNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
terminologyNames,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Text" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
text),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SourceLanguageCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
sourceLanguageCode),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"TargetLanguageCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
targetLanguageCode)
          ]
      )

instance Core.ToPath TranslateText where
  toPath :: TranslateText -> ByteString
toPath = ByteString -> TranslateText -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery TranslateText where
  toQuery :: TranslateText -> QueryString
toQuery = QueryString -> TranslateText -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newTranslateTextResponse' smart constructor.
data TranslateTextResponse = TranslateTextResponse'
  { -- | The names of the custom terminologies applied to the input text by
    -- Amazon Translate for the translated text response.
    TranslateTextResponse -> Maybe [AppliedTerminology]
appliedTerminologies :: Prelude.Maybe [AppliedTerminology],
    -- | The response's http status code.
    TranslateTextResponse -> Int
httpStatus :: Prelude.Int,
    -- | The translated text.
    TranslateTextResponse -> Text
translatedText :: Prelude.Text,
    -- | The language code for the language of the source text.
    TranslateTextResponse -> Text
sourceLanguageCode :: Prelude.Text,
    -- | The language code for the language of the target text.
    TranslateTextResponse -> Text
targetLanguageCode :: Prelude.Text
  }
  deriving (TranslateTextResponse -> TranslateTextResponse -> Bool
(TranslateTextResponse -> TranslateTextResponse -> Bool)
-> (TranslateTextResponse -> TranslateTextResponse -> Bool)
-> Eq TranslateTextResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TranslateTextResponse -> TranslateTextResponse -> Bool
$c/= :: TranslateTextResponse -> TranslateTextResponse -> Bool
== :: TranslateTextResponse -> TranslateTextResponse -> Bool
$c== :: TranslateTextResponse -> TranslateTextResponse -> Bool
Prelude.Eq, ReadPrec [TranslateTextResponse]
ReadPrec TranslateTextResponse
Int -> ReadS TranslateTextResponse
ReadS [TranslateTextResponse]
(Int -> ReadS TranslateTextResponse)
-> ReadS [TranslateTextResponse]
-> ReadPrec TranslateTextResponse
-> ReadPrec [TranslateTextResponse]
-> Read TranslateTextResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TranslateTextResponse]
$creadListPrec :: ReadPrec [TranslateTextResponse]
readPrec :: ReadPrec TranslateTextResponse
$creadPrec :: ReadPrec TranslateTextResponse
readList :: ReadS [TranslateTextResponse]
$creadList :: ReadS [TranslateTextResponse]
readsPrec :: Int -> ReadS TranslateTextResponse
$creadsPrec :: Int -> ReadS TranslateTextResponse
Prelude.Read, Int -> TranslateTextResponse -> ShowS
[TranslateTextResponse] -> ShowS
TranslateTextResponse -> String
(Int -> TranslateTextResponse -> ShowS)
-> (TranslateTextResponse -> String)
-> ([TranslateTextResponse] -> ShowS)
-> Show TranslateTextResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TranslateTextResponse] -> ShowS
$cshowList :: [TranslateTextResponse] -> ShowS
show :: TranslateTextResponse -> String
$cshow :: TranslateTextResponse -> String
showsPrec :: Int -> TranslateTextResponse -> ShowS
$cshowsPrec :: Int -> TranslateTextResponse -> ShowS
Prelude.Show, (forall x. TranslateTextResponse -> Rep TranslateTextResponse x)
-> (forall x. Rep TranslateTextResponse x -> TranslateTextResponse)
-> Generic TranslateTextResponse
forall x. Rep TranslateTextResponse x -> TranslateTextResponse
forall x. TranslateTextResponse -> Rep TranslateTextResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TranslateTextResponse x -> TranslateTextResponse
$cfrom :: forall x. TranslateTextResponse -> Rep TranslateTextResponse x
Prelude.Generic)

-- |
-- Create a value of 'TranslateTextResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'appliedTerminologies', 'translateTextResponse_appliedTerminologies' - The names of the custom terminologies applied to the input text by
-- Amazon Translate for the translated text response.
--
-- 'httpStatus', 'translateTextResponse_httpStatus' - The response's http status code.
--
-- 'translatedText', 'translateTextResponse_translatedText' - The translated text.
--
-- 'sourceLanguageCode', 'translateTextResponse_sourceLanguageCode' - The language code for the language of the source text.
--
-- 'targetLanguageCode', 'translateTextResponse_targetLanguageCode' - The language code for the language of the target text.
newTranslateTextResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'translatedText'
  Prelude.Text ->
  -- | 'sourceLanguageCode'
  Prelude.Text ->
  -- | 'targetLanguageCode'
  Prelude.Text ->
  TranslateTextResponse
newTranslateTextResponse :: Int -> Text -> Text -> Text -> TranslateTextResponse
newTranslateTextResponse
  Int
pHttpStatus_
  Text
pTranslatedText_
  Text
pSourceLanguageCode_
  Text
pTargetLanguageCode_ =
    TranslateTextResponse' :: Maybe [AppliedTerminology]
-> Int -> Text -> Text -> Text -> TranslateTextResponse
TranslateTextResponse'
      { $sel:appliedTerminologies:TranslateTextResponse' :: Maybe [AppliedTerminology]
appliedTerminologies =
          Maybe [AppliedTerminology]
forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:TranslateTextResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:translatedText:TranslateTextResponse' :: Text
translatedText = Text
pTranslatedText_,
        $sel:sourceLanguageCode:TranslateTextResponse' :: Text
sourceLanguageCode = Text
pSourceLanguageCode_,
        $sel:targetLanguageCode:TranslateTextResponse' :: Text
targetLanguageCode = Text
pTargetLanguageCode_
      }

-- | The names of the custom terminologies applied to the input text by
-- Amazon Translate for the translated text response.
translateTextResponse_appliedTerminologies :: Lens.Lens' TranslateTextResponse (Prelude.Maybe [AppliedTerminology])
translateTextResponse_appliedTerminologies :: (Maybe [AppliedTerminology] -> f (Maybe [AppliedTerminology]))
-> TranslateTextResponse -> f TranslateTextResponse
translateTextResponse_appliedTerminologies = (TranslateTextResponse -> Maybe [AppliedTerminology])
-> (TranslateTextResponse
    -> Maybe [AppliedTerminology] -> TranslateTextResponse)
-> Lens
     TranslateTextResponse
     TranslateTextResponse
     (Maybe [AppliedTerminology])
     (Maybe [AppliedTerminology])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TranslateTextResponse' {Maybe [AppliedTerminology]
appliedTerminologies :: Maybe [AppliedTerminology]
$sel:appliedTerminologies:TranslateTextResponse' :: TranslateTextResponse -> Maybe [AppliedTerminology]
appliedTerminologies} -> Maybe [AppliedTerminology]
appliedTerminologies) (\s :: TranslateTextResponse
s@TranslateTextResponse' {} Maybe [AppliedTerminology]
a -> TranslateTextResponse
s {$sel:appliedTerminologies:TranslateTextResponse' :: Maybe [AppliedTerminology]
appliedTerminologies = Maybe [AppliedTerminology]
a} :: TranslateTextResponse) ((Maybe [AppliedTerminology] -> f (Maybe [AppliedTerminology]))
 -> TranslateTextResponse -> f TranslateTextResponse)
-> ((Maybe [AppliedTerminology] -> f (Maybe [AppliedTerminology]))
    -> Maybe [AppliedTerminology] -> f (Maybe [AppliedTerminology]))
-> (Maybe [AppliedTerminology] -> f (Maybe [AppliedTerminology]))
-> TranslateTextResponse
-> f TranslateTextResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AppliedTerminology]
  [AppliedTerminology]
  [AppliedTerminology]
  [AppliedTerminology]
-> Iso
     (Maybe [AppliedTerminology])
     (Maybe [AppliedTerminology])
     (Maybe [AppliedTerminology])
     (Maybe [AppliedTerminology])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [AppliedTerminology]
  [AppliedTerminology]
  [AppliedTerminology]
  [AppliedTerminology]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The response's http status code.
translateTextResponse_httpStatus :: Lens.Lens' TranslateTextResponse Prelude.Int
translateTextResponse_httpStatus :: (Int -> f Int) -> TranslateTextResponse -> f TranslateTextResponse
translateTextResponse_httpStatus = (TranslateTextResponse -> Int)
-> (TranslateTextResponse -> Int -> TranslateTextResponse)
-> Lens TranslateTextResponse TranslateTextResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TranslateTextResponse' {Int
httpStatus :: Int
$sel:httpStatus:TranslateTextResponse' :: TranslateTextResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: TranslateTextResponse
s@TranslateTextResponse' {} Int
a -> TranslateTextResponse
s {$sel:httpStatus:TranslateTextResponse' :: Int
httpStatus = Int
a} :: TranslateTextResponse)

-- | The translated text.
translateTextResponse_translatedText :: Lens.Lens' TranslateTextResponse Prelude.Text
translateTextResponse_translatedText :: (Text -> f Text)
-> TranslateTextResponse -> f TranslateTextResponse
translateTextResponse_translatedText = (TranslateTextResponse -> Text)
-> (TranslateTextResponse -> Text -> TranslateTextResponse)
-> Lens TranslateTextResponse TranslateTextResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TranslateTextResponse' {Text
translatedText :: Text
$sel:translatedText:TranslateTextResponse' :: TranslateTextResponse -> Text
translatedText} -> Text
translatedText) (\s :: TranslateTextResponse
s@TranslateTextResponse' {} Text
a -> TranslateTextResponse
s {$sel:translatedText:TranslateTextResponse' :: Text
translatedText = Text
a} :: TranslateTextResponse)

-- | The language code for the language of the source text.
translateTextResponse_sourceLanguageCode :: Lens.Lens' TranslateTextResponse Prelude.Text
translateTextResponse_sourceLanguageCode :: (Text -> f Text)
-> TranslateTextResponse -> f TranslateTextResponse
translateTextResponse_sourceLanguageCode = (TranslateTextResponse -> Text)
-> (TranslateTextResponse -> Text -> TranslateTextResponse)
-> Lens TranslateTextResponse TranslateTextResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TranslateTextResponse' {Text
sourceLanguageCode :: Text
$sel:sourceLanguageCode:TranslateTextResponse' :: TranslateTextResponse -> Text
sourceLanguageCode} -> Text
sourceLanguageCode) (\s :: TranslateTextResponse
s@TranslateTextResponse' {} Text
a -> TranslateTextResponse
s {$sel:sourceLanguageCode:TranslateTextResponse' :: Text
sourceLanguageCode = Text
a} :: TranslateTextResponse)

-- | The language code for the language of the target text.
translateTextResponse_targetLanguageCode :: Lens.Lens' TranslateTextResponse Prelude.Text
translateTextResponse_targetLanguageCode :: (Text -> f Text)
-> TranslateTextResponse -> f TranslateTextResponse
translateTextResponse_targetLanguageCode = (TranslateTextResponse -> Text)
-> (TranslateTextResponse -> Text -> TranslateTextResponse)
-> Lens TranslateTextResponse TranslateTextResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TranslateTextResponse' {Text
targetLanguageCode :: Text
$sel:targetLanguageCode:TranslateTextResponse' :: TranslateTextResponse -> Text
targetLanguageCode} -> Text
targetLanguageCode) (\s :: TranslateTextResponse
s@TranslateTextResponse' {} Text
a -> TranslateTextResponse
s {$sel:targetLanguageCode:TranslateTextResponse' :: Text
targetLanguageCode = Text
a} :: TranslateTextResponse)

instance Prelude.NFData TranslateTextResponse