{-# 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.GetCampaignDateRangeKpi
-- 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 metric that
-- applies to a campaign.
module Amazonka.Pinpoint.GetCampaignDateRangeKpi
  ( -- * Creating a Request
    GetCampaignDateRangeKpi (..),
    newGetCampaignDateRangeKpi,

    -- * Request Lenses
    getCampaignDateRangeKpi_startTime,
    getCampaignDateRangeKpi_nextToken,
    getCampaignDateRangeKpi_endTime,
    getCampaignDateRangeKpi_pageSize,
    getCampaignDateRangeKpi_applicationId,
    getCampaignDateRangeKpi_kpiName,
    getCampaignDateRangeKpi_campaignId,

    -- * Destructuring the Response
    GetCampaignDateRangeKpiResponse (..),
    newGetCampaignDateRangeKpiResponse,

    -- * Response Lenses
    getCampaignDateRangeKpiResponse_httpStatus,
    getCampaignDateRangeKpiResponse_campaignDateRangeKpiResponse,
  )
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:/ 'newGetCampaignDateRangeKpi' smart constructor.
data GetCampaignDateRangeKpi = GetCampaignDateRangeKpi'
  { -- | 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.
    GetCampaignDateRangeKpi -> 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.
    GetCampaignDateRangeKpi -> 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.
    GetCampaignDateRangeKpi -> 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.
    GetCampaignDateRangeKpi -> Maybe Text
pageSize :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the application. This identifier is displayed
    -- as the __Project ID__ on the Amazon Pinpoint console.
    GetCampaignDateRangeKpi -> 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>.
    GetCampaignDateRangeKpi -> Text
kpiName :: Prelude.Text,
    -- | The unique identifier for the campaign.
    GetCampaignDateRangeKpi -> Text
campaignId :: Prelude.Text
  }
  deriving (GetCampaignDateRangeKpi -> GetCampaignDateRangeKpi -> Bool
(GetCampaignDateRangeKpi -> GetCampaignDateRangeKpi -> Bool)
-> (GetCampaignDateRangeKpi -> GetCampaignDateRangeKpi -> Bool)
-> Eq GetCampaignDateRangeKpi
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCampaignDateRangeKpi -> GetCampaignDateRangeKpi -> Bool
$c/= :: GetCampaignDateRangeKpi -> GetCampaignDateRangeKpi -> Bool
== :: GetCampaignDateRangeKpi -> GetCampaignDateRangeKpi -> Bool
$c== :: GetCampaignDateRangeKpi -> GetCampaignDateRangeKpi -> Bool
Prelude.Eq, ReadPrec [GetCampaignDateRangeKpi]
ReadPrec GetCampaignDateRangeKpi
Int -> ReadS GetCampaignDateRangeKpi
ReadS [GetCampaignDateRangeKpi]
(Int -> ReadS GetCampaignDateRangeKpi)
-> ReadS [GetCampaignDateRangeKpi]
-> ReadPrec GetCampaignDateRangeKpi
-> ReadPrec [GetCampaignDateRangeKpi]
-> Read GetCampaignDateRangeKpi
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCampaignDateRangeKpi]
$creadListPrec :: ReadPrec [GetCampaignDateRangeKpi]
readPrec :: ReadPrec GetCampaignDateRangeKpi
$creadPrec :: ReadPrec GetCampaignDateRangeKpi
readList :: ReadS [GetCampaignDateRangeKpi]
$creadList :: ReadS [GetCampaignDateRangeKpi]
readsPrec :: Int -> ReadS GetCampaignDateRangeKpi
$creadsPrec :: Int -> ReadS GetCampaignDateRangeKpi
Prelude.Read, Int -> GetCampaignDateRangeKpi -> ShowS
[GetCampaignDateRangeKpi] -> ShowS
GetCampaignDateRangeKpi -> String
(Int -> GetCampaignDateRangeKpi -> ShowS)
-> (GetCampaignDateRangeKpi -> String)
-> ([GetCampaignDateRangeKpi] -> ShowS)
-> Show GetCampaignDateRangeKpi
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCampaignDateRangeKpi] -> ShowS
$cshowList :: [GetCampaignDateRangeKpi] -> ShowS
show :: GetCampaignDateRangeKpi -> String
$cshow :: GetCampaignDateRangeKpi -> String
showsPrec :: Int -> GetCampaignDateRangeKpi -> ShowS
$cshowsPrec :: Int -> GetCampaignDateRangeKpi -> ShowS
Prelude.Show, (forall x.
 GetCampaignDateRangeKpi -> Rep GetCampaignDateRangeKpi x)
