{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.FraudDetector.ListEventPredictions
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets a list of past predictions. The list can be filtered by detector
-- ID, detector version ID, event ID, event type, or by specifying a time
-- period. If filter is not specified, the most recent prediction is
-- returned.
--
-- For example, the following filter lists all past predictions for @xyz@
-- event type - @{ \"eventType\":{ \"value\": \"xyz\" }” } @
--
-- This is a paginated API. If you provide a null @maxResults@, this action
-- will retrieve a maximum of 10 records per page. If you provide a
-- @maxResults@, the value must be between 50 and 100. To get the next page
-- results, provide the @nextToken@ from the response as part of your
-- request. A null @nextToken@ fetches the records from the beginning.
module Amazonka.FraudDetector.ListEventPredictions
  ( -- * Creating a Request
    ListEventPredictions (..),
    newListEventPredictions,

    -- * Request Lenses
    listEventPredictions_detectorId,
    listEventPredictions_detectorVersionId,
    listEventPredictions_eventId,
    listEventPredictions_eventType,
    listEventPredictions_maxResults,
    listEventPredictions_nextToken,
    listEventPredictions_predictionTimeRange,

    -- * Destructuring the Response
    ListEventPredictionsResponse (..),
    newListEventPredictionsResponse,

    -- * Response Lenses
    listEventPredictionsResponse_eventPredictionSummaries,
    listEventPredictionsResponse_nextToken,
    listEventPredictionsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.FraudDetector.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListEventPredictions' smart constructor.
data ListEventPredictions = ListEventPredictions'
  { -- | The detector ID.
    ListEventPredictions -> Maybe FilterCondition
detectorId :: Prelude.Maybe FilterCondition,
    -- | The detector version ID.
    ListEventPredictions -> Maybe FilterCondition
detectorVersionId :: Prelude.Maybe FilterCondition,
    -- | The event ID.
    ListEventPredictions -> Maybe FilterCondition
eventId :: Prelude.Maybe FilterCondition,
    -- | The event type associated with the detector.
    ListEventPredictions -> Maybe FilterCondition
eventType :: Prelude.Maybe FilterCondition,
    -- | The maximum number of predictions to return for the request.
    ListEventPredictions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | Identifies the next page of results to return. Use the token to make the
    -- call again to retrieve the next page. Keep all other arguments
    -- unchanged. Each pagination token expires after 24 hours.
    ListEventPredictions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The time period for when the predictions were generated.
    ListEventPredictions -> Maybe PredictionTimeRange
predictionTimeRange :: Prelude.Maybe PredictionTimeRange
  }
  deriving (ListEventPredictions -> ListEventPredictions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEventPredictions -> ListEventPredictions -> Bool
$c/= :: ListEventPredictions -> ListEventPredictions -> Bool
== :: ListEventPredictions -> ListEventPredictions -> Bool
$c== :: ListEventPredictions -> ListEventPredictions -> Bool
Prelude.Eq, ReadPrec [ListEventPredictions]
ReadPrec ListEventPredictions
Int -> ReadS ListEventPredictions
ReadS [ListEventPredictions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEventPredictions]
$creadListPrec :: ReadPrec [ListEventPredictions]
readPrec :: ReadPrec ListEventPredictions
$creadPrec :: ReadPrec ListEventPredictions
readList :: ReadS [ListEventPredictions]
$creadList :: ReadS [ListEventPredictions]
readsPrec :: Int -> ReadS ListEventPredictions
$creadsPrec :: Int -> ReadS ListEventPredictions
Prelude.Read, Int -> ListEventPredictions -> ShowS
[ListEventPredictions] -> ShowS
ListEventPredictions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEventPredictions] -> ShowS
$cshowList :: [ListEventPredictions] -> ShowS
show :: ListEventPredictions -> String
$cshow :: ListEventPredictions -> String
showsPrec :: Int -> ListEventPredictions -> ShowS
$cshowsPrec :: Int -> ListEventPredictions -> ShowS
Prelude.Show, forall x. Rep ListEventPredictions x -> ListEventPredictions
forall x. ListEventPredictions -> Rep ListEventPredictions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEventPredictions x -> ListEventPredictions
$cfrom :: forall x. ListEventPredictions -> Rep ListEventPredictions x
Prelude.Generic)

-- |
-- Create a value of 'ListEventPredictions' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'detectorId', 'listEventPredictions_detectorId' - The detector ID.
--
-- 'detectorVersionId', 'listEventPredictions_detectorVersionId' - The detector version ID.
--
-- 'eventId', 'listEventPredictions_eventId' - The event ID.
--
-- 'eventType', 'listEventPredictions_eventType' - The event type associated with the detector.
--
-- 'maxResults', 'listEventPredictions_maxResults' - The maximum number of predictions to return for the request.
--
-- 'nextToken', 'listEventPredictions_nextToken' - Identifies the next page of results to return. Use the token to make the
-- call again to retrieve the next page. Keep all other arguments
-- unchanged. Each pagination token expires after 24 hours.
--
-- 'predictionTimeRange', 'listEventPredictions_predictionTimeRange' - The time period for when the predictions were generated.
newListEventPredictions ::
  ListEventPredictions
newListEventPredictions :: ListEventPredictions
newListEventPredictions =
  ListEventPredictions'
    { $sel:detectorId:ListEventPredictions' :: Maybe FilterCondition
detectorId = forall a. Maybe a
Prelude.Nothing,
      $sel:detectorVersionId:ListEventPredictions' :: Maybe FilterCondition
detectorVersionId = forall a. Maybe a
Prelude.Nothing,
      $sel:eventId:ListEventPredictions' :: Maybe FilterCondition
eventId = forall a. Maybe a
Prelude.Nothing,
      $sel:eventType:ListEventPredictions' :: Maybe FilterCondition
eventType = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListEventPredictions' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListEventPredictions' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:predictionTimeRange:ListEventPredictions' :: Maybe PredictionTimeRange
predictionTimeRange = forall a. Maybe a
Prelude.Nothing
    }

-- | The detector ID.
listEventPredictions_detectorId :: Lens.Lens' ListEventPredictions (Prelude.Maybe FilterCondition)
listEventPredictions_detectorId :: Lens' ListEventPredictions (Maybe FilterCondition)
listEventPredictions_detectorId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventPredictions' {Maybe FilterCondition
detectorId :: Maybe FilterCondition
$sel:detectorId:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
detectorId} -> Maybe FilterCondition
detectorId) (\s :: ListEventPredictions
s@ListEventPredictions' {} Maybe FilterCondition
a -> ListEventPredictions
s {$sel:detectorId:ListEventPredictions' :: Maybe FilterCondition
detectorId = Maybe FilterCondition
a} :: ListEventPredictions)

