{-# 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.Pinpoint.GetJourneyDateRangeKpi
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves (queries) pre-aggregated data for a standard engagement metric
-- that applies to a journey.
module Amazonka.Pinpoint.GetJourneyDateRangeKpi
  ( -- * Creating a Request
    GetJourneyDateRangeKpi (..),
    newGetJourneyDateRangeKpi,

    -- * Request Lenses
    getJourneyDateRangeKpi_startTime,
    getJourneyDateRangeKpi_nextToken,
    getJourneyDateRangeKpi_endTime,
    getJourneyDateRangeKpi_pageSize,
    getJourneyDateRangeKpi_journeyId,
    getJourneyDateRangeKpi_applicationId,
    getJourneyDateRangeKpi_kpiName,

    -- * Destructuring the Response
    GetJourneyDateRangeKpiResponse (..),
    newGetJourneyDateRangeKpiResponse,

    -- * Response Lenses
    getJourneyDateRangeKpiResponse_httpStatus,
    getJourneyDateRangeKpiResponse_journeyDateRangeKpiResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetJourneyDateRangeKpi' smart constructor.
data GetJourneyDateRangeKpi = GetJourneyDateRangeKpi'
  { -- | The first date and time to retrieve data for, as part of an inclusive
    -- date range that filters the query results. This value should be in
    -- extended ISO 8601 format and use Coordinated Universal Time (UTC), for
    -- example: 2019-07-19T20:00:00Z for 8:00 PM UTC July 19, 2019. This value
    -- should also be fewer than 90 days from the current day.
    GetJourneyDateRangeKpi -> Maybe POSIX
startTime :: Prelude.Maybe Core.POSIX,
    -- | The string that specifies which page of results to return in a paginated
    -- response. This parameter is not supported for application, campaign, and
    -- journey metrics.
    GetJourneyDateRangeKpi -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The last date and time to retrieve data for, as part of an inclusive
    -- date range that filters the query results. This value should be in
    -- extended ISO 8601 format and use Coordinated Universal Time (UTC), for
    -- example: 2019-07-26T20:00:00Z for 8:00 PM UTC July 26, 2019.
    GetJourneyDateRangeKpi -> Maybe POSIX
endTime :: Prelude.Maybe Core.POSIX,
    -- | The maximum number of items to include in each page of a paginated
    -- response. This parameter is not supported for application, campaign, and
    -- journey metrics.
    GetJourneyDateRangeKpi -> Maybe Text
pageSize :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the journey.
    GetJourneyDateRangeKpi -> Text
journeyId :: Prelude.Text,
    -- | The unique identifier for the application. This identifier is displayed
    -- as the __Project ID__ on the Amazon Pinpoint console.
    GetJourneyDateRangeKpi -> Text
applicationId :: Prelude.Text,
    -- | The name of the metric, also referred to as a /key performance indicator
    -- (KPI)/, to retrieve data for. This value describes the associated metric
    -- and consists of two or more terms, which are comprised of lowercase
    -- alphanumeric characters, separated by a hyphen. Examples are
    -- email-open-rate and successful-delivery-rate. For a list of valid
    -- values, see the
    -- <https://docs.aws.amazon.com/pinpoint/latest/developerguide/analytics-standard-metrics.html Amazon Pinpoint Developer Guide>.
    GetJourneyDateRangeKpi -> Text
kpiName :: Prelude.Text
  }
  deriving (GetJourneyDateRangeKpi -> GetJourneyDateRangeKpi -> Bool
(GetJourneyDateRangeKpi -> GetJourneyDateRangeKpi -> Bool)
-> (GetJourneyDateRangeKpi -> GetJourneyDateRangeKpi -> Bool)
-> Eq GetJourneyDateRangeKpi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetJourneyDateRangeKpi -> GetJourneyDateRangeKpi -> Bool
$c/= :: GetJourneyDateRangeKpi -> GetJourneyDateRangeKpi -> Bool
== :: GetJourneyDateRangeKpi -> GetJourneyDateRangeKpi -> Bool
$c== :: GetJourneyDateRangeKpi -> GetJourneyDateRangeKpi -> Bool
Prelude.Eq, ReadPrec [GetJourneyDateRangeKpi]
ReadPrec GetJourneyDateRangeKpi
Int -> ReadS GetJourneyDateRangeKpi
ReadS [GetJourneyDateRangeKpi]
(Int -> ReadS GetJourneyDateRangeKpi)
-> ReadS [GetJourneyDateRangeKpi]
-> ReadPrec GetJourneyDateRangeKpi
-> ReadPrec [GetJourneyDateRangeKpi]
-> Read GetJourneyDateRangeKpi
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetJourneyDateRangeKpi]
$creadListPrec :: ReadPrec [GetJourneyDateRangeKpi]
readPrec :: ReadPrec GetJourneyDateRangeKpi
$creadPrec :: ReadPrec GetJourneyDateRangeKpi
readList :: ReadS [GetJourneyDateRangeKpi]
$creadList :: ReadS [GetJourneyDateRangeKpi]
readsPrec :: Int -> ReadS GetJourneyDateRangeKpi
$creadsPrec :: Int -> ReadS GetJourneyDateRangeKpi
Prelude.Read, Int -> GetJourneyDateRangeKpi -> ShowS
[GetJourneyDateRangeKpi] -> ShowS
GetJourneyDateRangeKpi -> String
(Int -> GetJourneyDateRangeKpi -> ShowS)
-> (GetJourneyDateRangeKpi -> String)
-> ([GetJourneyDateRangeKpi] -> ShowS)
-> Show GetJourneyDateRangeKpi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetJourneyDateRangeKpi] -> ShowS
$cshowList :: [GetJourneyDateRangeKpi] -> ShowS
show :: GetJourneyDateRangeKpi -> String
$cshow :: GetJourneyDateRangeKpi -> String
showsPrec :: Int -> GetJourneyDateRangeKpi -> ShowS
$cshowsPrec :: Int -> GetJourneyDateRangeKpi -> ShowS
Prelude.Show, (forall x. GetJourneyDateRangeKpi -> Rep GetJourneyDateRangeKpi x)
-> (forall x.
    Rep GetJourneyDateRangeKpi x -> GetJourneyDateRangeKpi)
-> Generic GetJourneyDateRangeKpi
forall x. Rep GetJourneyDateRangeKpi x -> GetJourneyDateRangeKpi
forall x. GetJourneyDateRangeKpi -> Rep GetJourneyDateRangeKpi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetJourneyDateRangeKpi x -> GetJourneyDateRangeKpi
$cfrom :: forall x. GetJourneyDateRangeKpi -> Rep GetJourneyDateRangeKpi x
Prelude.Generic)