-> (forall x.
    Rep GetCampaignDateRangeKpi x -> GetCampaignDateRangeKpi)
-> Generic GetCampaignDateRangeKpi
forall x. Rep GetCampaignDateRangeKpi x -> GetCampaignDateRangeKpi
forall x. GetCampaignDateRangeKpi -> Rep GetCampaignDateRangeKpi x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCampaignDateRangeKpi x -> GetCampaignDateRangeKpi
$cfrom :: forall x. GetCampaignDateRangeKpi -> Rep GetCampaignDateRangeKpi x
Prelude.Generic)

-- |
-- Create a value of 'GetCampaignDateRangeKpi' 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', 'getCampaignDateRangeKpi_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', 'getCampaignDateRangeKpi_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', 'getCampaignDateRangeKpi_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', 'getCampaignDateRangeKpi_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.
--
-- 'applicationId', 'getCampaignDateRangeKpi_applicationId' - The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
--
-- 'kpiName', 'getCampaignDateRangeKpi_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>.
--
-- 'campaignId', 'getCampaignDateRangeKpi_campaignId' - The unique identifier for the campaign.
newGetCampaignDateRangeKpi ::
  -- | 'applicationId'
  Prelude.Text ->
  -- | 'kpiName'
  Prelude.Text ->
  -- | 'campaignId'
  Prelude.Text ->
  GetCampaignDateRangeKpi
newGetCampaignDateRangeKpi :: Text -> Text -> Text -> GetCampaignDateRangeKpi
newGetCampaignDateRangeKpi
  Text
pApplicationId_
  Text
pKpiName_
  Text
pCampaignId_ =
    GetCampaignDateRangeKpi' :: Maybe POSIX
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Text
-> Text
-> Text
-> GetCampaignDateRangeKpi
GetCampaignDateRangeKpi'
      { $sel:startTime:GetCampaignDateRangeKpi' :: Maybe POSIX
startTime =
          Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:nextToken:GetCampaignDateRangeKpi' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:endTime:GetCampaignDateRangeKpi' :: Maybe POSIX
endTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
        $sel:pageSize:GetCampaignDateRangeKpi' :: Maybe Text
pageSize = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:applicationId:GetCampaignDateRangeKpi' :: Text
applicationId = Text
pApplicationId_,
        $sel:kpiName:GetCampaignDateRangeKpi' :: Text
kpiName = Text
pKpiName_,
        $sel:campaignId:GetCampaignDateRangeKpi' :: Text
campaignId = Text
pCampaignId_
      }

-- | 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.
getCampaignDateRangeKpi_startTime :: Lens.Lens' GetCampaignDateRangeKpi (Prelude.Maybe Prelude.UTCTime)
getCampaignDateRangeKpi_startTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetCampaignDateRangeKpi -> f GetCampaignDateRangeKpi
getCampaignDateRangeKpi_startTime = (GetCampaignDateRangeKpi -> Maybe POSIX)
-> (GetCampaignDateRangeKpi
    -> Maybe POSIX -> GetCampaignDateRangeKpi)
