{-# 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.BatchDetectSyntax
(
BatchDetectSyntax (..),
newBatchDetectSyntax,
batchDetectSyntax_textList,
batchDetectSyntax_languageCode,
BatchDetectSyntaxResponse (..),
newBatchDetectSyntaxResponse,
batchDetectSyntaxResponse_httpStatus,
batchDetectSyntaxResponse_resultList,
batchDetectSyntaxResponse_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 BatchDetectSyntax = BatchDetectSyntax'
{
BatchDetectSyntax -> Sensitive [Sensitive Text]
textList :: Core.Sensitive [Core.Sensitive Prelude.Text],
BatchDetectSyntax -> SyntaxLanguageCode
languageCode :: SyntaxLanguageCode
}
deriving (BatchDetectSyntax -> BatchDetectSyntax -> Bool
(BatchDetectSyntax -> BatchDetectSyntax -> Bool)
-> (BatchDetectSyntax -> BatchDetectSyntax -> Bool)
-> Eq BatchDetectSyntax
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDetectSyntax -> BatchDetectSyntax -> Bool
$c/= :: BatchDetectSyntax -> BatchDetectSyntax -> Bool
== :: BatchDetectSyntax -> BatchDetectSyntax -> Bool
$c== :: BatchDetectSyntax -> BatchDetectSyntax -> Bool
Prelude.Eq, Int -> BatchDetectSyntax -> ShowS
[BatchDetectSyntax] -> ShowS
BatchDetectSyntax -> String
(Int -> BatchDetectSyntax -> ShowS)
-> (BatchDetectSyntax -> String)
-> ([BatchDetectSyntax] -> ShowS)
-> Show BatchDetectSyntax
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDetectSyntax] -> ShowS
$cshowList :: [BatchDetectSyntax] -> ShowS
show :: BatchDetectSyntax -> String
$cshow :: BatchDetectSyntax -> String
showsPrec :: Int -> BatchDetectSyntax -> ShowS
$cshowsPrec :: Int -> BatchDetectSyntax -> ShowS
Prelude.Show, (forall x. BatchDetectSyntax -> Rep BatchDetectSyntax x)
-> (forall x. Rep BatchDetectSyntax x -> BatchDetectSyntax)
-> Generic BatchDetectSyntax
forall x. Rep BatchDetectSyntax x -> BatchDetectSyntax
forall x. BatchDetectSyntax -> Rep BatchDetectSyntax x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchDetectSyntax x -> BatchDetectSyntax
$cfrom :: forall x. BatchDetectSyntax -> Rep BatchDetectSyntax x
Prelude.Generic)
newBatchDetectSyntax ::
SyntaxLanguageCode ->
BatchDetectSyntax
newBatchDetectSyntax :: SyntaxLanguageCode -> BatchDetectSyntax
newBatchDetectSyntax SyntaxLanguageCode
pLanguageCode_ =
BatchDetectSyntax' :: Sensitive [Sensitive Text]
-> SyntaxLanguageCode -> BatchDetectSyntax
BatchDetectSyntax'
{ $sel:textList:BatchDetectSyntax' :: Sensitive [Sensitive Text]
textList = Sensitive [Sensitive Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:languageCode:BatchDetectSyntax' :: SyntaxLanguageCode
languageCode = SyntaxLanguageCode
pLanguageCode_
}
batchDetectSyntax_textList :: Lens.Lens' BatchDetectSyntax [Prelude.Text]
batchDetectSyntax_textList :: ([Text] -> f [Text]) -> BatchDetectSyntax -> f BatchDetectSyntax
batchDetectSyntax_textList = (BatchDetectSyntax -> Sensitive [Sensitive Text])
-> (BatchDetectSyntax
-> Sensitive [Sensitive Text] -> BatchDetectSyntax)
-> Lens
BatchDetectSyntax
BatchDetectSyntax
(Sensitive [Sensitive Text])
(Sensitive [Sensitive Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectSyntax' {Sensitive [Sensitive Text]
textList :: Sensitive [Sensitive Text]
$sel:textList:BatchDetectSyntax' :: BatchDetectSyntax -> Sensitive [Sensitive Text]
textList} -> Sensitive [Sensitive Text]
textList) (\s :: BatchDetectSyntax
s@BatchDetectSyntax' {} Sensitive [Sensitive Text]
a -> BatchDetectSyntax
s {$sel:textList:BatchDetectSyntax' :: Sensitive [Sensitive Text]
textList = Sensitive [Sensitive Text]
a} :: BatchDetectSyntax) ((Sensitive [Sensitive Text] -> f (Sensitive [Sensitive Text]))
-> BatchDetectSyntax -> f BatchDetectSyntax)
-> (([Text] -> f [Text])
-> Sensitive [Sensitive Text] -> f (Sensitive [Sensitive Text]))
-> ([Text] -> f [Text])
-> BatchDetectSyntax
-> f BatchDetectSyntax
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
batchDetectSyntax_languageCode :: Lens.Lens' BatchDetectSyntax SyntaxLanguageCode
batchDetectSyntax_languageCode :: (SyntaxLanguageCode -> f SyntaxLanguageCode)
-> BatchDetectSyntax -> f BatchDetectSyntax
batchDetectSyntax_languageCode = (BatchDetectSyntax -> SyntaxLanguageCode)
-> (BatchDetectSyntax -> SyntaxLanguageCode -> BatchDetectSyntax)
-> Lens
BatchDetectSyntax
BatchDetectSyntax
SyntaxLanguageCode
SyntaxLanguageCode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectSyntax' {SyntaxLanguageCode
languageCode :: SyntaxLanguageCode
$sel:languageCode:BatchDetectSyntax' :: BatchDetectSyntax -> SyntaxLanguageCode
languageCode} -> SyntaxLanguageCode
languageCode) (\s :: BatchDetectSyntax
s@BatchDetectSyntax' {} SyntaxLanguageCode
a -> BatchDetectSyntax
s {$sel:languageCode:BatchDetectSyntax' :: SyntaxLanguageCode
languageCode = SyntaxLanguageCode
a} :: BatchDetectSyntax)
instance Core.AWSRequest BatchDetectSyntax where
type
AWSResponse BatchDetectSyntax =
BatchDetectSyntaxResponse
request :: BatchDetectSyntax -> Request BatchDetectSyntax
request = Service -> BatchDetectSyntax -> Request BatchDetectSyntax
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchDetectSyntax
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDetectSyntax)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchDetectSyntax))
-> Logger
-> Service
-> Proxy BatchDetectSyntax
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDetectSyntax)))
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
-> [BatchDetectSyntaxItemResult]
-> [BatchItemError]
-> BatchDetectSyntaxResponse
BatchDetectSyntaxResponse'
(Int
-> [BatchDetectSyntaxItemResult]
-> [BatchItemError]
-> BatchDetectSyntaxResponse)
-> Either String Int
-> Either
String
([BatchDetectSyntaxItemResult]
-> [BatchItemError] -> BatchDetectSyntaxResponse)
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
([BatchDetectSyntaxItemResult]
-> [BatchItemError] -> BatchDetectSyntaxResponse)
-> Either String [BatchDetectSyntaxItemResult]
-> Either String ([BatchItemError] -> BatchDetectSyntaxResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe [BatchDetectSyntaxItemResult])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResultList" Either String (Maybe [BatchDetectSyntaxItemResult])
-> [BatchDetectSyntaxItemResult]
-> Either String [BatchDetectSyntaxItemResult]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [BatchDetectSyntaxItemResult]
forall a. Monoid a => a
Prelude.mempty)
Either String ([BatchItemError] -> BatchDetectSyntaxResponse)
-> Either String [BatchItemError]
-> Either String BatchDetectSyntaxResponse
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 BatchDetectSyntax
instance Prelude.NFData BatchDetectSyntax
instance Core.ToHeaders BatchDetectSyntax where
toHeaders :: BatchDetectSyntax -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchDetectSyntax -> 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.BatchDetectSyntax" ::
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 BatchDetectSyntax where
toJSON :: BatchDetectSyntax -> Value
toJSON BatchDetectSyntax' {Sensitive [Sensitive Text]
SyntaxLanguageCode
languageCode :: SyntaxLanguageCode
textList :: Sensitive [Sensitive Text]
$sel:languageCode:BatchDetectSyntax' :: BatchDetectSyntax -> SyntaxLanguageCode
$sel:textList:BatchDetectSyntax' :: BatchDetectSyntax -> 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),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LanguageCode" Text -> SyntaxLanguageCode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SyntaxLanguageCode
languageCode)
]
)
instance Core.ToPath BatchDetectSyntax where
toPath :: BatchDetectSyntax -> ByteString
toPath = ByteString -> BatchDetectSyntax -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery BatchDetectSyntax where
toQuery :: BatchDetectSyntax -> QueryString
toQuery = QueryString -> BatchDetectSyntax -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchDetectSyntaxResponse = BatchDetectSyntaxResponse'
{
BatchDetectSyntaxResponse -> Int
httpStatus :: Prelude.Int,
BatchDetectSyntaxResponse -> [BatchDetectSyntaxItemResult]
resultList :: [BatchDetectSyntaxItemResult],
BatchDetectSyntaxResponse -> [BatchItemError]
errorList :: [BatchItemError]
}
deriving (BatchDetectSyntaxResponse -> BatchDetectSyntaxResponse -> Bool
(BatchDetectSyntaxResponse -> BatchDetectSyntaxResponse -> Bool)
-> (BatchDetectSyntaxResponse -> BatchDetectSyntaxResponse -> Bool)
-> Eq BatchDetectSyntaxResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDetectSyntaxResponse -> BatchDetectSyntaxResponse -> Bool
$c/= :: BatchDetectSyntaxResponse -> BatchDetectSyntaxResponse -> Bool
== :: BatchDetectSyntaxResponse -> BatchDetectSyntaxResponse -> Bool
$c== :: BatchDetectSyntaxResponse -> BatchDetectSyntaxResponse -> Bool
Prelude.Eq, Int -> BatchDetectSyntaxResponse -> ShowS
[BatchDetectSyntaxResponse] -> ShowS
BatchDetectSyntaxResponse -> String
(Int -> BatchDetectSyntaxResponse -> ShowS)
-> (BatchDetectSyntaxResponse -> String)
-> ([BatchDetectSyntaxResponse] -> ShowS)
-> Show BatchDetectSyntaxResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDetectSyntaxResponse] -> ShowS
$cshowList :: [BatchDetectSyntaxResponse] -> ShowS
show :: BatchDetectSyntaxResponse -> String
$cshow :: BatchDetectSyntaxResponse -> String
showsPrec :: Int -> BatchDetectSyntaxResponse -> ShowS
$cshowsPrec :: Int -> BatchDetectSyntaxResponse -> ShowS
Prelude.Show, (forall x.
BatchDetectSyntaxResponse -> Rep BatchDetectSyntaxResponse x)
-> (forall x.
Rep BatchDetectSyntaxResponse x -> BatchDetectSyntaxResponse)
-> Generic BatchDetectSyntaxResponse
forall x.
Rep BatchDetectSyntaxResponse x -> BatchDetectSyntaxResponse
forall x.
BatchDetectSyntaxResponse -> Rep BatchDetectSyntaxResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDetectSyntaxResponse x -> BatchDetectSyntaxResponse
$cfrom :: forall x.
BatchDetectSyntaxResponse -> Rep BatchDetectSyntaxResponse x
Prelude.Generic)
newBatchDetectSyntaxResponse ::
Prelude.Int ->
BatchDetectSyntaxResponse
newBatchDetectSyntaxResponse :: Int -> BatchDetectSyntaxResponse
newBatchDetectSyntaxResponse Int
pHttpStatus_ =
BatchDetectSyntaxResponse' :: Int
-> [BatchDetectSyntaxItemResult]
-> [BatchItemError]
-> BatchDetectSyntaxResponse
BatchDetectSyntaxResponse'
{ $sel:httpStatus:BatchDetectSyntaxResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:resultList:BatchDetectSyntaxResponse' :: [BatchDetectSyntaxItemResult]
resultList = [BatchDetectSyntaxItemResult]
forall a. Monoid a => a
Prelude.mempty,
$sel:errorList:BatchDetectSyntaxResponse' :: [BatchItemError]
errorList = [BatchItemError]
forall a. Monoid a => a
Prelude.mempty
}
batchDetectSyntaxResponse_httpStatus :: Lens.Lens' BatchDetectSyntaxResponse Prelude.Int
batchDetectSyntaxResponse_httpStatus :: (Int -> f Int)
-> BatchDetectSyntaxResponse -> f BatchDetectSyntaxResponse
batchDetectSyntaxResponse_httpStatus = (BatchDetectSyntaxResponse -> Int)
-> (BatchDetectSyntaxResponse -> Int -> BatchDetectSyntaxResponse)
-> Lens BatchDetectSyntaxResponse BatchDetectSyntaxResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectSyntaxResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchDetectSyntaxResponse' :: BatchDetectSyntaxResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchDetectSyntaxResponse
s@BatchDetectSyntaxResponse' {} Int
a -> BatchDetectSyntaxResponse
s {$sel:httpStatus:BatchDetectSyntaxResponse' :: Int
httpStatus = Int
a} :: BatchDetectSyntaxResponse)
batchDetectSyntaxResponse_resultList :: Lens.Lens' BatchDetectSyntaxResponse [BatchDetectSyntaxItemResult]
batchDetectSyntaxResponse_resultList :: ([BatchDetectSyntaxItemResult] -> f [BatchDetectSyntaxItemResult])
-> BatchDetectSyntaxResponse -> f BatchDetectSyntaxResponse
batchDetectSyntaxResponse_resultList = (BatchDetectSyntaxResponse -> [BatchDetectSyntaxItemResult])
-> (BatchDetectSyntaxResponse
-> [BatchDetectSyntaxItemResult] -> BatchDetectSyntaxResponse)
-> Lens
BatchDetectSyntaxResponse
BatchDetectSyntaxResponse
[BatchDetectSyntaxItemResult]
[BatchDetectSyntaxItemResult]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectSyntaxResponse' {[BatchDetectSyntaxItemResult]
resultList :: [BatchDetectSyntaxItemResult]
$sel:resultList:BatchDetectSyntaxResponse' :: BatchDetectSyntaxResponse -> [BatchDetectSyntaxItemResult]
resultList} -> [BatchDetectSyntaxItemResult]
resultList) (\s :: BatchDetectSyntaxResponse
s@BatchDetectSyntaxResponse' {} [BatchDetectSyntaxItemResult]
a -> BatchDetectSyntaxResponse
s {$sel:resultList:BatchDetectSyntaxResponse' :: [BatchDetectSyntaxItemResult]
resultList = [BatchDetectSyntaxItemResult]
a} :: BatchDetectSyntaxResponse) (([BatchDetectSyntaxItemResult] -> f [BatchDetectSyntaxItemResult])
-> BatchDetectSyntaxResponse -> f BatchDetectSyntaxResponse)
-> (([BatchDetectSyntaxItemResult]
-> f [BatchDetectSyntaxItemResult])
-> [BatchDetectSyntaxItemResult]
-> f [BatchDetectSyntaxItemResult])
-> ([BatchDetectSyntaxItemResult]
-> f [BatchDetectSyntaxItemResult])
-> BatchDetectSyntaxResponse
-> f BatchDetectSyntaxResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BatchDetectSyntaxItemResult] -> f [BatchDetectSyntaxItemResult])
-> [BatchDetectSyntaxItemResult] -> f [BatchDetectSyntaxItemResult]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
batchDetectSyntaxResponse_errorList :: Lens.Lens' BatchDetectSyntaxResponse [BatchItemError]
batchDetectSyntaxResponse_errorList :: ([BatchItemError] -> f [BatchItemError])
-> BatchDetectSyntaxResponse -> f BatchDetectSyntaxResponse
batchDetectSyntaxResponse_errorList = (BatchDetectSyntaxResponse -> [BatchItemError])
-> (BatchDetectSyntaxResponse
-> [BatchItemError] -> BatchDetectSyntaxResponse)
-> Lens
BatchDetectSyntaxResponse
BatchDetectSyntaxResponse
[BatchItemError]
[BatchItemError]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDetectSyntaxResponse' {[BatchItemError]
errorList :: [BatchItemError]
$sel:errorList:BatchDetectSyntaxResponse' :: BatchDetectSyntaxResponse -> [BatchItemError]
errorList} -> [BatchItemError]
errorList) (\s :: BatchDetectSyntaxResponse
s@BatchDetectSyntaxResponse' {} [BatchItemError]
a -> BatchDetectSyntaxResponse
s {$sel:errorList:BatchDetectSyntaxResponse' :: [BatchItemError]
errorList = [BatchItemError]
a} :: BatchDetectSyntaxResponse) (([BatchItemError] -> f [BatchItemError])
-> BatchDetectSyntaxResponse -> f BatchDetectSyntaxResponse)
-> (([BatchItemError] -> f [BatchItemError])
-> [BatchItemError] -> f [BatchItemError])
-> ([BatchItemError] -> f [BatchItemError])
-> BatchDetectSyntaxResponse
-> f BatchDetectSyntaxResponse
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 BatchDetectSyntaxResponse