{-# 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 #-}
module Amazonka.Comprehend.BatchDetectDominantLanguage
(
BatchDetectDominantLanguage (..),
newBatchDetectDominantLanguage,
batchDetectDominantLanguage_textList,
BatchDetectDominantLanguageResponse (..),
newBatchDetectDominantLanguageResponse,
batchDetectDominantLanguageResponse_httpStatus,
batchDetectDominantLanguageResponse_resultList,
batchDetectDominantLanguageResponse_errorList,
)
where
import Amazonka.Comprehend.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data BatchDetectDominantLanguage = BatchDetectDominantLanguage'
{
BatchDetectDominantLanguage
-> Sensitive (NonEmpty (Sensitive Text))
textList :: Data.Sensitive (Prelude.NonEmpty (Data.Sensitive Prelude.Text))
}
deriving (BatchDetectDominantLanguage -> BatchDetectDominantLanguage -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDetectDominantLanguage -> BatchDetectDominantLanguage -> Bool
$c/= :: BatchDetectDominantLanguage -> BatchDetectDominantLanguage -> Bool
== :: BatchDetectDominantLanguage -> BatchDetectDominantLanguage -> Bool
$c== :: BatchDetectDominantLanguage -> BatchDetectDominantLanguage -> Bool
Prelude.Eq, Int -> BatchDetectDominantLanguage -> ShowS
[BatchDetectDominantLanguage] -> ShowS
BatchDetectDominantLanguage -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDetectDominantLanguage] -> ShowS
$cshowList :: [BatchDetectDominantLanguage] -> ShowS
show :: BatchDetectDominantLanguage -> String
$cshow :: BatchDetectDominantLanguage -> String
showsPrec :: Int -> BatchDetectDominantLanguage -> ShowS
$cshowsPrec :: Int -> BatchDetectDominantLanguage -> ShowS
Prelude.Show, forall x.
Rep BatchDetectDominantLanguage x -> BatchDetectDominantLanguage
forall x.
BatchDetectDominantLanguage -> Rep BatchDetectDominantLanguage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDetectDominantLanguage x -> BatchDetectDominantLanguage
$cfrom :: forall x.
BatchDetectDominantLanguage -> Rep BatchDetectDominantLanguage x
Prelude.Generic)
newBatchDetectDominantLanguage ::
Prelude.NonEmpty Prelude.Text ->
BatchDetectDominantLanguage
newBatchDetectDominantLanguage :: NonEmpty Text -> BatchDetectDominantLanguage
newBatchDetectDominantLanguage NonEmpty Text
pTextList_ =
BatchDetectDominantLanguage'
{ $sel:textList:BatchDetectDominantLanguage' :: Sensitive (NonEmpty (Sensitive Text))
textList =
forall a. Iso' (Sensitive a) a
Data._Sensitive
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pTextList_
}
batchDetectDominantLanguage_textList :: Lens.Lens' BatchDetectDominantLanguage (Prelude.NonEmpty Prelude.Text)
batchDetectDominantLanguage_textList :: Lens' BatchDetectDominantLanguage (NonEmpty Text)
batchDetectDominantLanguage_textList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectDominantLanguage' {Sensitive (NonEmpty (Sensitive Text))
textList :: Sensitive (NonEmpty (Sensitive Text))
$sel:textList:BatchDetectDominantLanguage' :: BatchDetectDominantLanguage
-> Sensitive (NonEmpty (Sensitive Text))
textList} -> Sensitive (NonEmpty (Sensitive Text))
textList) (\s :: BatchDetectDominantLanguage
s@BatchDetectDominantLanguage' {} Sensitive (NonEmpty (Sensitive Text))
a -> BatchDetectDominantLanguage
s {$sel:textList:BatchDetectDominantLanguage' :: Sensitive (NonEmpty (Sensitive Text))
textList = Sensitive (NonEmpty (Sensitive Text))
a} :: BatchDetectDominantLanguage) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchDetectDominantLanguage where
type
AWSResponse BatchDetectDominantLanguage =
BatchDetectDominantLanguageResponse
request :: (Service -> Service)
-> BatchDetectDominantLanguage
-> Request BatchDetectDominantLanguage
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy BatchDetectDominantLanguage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDetectDominantLanguage)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Int
-> [BatchDetectDominantLanguageItemResult]
-> [BatchItemError]
-> BatchDetectDominantLanguageResponse
BatchDetectDominantLanguageResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ResultList" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"ErrorList" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable BatchDetectDominantLanguage where
hashWithSalt :: Int -> BatchDetectDominantLanguage -> Int
hashWithSalt Int
_salt BatchDetectDominantLanguage' {Sensitive (NonEmpty (Sensitive Text))
textList :: Sensitive (NonEmpty (Sensitive Text))
$sel:textList:BatchDetectDominantLanguage' :: BatchDetectDominantLanguage
-> Sensitive (NonEmpty (Sensitive Text))
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive (NonEmpty (Sensitive Text))
textList
instance Prelude.NFData BatchDetectDominantLanguage where
rnf :: BatchDetectDominantLanguage -> ()
rnf BatchDetectDominantLanguage' {Sensitive (NonEmpty (Sensitive Text))
textList :: Sensitive (NonEmpty (Sensitive Text))
$sel:textList:BatchDetectDominantLanguage' :: BatchDetectDominantLanguage
-> Sensitive (NonEmpty (Sensitive Text))
..} =
forall a. NFData a => a -> ()
Prelude.rnf Sensitive (NonEmpty (Sensitive Text))
textList
instance Data.ToHeaders BatchDetectDominantLanguage where
toHeaders :: BatchDetectDominantLanguage -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Comprehend_20171127.BatchDetectDominantLanguage" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON BatchDetectDominantLanguage where
toJSON :: BatchDetectDominantLanguage -> Value
toJSON BatchDetectDominantLanguage' {Sensitive (NonEmpty (Sensitive Text))
textList :: Sensitive (NonEmpty (Sensitive Text))
$sel:textList:BatchDetectDominantLanguage' :: BatchDetectDominantLanguage
-> Sensitive (NonEmpty (Sensitive Text))
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"TextList" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Sensitive (NonEmpty (Sensitive Text))
textList)]
)
instance Data.ToPath BatchDetectDominantLanguage where
toPath :: BatchDetectDominantLanguage -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery BatchDetectDominantLanguage where
toQuery :: BatchDetectDominantLanguage -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchDetectDominantLanguageResponse = BatchDetectDominantLanguageResponse'
{
BatchDetectDominantLanguageResponse -> Int
httpStatus :: Prelude.Int,
BatchDetectDominantLanguageResponse
-> [BatchDetectDominantLanguageItemResult]
resultList :: [BatchDetectDominantLanguageItemResult],
BatchDetectDominantLanguageResponse -> [BatchItemError]
errorList :: [BatchItemError]
}
deriving (BatchDetectDominantLanguageResponse
-> BatchDetectDominantLanguageResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDetectDominantLanguageResponse
-> BatchDetectDominantLanguageResponse -> Bool
$c/= :: BatchDetectDominantLanguageResponse
-> BatchDetectDominantLanguageResponse -> Bool
== :: BatchDetectDominantLanguageResponse
-> BatchDetectDominantLanguageResponse -> Bool
$c== :: BatchDetectDominantLanguageResponse
-> BatchDetectDominantLanguageResponse -> Bool
Prelude.Eq, Int -> BatchDetectDominantLanguageResponse -> ShowS
[BatchDetectDominantLanguageResponse] -> ShowS
BatchDetectDominantLanguageResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDetectDominantLanguageResponse] -> ShowS
$cshowList :: [BatchDetectDominantLanguageResponse] -> ShowS
show :: BatchDetectDominantLanguageResponse -> String
$cshow :: BatchDetectDominantLanguageResponse -> String
showsPrec :: Int -> BatchDetectDominantLanguageResponse -> ShowS
$cshowsPrec :: Int -> BatchDetectDominantLanguageResponse -> ShowS
Prelude.Show, forall x.
Rep BatchDetectDominantLanguageResponse x
-> BatchDetectDominantLanguageResponse
forall x.
BatchDetectDominantLanguageResponse
-> Rep BatchDetectDominantLanguageResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDetectDominantLanguageResponse x
-> BatchDetectDominantLanguageResponse
$cfrom :: forall x.
BatchDetectDominantLanguageResponse
-> Rep BatchDetectDominantLanguageResponse x
Prelude.Generic)
newBatchDetectDominantLanguageResponse ::
Prelude.Int ->
BatchDetectDominantLanguageResponse
newBatchDetectDominantLanguageResponse :: Int -> BatchDetectDominantLanguageResponse
newBatchDetectDominantLanguageResponse Int
pHttpStatus_ =
BatchDetectDominantLanguageResponse'
{ $sel:httpStatus:BatchDetectDominantLanguageResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:resultList:BatchDetectDominantLanguageResponse' :: [BatchDetectDominantLanguageItemResult]
resultList = forall a. Monoid a => a
Prelude.mempty,
$sel:errorList:BatchDetectDominantLanguageResponse' :: [BatchItemError]
errorList = forall a. Monoid a => a
Prelude.mempty
}
batchDetectDominantLanguageResponse_httpStatus :: Lens.Lens' BatchDetectDominantLanguageResponse Prelude.Int
batchDetectDominantLanguageResponse_httpStatus :: Lens' BatchDetectDominantLanguageResponse Int
batchDetectDominantLanguageResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectDominantLanguageResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchDetectDominantLanguageResponse' :: BatchDetectDominantLanguageResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchDetectDominantLanguageResponse
s@BatchDetectDominantLanguageResponse' {} Int
a -> BatchDetectDominantLanguageResponse
s {$sel:httpStatus:BatchDetectDominantLanguageResponse' :: Int
httpStatus = Int
a} :: BatchDetectDominantLanguageResponse)
batchDetectDominantLanguageResponse_resultList :: Lens.Lens' BatchDetectDominantLanguageResponse [BatchDetectDominantLanguageItemResult]
batchDetectDominantLanguageResponse_resultList :: Lens'
BatchDetectDominantLanguageResponse
[BatchDetectDominantLanguageItemResult]
batchDetectDominantLanguageResponse_resultList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectDominantLanguageResponse' {[BatchDetectDominantLanguageItemResult]
resultList :: [BatchDetectDominantLanguageItemResult]
$sel:resultList:BatchDetectDominantLanguageResponse' :: BatchDetectDominantLanguageResponse
-> [BatchDetectDominantLanguageItemResult]
resultList} -> [BatchDetectDominantLanguageItemResult]
resultList) (\s :: BatchDetectDominantLanguageResponse
s@BatchDetectDominantLanguageResponse' {} [BatchDetectDominantLanguageItemResult]
a -> BatchDetectDominantLanguageResponse
s {$sel:resultList:BatchDetectDominantLanguageResponse' :: [BatchDetectDominantLanguageItemResult]
resultList = [BatchDetectDominantLanguageItemResult]
a} :: BatchDetectDominantLanguageResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchDetectDominantLanguageResponse_errorList :: Lens.Lens' BatchDetectDominantLanguageResponse [BatchItemError]
batchDetectDominantLanguageResponse_errorList :: Lens' BatchDetectDominantLanguageResponse [BatchItemError]
batchDetectDominantLanguageResponse_errorList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectDominantLanguageResponse' {[BatchItemError]
errorList :: [BatchItemError]
$sel:errorList:BatchDetectDominantLanguageResponse' :: BatchDetectDominantLanguageResponse -> [BatchItemError]
errorList} -> [BatchItemError]
errorList) (\s :: BatchDetectDominantLanguageResponse
s@BatchDetectDominantLanguageResponse' {} [BatchItemError]
a -> BatchDetectDominantLanguageResponse
s {$sel:errorList:BatchDetectDominantLanguageResponse' :: [BatchItemError]
errorList = [BatchItemError]
a} :: BatchDetectDominantLanguageResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance
Prelude.NFData
BatchDetectDominantLanguageResponse
where
rnf :: BatchDetectDominantLanguageResponse -> ()
rnf BatchDetectDominantLanguageResponse' {Int
[BatchItemError]
[BatchDetectDominantLanguageItemResult]
errorList :: [BatchItemError]
resultList :: [BatchDetectDominantLanguageItemResult]
httpStatus :: Int
$sel:errorList:BatchDetectDominantLanguageResponse' :: BatchDetectDominantLanguageResponse -> [BatchItemError]
$sel:resultList:BatchDetectDominantLanguageResponse' :: BatchDetectDominantLanguageResponse
-> [BatchDetectDominantLanguageItemResult]
$sel:httpStatus:BatchDetectDominantLanguageResponse' :: BatchDetectDominantLanguageResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [BatchDetectDominantLanguageItemResult]
resultList
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [BatchItemError]
errorList