-> Lens
     GetCampaignDateRangeKpi
     GetCampaignDateRangeKpi
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignDateRangeKpi' {Maybe POSIX
startTime :: Maybe POSIX
$sel:startTime:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Maybe POSIX
startTime} -> Maybe POSIX
startTime) (\s :: GetCampaignDateRangeKpi
s@GetCampaignDateRangeKpi' {} Maybe POSIX
a -> GetCampaignDateRangeKpi
s {$sel:startTime:GetCampaignDateRangeKpi' :: Maybe POSIX
startTime = Maybe POSIX
a} :: GetCampaignDateRangeKpi) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetCampaignDateRangeKpi -> f GetCampaignDateRangeKpi)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetCampaignDateRangeKpi
-> f GetCampaignDateRangeKpi
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.
getCampaignDateRangeKpi_nextToken :: Lens.Lens' GetCampaignDateRangeKpi (Prelude.Maybe Prelude.Text)
getCampaignDateRangeKpi_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetCampaignDateRangeKpi -> f GetCampaignDateRangeKpi
getCampaignDateRangeKpi_nextToken = (GetCampaignDateRangeKpi -> Maybe Text)
-> (GetCampaignDateRangeKpi
    -> Maybe Text -> GetCampaignDateRangeKpi)
-> Lens
     GetCampaignDateRangeKpi
     GetCampaignDateRangeKpi
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignDateRangeKpi' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetCampaignDateRangeKpi
s@GetCampaignDateRangeKpi' {} Maybe Text
a -> GetCampaignDateRangeKpi
s {$sel:nextToken:GetCampaignDateRangeKpi' :: Maybe Text
nextToken = Maybe Text
a} :: GetCampaignDateRangeKpi)

-- | 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.
getCampaignDateRangeKpi_endTime :: Lens.Lens' GetCampaignDateRangeKpi (Prelude.Maybe Prelude.UTCTime)
getCampaignDateRangeKpi_endTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> GetCampaignDateRangeKpi -> f GetCampaignDateRangeKpi
getCampaignDateRangeKpi_endTime = (GetCampaignDateRangeKpi -> Maybe POSIX)
-> (GetCampaignDateRangeKpi
    -> Maybe POSIX -> GetCampaignDateRangeKpi)
-> Lens
     GetCampaignDateRangeKpi
     GetCampaignDateRangeKpi
     (Maybe POSIX)
     (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignDateRangeKpi' {Maybe POSIX
endTime :: Maybe POSIX
$sel:endTime:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Maybe POSIX
endTime} -> Maybe POSIX
endTime) (\s :: GetCampaignDateRangeKpi
s@GetCampaignDateRangeKpi' {} Maybe POSIX
a -> GetCampaignDateRangeKpi
s {$sel:endTime:GetCampaignDateRangeKpi' :: Maybe POSIX
endTime = Maybe POSIX
a} :: GetCampaignDateRangeKpi) ((Maybe POSIX -> f (Maybe POSIX))
 -> GetCampaignDateRangeKpi -> f GetCampaignDateRangeKpi)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> GetCampaignDateRangeKpi
-> f GetCampaignDateRangeKpi
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.
getCampaignDateRangeKpi_pageSize :: Lens.Lens' GetCampaignDateRangeKpi (Prelude.Maybe Prelude.Text)
getCampaignDateRangeKpi_pageSize :: (Maybe Text -> f (Maybe Text))
-> GetCampaignDateRangeKpi -> f GetCampaignDateRangeKpi
getCampaignDateRangeKpi_pageSize = (GetCampaignDateRangeKpi -> Maybe Text)
-> (GetCampaignDateRangeKpi
    -> Maybe Text -> GetCampaignDateRangeKpi)
-> Lens
     GetCampaignDateRangeKpi
     GetCampaignDateRangeKpi
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignDateRangeKpi' {Maybe Text
pageSize :: Maybe Text
$sel:pageSize:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Maybe Text
pageSize} -> Maybe Text
pageSize) (\s :: GetCampaignDateRangeKpi
s@GetCampaignDateRangeKpi' {} Maybe Text
a -> GetCampaignDateRangeKpi
s {$sel:pageSize:GetCampaignDateRangeKpi' :: Maybe Text
pageSize = Maybe Text
a} :: GetCampaignDateRangeKpi)

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