-- | The detector version ID.
listEventPredictions_detectorVersionId :: Lens.Lens' ListEventPredictions (Prelude.Maybe FilterCondition)
listEventPredictions_detectorVersionId :: Lens' ListEventPredictions (Maybe FilterCondition)
listEventPredictions_detectorVersionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventPredictions' {Maybe FilterCondition
detectorVersionId :: Maybe FilterCondition
$sel:detectorVersionId:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
detectorVersionId} -> Maybe FilterCondition
detectorVersionId) (\s :: ListEventPredictions
s@ListEventPredictions' {} Maybe FilterCondition
a -> ListEventPredictions
s {$sel:detectorVersionId:ListEventPredictions' :: Maybe FilterCondition
detectorVersionId = Maybe FilterCondition
a} :: ListEventPredictions)

-- | The event ID.
listEventPredictions_eventId :: Lens.Lens' ListEventPredictions (Prelude.Maybe FilterCondition)
listEventPredictions_eventId :: Lens' ListEventPredictions (Maybe FilterCondition)
listEventPredictions_eventId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventPredictions' {Maybe FilterCondition
eventId :: Maybe FilterCondition
$sel:eventId:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
eventId} -> Maybe FilterCondition
eventId) (\s :: ListEventPredictions
s@ListEventPredictions' {} Maybe FilterCondition
a -> ListEventPredictions
s {$sel:eventId:ListEventPredictions' :: Maybe FilterCondition
eventId = Maybe FilterCondition
a} :: ListEventPredictions)

-- | The event type associated with the detector.
listEventPredictions_eventType :: Lens.Lens' ListEventPredictions (Prelude.Maybe FilterCondition)
listEventPredictions_eventType :: Lens' ListEventPredictions (Maybe FilterCondition)
listEventPredictions_eventType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventPredictions' {Maybe FilterCondition
eventType :: Maybe FilterCondition
$sel:eventType:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
eventType} -> Maybe FilterCondition
eventType) (\s :: ListEventPredictions
s@ListEventPredictions' {} Maybe FilterCondition
a -> ListEventPredictions
s {$sel:eventType:ListEventPredictions' :: Maybe FilterCondition
eventType = Maybe FilterCondition
a} :: ListEventPredictions)

