{-# 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_waitTimeSeconds,
getRecommendations_maxResults,
getRecommendations_assistantId,
getRecommendations_sessionId,
GetRecommendationsResponse (..),
newGetRecommendationsResponse,
getRecommendationsResponse_httpStatus,
getRecommendationsResponse_recommendations,
)
where
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
import Amazonka.Wisdom.Types
data GetRecommendations = GetRecommendations'
{
GetRecommendations -> Maybe Natural
waitTimeSeconds :: Prelude.Maybe Prelude.Natural,
GetRecommendations -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
GetRecommendations -> Text
assistantId :: Prelude.Text,
GetRecommendations -> Text
sessionId :: Prelude.Text
}
deriving (GetRecommendations -> GetRecommendations -> Bool
(GetRecommendations -> GetRecommendations -> Bool)
-> (GetRecommendations -> GetRecommendations -> Bool)
-> Eq GetRecommendations
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]
(Int -> ReadS GetRecommendations)
-> ReadS [GetRecommendations]
-> ReadPrec GetRecommendations
-> ReadPrec [GetRecommendations]
-> Read 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
(Int -> GetRecommendations -> ShowS)
-> (GetRecommendations -> String)
-> ([GetRecommendations] -> ShowS)
-> Show GetRecommendations
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. GetRecommendations -> Rep GetRecommendations x)
-> (forall x. Rep GetRecommendations x -> GetRecommendations)
-> Generic GetRecommendations
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' :: Maybe Natural
-> Maybe Natural -> Text -> Text -> GetRecommendations
GetRecommendations'
{ $sel:waitTimeSeconds:GetRecommendations' :: Maybe Natural
waitTimeSeconds =
Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:GetRecommendations' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:assistantId:GetRecommendations' :: Text
assistantId = Text
pAssistantId_,
$sel:sessionId:GetRecommendations' :: Text
sessionId = Text
pSessionId_
}
getRecommendations_waitTimeSeconds :: Lens.Lens' GetRecommendations (Prelude.Maybe Prelude.Natural)
getRecommendations_waitTimeSeconds :: (Maybe Natural -> f (Maybe Natural))
-> GetRecommendations -> f GetRecommendations
getRecommendations_waitTimeSeconds = (GetRecommendations -> Maybe Natural)
-> (GetRecommendations -> Maybe Natural -> GetRecommendations)
-> Lens
GetRecommendations
GetRecommendations
(Maybe Natural)
(Maybe Natural)
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_maxResults :: Lens.Lens' GetRecommendations (Prelude.Maybe Prelude.Natural)
getRecommendations_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetRecommendations -> f GetRecommendations
getRecommendations_maxResults = (GetRecommendations -> Maybe Natural)
-> (GetRecommendations -> Maybe Natural -> GetRecommendations)
-> Lens
GetRecommendations
GetRecommendations
(Maybe Natural)
(Maybe Natural)
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_assistantId :: Lens.Lens' GetRecommendations Prelude.Text
getRecommendations_assistantId :: (Text -> f Text) -> GetRecommendations -> f GetRecommendations
getRecommendations_assistantId = (GetRecommendations -> Text)
-> (GetRecommendations -> Text -> GetRecommendations)
-> Lens GetRecommendations GetRecommendations Text Text
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 :: (Text -> f Text) -> GetRecommendations -> f GetRecommendations
getRecommendations_sessionId = (GetRecommendations -> Text)
-> (GetRecommendations -> Text -> GetRecommendations)
-> Lens GetRecommendations GetRecommendations Text Text
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 :: GetRecommendations -> Request GetRecommendations
request = Service -> GetRecommendations -> Request GetRecommendations
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetRecommendations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetRecommendations)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetRecommendations))
-> Logger
-> Service
-> Proxy GetRecommendations
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetRecommendations)))
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 -> [RecommendationData] -> GetRecommendationsResponse
GetRecommendationsResponse'
(Int -> [RecommendationData] -> GetRecommendationsResponse)
-> Either String Int
-> Either
String ([RecommendationData] -> GetRecommendationsResponse)
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 ([RecommendationData] -> GetRecommendationsResponse)
-> Either String [RecommendationData]
-> Either String GetRecommendationsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [RecommendationData])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"recommendations"
Either String (Maybe [RecommendationData])
-> [RecommendationData] -> Either String [RecommendationData]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [RecommendationData]
forall a. Monoid a => a
Prelude.mempty
)
)
instance Prelude.Hashable GetRecommendations
instance Prelude.NFData GetRecommendations
instance Core.ToHeaders GetRecommendations where
toHeaders :: GetRecommendations -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetRecommendations -> 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 GetRecommendations where
toPath :: GetRecommendations -> ByteString
toPath GetRecommendations' {Maybe Natural
Text
sessionId :: Text
assistantId :: Text
maxResults :: Maybe Natural
waitTimeSeconds :: Maybe Natural
$sel:sessionId:GetRecommendations' :: GetRecommendations -> Text
$sel:assistantId:GetRecommendations' :: GetRecommendations -> Text
$sel:maxResults:GetRecommendations' :: GetRecommendations -> Maybe Natural
$sel:waitTimeSeconds:GetRecommendations' :: GetRecommendations -> Maybe Natural
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/assistants/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
assistantId,
ByteString
"/sessions/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
sessionId,
ByteString
"/recommendations"
]
instance Core.ToQuery GetRecommendations where
toQuery :: GetRecommendations -> QueryString
toQuery GetRecommendations' {Maybe Natural
Text
sessionId :: Text
assistantId :: Text
maxResults :: Maybe Natural
waitTimeSeconds :: Maybe Natural
$sel:sessionId:GetRecommendations' :: GetRecommendations -> Text
$sel:assistantId:GetRecommendations' :: GetRecommendations -> Text
$sel:maxResults:GetRecommendations' :: GetRecommendations -> Maybe Natural
$sel:waitTimeSeconds:GetRecommendations' :: GetRecommendations -> Maybe Natural
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"waitTimeSeconds" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
waitTimeSeconds,
ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data GetRecommendationsResponse = GetRecommendationsResponse'
{
GetRecommendationsResponse -> Int
httpStatus :: Prelude.Int,
GetRecommendationsResponse -> [RecommendationData]
recommendations :: [RecommendationData]
}
deriving (GetRecommendationsResponse -> GetRecommendationsResponse -> Bool
(GetRecommendationsResponse -> GetRecommendationsResponse -> Bool)
-> (GetRecommendationsResponse
-> GetRecommendationsResponse -> Bool)
-> Eq GetRecommendationsResponse
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
(Int -> GetRecommendationsResponse -> ShowS)
-> (GetRecommendationsResponse -> String)
-> ([GetRecommendationsResponse] -> ShowS)
-> Show GetRecommendationsResponse
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.
GetRecommendationsResponse -> Rep GetRecommendationsResponse x)
-> (forall x.
Rep GetRecommendationsResponse x -> GetRecommendationsResponse)
-> Generic GetRecommendationsResponse
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' :: Int -> [RecommendationData] -> GetRecommendationsResponse
GetRecommendationsResponse'
{ $sel:httpStatus:GetRecommendationsResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:recommendations:GetRecommendationsResponse' :: [RecommendationData]
recommendations = [RecommendationData]
forall a. Monoid a => a
Prelude.mempty
}
getRecommendationsResponse_httpStatus :: Lens.Lens' GetRecommendationsResponse Prelude.Int
getRecommendationsResponse_httpStatus :: (Int -> f Int)
-> GetRecommendationsResponse -> f GetRecommendationsResponse
getRecommendationsResponse_httpStatus = (GetRecommendationsResponse -> Int)
-> (GetRecommendationsResponse
-> Int -> GetRecommendationsResponse)
-> Lens
GetRecommendationsResponse GetRecommendationsResponse Int Int
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 :: ([RecommendationData] -> f [RecommendationData])
-> GetRecommendationsResponse -> f GetRecommendationsResponse
getRecommendationsResponse_recommendations = (GetRecommendationsResponse -> [RecommendationData])
-> (GetRecommendationsResponse
-> [RecommendationData] -> GetRecommendationsResponse)
-> Lens
GetRecommendationsResponse
GetRecommendationsResponse
[RecommendationData]
[RecommendationData]
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) (([RecommendationData] -> f [RecommendationData])
-> GetRecommendationsResponse -> f GetRecommendationsResponse)
-> (([RecommendationData] -> f [RecommendationData])
-> [RecommendationData] -> f [RecommendationData])
-> ([RecommendationData] -> f [RecommendationData])
-> GetRecommendationsResponse
-> f GetRecommendationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RecommendationData] -> f [RecommendationData])
-> [RecommendationData] -> f [RecommendationData]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData GetRecommendationsResponse