{-# 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.Wisdom.GetRecommendations
(
GetRecommendations (..),
newGetRecommendations,
getRecommendations_maxResults,
getRecommendations_waitTimeSeconds,
getRecommendations_assistantId,
getRecommendations_sessionId,
GetRecommendationsResponse (..),
newGetRecommendationsResponse,
getRecommendationsResponse_triggers,
getRecommendationsResponse_httpStatus,
getRecommendationsResponse_recommendations,
)
where
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
import Amazonka.Wisdom.Types
data GetRecommendations = GetRecommendations'
{
GetRecommendations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
GetRecommendations -> Maybe Natural
waitTimeSeconds :: Prelude.Maybe Prelude.Natural,
GetRecommendations -> Text
assistantId :: Prelude.Text,
GetRecommendations -> Text
sessionId :: Prelude.Text
}
deriving (GetRecommendations -> GetRecommendations -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRecommendations -> GetRecommendations -> Bool
$c/= :: GetRecommendations -> GetRecommendations -> Bool
== :: GetRecommendations -> GetRecommendations -> Bool
$c== :: GetRecommendations -> GetRecommendations -> Bool
Prelude.Eq, ReadPrec [GetRecommendations]
ReadPrec GetRecommendations
Int -> ReadS GetRecommendations
ReadS [GetRecommendations]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRecommendations]
$creadListPrec :: ReadPrec [GetRecommendations]
readPrec :: ReadPrec GetRecommendations
$creadPrec :: ReadPrec GetRecommendations
readList :: ReadS [GetRecommendations]
$creadList :: ReadS [GetRecommendations]
readsPrec :: Int -> ReadS GetRecommendations
$creadsPrec :: Int -> ReadS GetRecommendations
Prelude.Read, Int -> GetRecommendations -> ShowS
[GetRecommendations] -> ShowS
GetRecommendations -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRecommendations] -> ShowS
$cshowList :: [GetRecommendations] -> ShowS
show :: GetRecommendations -> String
$cshow :: GetRecommendations -> String
showsPrec :: Int -> GetRecommendations -> ShowS
$cshowsPrec :: Int -> GetRecommendations -> ShowS
Prelude.Show, forall x. Rep GetRecommendations x -> GetRecommendations
forall x. GetRecommendations -> Rep GetRecommendations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetRecommendations x -> GetRecommendations
$cfrom :: forall x. GetRecommendations -> Rep GetRecommendations x
Prelude.Generic)
newGetRecommendations ::
Prelude.Text ->
Prelude.Text ->
GetRecommendations
newGetRecommendations :: Text -> Text -> GetRecommendations
newGetRecommendations Text
pAssistantId_ Text
pSessionId_ =
GetRecommendations'
{ $sel:maxResults:GetRecommendations' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:waitTimeSeconds:GetRecommendations' :: Maybe Natural
waitTimeSeconds = forall a. Maybe a
Prelude.Nothing,
$sel:assistantId:GetRecommendations' :: Text
assistantId = Text
pAssistantId_,
$sel:sessionId:GetRecommendations' :: Text
sessionId = Text
pSessionId_
}
getRecommendations_maxResults :: Lens.Lens' GetRecommendations (Prelude.Maybe Prelude.Natural)
getRecommendations_maxResults :: Lens' GetRecommendations (Maybe Natural)
getRecommendations_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendations' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetRecommendations' :: GetRecommendations -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetRecommendations
s@GetRecommendations' {} Maybe Natural
a -> GetRecommendations
s {$sel:maxResults:GetRecommendations' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetRecommendations)
getRecommendations_waitTimeSeconds :: Lens.Lens' GetRecommendations (Prelude.Maybe Prelude.Natural)
getRecommendations_waitTimeSeconds :: Lens' GetRecommendations (Maybe Natural)
getRecommendations_waitTimeSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendations' {Maybe Natural
waitTimeSeconds :: Maybe Natural
$sel:waitTimeSeconds:GetRecommendations' :: GetRecommendations -> Maybe Natural
waitTimeSeconds} -> Maybe Natural
waitTimeSeconds) (\s :: GetRecommendations
s@GetRecommendations' {} Maybe Natural
a -> GetRecommendations
s {$sel:waitTimeSeconds:GetRecommendations' :: Maybe Natural
waitTimeSeconds = Maybe Natural
a} :: GetRecommendations)
getRecommendations_assistantId :: Lens.Lens' GetRecommendations Prelude.Text
getRecommendations_assistantId :: Lens' GetRecommendations Text
getRecommendations_assistantId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendations' {Text
assistantId :: Text
$sel:assistantId:GetRecommendations' :: GetRecommendations -> Text
assistantId} -> Text
assistantId) (\s :: GetRecommendations
s@GetRecommendations' {} Text
a -> GetRecommendations
s {$sel:assistantId:GetRecommendations' :: Text
assistantId = Text
a} :: GetRecommendations)
getRecommendations_sessionId :: Lens.Lens' GetRecommendations Prelude.Text
getRecommendations_sessionId :: Lens' GetRecommendations Text
getRecommendations_sessionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendations' {Text
sessionId :: Text
$sel:sessionId:GetRecommendations' :: GetRecommendations -> Text
sessionId} -> Text
sessionId) (\s :: GetRecommendations
s@GetRecommendations' {} Text
a -> GetRecommendations
s {$sel:sessionId:GetRecommendations' :: Text
sessionId = Text
a} :: GetRecommendations)
instance Core.AWSRequest GetRecommendations where
type
AWSResponse GetRecommendations =
GetRecommendationsResponse
request :: (Service -> Service)
-> GetRecommendations -> Request GetRecommendations
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetRecommendations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetRecommendations)))
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 ->
Maybe [RecommendationTrigger]
-> Int -> [RecommendationData] -> GetRecommendationsResponse
GetRecommendationsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"triggers" 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.<*> (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
"recommendations"
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable GetRecommendations where
hashWithSalt :: Int -> GetRecommendations -> Int
hashWithSalt Int
_salt GetRecommendations' {Maybe Natural
Text
sessionId :: Text
assistantId :: Text
waitTimeSeconds :: Maybe Natural
maxResults :: Maybe Natural
$sel:sessionId:GetRecommendations' :: GetRecommendations -> Text
$sel:assistantId:GetRecommendations' :: GetRecommendations -> Text
$sel:waitTimeSeconds:GetRecommendations' :: GetRecommendations -> Maybe Natural
$sel:maxResults:GetRecommendations' :: GetRecommendations -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
waitTimeSeconds
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
assistantId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sessionId
instance Prelude.NFData GetRecommendations where
rnf :: GetRecommendations -> ()
rnf GetRecommendations' {Maybe Natural
Text
sessionId :: Text
assistantId :: Text
waitTimeSeconds :: Maybe Natural
maxResults :: Maybe Natural
$sel:sessionId:GetRecommendations' :: GetRecommendations -> Text
$sel:assistantId:GetRecommendations' :: GetRecommendations -> Text
$sel:waitTimeSeconds:GetRecommendations' :: GetRecommendations -> Maybe Natural
$sel:maxResults:GetRecommendations' :: GetRecommendations -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
waitTimeSeconds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
assistantId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sessionId
instance Data.ToHeaders GetRecommendations where
toHeaders :: GetRecommendations -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath GetRecommendations where
toPath :: GetRecommendations -> ByteString
toPath GetRecommendations' {Maybe Natural
Text
sessionId :: Text
assistantId :: Text
waitTimeSeconds :: Maybe Natural
maxResults :: Maybe Natural
$sel:sessionId:GetRecommendations' :: GetRecommendations -> Text
$sel:assistantId:GetRecommendations' :: GetRecommendations -> Text
$sel:waitTimeSeconds:GetRecommendations' :: GetRecommendations -> Maybe Natural
$sel:maxResults:GetRecommendations' :: GetRecommendations -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/assistants/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
assistantId,
ByteString
"/sessions/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
sessionId,
ByteString
"/recommendations"
]
instance Data.ToQuery GetRecommendations where
toQuery :: GetRecommendations -> QueryString
toQuery GetRecommendations' {Maybe Natural
Text
sessionId :: Text
assistantId :: Text
waitTimeSeconds :: Maybe Natural
maxResults :: Maybe Natural
$sel:sessionId:GetRecommendations' :: GetRecommendations -> Text
$sel:assistantId:GetRecommendations' :: GetRecommendations -> Text
$sel:waitTimeSeconds:GetRecommendations' :: GetRecommendations -> Maybe Natural
$sel:maxResults:GetRecommendations' :: GetRecommendations -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"waitTimeSeconds" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
waitTimeSeconds
]
data GetRecommendationsResponse = GetRecommendationsResponse'
{
GetRecommendationsResponse -> Maybe [RecommendationTrigger]
triggers :: Prelude.Maybe [RecommendationTrigger],
GetRecommendationsResponse -> Int
httpStatus :: Prelude.Int,
GetRecommendationsResponse -> [RecommendationData]
recommendations :: [RecommendationData]
}
deriving (GetRecommendationsResponse -> GetRecommendationsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRecommendationsResponse -> GetRecommendationsResponse -> Bool
$c/= :: GetRecommendationsResponse -> GetRecommendationsResponse -> Bool
== :: GetRecommendationsResponse -> GetRecommendationsResponse -> Bool
$c== :: GetRecommendationsResponse -> GetRecommendationsResponse -> Bool
Prelude.Eq, Int -> GetRecommendationsResponse -> ShowS
[GetRecommendationsResponse] -> ShowS
GetRecommendationsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRecommendationsResponse] -> ShowS
$cshowList :: [GetRecommendationsResponse] -> ShowS
show :: GetRecommendationsResponse -> String
$cshow :: GetRecommendationsResponse -> String
showsPrec :: Int -> GetRecommendationsResponse -> ShowS
$cshowsPrec :: Int -> GetRecommendationsResponse -> ShowS
Prelude.Show, forall x.
Rep GetRecommendationsResponse x -> GetRecommendationsResponse
forall x.
GetRecommendationsResponse -> Rep GetRecommendationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRecommendationsResponse x -> GetRecommendationsResponse
$cfrom :: forall x.
GetRecommendationsResponse -> Rep GetRecommendationsResponse x
Prelude.Generic)
newGetRecommendationsResponse ::
Prelude.Int ->
GetRecommendationsResponse
newGetRecommendationsResponse :: Int -> GetRecommendationsResponse
newGetRecommendationsResponse Int
pHttpStatus_ =
GetRecommendationsResponse'
{ $sel:triggers:GetRecommendationsResponse' :: Maybe [RecommendationTrigger]
triggers =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetRecommendationsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:recommendations:GetRecommendationsResponse' :: [RecommendationData]
recommendations = forall a. Monoid a => a
Prelude.mempty
}
getRecommendationsResponse_triggers :: Lens.Lens' GetRecommendationsResponse (Prelude.Maybe [RecommendationTrigger])
getRecommendationsResponse_triggers :: Lens' GetRecommendationsResponse (Maybe [RecommendationTrigger])
getRecommendationsResponse_triggers = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendationsResponse' {Maybe [RecommendationTrigger]
triggers :: Maybe [RecommendationTrigger]
$sel:triggers:GetRecommendationsResponse' :: GetRecommendationsResponse -> Maybe [RecommendationTrigger]
triggers} -> Maybe [RecommendationTrigger]
triggers) (\s :: GetRecommendationsResponse
s@GetRecommendationsResponse' {} Maybe [RecommendationTrigger]
a -> GetRecommendationsResponse
s {$sel:triggers:GetRecommendationsResponse' :: Maybe [RecommendationTrigger]
triggers = Maybe [RecommendationTrigger]
a} :: GetRecommendationsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getRecommendationsResponse_httpStatus :: Lens.Lens' GetRecommendationsResponse Prelude.Int
getRecommendationsResponse_httpStatus :: Lens' GetRecommendationsResponse Int
getRecommendationsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendationsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetRecommendationsResponse' :: GetRecommendationsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetRecommendationsResponse
s@GetRecommendationsResponse' {} Int
a -> GetRecommendationsResponse
s {$sel:httpStatus:GetRecommendationsResponse' :: Int
httpStatus = Int
a} :: GetRecommendationsResponse)
getRecommendationsResponse_recommendations :: Lens.Lens' GetRecommendationsResponse [RecommendationData]
getRecommendationsResponse_recommendations :: Lens' GetRecommendationsResponse [RecommendationData]
getRecommendationsResponse_recommendations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommendationsResponse' {[RecommendationData]
recommendations :: [RecommendationData]
$sel:recommendations:GetRecommendationsResponse' :: GetRecommendationsResponse -> [RecommendationData]
recommendations} -> [RecommendationData]
recommendations) (\s :: GetRecommendationsResponse
s@GetRecommendationsResponse' {} [RecommendationData]
a -> GetRecommendationsResponse
s {$sel:recommendations:GetRecommendationsResponse' :: [RecommendationData]
recommendations = [RecommendationData]
a} :: GetRecommendationsResponse) 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 GetRecommendationsResponse where
rnf :: GetRecommendationsResponse -> ()
rnf GetRecommendationsResponse' {Int
[RecommendationData]
Maybe [RecommendationTrigger]
recommendations :: [RecommendationData]
httpStatus :: Int
triggers :: Maybe [RecommendationTrigger]
$sel:recommendations:GetRecommendationsResponse' :: GetRecommendationsResponse -> [RecommendationData]
$sel:httpStatus:GetRecommendationsResponse' :: GetRecommendationsResponse -> Int
$sel:triggers:GetRecommendationsResponse' :: GetRecommendationsResponse -> Maybe [RecommendationTrigger]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [RecommendationTrigger]
triggers
seq :: forall a b. a -> b -> b
`Prelude.seq` 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 [RecommendationData]
recommendations