-- |
-- Create a value of 'GetJourneyDateRangeKpi' 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:
--
-- 'startTime', 'getJourneyDateRangeKpi_startTime' - The first date and time to retrieve data for, as part of an inclusive
-- date range that filters the query results. This value should be in
-- extended ISO 8601 format and use Coordinated Universal Time (UTC), for
-- example: 2019-07-19T20:00:00Z for 8:00 PM UTC July 19, 2019. This value
-- should also be fewer than 90 days from the current day.
--
-- 'nextToken', 'getJourneyDateRangeKpi_nextToken' - The string that specifies which page of results to return in a paginated
-- response. This parameter is not supported for application, campaign, and
-- journey metrics.
--
-- 'endTime', 'getJourneyDateRangeKpi_endTime' - The last date and time to retrieve data for, as part of an inclusive
-- date range that filters the query results. This value should be in
-- extended ISO 8601 format and use Coordinated Universal Time (UTC), for
-- example: 2019-07-26T20:00:00Z for 8:00 PM UTC July 26, 2019.
--
-- 'pageSize', 'getJourneyDateRangeKpi_pageSize' - The maximum number of items to include in each page of a paginated
-- response. This parameter is not supported for application, campaign, and
-- journey metrics.
--
-- 'journeyId', 'getJourneyDateRangeKpi_journeyId' - The unique identifier for the journey.
--
-- 'applicationId', 'getJourneyDateRangeKpi_applicationId' - The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
--
-- 'kpiName', 'getJourneyDateRangeKpi_kpiName' - The name of the metric, also referred to as a /key performance indicator
-- (KPI)/, to retrieve data for. This value describes the associated metric
-- and consists of two or more terms, which are comprised of lowercase
-- alphanumeric characters, separated by a hyphen. Examples are
-- email-open-rate and successful-delivery-rate. For a list of valid
-- values, see the
-- <https://docs.aws.amazon.com/pinpoint/latest/developerguide/analytics-standard-metrics.html Amazon Pinpoint Developer Guide>.
newGetJourneyDateRangeKpi ::
  -- | 'journeyId'
  Prelude.Text ->
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'kpiName'
  Prelude.Text ->
  GetJourneyDateRangeKpi