-- | 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>.
getCampaignDateRangeKpi_kpiName :: Lens.Lens' GetCampaignDateRangeKpi Prelude.Text
getCampaignDateRangeKpi_kpiName :: (Text -> f Text)
-> GetCampaignDateRangeKpi -> f GetCampaignDateRangeKpi
getCampaignDateRangeKpi_kpiName = (GetCampaignDateRangeKpi -> Text)
-> (GetCampaignDateRangeKpi -> Text -> GetCampaignDateRangeKpi)
-> Lens GetCampaignDateRangeKpi GetCampaignDateRangeKpi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignDateRangeKpi' {Text
kpiName :: Text
$sel:kpiName:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Text
kpiName} -> Text
kpiName) (\s :: GetCampaignDateRangeKpi
s@GetCampaignDateRangeKpi' {} Text
a -> GetCampaignDateRangeKpi
s {$sel:kpiName:GetCampaignDateRangeKpi' :: Text
kpiName = Text
a} :: GetCampaignDateRangeKpi)

-- | The unique identifier for the campaign.
getCampaignDateRangeKpi_campaignId :: Lens.Lens' GetCampaignDateRangeKpi Prelude.Text
getCampaignDateRangeKpi_campaignId :: (Text -> f Text)
-> GetCampaignDateRangeKpi -> f GetCampaignDateRangeKpi
getCampaignDateRangeKpi_campaignId = (GetCampaignDateRangeKpi -> Text)
-> (GetCampaignDateRangeKpi -> Text -> GetCampaignDateRangeKpi)
-> Lens GetCampaignDateRangeKpi GetCampaignDateRangeKpi Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignDateRangeKpi' {Text
campaignId :: Text
$sel:campaignId:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Text
campaignId} -> Text
campaignId) (\s :: GetCampaignDateRangeKpi
s@GetCampaignDateRangeKpi' {} Text
a -> GetCampaignDateRangeKpi
s {$sel:campaignId:GetCampaignDateRangeKpi' :: Text
campaignId = Text
a} :: GetCampaignDateRangeKpi)

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

instance Prelude.Hashable GetCampaignDateRangeKpi

instance Prelude.NFData GetCampaignDateRangeKpi

instance Core.ToHeaders GetCampaignDateRangeKpi where
  toHeaders :: GetCampaignDateRangeKpi -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetCampaignDateRangeKpi -> 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 GetCampaignDateRangeKpi where
  toPath :: GetCampaignDateRangeKpi -> ByteString
toPath GetCampaignDateRangeKpi' {Maybe Text
Maybe POSIX
Text
campaignId :: Text
kpiName :: Text
applicationId :: Text
pageSize :: Maybe Text
endTime :: Maybe POSIX
nextToken :: Maybe Text
startTime :: Maybe POSIX
$sel:campaignId:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Text
$sel:kpiName:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Text
$sel:applicationId:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Text
$sel:pageSize:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Maybe Text
$sel:endTime:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Maybe POSIX
$sel:nextToken:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Maybe Text
$sel:startTime:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> 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
"/campaigns/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
campaignId,
        ByteString
"/kpis/daterange/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
kpiName
      ]

instance Core.ToQuery GetCampaignDateRangeKpi where
  toQuery :: GetCampaignDateRangeKpi -> QueryString
