{-# 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.LexModels.GetUtterancesView
(
GetUtterancesView (..),
newGetUtterancesView,
getUtterancesView_botName,
getUtterancesView_botVersions,
getUtterancesView_statusType,
GetUtterancesViewResponse (..),
newGetUtterancesViewResponse,
getUtterancesViewResponse_botName,
getUtterancesViewResponse_utterances,
getUtterancesViewResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.LexModels.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetUtterancesView = GetUtterancesView'
{
GetUtterancesView -> Text
botName :: Prelude.Text,
GetUtterancesView -> NonEmpty Text
botVersions :: Prelude.NonEmpty Prelude.Text,
GetUtterancesView -> StatusType
statusType :: StatusType
}
deriving (GetUtterancesView -> GetUtterancesView -> Bool
(GetUtterancesView -> GetUtterancesView -> Bool)
-> (GetUtterancesView -> GetUtterancesView -> Bool)
-> Eq GetUtterancesView
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUtterancesView -> GetUtterancesView -> Bool
$c/= :: GetUtterancesView -> GetUtterancesView -> Bool
== :: GetUtterancesView -> GetUtterancesView -> Bool
$c== :: GetUtterancesView -> GetUtterancesView -> Bool
Prelude.Eq, ReadPrec [GetUtterancesView]
ReadPrec GetUtterancesView
Int -> ReadS GetUtterancesView
ReadS [GetUtterancesView]
(Int -> ReadS GetUtterancesView)
-> ReadS [GetUtterancesView]
-> ReadPrec GetUtterancesView
-> ReadPrec [GetUtterancesView]
-> Read GetUtterancesView
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUtterancesView]
$creadListPrec :: ReadPrec [GetUtterancesView]
readPrec :: ReadPrec GetUtterancesView
$creadPrec :: ReadPrec GetUtterancesView
readList :: ReadS [GetUtterancesView]
$creadList :: ReadS [GetUtterancesView]
readsPrec :: Int -> ReadS GetUtterancesView
$creadsPrec :: Int -> ReadS GetUtterancesView
Prelude.Read, Int -> GetUtterancesView -> ShowS
[GetUtterancesView] -> ShowS
GetUtterancesView -> String
(Int -> GetUtterancesView -> ShowS)
-> (GetUtterancesView -> String)
-> ([GetUtterancesView] -> ShowS)
-> Show GetUtterancesView
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUtterancesView] -> ShowS
$cshowList :: [GetUtterancesView] -> ShowS
show :: GetUtterancesView -> String
$cshow :: GetUtterancesView -> String
showsPrec :: Int -> GetUtterancesView -> ShowS
$cshowsPrec :: Int -> GetUtterancesView -> ShowS
Prelude.Show, (forall x. GetUtterancesView -> Rep GetUtterancesView x)
-> (forall x. Rep GetUtterancesView x -> GetUtterancesView)
-> Generic GetUtterancesView
forall x. Rep GetUtterancesView x -> GetUtterancesView
forall x. GetUtterancesView -> Rep GetUtterancesView x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetUtterancesView x -> GetUtterancesView
$cfrom :: forall x. GetUtterancesView -> Rep GetUtterancesView x
Prelude.Generic)
newGetUtterancesView ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
StatusType ->
GetUtterancesView
newGetUtterancesView :: Text -> NonEmpty Text -> StatusType -> GetUtterancesView
newGetUtterancesView
Text
pBotName_
NonEmpty Text
pBotVersions_
StatusType
pStatusType_ =
GetUtterancesView' :: Text -> NonEmpty Text -> StatusType -> GetUtterancesView
GetUtterancesView'
{ $sel:botName:GetUtterancesView' :: Text
botName = Text
pBotName_,
$sel:botVersions:GetUtterancesView' :: NonEmpty Text
botVersions = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pBotVersions_,
$sel:statusType:GetUtterancesView' :: StatusType
statusType = StatusType
pStatusType_
}
getUtterancesView_botName :: Lens.Lens' GetUtterancesView Prelude.Text
getUtterancesView_botName :: (Text -> f Text) -> GetUtterancesView -> f GetUtterancesView
getUtterancesView_botName = (GetUtterancesView -> Text)
-> (GetUtterancesView -> Text -> GetUtterancesView)
-> Lens GetUtterancesView GetUtterancesView Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUtterancesView' {Text
botName :: Text
$sel:botName:GetUtterancesView' :: GetUtterancesView -> Text
botName} -> Text
botName) (\s :: GetUtterancesView
s@GetUtterancesView' {} Text
a -> GetUtterancesView
s {$sel:botName:GetUtterancesView' :: Text
botName = Text
a} :: GetUtterancesView)
getUtterancesView_botVersions :: Lens.Lens' GetUtterancesView (Prelude.NonEmpty Prelude.Text)
getUtterancesView_botVersions :: (NonEmpty Text -> f (NonEmpty Text))
-> GetUtterancesView -> f GetUtterancesView
getUtterancesView_botVersions = (GetUtterancesView -> NonEmpty Text)
-> (GetUtterancesView -> NonEmpty Text -> GetUtterancesView)
-> Lens
GetUtterancesView GetUtterancesView (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUtterancesView' {NonEmpty Text
botVersions :: NonEmpty Text
$sel:botVersions:GetUtterancesView' :: GetUtterancesView -> NonEmpty Text
botVersions} -> NonEmpty Text
botVersions) (\s :: GetUtterancesView
s@GetUtterancesView' {} NonEmpty Text
a -> GetUtterancesView
s {$sel:botVersions:GetUtterancesView' :: NonEmpty Text
botVersions = NonEmpty Text
a} :: GetUtterancesView) ((NonEmpty Text -> f (NonEmpty Text))
-> GetUtterancesView -> f GetUtterancesView)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> GetUtterancesView
-> f GetUtterancesView
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getUtterancesView_statusType :: Lens.Lens' GetUtterancesView StatusType
getUtterancesView_statusType :: (StatusType -> f StatusType)
-> GetUtterancesView -> f GetUtterancesView
getUtterancesView_statusType = (GetUtterancesView -> StatusType)
-> (GetUtterancesView -> StatusType -> GetUtterancesView)
-> Lens GetUtterancesView GetUtterancesView StatusType StatusType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUtterancesView' {StatusType
statusType :: StatusType
$sel:statusType:GetUtterancesView' :: GetUtterancesView -> StatusType
statusType} -> StatusType
statusType) (\s :: GetUtterancesView
s@GetUtterancesView' {} StatusType
a -> GetUtterancesView
s {$sel:statusType:GetUtterancesView' :: StatusType
statusType = StatusType
a} :: GetUtterancesView)
instance Core.AWSRequest GetUtterancesView where
type
AWSResponse GetUtterancesView =
GetUtterancesViewResponse
request :: GetUtterancesView -> Request GetUtterancesView
request = Service -> GetUtterancesView -> Request GetUtterancesView
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetUtterancesView
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetUtterancesView)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetUtterancesView))
-> Logger
-> Service
-> Proxy GetUtterancesView
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetUtterancesView)))
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 Text
-> Maybe [UtteranceList] -> Int -> GetUtterancesViewResponse
GetUtterancesViewResponse'
(Maybe Text
-> Maybe [UtteranceList] -> Int -> GetUtterancesViewResponse)
-> Either String (Maybe Text)
-> Either
String (Maybe [UtteranceList] -> Int -> GetUtterancesViewResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"botName")
Either
String (Maybe [UtteranceList] -> Int -> GetUtterancesViewResponse)
-> Either String (Maybe [UtteranceList])
-> Either String (Int -> GetUtterancesViewResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [UtteranceList]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"utterances" Either String (Maybe (Maybe [UtteranceList]))
-> Maybe [UtteranceList] -> Either String (Maybe [UtteranceList])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [UtteranceList]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> GetUtterancesViewResponse)
-> Either String Int -> Either String GetUtterancesViewResponse
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))
)
instance Prelude.Hashable GetUtterancesView
instance Prelude.NFData GetUtterancesView
instance Core.ToHeaders GetUtterancesView where
toHeaders :: GetUtterancesView -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetUtterancesView -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath GetUtterancesView where
toPath :: GetUtterancesView -> ByteString
toPath GetUtterancesView' {NonEmpty Text
Text
StatusType
statusType :: StatusType
botVersions :: NonEmpty Text
botName :: Text
$sel:statusType:GetUtterancesView' :: GetUtterancesView -> StatusType
$sel:botVersions:GetUtterancesView' :: GetUtterancesView -> NonEmpty Text
$sel:botName:GetUtterancesView' :: GetUtterancesView -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/bots/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
botName, ByteString
"/utterances"]
instance Core.ToQuery GetUtterancesView where
toQuery :: GetUtterancesView -> QueryString
toQuery GetUtterancesView' {NonEmpty Text
Text
StatusType
statusType :: StatusType
botVersions :: NonEmpty Text
botName :: Text
$sel:statusType:GetUtterancesView' :: GetUtterancesView -> StatusType
$sel:botVersions:GetUtterancesView' :: GetUtterancesView -> NonEmpty Text
$sel:botName:GetUtterancesView' :: GetUtterancesView -> Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"bot_versions"
ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ByteString -> NonEmpty Text -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" NonEmpty Text
botVersions,
ByteString
"status_type" ByteString -> StatusType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: StatusType
statusType,
QueryString
"view=aggregation"
]
data GetUtterancesViewResponse = GetUtterancesViewResponse'
{
GetUtterancesViewResponse -> Maybe Text
botName :: Prelude.Maybe Prelude.Text,
GetUtterancesViewResponse -> Maybe [UtteranceList]
utterances :: Prelude.Maybe [UtteranceList],
GetUtterancesViewResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetUtterancesViewResponse -> GetUtterancesViewResponse -> Bool
(GetUtterancesViewResponse -> GetUtterancesViewResponse -> Bool)
-> (GetUtterancesViewResponse -> GetUtterancesViewResponse -> Bool)
-> Eq GetUtterancesViewResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetUtterancesViewResponse -> GetUtterancesViewResponse -> Bool
$c/= :: GetUtterancesViewResponse -> GetUtterancesViewResponse -> Bool
== :: GetUtterancesViewResponse -> GetUtterancesViewResponse -> Bool
$c== :: GetUtterancesViewResponse -> GetUtterancesViewResponse -> Bool
Prelude.Eq, ReadPrec [GetUtterancesViewResponse]
ReadPrec GetUtterancesViewResponse
Int -> ReadS GetUtterancesViewResponse
ReadS [GetUtterancesViewResponse]
(Int -> ReadS GetUtterancesViewResponse)
-> ReadS [GetUtterancesViewResponse]
-> ReadPrec GetUtterancesViewResponse
-> ReadPrec [GetUtterancesViewResponse]
-> Read GetUtterancesViewResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetUtterancesViewResponse]
$creadListPrec :: ReadPrec [GetUtterancesViewResponse]
readPrec :: ReadPrec GetUtterancesViewResponse
$creadPrec :: ReadPrec GetUtterancesViewResponse
readList :: ReadS [GetUtterancesViewResponse]
$creadList :: ReadS [GetUtterancesViewResponse]
readsPrec :: Int -> ReadS GetUtterancesViewResponse
$creadsPrec :: Int -> ReadS GetUtterancesViewResponse
Prelude.Read, Int -> GetUtterancesViewResponse -> ShowS
[GetUtterancesViewResponse] -> ShowS
GetUtterancesViewResponse -> String
(Int -> GetUtterancesViewResponse -> ShowS)
-> (GetUtterancesViewResponse -> String)
-> ([GetUtterancesViewResponse] -> ShowS)
-> Show GetUtterancesViewResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetUtterancesViewResponse] -> ShowS
$cshowList :: [GetUtterancesViewResponse] -> ShowS
show :: GetUtterancesViewResponse -> String
$cshow :: GetUtterancesViewResponse -> String
showsPrec :: Int -> GetUtterancesViewResponse -> ShowS
$cshowsPrec :: Int -> GetUtterancesViewResponse -> ShowS
Prelude.Show, (forall x.
GetUtterancesViewResponse -> Rep GetUtterancesViewResponse x)
-> (forall x.
Rep GetUtterancesViewResponse x -> GetUtterancesViewResponse)
-> Generic GetUtterancesViewResponse
forall x.
Rep GetUtterancesViewResponse x -> GetUtterancesViewResponse
forall x.
GetUtterancesViewResponse -> Rep GetUtterancesViewResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetUtterancesViewResponse x -> GetUtterancesViewResponse
$cfrom :: forall x.
GetUtterancesViewResponse -> Rep GetUtterancesViewResponse x
Prelude.Generic)
newGetUtterancesViewResponse ::
Prelude.Int ->
GetUtterancesViewResponse
newGetUtterancesViewResponse :: Int -> GetUtterancesViewResponse
newGetUtterancesViewResponse Int
pHttpStatus_ =
GetUtterancesViewResponse' :: Maybe Text
-> Maybe [UtteranceList] -> Int -> GetUtterancesViewResponse
GetUtterancesViewResponse'
{ $sel:botName:GetUtterancesViewResponse' :: Maybe Text
botName =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:utterances:GetUtterancesViewResponse' :: Maybe [UtteranceList]
utterances = Maybe [UtteranceList]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetUtterancesViewResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getUtterancesViewResponse_botName :: Lens.Lens' GetUtterancesViewResponse (Prelude.Maybe Prelude.Text)
getUtterancesViewResponse_botName :: (Maybe Text -> f (Maybe Text))
-> GetUtterancesViewResponse -> f GetUtterancesViewResponse
getUtterancesViewResponse_botName = (GetUtterancesViewResponse -> Maybe Text)
-> (GetUtterancesViewResponse
-> Maybe Text -> GetUtterancesViewResponse)
-> Lens
GetUtterancesViewResponse
GetUtterancesViewResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUtterancesViewResponse' {Maybe Text
botName :: Maybe Text
$sel:botName:GetUtterancesViewResponse' :: GetUtterancesViewResponse -> Maybe Text
botName} -> Maybe Text
botName) (\s :: GetUtterancesViewResponse
s@GetUtterancesViewResponse' {} Maybe Text
a -> GetUtterancesViewResponse
s {$sel:botName:GetUtterancesViewResponse' :: Maybe Text
botName = Maybe Text
a} :: GetUtterancesViewResponse)
getUtterancesViewResponse_utterances :: Lens.Lens' GetUtterancesViewResponse (Prelude.Maybe [UtteranceList])
getUtterancesViewResponse_utterances :: (Maybe [UtteranceList] -> f (Maybe [UtteranceList]))
-> GetUtterancesViewResponse -> f GetUtterancesViewResponse
getUtterancesViewResponse_utterances = (GetUtterancesViewResponse -> Maybe [UtteranceList])
-> (GetUtterancesViewResponse
-> Maybe [UtteranceList] -> GetUtterancesViewResponse)
-> Lens
GetUtterancesViewResponse
GetUtterancesViewResponse
(Maybe [UtteranceList])
(Maybe [UtteranceList])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUtterancesViewResponse' {Maybe [UtteranceList]
utterances :: Maybe [UtteranceList]
$sel:utterances:GetUtterancesViewResponse' :: GetUtterancesViewResponse -> Maybe [UtteranceList]
utterances} -> Maybe [UtteranceList]
utterances) (\s :: GetUtterancesViewResponse
s@GetUtterancesViewResponse' {} Maybe [UtteranceList]
a -> GetUtterancesViewResponse
s {$sel:utterances:GetUtterancesViewResponse' :: Maybe [UtteranceList]
utterances = Maybe [UtteranceList]
a} :: GetUtterancesViewResponse) ((Maybe [UtteranceList] -> f (Maybe [UtteranceList]))
-> GetUtterancesViewResponse -> f GetUtterancesViewResponse)
-> ((Maybe [UtteranceList] -> f (Maybe [UtteranceList]))
-> Maybe [UtteranceList] -> f (Maybe [UtteranceList]))
-> (Maybe [UtteranceList] -> f (Maybe [UtteranceList]))
-> GetUtterancesViewResponse
-> f GetUtterancesViewResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[UtteranceList] [UtteranceList] [UtteranceList] [UtteranceList]
-> Iso
(Maybe [UtteranceList])
(Maybe [UtteranceList])
(Maybe [UtteranceList])
(Maybe [UtteranceList])
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
[UtteranceList] [UtteranceList] [UtteranceList] [UtteranceList]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getUtterancesViewResponse_httpStatus :: Lens.Lens' GetUtterancesViewResponse Prelude.Int
getUtterancesViewResponse_httpStatus :: (Int -> f Int)
-> GetUtterancesViewResponse -> f GetUtterancesViewResponse
getUtterancesViewResponse_httpStatus = (GetUtterancesViewResponse -> Int)
-> (GetUtterancesViewResponse -> Int -> GetUtterancesViewResponse)
-> Lens GetUtterancesViewResponse GetUtterancesViewResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetUtterancesViewResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetUtterancesViewResponse' :: GetUtterancesViewResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetUtterancesViewResponse
s@GetUtterancesViewResponse' {} Int
a -> GetUtterancesViewResponse
s {$sel:httpStatus:GetUtterancesViewResponse' :: Int
httpStatus = Int
a} :: GetUtterancesViewResponse)
instance Prelude.NFData GetUtterancesViewResponse