newGetJourneyDateRangeKpi :: Text -> Text -> Text -> GetJourneyDateRangeKpi
newGetJourneyDateRangeKpi
  Text
pJourneyId_
  Text
pApplicationId_
  Text
pKpiName_ =
    GetJourneyDateRangeKpi' :: Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Text
-> Text
-> Text
-> GetJourneyDateRangeKpi
GetJourneyDateRangeKpi'
      { $sel:startTime:GetJourneyDateRangeKpi' :: Maybe POSIX
startTime =
          Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetJourneyDateRangeKpi' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:endTime:GetJourneyDateRangeKpi' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:pageSize:GetJourneyDateRangeKpi' :: Maybe Text
pageSize = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:journeyId:GetJourneyDateRangeKpi' :: Text
journeyId = Text
pJourneyId_,
        $sel:applicationId:GetJourneyDateRangeKpi' :: Text
applicationId = Text
pApplicationId_,
        $sel:kpiName:GetJourneyDateRangeKpi' :: Text
kpiName = Text
pKpiName_
      }

-- | The first date and time to retrieve data for, as part of an inclusive
-- date range that filters the query results. This value should be in
-- extended ISO 8601 format and use Coordinated Universal Time (UTC), for
-- example: 2019-07-19T20:00:00Z for 8:00 PM UTC July 19, 2019. This value
-- should also be fewer than 90 days from the current day.
getJourneyDateRangeKpi_startTime :: Lens.Lens' GetJourneyDateRangeKpi (Prelude.Maybe Prelude.UTCTime)
getJourneyDateRangeKpi_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetJourneyDateRangeKpi -> f GetJourneyDateRangeKpi
getJourneyDateRangeKpi_startTime = (GetJourneyDateRangeKpi -> Maybe POSIX)
-> (GetJourneyDateRangeKpi
    -> Maybe POSIX -> GetJourneyDateRangeKpi)
-> Lens
     GetJourneyDateRangeKpi
     GetJourneyDateRangeKpi
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJourneyDateRangeKpi' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: GetJourneyDateRangeKpi
s@GetJourneyDateRangeKpi' {} Maybe POSIX
a -> GetJourneyDateRangeKpi
s {$sel:startTime:GetJourneyDateRangeKpi' :: Maybe POSIX
startTime = Maybe POSIX
a} :: GetJourneyDateRangeKpi) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetJourneyDateRangeKpi -> f GetJourneyDateRangeKpi)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetJourneyDateRangeKpi
-> f GetJourneyDateRangeKpi
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The string that specifies which page of results to return in a paginated
-- response. This parameter is not supported for application, campaign, and
-- journey metrics.
getJourneyDateRangeKpi_nextToken :: Lens.Lens' GetJourneyDateRangeKpi (Prelude.Maybe Prelude.Text)
getJourneyDateRangeKpi_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetJourneyDateRangeKpi -> f GetJourneyDateRangeKpi
getJourneyDateRangeKpi_nextToken = (GetJourneyDateRangeKpi -> Maybe Text)
-> (GetJourneyDateRangeKpi -> Maybe Text -> GetJourneyDateRangeKpi)
-> Lens
     GetJourneyDateRangeKpi
     GetJourneyDateRangeKpi
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJourneyDateRangeKpi' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetJourneyDateRangeKpi
s@GetJourneyDateRangeKpi' {} Maybe Text
a -> GetJourneyDateRangeKpi
s {$sel:nextToken:GetJourneyDateRangeKpi' :: Maybe Text
nextToken = Maybe Text
a} :: GetJourneyDateRangeKpi)