toQuery GetCampaignDateRangeKpi' {Maybe Text
Maybe POSIX
Text
campaignId :: Text
kpiName :: Text
applicationId :: Text
pageSize :: Maybe Text
endTime :: Maybe POSIX
nextToken :: Maybe Text
startTime :: Maybe POSIX
$sel:campaignId:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Text
$sel:kpiName:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Text
$sel:applicationId:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Text
$sel:pageSize:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Maybe Text
$sel:endTime:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Maybe POSIX
$sel:nextToken:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> Maybe Text
$sel:startTime:GetCampaignDateRangeKpi' :: GetCampaignDateRangeKpi -> 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:/ 'newGetCampaignDateRangeKpiResponse' smart constructor.
data GetCampaignDateRangeKpiResponse = GetCampaignDateRangeKpiResponse'
  { -- | The response's http status code.
    GetCampaignDateRangeKpiResponse -> Int
httpStatus :: Prelude.Int,
    GetCampaignDateRangeKpiResponse -> CampaignDateRangeKpiResponse
campaignDateRangeKpiResponse :: CampaignDateRangeKpiResponse
  }
  deriving (GetCampaignDateRangeKpiResponse
-> GetCampaignDateRangeKpiResponse -> Bool
(GetCampaignDateRangeKpiResponse
 -> GetCampaignDateRangeKpiResponse -> Bool)
-> (GetCampaignDateRangeKpiResponse
    -> GetCampaignDateRangeKpiResponse -> Bool)
-> Eq GetCampaignDateRangeKpiResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCampaignDateRangeKpiResponse
-> GetCampaignDateRangeKpiResponse -> Bool
$c/= :: GetCampaignDateRangeKpiResponse
-> GetCampaignDateRangeKpiResponse -> Bool
== :: GetCampaignDateRangeKpiResponse
-> GetCampaignDateRangeKpiResponse -> Bool
$c== :: GetCampaignDateRangeKpiResponse
-> GetCampaignDateRangeKpiResponse -> Bool
Prelude.Eq, ReadPrec [GetCampaignDateRangeKpiResponse]
ReadPrec GetCampaignDateRangeKpiResponse
Int -> ReadS GetCampaignDateRangeKpiResponse
ReadS [GetCampaignDateRangeKpiResponse]
(Int -> ReadS GetCampaignDateRangeKpiResponse)
-> ReadS [GetCampaignDateRangeKpiResponse]
-> ReadPrec GetCampaignDateRangeKpiResponse
-> ReadPrec [GetCampaignDateRangeKpiResponse]
-> Read GetCampaignDateRangeKpiResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCampaignDateRangeKpiResponse]
$creadListPrec :: ReadPrec [GetCampaignDateRangeKpiResponse]
readPrec :: ReadPrec GetCampaignDateRangeKpiResponse
$creadPrec :: ReadPrec GetCampaignDateRangeKpiResponse
readList :: ReadS [GetCampaignDateRangeKpiResponse]
$creadList :: ReadS [GetCampaignDateRangeKpiResponse]
readsPrec :: Int -> ReadS GetCampaignDateRangeKpiResponse
$creadsPrec :: Int -> ReadS GetCampaignDateRangeKpiResponse
Prelude.Read, Int -> GetCampaignDateRangeKpiResponse -> ShowS
[GetCampaignDateRangeKpiResponse] -> ShowS
GetCampaignDateRangeKpiResponse -> String
(Int -> GetCampaignDateRangeKpiResponse -> ShowS)
-> (GetCampaignDateRangeKpiResponse -> String)
-> ([GetCampaignDateRangeKpiResponse] -> ShowS)
-> Show GetCampaignDateRangeKpiResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCampaignDateRangeKpiResponse] -> ShowS
$cshowList :: [GetCampaignDateRangeKpiResponse] -> ShowS
show :: GetCampaignDateRangeKpiResponse -> String
$cshow :: GetCampaignDateRangeKpiResponse -> String
showsPrec :: Int -> GetCampaignDateRangeKpiResponse -> ShowS
$cshowsPrec :: Int -> GetCampaignDateRangeKpiResponse -> ShowS
Prelude.Show, (forall x.
 GetCampaignDateRangeKpiResponse
 -> Rep GetCampaignDateRangeKpiResponse x)
-> (forall x.
    Rep GetCampaignDateRangeKpiResponse x
    -> GetCampaignDateRangeKpiResponse)
