{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.LexRuntime.Types.SentimentResponse where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SentimentResponse = SentimentResponse'
{
SentimentResponse -> Maybe Text
sentimentScore :: Prelude.Maybe Prelude.Text,
SentimentResponse -> Maybe Text
sentimentLabel :: Prelude.Maybe Prelude.Text
}
deriving (SentimentResponse -> SentimentResponse -> Bool
(SentimentResponse -> SentimentResponse -> Bool)
-> (SentimentResponse -> SentimentResponse -> Bool)
-> Eq SentimentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SentimentResponse -> SentimentResponse -> Bool
$c/= :: SentimentResponse -> SentimentResponse -> Bool
== :: SentimentResponse -> SentimentResponse -> Bool
$c== :: SentimentResponse -> SentimentResponse -> Bool
Prelude.Eq, ReadPrec [SentimentResponse]
ReadPrec SentimentResponse
Int -> ReadS SentimentResponse
ReadS [SentimentResponse]
(Int -> ReadS SentimentResponse)
-> ReadS [SentimentResponse]
-> ReadPrec SentimentResponse
-> ReadPrec [SentimentResponse]
-> Read SentimentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SentimentResponse]
$creadListPrec :: ReadPrec [SentimentResponse]
readPrec :: ReadPrec SentimentResponse
$creadPrec :: ReadPrec SentimentResponse
readList :: ReadS [SentimentResponse]
$creadList :: ReadS [SentimentResponse]
readsPrec :: Int -> ReadS SentimentResponse
$creadsPrec :: Int -> ReadS SentimentResponse
Prelude.Read, Int -> SentimentResponse -> ShowS
[SentimentResponse] -> ShowS
SentimentResponse -> String
(Int -> SentimentResponse -> ShowS)
-> (SentimentResponse -> String)
-> ([SentimentResponse] -> ShowS)
-> Show SentimentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SentimentResponse] -> ShowS
$cshowList :: [SentimentResponse] -> ShowS
show :: SentimentResponse -> String
$cshow :: SentimentResponse -> String
showsPrec :: Int -> SentimentResponse -> ShowS
$cshowsPrec :: Int -> SentimentResponse -> ShowS
Prelude.Show, (forall x. SentimentResponse -> Rep SentimentResponse x)
-> (forall x. Rep SentimentResponse x -> SentimentResponse)
-> Generic SentimentResponse
forall x. Rep SentimentResponse x -> SentimentResponse
forall x. SentimentResponse -> Rep SentimentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SentimentResponse x -> SentimentResponse
$cfrom :: forall x. SentimentResponse -> Rep SentimentResponse x
Prelude.Generic)
newSentimentResponse ::
SentimentResponse
newSentimentResponse :: SentimentResponse
newSentimentResponse =
SentimentResponse' :: Maybe Text -> Maybe Text -> SentimentResponse
SentimentResponse'
{ $sel:sentimentScore:SentimentResponse' :: Maybe Text
sentimentScore =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:sentimentLabel:SentimentResponse' :: Maybe Text
sentimentLabel = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
sentimentResponse_sentimentScore :: Lens.Lens' SentimentResponse (Prelude.Maybe Prelude.Text)
sentimentResponse_sentimentScore :: (Maybe Text -> f (Maybe Text))
-> SentimentResponse -> f SentimentResponse
sentimentResponse_sentimentScore = (SentimentResponse -> Maybe Text)
-> (SentimentResponse -> Maybe Text -> SentimentResponse)
-> Lens
SentimentResponse SentimentResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SentimentResponse' {Maybe Text
sentimentScore :: Maybe Text
$sel:sentimentScore:SentimentResponse' :: SentimentResponse -> Maybe Text
sentimentScore} -> Maybe Text
sentimentScore) (\s :: SentimentResponse
s@SentimentResponse' {} Maybe Text
a -> SentimentResponse
s {$sel:sentimentScore:SentimentResponse' :: Maybe Text
sentimentScore = Maybe Text
a} :: SentimentResponse)
sentimentResponse_sentimentLabel :: Lens.Lens' SentimentResponse (Prelude.Maybe Prelude.Text)
sentimentResponse_sentimentLabel :: (Maybe Text -> f (Maybe Text))
-> SentimentResponse -> f SentimentResponse
sentimentResponse_sentimentLabel = (SentimentResponse -> Maybe Text)
-> (SentimentResponse -> Maybe Text -> SentimentResponse)
-> Lens
SentimentResponse SentimentResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SentimentResponse' {Maybe Text
sentimentLabel :: Maybe Text
$sel:sentimentLabel:SentimentResponse' :: SentimentResponse -> Maybe Text
sentimentLabel} -> Maybe Text
sentimentLabel) (\s :: SentimentResponse
s@SentimentResponse' {} Maybe Text
a -> SentimentResponse
s {$sel:sentimentLabel:SentimentResponse' :: Maybe Text
sentimentLabel = Maybe Text
a} :: SentimentResponse)
instance Core.FromJSON SentimentResponse where
parseJSON :: Value -> Parser SentimentResponse
parseJSON =
String
-> (Object -> Parser SentimentResponse)
-> Value
-> Parser SentimentResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"SentimentResponse"
( \Object
x ->
Maybe Text -> Maybe Text -> SentimentResponse
SentimentResponse'
(Maybe Text -> Maybe Text -> SentimentResponse)
-> Parser (Maybe Text) -> Parser (Maybe Text -> SentimentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sentimentScore")
Parser (Maybe Text -> SentimentResponse)
-> Parser (Maybe Text) -> Parser SentimentResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"sentimentLabel")
)
instance Prelude.Hashable SentimentResponse
instance Prelude.NFData SentimentResponse