-- | The last date and time to retrieve data for, as part of an inclusive
-- date range that filters the query results. This value should be in
-- extended ISO 8601 format and use Coordinated Universal Time (UTC), for
-- example: 2019-07-26T20:00:00Z for 8:00 PM UTC July 26, 2019.
getJourneyDateRangeKpi_endTime :: Lens.Lens' GetJourneyDateRangeKpi (Prelude.Maybe Prelude.UTCTime)
getJourneyDateRangeKpi_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetJourneyDateRangeKpi -> f GetJourneyDateRangeKpi
getJourneyDateRangeKpi_endTime = (GetJourneyDateRangeKpi -> Maybe POSIX)
-> (GetJourneyDateRangeKpi
    -> Maybe POSIX -> GetJourneyDateRangeKpi)
-> Lens
     GetJourneyDateRangeKpi
     GetJourneyDateRangeKpi
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJourneyDateRangeKpi' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: GetJourneyDateRangeKpi
s@GetJourneyDateRangeKpi' {} Maybe POSIX
a -> GetJourneyDateRangeKpi
s {$sel:endTime:GetJourneyDateRangeKpi' :: Maybe POSIX
endTime = Maybe POSIX
a} :: GetJourneyDateRangeKpi) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetJourneyDateRangeKpi -> f GetJourneyDateRangeKpi)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetJourneyDateRangeKpi
-> f GetJourneyDateRangeKpi
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The maximum number of items to include in each page of a paginated
-- response. This parameter is not supported for application, campaign, and
-- journey metrics.
getJourneyDateRangeKpi_pageSize :: Lens.Lens' GetJourneyDateRangeKpi (Prelude.Maybe Prelude.Text)
getJourneyDateRangeKpi_pageSize :: (Maybe Text -> f (Maybe Text))
-> GetJourneyDateRangeKpi -> f GetJourneyDateRangeKpi
getJourneyDateRangeKpi_pageSize = (GetJourneyDateRangeKpi -> Maybe Text)
-> (GetJourneyDateRangeKpi -> Maybe Text -> GetJourneyDateRangeKpi)
-> Lens
     GetJourneyDateRangeKpi
     GetJourneyDateRangeKpi
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJourneyDateRangeKpi' {Maybe Text
pageSize :: Maybe Text
$sel:pageSize:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Maybe Text
pageSize} -> Maybe Text
pageSize) (\s :: GetJourneyDateRangeKpi
s@GetJourneyDateRangeKpi' {} Maybe Text
a -> GetJourneyDateRangeKpi
s {$sel:pageSize:GetJourneyDateRangeKpi' :: Maybe Text
pageSize = Maybe Text
a} :: GetJourneyDateRangeKpi)

-- | The unique identifier for the journey.
getJourneyDateRangeKpi_journeyId :: Lens.Lens' GetJourneyDateRangeKpi Prelude.Text
getJourneyDateRangeKpi_journeyId :: (Text -> f Text)
-> GetJourneyDateRangeKpi -> f GetJourneyDateRangeKpi
getJourneyDateRangeKpi_journeyId = (GetJourneyDateRangeKpi -> Text)
-> (GetJourneyDateRangeKpi -> Text -> GetJourneyDateRangeKpi)
-> Lens GetJourneyDateRangeKpi GetJourneyDateRangeKpi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJourneyDateRangeKpi' {Text
journeyId :: Text
$sel:journeyId:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Text
journeyId} -> Text
journeyId) (\s :: GetJourneyDateRangeKpi
s@GetJourneyDateRangeKpi' {} Text
a -> GetJourneyDateRangeKpi
s {$sel:journeyId:GetJourneyDateRangeKpi' :: Text
journeyId = Text
a} :: GetJourneyDateRangeKpi)

-- | The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
getJourneyDateRangeKpi_applicationId :: Lens.Lens' GetJourneyDateRangeKpi Prelude.Text
getJourneyDateRangeKpi_applicationId :: (Text -> f Text)
-> GetJourneyDateRangeKpi -> f GetJourneyDateRangeKpi
getJourneyDateRangeKpi_applicationId = (GetJourneyDateRangeKpi -> Text)
-> (GetJourneyDateRangeKpi -> Text -> GetJourneyDateRangeKpi)
-> Lens GetJourneyDateRangeKpi GetJourneyDateRangeKpi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJourneyDateRangeKpi' {Text
applicationId :: Text
$sel:applicationId:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Text
applicationId} -> Text
applicationId) (\s :: GetJourneyDateRangeKpi
s@GetJourneyDateRangeKpi' {} Text
a -> GetJourneyDateRangeKpi
s {$sel:applicationId:GetJourneyDateRangeKpi' :: Text
applicationId = Text
a} :: GetJourneyDateRangeKpi)