-> Generic GetCampaignDateRangeKpiResponse
forall x.
Rep GetCampaignDateRangeKpiResponse x
-> GetCampaignDateRangeKpiResponse
forall x.
GetCampaignDateRangeKpiResponse
-> Rep GetCampaignDateRangeKpiResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCampaignDateRangeKpiResponse x
-> GetCampaignDateRangeKpiResponse
$cfrom :: forall x.
GetCampaignDateRangeKpiResponse
-> Rep GetCampaignDateRangeKpiResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetCampaignDateRangeKpiResponse' 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', 'getCampaignDateRangeKpiResponse_httpStatus' - The response's http status code.
--
-- 'campaignDateRangeKpiResponse', 'getCampaignDateRangeKpiResponse_campaignDateRangeKpiResponse' - Undocumented member.
newGetCampaignDateRangeKpiResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'campaignDateRangeKpiResponse'
  CampaignDateRangeKpiResponse ->
  GetCampaignDateRangeKpiResponse
newGetCampaignDateRangeKpiResponse :: Int
-> CampaignDateRangeKpiResponse -> GetCampaignDateRangeKpiResponse
newGetCampaignDateRangeKpiResponse
  Int
pHttpStatus_
  CampaignDateRangeKpiResponse
pCampaignDateRangeKpiResponse_ =
    GetCampaignDateRangeKpiResponse' :: Int
-> CampaignDateRangeKpiResponse -> GetCampaignDateRangeKpiResponse
GetCampaignDateRangeKpiResponse'
      { $sel:httpStatus:GetCampaignDateRangeKpiResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:campaignDateRangeKpiResponse:GetCampaignDateRangeKpiResponse' :: CampaignDateRangeKpiResponse
campaignDateRangeKpiResponse =
          CampaignDateRangeKpiResponse
pCampaignDateRangeKpiResponse_
      }

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

-- | Undocumented member.
getCampaignDateRangeKpiResponse_campaignDateRangeKpiResponse :: Lens.Lens' GetCampaignDateRangeKpiResponse CampaignDateRangeKpiResponse
getCampaignDateRangeKpiResponse_campaignDateRangeKpiResponse :: (CampaignDateRangeKpiResponse -> f CampaignDateRangeKpiResponse)
-> GetCampaignDateRangeKpiResponse
-> f GetCampaignDateRangeKpiResponse
getCampaignDateRangeKpiResponse_campaignDateRangeKpiResponse = (GetCampaignDateRangeKpiResponse -> CampaignDateRangeKpiResponse)
-> (GetCampaignDateRangeKpiResponse
    -> CampaignDateRangeKpiResponse -> GetCampaignDateRangeKpiResponse)
-> Lens
     GetCampaignDateRangeKpiResponse
     GetCampaignDateRangeKpiResponse
     CampaignDateRangeKpiResponse
     CampaignDateRangeKpiResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignDateRangeKpiResponse' {CampaignDateRangeKpiResponse
campaignDateRangeKpiResponse :: CampaignDateRangeKpiResponse
$sel:campaignDateRangeKpiResponse:GetCampaignDateRangeKpiResponse' :: GetCampaignDateRangeKpiResponse -> CampaignDateRangeKpiResponse
campaignDateRangeKpiResponse} -> CampaignDateRangeKpiResponse
campaignDateRangeKpiResponse) (\s :: GetCampaignDateRangeKpiResponse
s@GetCampaignDateRangeKpiResponse' {} CampaignDateRangeKpiResponse
a -> GetCampaignDateRangeKpiResponse
s {$sel:campaignDateRangeKpiResponse:GetCampaignDateRangeKpiResponse' :: CampaignDateRangeKpiResponse
campaignDateRangeKpiResponse = CampaignDateRangeKpiResponse
a} :: GetCampaignDateRangeKpiResponse)

instance
  Prelude.NFData
    GetCampaignDateRangeKpiResponse