{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Pinpoint.GetCampaignActivities
(
GetCampaignActivities (..),
newGetCampaignActivities,
getCampaignActivities_token,
getCampaignActivities_pageSize,
getCampaignActivities_applicationId,
getCampaignActivities_campaignId,
GetCampaignActivitiesResponse (..),
newGetCampaignActivitiesResponse,
getCampaignActivitiesResponse_httpStatus,
getCampaignActivitiesResponse_activitiesResponse,
)
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
data GetCampaignActivities = GetCampaignActivities'
{
GetCampaignActivities -> Maybe Text
token :: Prelude.Maybe Prelude.Text,
GetCampaignActivities -> Maybe Text
pageSize :: Prelude.Maybe Prelude.Text,
GetCampaignActivities -> Text
applicationId :: Prelude.Text,
GetCampaignActivities -> Text
campaignId :: Prelude.Text
}
deriving (GetCampaignActivities -> GetCampaignActivities -> Bool
(GetCampaignActivities -> GetCampaignActivities -> Bool)
-> (GetCampaignActivities -> GetCampaignActivities -> Bool)
-> Eq GetCampaignActivities
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCampaignActivities -> GetCampaignActivities -> Bool
$c/= :: GetCampaignActivities -> GetCampaignActivities -> Bool
== :: GetCampaignActivities -> GetCampaignActivities -> Bool
$c== :: GetCampaignActivities -> GetCampaignActivities -> Bool
Prelude.Eq, ReadPrec [GetCampaignActivities]
ReadPrec GetCampaignActivities
Int -> ReadS GetCampaignActivities
ReadS [GetCampaignActivities]
(Int -> ReadS GetCampaignActivities)
-> ReadS [GetCampaignActivities]
-> ReadPrec GetCampaignActivities
-> ReadPrec [GetCampaignActivities]
-> Read GetCampaignActivities
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCampaignActivities]
$creadListPrec :: ReadPrec [GetCampaignActivities]
readPrec :: ReadPrec GetCampaignActivities
$creadPrec :: ReadPrec GetCampaignActivities
readList :: ReadS [GetCampaignActivities]
$creadList :: ReadS [GetCampaignActivities]
readsPrec :: Int -> ReadS GetCampaignActivities
$creadsPrec :: Int -> ReadS GetCampaignActivities
Prelude.Read, Int -> GetCampaignActivities -> ShowS
[GetCampaignActivities] -> ShowS
GetCampaignActivities -> String
(Int -> GetCampaignActivities -> ShowS)
-> (GetCampaignActivities -> String)
-> ([GetCampaignActivities] -> ShowS)
-> Show GetCampaignActivities
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCampaignActivities] -> ShowS
$cshowList :: [GetCampaignActivities] -> ShowS
show :: GetCampaignActivities -> String
$cshow :: GetCampaignActivities -> String
showsPrec :: Int -> GetCampaignActivities -> ShowS
$cshowsPrec :: Int -> GetCampaignActivities -> ShowS
Prelude.Show, (forall x. GetCampaignActivities -> Rep GetCampaignActivities x)
-> (forall x. Rep GetCampaignActivities x -> GetCampaignActivities)
-> Generic GetCampaignActivities
forall x. Rep GetCampaignActivities x -> GetCampaignActivities
forall x. GetCampaignActivities -> Rep GetCampaignActivities x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCampaignActivities x -> GetCampaignActivities
$cfrom :: forall x. GetCampaignActivities -> Rep GetCampaignActivities x
Prelude.Generic)
newGetCampaignActivities ::
Prelude.Text ->
Prelude.Text ->
GetCampaignActivities
newGetCampaignActivities :: Text -> Text -> GetCampaignActivities
newGetCampaignActivities Text
pApplicationId_ Text
pCampaignId_ =
GetCampaignActivities' :: Maybe Text -> Maybe Text -> Text -> Text -> GetCampaignActivities
GetCampaignActivities'
{ $sel:token:GetCampaignActivities' :: Maybe Text
token = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:pageSize:GetCampaignActivities' :: Maybe Text
pageSize = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:applicationId:GetCampaignActivities' :: Text
applicationId = Text
pApplicationId_,
$sel:campaignId:GetCampaignActivities' :: Text
campaignId = Text
pCampaignId_
}
getCampaignActivities_token :: Lens.Lens' GetCampaignActivities (Prelude.Maybe Prelude.Text)
getCampaignActivities_token :: (Maybe Text -> f (Maybe Text))
-> GetCampaignActivities -> f GetCampaignActivities
getCampaignActivities_token = (GetCampaignActivities -> Maybe Text)
-> (GetCampaignActivities -> Maybe Text -> GetCampaignActivities)
-> Lens
GetCampaignActivities
GetCampaignActivities
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignActivities' {Maybe Text
token :: Maybe Text
$sel:token:GetCampaignActivities' :: GetCampaignActivities -> Maybe Text
token} -> Maybe Text
token) (\s :: GetCampaignActivities
s@GetCampaignActivities' {} Maybe Text
a -> GetCampaignActivities
s {$sel:token:GetCampaignActivities' :: Maybe Text
token = Maybe Text
a} :: GetCampaignActivities)
getCampaignActivities_pageSize :: Lens.Lens' GetCampaignActivities (Prelude.Maybe Prelude.Text)
getCampaignActivities_pageSize :: (Maybe Text -> f (Maybe Text))
-> GetCampaignActivities -> f GetCampaignActivities
getCampaignActivities_pageSize = (GetCampaignActivities -> Maybe Text)
-> (GetCampaignActivities -> Maybe Text -> GetCampaignActivities)
-> Lens
GetCampaignActivities
GetCampaignActivities
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignActivities' {Maybe Text
pageSize :: Maybe Text
$sel:pageSize:GetCampaignActivities' :: GetCampaignActivities -> Maybe Text
pageSize} -> Maybe Text
pageSize) (\s :: GetCampaignActivities
s@GetCampaignActivities' {} Maybe Text
a -> GetCampaignActivities
s {$sel:pageSize:GetCampaignActivities' :: Maybe Text
pageSize = Maybe Text
a} :: GetCampaignActivities)
getCampaignActivities_applicationId :: Lens.Lens' GetCampaignActivities Prelude.Text
getCampaignActivities_applicationId :: (Text -> f Text)
-> GetCampaignActivities -> f GetCampaignActivities
getCampaignActivities_applicationId = (GetCampaignActivities -> Text)
-> (GetCampaignActivities -> Text -> GetCampaignActivities)
-> Lens GetCampaignActivities GetCampaignActivities Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignActivities' {Text
applicationId :: Text
$sel:applicationId:GetCampaignActivities' :: GetCampaignActivities -> Text
applicationId} -> Text
applicationId) (\s :: GetCampaignActivities
s@GetCampaignActivities' {} Text
a -> GetCampaignActivities
s {$sel:applicationId:GetCampaignActivities' :: Text
applicationId = Text
a} :: GetCampaignActivities)
getCampaignActivities_campaignId :: Lens.Lens' GetCampaignActivities Prelude.Text
getCampaignActivities_campaignId :: (Text -> f Text)
-> GetCampaignActivities -> f GetCampaignActivities
getCampaignActivities_campaignId = (GetCampaignActivities -> Text)
-> (GetCampaignActivities -> Text -> GetCampaignActivities)
-> Lens GetCampaignActivities GetCampaignActivities Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignActivities' {Text
campaignId :: Text
$sel:campaignId:GetCampaignActivities' :: GetCampaignActivities -> Text
campaignId} -> Text
campaignId) (\s :: GetCampaignActivities
s@GetCampaignActivities' {} Text
a -> GetCampaignActivities
s {$sel:campaignId:GetCampaignActivities' :: Text
campaignId = Text
a} :: GetCampaignActivities)
instance Core.AWSRequest GetCampaignActivities where
type
AWSResponse GetCampaignActivities =
GetCampaignActivitiesResponse
request :: GetCampaignActivities -> Request GetCampaignActivities
request = Service -> GetCampaignActivities -> Request GetCampaignActivities
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetCampaignActivities
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCampaignActivities)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetCampaignActivities))
-> Logger
-> Service
-> Proxy GetCampaignActivities
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCampaignActivities)))
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 -> ActivitiesResponse -> GetCampaignActivitiesResponse
GetCampaignActivitiesResponse'
(Int -> ActivitiesResponse -> GetCampaignActivitiesResponse)
-> Either String Int
-> Either
String (ActivitiesResponse -> GetCampaignActivitiesResponse)
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 (ActivitiesResponse -> GetCampaignActivitiesResponse)
-> Either String ActivitiesResponse
-> Either String GetCampaignActivitiesResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String ActivitiesResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetCampaignActivities
instance Prelude.NFData GetCampaignActivities
instance Core.ToHeaders GetCampaignActivities where
toHeaders :: GetCampaignActivities -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetCampaignActivities -> 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 GetCampaignActivities where
toPath :: GetCampaignActivities -> ByteString
toPath GetCampaignActivities' {Maybe Text
Text
campaignId :: Text
applicationId :: Text
pageSize :: Maybe Text
token :: Maybe Text
$sel:campaignId:GetCampaignActivities' :: GetCampaignActivities -> Text
$sel:applicationId:GetCampaignActivities' :: GetCampaignActivities -> Text
$sel:pageSize:GetCampaignActivities' :: GetCampaignActivities -> Maybe Text
$sel:token:GetCampaignActivities' :: GetCampaignActivities -> Maybe Text
..} =
[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
"/activities"
]
instance Core.ToQuery GetCampaignActivities where
toQuery :: GetCampaignActivities -> QueryString
toQuery GetCampaignActivities' {Maybe Text
Text
campaignId :: Text
applicationId :: Text
pageSize :: Maybe Text
token :: Maybe Text
$sel:campaignId:GetCampaignActivities' :: GetCampaignActivities -> Text
$sel:applicationId:GetCampaignActivities' :: GetCampaignActivities -> Text
$sel:pageSize:GetCampaignActivities' :: GetCampaignActivities -> Maybe Text
$sel:token:GetCampaignActivities' :: GetCampaignActivities -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
token, ByteString
"page-size" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
pageSize]
data GetCampaignActivitiesResponse = GetCampaignActivitiesResponse'
{
GetCampaignActivitiesResponse -> Int
httpStatus :: Prelude.Int,
GetCampaignActivitiesResponse -> ActivitiesResponse
activitiesResponse :: ActivitiesResponse
}
deriving (GetCampaignActivitiesResponse
-> GetCampaignActivitiesResponse -> Bool
(GetCampaignActivitiesResponse
-> GetCampaignActivitiesResponse -> Bool)
-> (GetCampaignActivitiesResponse
-> GetCampaignActivitiesResponse -> Bool)
-> Eq GetCampaignActivitiesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCampaignActivitiesResponse
-> GetCampaignActivitiesResponse -> Bool
$c/= :: GetCampaignActivitiesResponse
-> GetCampaignActivitiesResponse -> Bool
== :: GetCampaignActivitiesResponse
-> GetCampaignActivitiesResponse -> Bool
$c== :: GetCampaignActivitiesResponse
-> GetCampaignActivitiesResponse -> Bool
Prelude.Eq, ReadPrec [GetCampaignActivitiesResponse]
ReadPrec GetCampaignActivitiesResponse
Int -> ReadS GetCampaignActivitiesResponse
ReadS [GetCampaignActivitiesResponse]
(Int -> ReadS GetCampaignActivitiesResponse)
-> ReadS [GetCampaignActivitiesResponse]
-> ReadPrec GetCampaignActivitiesResponse
-> ReadPrec [GetCampaignActivitiesResponse]
-> Read GetCampaignActivitiesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCampaignActivitiesResponse]
$creadListPrec :: ReadPrec [GetCampaignActivitiesResponse]
readPrec :: ReadPrec GetCampaignActivitiesResponse
$creadPrec :: ReadPrec GetCampaignActivitiesResponse
readList :: ReadS [GetCampaignActivitiesResponse]
$creadList :: ReadS [GetCampaignActivitiesResponse]
readsPrec :: Int -> ReadS GetCampaignActivitiesResponse
$creadsPrec :: Int -> ReadS GetCampaignActivitiesResponse
Prelude.Read, Int -> GetCampaignActivitiesResponse -> ShowS
[GetCampaignActivitiesResponse] -> ShowS
GetCampaignActivitiesResponse -> String
(Int -> GetCampaignActivitiesResponse -> ShowS)
-> (GetCampaignActivitiesResponse -> String)
-> ([GetCampaignActivitiesResponse] -> ShowS)
-> Show GetCampaignActivitiesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCampaignActivitiesResponse] -> ShowS
$cshowList :: [GetCampaignActivitiesResponse] -> ShowS
show :: GetCampaignActivitiesResponse -> String
$cshow :: GetCampaignActivitiesResponse -> String
showsPrec :: Int -> GetCampaignActivitiesResponse -> ShowS
$cshowsPrec :: Int -> GetCampaignActivitiesResponse -> ShowS
Prelude.Show, (forall x.
GetCampaignActivitiesResponse
-> Rep GetCampaignActivitiesResponse x)
-> (forall x.
Rep GetCampaignActivitiesResponse x
-> GetCampaignActivitiesResponse)
-> Generic GetCampaignActivitiesResponse
forall x.
Rep GetCampaignActivitiesResponse x
-> GetCampaignActivitiesResponse
forall x.
GetCampaignActivitiesResponse
-> Rep GetCampaignActivitiesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCampaignActivitiesResponse x
-> GetCampaignActivitiesResponse
$cfrom :: forall x.
GetCampaignActivitiesResponse
-> Rep GetCampaignActivitiesResponse x
Prelude.Generic)
newGetCampaignActivitiesResponse ::
Prelude.Int ->
ActivitiesResponse ->
GetCampaignActivitiesResponse
newGetCampaignActivitiesResponse :: Int -> ActivitiesResponse -> GetCampaignActivitiesResponse
newGetCampaignActivitiesResponse
Int
pHttpStatus_
ActivitiesResponse
pActivitiesResponse_ =
GetCampaignActivitiesResponse' :: Int -> ActivitiesResponse -> GetCampaignActivitiesResponse
GetCampaignActivitiesResponse'
{ $sel:httpStatus:GetCampaignActivitiesResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:activitiesResponse:GetCampaignActivitiesResponse' :: ActivitiesResponse
activitiesResponse = ActivitiesResponse
pActivitiesResponse_
}
getCampaignActivitiesResponse_httpStatus :: Lens.Lens' GetCampaignActivitiesResponse Prelude.Int
getCampaignActivitiesResponse_httpStatus :: (Int -> f Int)
-> GetCampaignActivitiesResponse -> f GetCampaignActivitiesResponse
getCampaignActivitiesResponse_httpStatus = (GetCampaignActivitiesResponse -> Int)
-> (GetCampaignActivitiesResponse
-> Int -> GetCampaignActivitiesResponse)
-> Lens
GetCampaignActivitiesResponse GetCampaignActivitiesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignActivitiesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCampaignActivitiesResponse' :: GetCampaignActivitiesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCampaignActivitiesResponse
s@GetCampaignActivitiesResponse' {} Int
a -> GetCampaignActivitiesResponse
s {$sel:httpStatus:GetCampaignActivitiesResponse' :: Int
httpStatus = Int
a} :: GetCampaignActivitiesResponse)
getCampaignActivitiesResponse_activitiesResponse :: Lens.Lens' GetCampaignActivitiesResponse ActivitiesResponse
getCampaignActivitiesResponse_activitiesResponse :: (ActivitiesResponse -> f ActivitiesResponse)
-> GetCampaignActivitiesResponse -> f GetCampaignActivitiesResponse
getCampaignActivitiesResponse_activitiesResponse = (GetCampaignActivitiesResponse -> ActivitiesResponse)
-> (GetCampaignActivitiesResponse
-> ActivitiesResponse -> GetCampaignActivitiesResponse)
-> Lens
GetCampaignActivitiesResponse
GetCampaignActivitiesResponse
ActivitiesResponse
ActivitiesResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignActivitiesResponse' {ActivitiesResponse
activitiesResponse :: ActivitiesResponse
$sel:activitiesResponse:GetCampaignActivitiesResponse' :: GetCampaignActivitiesResponse -> ActivitiesResponse
activitiesResponse} -> ActivitiesResponse
activitiesResponse) (\s :: GetCampaignActivitiesResponse
s@GetCampaignActivitiesResponse' {} ActivitiesResponse
a -> GetCampaignActivitiesResponse
s {$sel:activitiesResponse:GetCampaignActivitiesResponse' :: ActivitiesResponse
activitiesResponse = ActivitiesResponse
a} :: GetCampaignActivitiesResponse)
instance Prelude.NFData GetCampaignActivitiesResponse