-- | The name of the metric, also referred to as a /key performance indicator
-- (KPI)/, to retrieve data for. This value describes the associated metric
-- and consists of two or more terms, which are comprised of lowercase
-- alphanumeric characters, separated by a hyphen. Examples are
-- email-open-rate and successful-delivery-rate. For a list of valid
-- values, see the
-- <https://docs.aws.amazon.com/pinpoint/latest/developerguide/analytics-standard-metrics.html Amazon Pinpoint Developer Guide>.
getJourneyDateRangeKpi_kpiName :: Lens.Lens' GetJourneyDateRangeKpi Prelude.Text
getJourneyDateRangeKpi_kpiName :: (Text -> f Text)
-> GetJourneyDateRangeKpi -> f GetJourneyDateRangeKpi
getJourneyDateRangeKpi_kpiName = (GetJourneyDateRangeKpi -> Text)
-> (GetJourneyDateRangeKpi -> Text -> GetJourneyDateRangeKpi)
-> Lens GetJourneyDateRangeKpi GetJourneyDateRangeKpi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJourneyDateRangeKpi' {Text
kpiName :: Text
$sel:kpiName:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Text
kpiName} -> Text
kpiName) (\s :: GetJourneyDateRangeKpi
s@GetJourneyDateRangeKpi' {} Text
a -> GetJourneyDateRangeKpi
s {$sel:kpiName:GetJourneyDateRangeKpi' :: Text
kpiName = Text
a} :: GetJourneyDateRangeKpi)

instance Core.AWSRequest GetJourneyDateRangeKpi where
  type
    AWSResponse GetJourneyDateRangeKpi =
      GetJourneyDateRangeKpiResponse
  request :: GetJourneyDateRangeKpi -> Request GetJourneyDateRangeKpi
request = Service -> GetJourneyDateRangeKpi -> Request GetJourneyDateRangeKpi
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetJourneyDateRangeKpi
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetJourneyDateRangeKpi)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetJourneyDateRangeKpi))
-> Logger
-> Service
-> Proxy GetJourneyDateRangeKpi
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetJourneyDateRangeKpi)))
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
-> JourneyDateRangeKpiResponse -> GetJourneyDateRangeKpiResponse
GetJourneyDateRangeKpiResponse'
            (Int
 -> JourneyDateRangeKpiResponse -> GetJourneyDateRangeKpiResponse)
-> Either String Int
-> Either
     String
     (JourneyDateRangeKpiResponse -> GetJourneyDateRangeKpiResponse)
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
  (JourneyDateRangeKpiResponse -> GetJourneyDateRangeKpiResponse)
-> Either String JourneyDateRangeKpiResponse
-> Either String GetJourneyDateRangeKpiResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String JourneyDateRangeKpiResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance Prelude.Hashable GetJourneyDateRangeKpi

instance Prelude.NFData GetJourneyDateRangeKpi

instance Core.ToHeaders GetJourneyDateRangeKpi where
  toHeaders :: GetJourneyDateRangeKpi -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetJourneyDateRangeKpi -> 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 GetJourneyDateRangeKpi where
  toPath :: GetJourneyDateRangeKpi -> ByteString
toPath GetJourneyDateRangeKpi' {Maybe Text
Maybe POSIX
Text
kpiName :: Text
applicationId :: Text
journeyId :: Text
pageSize :: Maybe Text
endTime :: Maybe POSIX
nextToken :: Maybe Text
startTime :: Maybe POSIX
$sel:kpiName:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Text
$sel:applicationId:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Text
$sel:journeyId:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Text
$sel:pageSize:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Maybe Text
$sel:endTime:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Maybe POSIX
$sel:nextToken:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Maybe Text
$sel:startTime:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Maybe POSIX
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/apps/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
applicationId,
        ByteString
"/journeys/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
journeyId,
        ByteString
"/kpis/daterange/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
kpiName
      ]

instance Core.ToQuery GetJourneyDateRangeKpi where
  toQuery :: GetJourneyDateRangeKpi -> QueryString
