{-# 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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data BatchDetectDominantLanguage = BatchDetectDominantLanguage'
{
BatchDetectDominantLanguage -> Sensitive [Sensitive Text]
textList :: Core.Sensitive [Core.Sensitive Prelude.Text]
}
deriving (BatchDetectDominantLanguage -> BatchDetectDominantLanguage -> Bool
(BatchDetectDominantLanguage
-> BatchDetectDominantLanguage -> Bool)
-> (BatchDetectDominantLanguage
-> BatchDetectDominantLanguage -> Bool)
-> Eq BatchDetectDominantLanguage
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
(Int -> BatchDetectDominantLanguage -> ShowS)
-> (BatchDetectDominantLanguage -> String)
-> ([BatchDetectDominantLanguage] -> ShowS)
-> Show BatchDetectDominantLanguage
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.
BatchDetectDominantLanguage -> Rep BatchDetectDominantLanguage x)
-> (forall x.
Rep BatchDetectDominantLanguage x -> BatchDetectDominantLanguage)
-> Generic BatchDetectDominantLanguage
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 ::
BatchDetectDominantLanguage
newBatchDetectDominantLanguage :: BatchDetectDominantLanguage
newBatchDetectDominantLanguage =
BatchDetectDominantLanguage' :: Sensitive [Sensitive Text] -> BatchDetectDominantLanguage
BatchDetectDominantLanguage'
{ $sel:textList:BatchDetectDominantLanguage' :: Sensitive [Sensitive Text]
textList =
Sensitive [Sensitive Text]
forall a. Monoid a => a
Prelude.mempty
}
batchDetectDominantLanguage_textList :: Lens.Lens' BatchDetectDominantLanguage [Prelude.Text]
batchDetectDominantLanguage_textList :: ([Text] -> f [Text])
-> BatchDetectDominantLanguage -> f BatchDetectDominantLanguage
batchDetectDominantLanguage_textList = (BatchDetectDominantLanguage -> Sensitive [Sensitive Text])
-> (BatchDetectDominantLanguage
-> Sensitive [Sensitive Text] -> BatchDetectDominantLanguage)
-> Lens
BatchDetectDominantLanguage
BatchDetectDominantLanguage
(Sensitive [Sensitive Text])
(Sensitive [Sensitive Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectDominantLanguage' {Sensitive [Sensitive Text]
textList :: Sensitive [Sensitive Text]
$sel:textList:BatchDetectDominantLanguage' :: BatchDetectDominantLanguage -> Sensitive [Sensitive Text]
textList} -> Sensitive [Sensitive Text]
textList) (\s :: BatchDetectDominantLanguage
s@BatchDetectDominantLanguage' {} Sensitive [Sensitive Text]
a -> BatchDetectDominantLanguage
s {$sel:textList:BatchDetectDominantLanguage' :: Sensitive [Sensitive Text]
textList = Sensitive [Sensitive Text]
a} :: BatchDetectDominantLanguage) ((Sensitive [Sensitive Text] -> f (Sensitive [Sensitive Text]))
-> BatchDetectDominantLanguage -> f BatchDetectDominantLanguage)
-> (([Text] -> f [Text])
-> Sensitive [Sensitive Text] -> f (Sensitive [Sensitive Text]))
-> ([Text] -> f [Text])
-> BatchDetectDominantLanguage
-> f BatchDetectDominantLanguage
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Sensitive Text] -> f [Sensitive Text])
-> Sensitive [Sensitive Text] -> f (Sensitive [Sensitive Text])
forall a. Iso' (Sensitive a) a
Core._Sensitive (([Sensitive Text] -> f [Sensitive Text])
-> Sensitive [Sensitive Text] -> f (Sensitive [Sensitive Text]))
-> (([Text] -> f [Text]) -> [Sensitive Text] -> f [Sensitive Text])
-> ([Text] -> f [Text])
-> Sensitive [Sensitive Text]
-> f (Sensitive [Sensitive Text])
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Sensitive Text] -> f [Sensitive Text]
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 :: BatchDetectDominantLanguage -> Request BatchDetectDominantLanguage
request = Service
-> BatchDetectDominantLanguage
-> Request BatchDetectDominantLanguage
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchDetectDominantLanguage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDetectDominantLanguage)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchDetectDominantLanguage))
-> Logger
-> Service
-> Proxy BatchDetectDominantLanguage
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDetectDominantLanguage)))
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 ->
Int
-> [BatchDetectDominantLanguageItemResult]
-> [BatchItemError]
-> BatchDetectDominantLanguageResponse
BatchDetectDominantLanguageResponse'
(Int
-> [BatchDetectDominantLanguageItemResult]
-> [BatchItemError]
-> BatchDetectDominantLanguageResponse)
-> Either String Int
-> Either
String
([BatchDetectDominantLanguageItemResult]
-> [BatchItemError] -> BatchDetectDominantLanguageResponse)
forall (f :: * -> *) a b. Functor 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
([BatchDetectDominantLanguageItemResult]
-> [BatchItemError] -> BatchDetectDominantLanguageResponse)
-> Either String [BatchDetectDominantLanguageItemResult]
-> Either
String ([BatchItemError] -> BatchDetectDominantLanguageResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text
-> Either String (Maybe [BatchDetectDominantLanguageItemResult])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResultList" Either String (Maybe [BatchDetectDominantLanguageItemResult])
-> [BatchDetectDominantLanguageItemResult]
-> Either String [BatchDetectDominantLanguageItemResult]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [BatchDetectDominantLanguageItemResult]
forall a. Monoid a => a
Prelude.mempty)
Either
String ([BatchItemError] -> BatchDetectDominantLanguageResponse)
-> Either String [BatchItemError]
-> Either String BatchDetectDominantLanguageResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [BatchItemError])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ErrorList" Either String (Maybe [BatchItemError])
-> [BatchItemError] -> Either String [BatchItemError]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [BatchItemError]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable BatchDetectDominantLanguage
instance Prelude.NFData BatchDetectDominantLanguage
instance Core.ToHeaders BatchDetectDominantLanguage where
toHeaders :: BatchDetectDominantLanguage -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchDetectDominantLanguage -> 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
"Comprehend_20171127.BatchDetectDominantLanguage" ::
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 BatchDetectDominantLanguage where
toJSON :: BatchDetectDominantLanguage -> Value
toJSON BatchDetectDominantLanguage' {Sensitive [Sensitive Text]
textList :: Sensitive [Sensitive Text]
$sel:textList:BatchDetectDominantLanguage' :: BatchDetectDominantLanguage -> Sensitive [Sensitive Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TextList" Text -> Sensitive [Sensitive Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive [Sensitive Text]
textList)]
)
instance Core.ToPath BatchDetectDominantLanguage where
toPath :: BatchDetectDominantLanguage -> ByteString
toPath = ByteString -> BatchDetectDominantLanguage -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery BatchDetectDominantLanguage where
toQuery :: BatchDetectDominantLanguage -> QueryString
toQuery = QueryString -> BatchDetectDominantLanguage -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(BatchDetectDominantLanguageResponse
-> BatchDetectDominantLanguageResponse -> Bool)
-> (BatchDetectDominantLanguageResponse
-> BatchDetectDominantLanguageResponse -> Bool)
-> Eq BatchDetectDominantLanguageResponse
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
(Int -> BatchDetectDominantLanguageResponse -> ShowS)
-> (BatchDetectDominantLanguageResponse -> String)
-> ([BatchDetectDominantLanguageResponse] -> ShowS)
-> Show BatchDetectDominantLanguageResponse
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.
BatchDetectDominantLanguageResponse
-> Rep BatchDetectDominantLanguageResponse x)
-> (forall x.
Rep BatchDetectDominantLanguageResponse x
-> BatchDetectDominantLanguageResponse)
-> Generic BatchDetectDominantLanguageResponse
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' :: Int
-> [BatchDetectDominantLanguageItemResult]
-> [BatchItemError]
-> BatchDetectDominantLanguageResponse
BatchDetectDominantLanguageResponse'
{ $sel:httpStatus:BatchDetectDominantLanguageResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:resultList:BatchDetectDominantLanguageResponse' :: [BatchDetectDominantLanguageItemResult]
resultList = [BatchDetectDominantLanguageItemResult]
forall a. Monoid a => a
Prelude.mempty,
$sel:errorList:BatchDetectDominantLanguageResponse' :: [BatchItemError]
errorList = [BatchItemError]
forall a. Monoid a => a
Prelude.mempty
}
batchDetectDominantLanguageResponse_httpStatus :: Lens.Lens' BatchDetectDominantLanguageResponse Prelude.Int
batchDetectDominantLanguageResponse_httpStatus :: (Int -> f Int)
-> BatchDetectDominantLanguageResponse
-> f BatchDetectDominantLanguageResponse
batchDetectDominantLanguageResponse_httpStatus = (BatchDetectDominantLanguageResponse -> Int)
-> (BatchDetectDominantLanguageResponse
-> Int -> BatchDetectDominantLanguageResponse)
-> Lens
BatchDetectDominantLanguageResponse
BatchDetectDominantLanguageResponse
Int
Int
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 :: ([BatchDetectDominantLanguageItemResult]
-> f [BatchDetectDominantLanguageItemResult])
-> BatchDetectDominantLanguageResponse
-> f BatchDetectDominantLanguageResponse
batchDetectDominantLanguageResponse_resultList = (BatchDetectDominantLanguageResponse
-> [BatchDetectDominantLanguageItemResult])
-> (BatchDetectDominantLanguageResponse
-> [BatchDetectDominantLanguageItemResult]
-> BatchDetectDominantLanguageResponse)
-> Lens
BatchDetectDominantLanguageResponse
BatchDetectDominantLanguageResponse
[BatchDetectDominantLanguageItemResult]
[BatchDetectDominantLanguageItemResult]
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) (([BatchDetectDominantLanguageItemResult]
-> f [BatchDetectDominantLanguageItemResult])
-> BatchDetectDominantLanguageResponse
-> f BatchDetectDominantLanguageResponse)
-> (([BatchDetectDominantLanguageItemResult]
-> f [BatchDetectDominantLanguageItemResult])
-> [BatchDetectDominantLanguageItemResult]
-> f [BatchDetectDominantLanguageItemResult])
-> ([BatchDetectDominantLanguageItemResult]
-> f [BatchDetectDominantLanguageItemResult])
-> BatchDetectDominantLanguageResponse
-> f BatchDetectDominantLanguageResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BatchDetectDominantLanguageItemResult]
-> f [BatchDetectDominantLanguageItemResult])
-> [BatchDetectDominantLanguageItemResult]
-> f [BatchDetectDominantLanguageItemResult]
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 :: ([BatchItemError] -> f [BatchItemError])
-> BatchDetectDominantLanguageResponse
-> f BatchDetectDominantLanguageResponse
batchDetectDominantLanguageResponse_errorList = (BatchDetectDominantLanguageResponse -> [BatchItemError])
-> (BatchDetectDominantLanguageResponse
-> [BatchItemError] -> BatchDetectDominantLanguageResponse)
-> Lens
BatchDetectDominantLanguageResponse
BatchDetectDominantLanguageResponse
[BatchItemError]
[BatchItemError]
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) (([BatchItemError] -> f [BatchItemError])
-> BatchDetectDominantLanguageResponse
-> f BatchDetectDominantLanguageResponse)
-> (([BatchItemError] -> f [BatchItemError])
-> [BatchItemError] -> f [BatchItemError])
-> ([BatchItemError] -> f [BatchItemError])
-> BatchDetectDominantLanguageResponse
-> f BatchDetectDominantLanguageResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BatchItemError] -> f [BatchItemError])
-> [BatchItemError] -> f [BatchItemError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance
Prelude.NFData
BatchDetectDominantLanguageResponse