-- | The maximum number of predictions to return for the request.
listEventPredictions_maxResults :: Lens.Lens' ListEventPredictions (Prelude.Maybe Prelude.Natural)
listEventPredictions_maxResults :: Lens' ListEventPredictions (Maybe Natural)
listEventPredictions_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventPredictions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListEventPredictions' :: ListEventPredictions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListEventPredictions
s@ListEventPredictions' {} Maybe Natural
a -> ListEventPredictions
s {$sel:maxResults:ListEventPredictions' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListEventPredictions)

-- | Identifies the next page of results to return. Use the token to make the
-- call again to retrieve the next page. Keep all other arguments
-- unchanged. Each pagination token expires after 24 hours.
listEventPredictions_nextToken :: Lens.Lens' ListEventPredictions (Prelude.Maybe Prelude.Text)
listEventPredictions_nextToken :: Lens' ListEventPredictions (Maybe Text)
listEventPredictions_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventPredictions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEventPredictions' :: ListEventPredictions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEventPredictions
s@ListEventPredictions' {} Maybe Text
a -> ListEventPredictions
s {$sel:nextToken:ListEventPredictions' :: Maybe Text
nextToken = Maybe Text
a} :: ListEventPredictions)

-- | The time period for when the predictions were generated.
listEventPredictions_predictionTimeRange :: Lens.Lens' ListEventPredictions (Prelude.Maybe PredictionTimeRange)
listEventPredictions_predictionTimeRange :: Lens' ListEventPredictions (Maybe PredictionTimeRange)
listEventPredictions_predictionTimeRange = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventPredictions' {Maybe PredictionTimeRange
predictionTimeRange :: Maybe PredictionTimeRange
$sel:predictionTimeRange:ListEventPredictions' :: ListEventPredictions -> Maybe PredictionTimeRange
predictionTimeRange} -> Maybe PredictionTimeRange
predictionTimeRange) (\s :: ListEventPredictions
s@ListEventPredictions' {} Maybe PredictionTimeRange
a -> ListEventPredictions
s {$sel:predictionTimeRange:ListEventPredictions' :: Maybe PredictionTimeRange
predictionTimeRange = Maybe PredictionTimeRange
a} :: ListEventPredictions)

instance Core.AWSRequest ListEventPredictions where
  type
    AWSResponse ListEventPredictions =
      ListEventPredictionsResponse
  request :: (Service -> Service)
-> ListEventPredictions -> Request ListEventPredictions
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListEventPredictions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListEventPredictions)))
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 [EventPredictionSummary]
-> Maybe Text -> Int -> ListEventPredictionsResponse
ListEventPredictionsResponse'
            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
"eventPredictionSummaries"
                            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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
            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))
      )

instance Prelude.Hashable ListEventPredictions where
  hashWithSalt :: Int -> ListEventPredictions -> Int
hashWithSalt Int
_salt ListEventPredictions' {Maybe Natural
Maybe Text
Maybe FilterCondition
Maybe PredictionTimeRange
predictionTimeRange :: Maybe PredictionTimeRange
nextToken :: Maybe Text
maxResults :: Maybe Natural
eventType :: Maybe FilterCondition
eventId :: Maybe FilterCondition
detectorVersionId :: Maybe FilterCondition
detectorId :: Maybe FilterCondition
$sel:predictionTimeRange:ListEventPredictions' :: ListEventPredictions -> Maybe PredictionTimeRange
$sel:nextToken:ListEventPredictions' :: ListEventPredictions -> Maybe Text
$sel:maxResults:ListEventPredictions' :: ListEventPredictions -> Maybe Natural
$sel:eventType:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
$sel:eventId:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
$sel:detectorVersionId:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
$sel:detectorId:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FilterCondition
detectorId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FilterCondition
detectorVersionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FilterCondition
eventId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe FilterCondition
eventType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PredictionTimeRange
predictionTimeRange

instance Prelude.NFData ListEventPredictions where
  rnf :: ListEventPredictions -> ()