toQuery GetJourneyDateRangeKpi' {Maybe Text
Maybe POSIX
Text
kpiName :: Text
applicationId :: Text
journeyId :: Text
pageSize :: Maybe Text
endTime :: Maybe POSIX
nextToken :: Maybe Text
startTime :: Maybe POSIX
$sel:kpiName:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Text
$sel:applicationId:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Text
$sel:journeyId:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Text
$sel:pageSize:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Maybe Text
$sel:endTime:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Maybe POSIX
$sel:nextToken:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Maybe Text
$sel:startTime:GetJourneyDateRangeKpi' :: GetJourneyDateRangeKpi -> Maybe POSIX
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"start-time" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
startTime,
        ByteString
"next-token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"end-time" ByteString -> Maybe POSIX -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe POSIX
endTime,
        ByteString
"page-size" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
pageSize
      ]

-- | /See:/ 'newGetJourneyDateRangeKpiResponse' smart constructor.
data GetJourneyDateRangeKpiResponse = GetJourneyDateRangeKpiResponse'
  { -- | The response's http status code.
    GetJourneyDateRangeKpiResponse -> Int
httpStatus :: Prelude.Int,
    GetJourneyDateRangeKpiResponse -> JourneyDateRangeKpiResponse
journeyDateRangeKpiResponse :: JourneyDateRangeKpiResponse
  }
  deriving (GetJourneyDateRangeKpiResponse
-> GetJourneyDateRangeKpiResponse -> Bool
(GetJourneyDateRangeKpiResponse
 -> GetJourneyDateRangeKpiResponse -> Bool)
-> (GetJourneyDateRangeKpiResponse
    -> GetJourneyDateRangeKpiResponse -> Bool)
-> Eq GetJourneyDateRangeKpiResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetJourneyDateRangeKpiResponse
-> GetJourneyDateRangeKpiResponse -> Bool
$c/= :: GetJourneyDateRangeKpiResponse
-> GetJourneyDateRangeKpiResponse -> Bool
== :: GetJourneyDateRangeKpiResponse
-> GetJourneyDateRangeKpiResponse -> Bool
$c== :: GetJourneyDateRangeKpiResponse
-> GetJourneyDateRangeKpiResponse -> Bool
Prelude.Eq, ReadPrec [GetJourneyDateRangeKpiResponse]
ReadPrec GetJourneyDateRangeKpiResponse
Int -> ReadS GetJourneyDateRangeKpiResponse
ReadS [GetJourneyDateRangeKpiResponse]
(Int -> ReadS GetJourneyDateRangeKpiResponse)
-> ReadS [GetJourneyDateRangeKpiResponse]
-> ReadPrec GetJourneyDateRangeKpiResponse
-> ReadPrec [GetJourneyDateRangeKpiResponse]
-> Read GetJourneyDateRangeKpiResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetJourneyDateRangeKpiResponse]
$creadListPrec :: ReadPrec [GetJourneyDateRangeKpiResponse]
readPrec :: ReadPrec GetJourneyDateRangeKpiResponse
$creadPrec :: ReadPrec GetJourneyDateRangeKpiResponse
readList :: ReadS [GetJourneyDateRangeKpiResponse]
$creadList :: ReadS [GetJourneyDateRangeKpiResponse]
readsPrec :: Int -> ReadS GetJourneyDateRangeKpiResponse
$creadsPrec :: Int -> ReadS GetJourneyDateRangeKpiResponse
Prelude.Read, Int -> GetJourneyDateRangeKpiResponse -> ShowS
[GetJourneyDateRangeKpiResponse] -> ShowS
GetJourneyDateRangeKpiResponse -> String
(Int -> GetJourneyDateRangeKpiResponse -> ShowS)
-> (GetJourneyDateRangeKpiResponse -> String)
-> ([GetJourneyDateRangeKpiResponse] -> ShowS)
-> Show GetJourneyDateRangeKpiResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetJourneyDateRangeKpiResponse] -> ShowS
$cshowList :: [GetJourneyDateRangeKpiResponse] -> ShowS
show :: GetJourneyDateRangeKpiResponse -> String
$cshow :: GetJourneyDateRangeKpiResponse -> String
showsPrec :: Int -> GetJourneyDateRangeKpiResponse -> ShowS
$cshowsPrec :: Int -> GetJourneyDateRangeKpiResponse -> ShowS
Prelude.Show, (forall x.
 GetJourneyDateRangeKpiResponse
 -> Rep GetJourneyDateRangeKpiResponse x)
-> (forall x.
    Rep GetJourneyDateRangeKpiResponse x
    -> GetJourneyDateRangeKpiResponse)
-> Generic GetJourneyDateRangeKpiResponse
forall x.
Rep GetJourneyDateRangeKpiResponse x
-> GetJourneyDateRangeKpiResponse
forall x.
GetJourneyDateRangeKpiResponse
-> Rep GetJourneyDateRangeKpiResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetJourneyDateRangeKpiResponse x
-> GetJourneyDateRangeKpiResponse
$cfrom :: forall x.
GetJourneyDateRangeKpiResponse
-> Rep GetJourneyDateRangeKpiResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetJourneyDateRangeKpiResponse' 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:
--
-- 'httpStatus', 'getJourneyDateRangeKpiResponse_httpStatus' - The response's http status code.
--
-- 'journeyDateRangeKpiResponse', 'getJourneyDateRangeKpiResponse_journeyDateRangeKpiResponse' - Undocumented member.
newGetJourneyDateRangeKpiResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'journeyDateRangeKpiResponse'
  JourneyDateRangeKpiResponse ->
  GetJourneyDateRangeKpiResponse
newGetJourneyDateRangeKpiResponse :: Int
-> JourneyDateRangeKpiResponse -> GetJourneyDateRangeKpiResponse
newGetJourneyDateRangeKpiResponse
  Int
pHttpStatus_
  JourneyDateRangeKpiResponse
pJourneyDateRangeKpiResponse_ =
    GetJourneyDateRangeKpiResponse' :: Int
-> JourneyDateRangeKpiResponse -> GetJourneyDateRangeKpiResponse
GetJourneyDateRangeKpiResponse'
      { $sel:httpStatus:GetJourneyDateRangeKpiResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:journeyDateRangeKpiResponse:GetJourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse
journeyDateRangeKpiResponse =
          JourneyDateRangeKpiResponse
pJourneyDateRangeKpiResponse_
      }

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

-- | Undocumented member.
getJourneyDateRangeKpiResponse_journeyDateRangeKpiResponse :: Lens.Lens' GetJourneyDateRangeKpiResponse JourneyDateRangeKpiResponse
getJourneyDateRangeKpiResponse_journeyDateRangeKpiResponse :: (JourneyDateRangeKpiResponse -> f JourneyDateRangeKpiResponse)
-> GetJourneyDateRangeKpiResponse
-> f GetJourneyDateRangeKpiResponse
getJourneyDateRangeKpiResponse_journeyDateRangeKpiResponse = (GetJourneyDateRangeKpiResponse -> JourneyDateRangeKpiResponse)
-> (GetJourneyDateRangeKpiResponse
    -> JourneyDateRangeKpiResponse -> GetJourneyDateRangeKpiResponse)
-> Lens
     GetJourneyDateRangeKpiResponse
     GetJourneyDateRangeKpiResponse
     JourneyDateRangeKpiResponse
     JourneyDateRangeKpiResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJourneyDateRangeKpiResponse' {JourneyDateRangeKpiResponse
journeyDateRangeKpiResponse :: JourneyDateRangeKpiResponse
$sel:journeyDateRangeKpiResponse:GetJourneyDateRangeKpiResponse' :: GetJourneyDateRangeKpiResponse -> JourneyDateRangeKpiResponse
journeyDateRangeKpiResponse} -> JourneyDateRangeKpiResponse
journeyDateRangeKpiResponse) (\s :: GetJourneyDateRangeKpiResponse
s@GetJourneyDateRangeKpiResponse' {} JourneyDateRangeKpiResponse
a -> GetJourneyDateRangeKpiResponse
s {$sel:journeyDateRangeKpiResponse:GetJourneyDateRangeKpiResponse' :: JourneyDateRangeKpiResponse
journeyDateRangeKpiResponse = JourneyDateRangeKpiResponse
a} :: GetJourneyDateRangeKpiResponse)

instance
  Prelude.NFData
    GetJourneyDateRangeKpiResponse