rnf ListEventPredictions' {Maybe Natural
Maybe Text
Maybe FilterCondition
Maybe PredictionTimeRange
predictionTimeRange :: Maybe PredictionTimeRange
nextToken :: Maybe Text
maxResults :: Maybe Natural
eventType :: Maybe FilterCondition
eventId :: Maybe FilterCondition
detectorVersionId :: Maybe FilterCondition
detectorId :: Maybe FilterCondition
$sel:predictionTimeRange:ListEventPredictions' :: ListEventPredictions -> Maybe PredictionTimeRange
$sel:nextToken:ListEventPredictions' :: ListEventPredictions -> Maybe Text
$sel:maxResults:ListEventPredictions' :: ListEventPredictions -> Maybe Natural
$sel:eventType:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
$sel:eventId:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
$sel:detectorVersionId:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
$sel:detectorId:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe FilterCondition
detectorId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FilterCondition
detectorVersionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FilterCondition
eventId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe FilterCondition
eventType
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PredictionTimeRange
predictionTimeRange

instance Data.ToHeaders ListEventPredictions where
  toHeaders :: ListEventPredictions -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AWSHawksNestServiceFacade.ListEventPredictions" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON ListEventPredictions where
  toJSON :: ListEventPredictions -> Value
toJSON ListEventPredictions' {Maybe Natural
Maybe Text
Maybe FilterCondition
Maybe PredictionTimeRange
predictionTimeRange :: Maybe PredictionTimeRange
nextToken :: Maybe Text
maxResults :: Maybe Natural
eventType :: Maybe FilterCondition
eventId :: Maybe FilterCondition
detectorVersionId :: Maybe FilterCondition
detectorId :: Maybe FilterCondition
$sel:predictionTimeRange:ListEventPredictions' :: ListEventPredictions -> Maybe PredictionTimeRange
$sel:nextToken:ListEventPredictions' :: ListEventPredictions -> Maybe Text
$sel:maxResults:ListEventPredictions' :: ListEventPredictions -> Maybe Natural
$sel:eventType:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
$sel:eventId:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
$sel:detectorVersionId:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
$sel:detectorId:ListEventPredictions' :: ListEventPredictions -> Maybe FilterCondition
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"detectorId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FilterCondition
detectorId,
            (Key
"detectorVersionId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FilterCondition
detectorVersionId,
            (Key
"eventId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FilterCondition
eventId,
            (Key
"eventType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FilterCondition
eventType,
            (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"predictionTimeRange" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PredictionTimeRange
predictionTimeRange
          ]
      )

instance Data.ToPath ListEventPredictions where
  toPath :: ListEventPredictions -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery ListEventPredictions where
  toQuery :: ListEventPredictions -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListEventPredictionsResponse' smart constructor.
data ListEventPredictionsResponse = ListEventPredictionsResponse'
  { -- | The summary of the past predictions.
    ListEventPredictionsResponse -> Maybe [EventPredictionSummary]
eventPredictionSummaries :: Prelude.Maybe [EventPredictionSummary],
    -- | Identifies the next page of results to return. Use the token to make the
    -- call again to retrieve the next page. Keep all other arguments
    -- unchanged. Each pagination token expires after 24 hours.
    ListEventPredictionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListEventPredictionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListEventPredictionsResponse
-> ListEventPredictionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEventPredictionsResponse
-> ListEventPredictionsResponse -> Bool
$c/= :: ListEventPredictionsResponse
-> ListEventPredictionsResponse -> Bool
== :: ListEventPredictionsResponse
-> ListEventPredictionsResponse -> Bool
$c== :: ListEventPredictionsResponse
-> ListEventPredictionsResponse -> Bool
Prelude.Eq, ReadPrec [ListEventPredictionsResponse]
ReadPrec ListEventPredictionsResponse
Int -> ReadS ListEventPredictionsResponse
ReadS [ListEventPredictionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEventPredictionsResponse]
$creadListPrec :: ReadPrec [ListEventPredictionsResponse]
readPrec :: ReadPrec ListEventPredictionsResponse
$creadPrec :: ReadPrec ListEventPredictionsResponse
readList :: ReadS [ListEventPredictionsResponse]
$creadList :: ReadS [ListEventPredictionsResponse]
readsPrec :: Int -> ReadS ListEventPredictionsResponse
$creadsPrec :: Int -> ReadS ListEventPredictionsResponse
Prelude.Read, Int -> ListEventPredictionsResponse -> ShowS
[ListEventPredictionsResponse] -> ShowS
ListEventPredictionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEventPredictionsResponse] -> ShowS
$cshowList :: [ListEventPredictionsResponse] -> ShowS
show :: ListEventPredictionsResponse -> String
$cshow :: ListEventPredictionsResponse -> String
showsPrec :: Int -> ListEventPredictionsResponse -> ShowS
$cshowsPrec :: Int -> ListEventPredictionsResponse -> ShowS
Prelude.Show, forall x.
Rep ListEventPredictionsResponse x -> ListEventPredictionsResponse
forall x.
ListEventPredictionsResponse -> Rep ListEventPredictionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListEventPredictionsResponse x -> ListEventPredictionsResponse
$cfrom :: forall x.
ListEventPredictionsResponse -> Rep ListEventPredictionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListEventPredictionsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'eventPredictionSummaries', 'listEventPredictionsResponse_eventPredictionSummaries' - The summary of the past predictions.
--
-- 'nextToken', 'listEventPredictionsResponse_nextToken' - Identifies the next page of results to return. Use the token to make the
-- call again to retrieve the next page. Keep all other arguments
-- unchanged. Each pagination token expires after 24 hours.
--
-- 'httpStatus', 'listEventPredictionsResponse_httpStatus' - The response's http status code.
newListEventPredictionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListEventPredictionsResponse
newListEventPredictionsResponse :: Int -> ListEventPredictionsResponse
newListEventPredictionsResponse Int
pHttpStatus_ =
  ListEventPredictionsResponse'
    { $sel:eventPredictionSummaries:ListEventPredictionsResponse' :: Maybe [EventPredictionSummary]
eventPredictionSummaries =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListEventPredictionsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListEventPredictionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The summary of the past predictions.
listEventPredictionsResponse_eventPredictionSummaries :: Lens.Lens' ListEventPredictionsResponse (Prelude.Maybe [EventPredictionSummary])
listEventPredictionsResponse_eventPredictionSummaries :: Lens' ListEventPredictionsResponse (Maybe [EventPredictionSummary])
listEventPredictionsResponse_eventPredictionSummaries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventPredictionsResponse' {Maybe [EventPredictionSummary]
eventPredictionSummaries :: Maybe [EventPredictionSummary]
$sel:eventPredictionSummaries:ListEventPredictionsResponse' :: ListEventPredictionsResponse -> Maybe [EventPredictionSummary]
eventPredictionSummaries} -> Maybe [EventPredictionSummary]
eventPredictionSummaries) (\s :: ListEventPredictionsResponse
s@ListEventPredictionsResponse' {} Maybe [EventPredictionSummary]
a -> ListEventPredictionsResponse
s {$sel:eventPredictionSummaries:ListEventPredictionsResponse' :: Maybe [EventPredictionSummary]
eventPredictionSummaries = Maybe [EventPredictionSummary]
a} :: ListEventPredictionsResponse) 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

-- | Identifies the next page of results to return. Use the token to make the
-- call again to retrieve the next page. Keep all other arguments
-- unchanged. Each pagination token expires after 24 hours.
listEventPredictionsResponse_nextToken :: Lens.Lens' ListEventPredictionsResponse (Prelude.Maybe Prelude.Text)
listEventPredictionsResponse_nextToken :: Lens' ListEventPredictionsResponse (Maybe Text)
listEventPredictionsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventPredictionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEventPredictionsResponse' :: ListEventPredictionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEventPredictionsResponse
s@ListEventPredictionsResponse' {} Maybe Text
a -> ListEventPredictionsResponse
s {$sel:nextToken:ListEventPredictionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEventPredictionsResponse)

-- | The response's http status code.
listEventPredictionsResponse_httpStatus :: Lens.Lens' ListEventPredictionsResponse Prelude.Int
listEventPredictionsResponse_httpStatus :: Lens' ListEventPredictionsResponse Int
listEventPredictionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEventPredictionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListEventPredictionsResponse' :: ListEventPredictionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListEventPredictionsResponse
s@ListEventPredictionsResponse' {} Int
a -> ListEventPredictionsResponse
s {$sel:httpStatus:ListEventPredictionsResponse' :: Int
httpStatus = Int
a} :: ListEventPredictionsResponse)

instance Prelude.NFData ListEventPredictionsResponse where
  rnf :: ListEventPredictionsResponse -> ()
rnf ListEventPredictionsResponse' {Int
Maybe [EventPredictionSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
eventPredictionSummaries :: Maybe [EventPredictionSummary]
$sel:httpStatus:ListEventPredictionsResponse' :: ListEventPredictionsResponse -> Int
$sel:nextToken:ListEventPredictionsResponse' :: ListEventPredictionsResponse -> Maybe Text
$sel:eventPredictionSummaries:ListEventPredictionsResponse' :: ListEventPredictionsResponse -> Maybe [EventPredictionSummary]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [EventPredictionSummary]
eventPredictionSummaries
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus