{-# 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.GetCampaignVersions
(
GetCampaignVersions (..),
newGetCampaignVersions,
getCampaignVersions_token,
getCampaignVersions_pageSize,
getCampaignVersions_applicationId,
getCampaignVersions_campaignId,
GetCampaignVersionsResponse (..),
newGetCampaignVersionsResponse,
getCampaignVersionsResponse_httpStatus,
getCampaignVersionsResponse_campaignsResponse,
)
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 GetCampaignVersions = GetCampaignVersions'
{
GetCampaignVersions -> Maybe Text
token :: Prelude.Maybe Prelude.Text,
GetCampaignVersions -> Maybe Text
pageSize :: Prelude.Maybe Prelude.Text,
GetCampaignVersions -> Text
applicationId :: Prelude.Text,
GetCampaignVersions -> Text
campaignId :: Prelude.Text
}
deriving (GetCampaignVersions -> GetCampaignVersions -> Bool
(GetCampaignVersions -> GetCampaignVersions -> Bool)
-> (GetCampaignVersions -> GetCampaignVersions -> Bool)
-> Eq GetCampaignVersions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCampaignVersions -> GetCampaignVersions -> Bool
$c/= :: GetCampaignVersions -> GetCampaignVersions -> Bool
== :: GetCampaignVersions -> GetCampaignVersions -> Bool
$c== :: GetCampaignVersions -> GetCampaignVersions -> Bool
Prelude.Eq, ReadPrec [GetCampaignVersions]
ReadPrec GetCampaignVersions
Int -> ReadS GetCampaignVersions
ReadS [GetCampaignVersions]
(Int -> ReadS GetCampaignVersions)
-> ReadS [GetCampaignVersions]
-> ReadPrec GetCampaignVersions
-> ReadPrec [GetCampaignVersions]
-> Read GetCampaignVersions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCampaignVersions]
$creadListPrec :: ReadPrec [GetCampaignVersions]
readPrec :: ReadPrec GetCampaignVersions
$creadPrec :: ReadPrec GetCampaignVersions
readList :: ReadS [GetCampaignVersions]
$creadList :: ReadS [GetCampaignVersions]
readsPrec :: Int -> ReadS GetCampaignVersions
$creadsPrec :: Int -> ReadS GetCampaignVersions
Prelude.Read, Int -> GetCampaignVersions -> ShowS
[GetCampaignVersions] -> ShowS
GetCampaignVersions -> String
(Int -> GetCampaignVersions -> ShowS)
-> (GetCampaignVersions -> String)
-> ([GetCampaignVersions] -> ShowS)
-> Show GetCampaignVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCampaignVersions] -> ShowS
$cshowList :: [GetCampaignVersions] -> ShowS
show :: GetCampaignVersions -> String
$cshow :: GetCampaignVersions -> String
showsPrec :: Int -> GetCampaignVersions -> ShowS
$cshowsPrec :: Int -> GetCampaignVersions -> ShowS
Prelude.Show, (forall x. GetCampaignVersions -> Rep GetCampaignVersions x)
-> (forall x. Rep GetCampaignVersions x -> GetCampaignVersions)
-> Generic GetCampaignVersions
forall x. Rep GetCampaignVersions x -> GetCampaignVersions
forall x. GetCampaignVersions -> Rep GetCampaignVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCampaignVersions x -> GetCampaignVersions
$cfrom :: forall x. GetCampaignVersions -> Rep GetCampaignVersions x
Prelude.Generic)
newGetCampaignVersions ::
Prelude.Text ->
Prelude.Text ->
GetCampaignVersions
newGetCampaignVersions :: Text -> Text -> GetCampaignVersions
newGetCampaignVersions Text
pApplicationId_ Text
pCampaignId_ =
GetCampaignVersions' :: Maybe Text -> Maybe Text -> Text -> Text -> GetCampaignVersions
GetCampaignVersions'
{ $sel:token:GetCampaignVersions' :: Maybe Text
token = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:pageSize:GetCampaignVersions' :: Maybe Text
pageSize = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:applicationId:GetCampaignVersions' :: Text
applicationId = Text
pApplicationId_,
$sel:campaignId:GetCampaignVersions' :: Text
campaignId = Text
pCampaignId_
}
getCampaignVersions_token :: Lens.Lens' GetCampaignVersions (Prelude.Maybe Prelude.Text)
getCampaignVersions_token :: (Maybe Text -> f (Maybe Text))
-> GetCampaignVersions -> f GetCampaignVersions
getCampaignVersions_token = (GetCampaignVersions -> Maybe Text)
-> (GetCampaignVersions -> Maybe Text -> GetCampaignVersions)
-> Lens
GetCampaignVersions GetCampaignVersions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignVersions' {Maybe Text
token :: Maybe Text
$sel:token:GetCampaignVersions' :: GetCampaignVersions -> Maybe Text
token} -> Maybe Text
token) (\s :: GetCampaignVersions
s@GetCampaignVersions' {} Maybe Text
a -> GetCampaignVersions
s {$sel:token:GetCampaignVersions' :: Maybe Text
token = Maybe Text
a} :: GetCampaignVersions)
getCampaignVersions_pageSize :: Lens.Lens' GetCampaignVersions (Prelude.Maybe Prelude.Text)
getCampaignVersions_pageSize :: (Maybe Text -> f (Maybe Text))
-> GetCampaignVersions -> f GetCampaignVersions
getCampaignVersions_pageSize = (GetCampaignVersions -> Maybe Text)
-> (GetCampaignVersions -> Maybe Text -> GetCampaignVersions)
-> Lens
GetCampaignVersions GetCampaignVersions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignVersions' {Maybe Text
pageSize :: Maybe Text
$sel:pageSize:GetCampaignVersions' :: GetCampaignVersions -> Maybe Text
pageSize} -> Maybe Text
pageSize) (\s :: GetCampaignVersions
s@GetCampaignVersions' {} Maybe Text
a -> GetCampaignVersions
s {$sel:pageSize:GetCampaignVersions' :: Maybe Text
pageSize = Maybe Text
a} :: GetCampaignVersions)
getCampaignVersions_applicationId :: Lens.Lens' GetCampaignVersions Prelude.Text
getCampaignVersions_applicationId :: (Text -> f Text) -> GetCampaignVersions -> f GetCampaignVersions
getCampaignVersions_applicationId = (GetCampaignVersions -> Text)
-> (GetCampaignVersions -> Text -> GetCampaignVersions)
-> Lens GetCampaignVersions GetCampaignVersions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignVersions' {Text
applicationId :: Text
$sel:applicationId:GetCampaignVersions' :: GetCampaignVersions -> Text
applicationId} -> Text
applicationId) (\s :: GetCampaignVersions
s@GetCampaignVersions' {} Text
a -> GetCampaignVersions
s {$sel:applicationId:GetCampaignVersions' :: Text
applicationId = Text
a} :: GetCampaignVersions)
getCampaignVersions_campaignId :: Lens.Lens' GetCampaignVersions Prelude.Text
getCampaignVersions_campaignId :: (Text -> f Text) -> GetCampaignVersions -> f GetCampaignVersions
getCampaignVersions_campaignId = (GetCampaignVersions -> Text)
-> (GetCampaignVersions -> Text -> GetCampaignVersions)
-> Lens GetCampaignVersions GetCampaignVersions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignVersions' {Text
campaignId :: Text
$sel:campaignId:GetCampaignVersions' :: GetCampaignVersions -> Text
campaignId} -> Text
campaignId) (\s :: GetCampaignVersions
s@GetCampaignVersions' {} Text
a -> GetCampaignVersions
s {$sel:campaignId:GetCampaignVersions' :: Text
campaignId = Text
a} :: GetCampaignVersions)
instance Core.AWSRequest GetCampaignVersions where
type
AWSResponse GetCampaignVersions =
GetCampaignVersionsResponse
request :: GetCampaignVersions -> Request GetCampaignVersions
request = Service -> GetCampaignVersions -> Request GetCampaignVersions
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetCampaignVersions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCampaignVersions)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetCampaignVersions))
-> Logger
-> Service
-> Proxy GetCampaignVersions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCampaignVersions)))
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 -> CampaignsResponse -> GetCampaignVersionsResponse
GetCampaignVersionsResponse'
(Int -> CampaignsResponse -> GetCampaignVersionsResponse)
-> Either String Int
-> Either String (CampaignsResponse -> GetCampaignVersionsResponse)
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 (CampaignsResponse -> GetCampaignVersionsResponse)
-> Either String CampaignsResponse
-> Either String GetCampaignVersionsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String CampaignsResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetCampaignVersions
instance Prelude.NFData GetCampaignVersions
instance Core.ToHeaders GetCampaignVersions where
toHeaders :: GetCampaignVersions -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetCampaignVersions -> 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 GetCampaignVersions where
toPath :: GetCampaignVersions -> ByteString
toPath GetCampaignVersions' {Maybe Text
Text
campaignId :: Text
applicationId :: Text
pageSize :: Maybe Text
token :: Maybe Text
$sel:campaignId:GetCampaignVersions' :: GetCampaignVersions -> Text
$sel:applicationId:GetCampaignVersions' :: GetCampaignVersions -> Text
$sel:pageSize:GetCampaignVersions' :: GetCampaignVersions -> Maybe Text
$sel:token:GetCampaignVersions' :: GetCampaignVersions -> 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
"/versions"
]
instance Core.ToQuery GetCampaignVersions where
toQuery :: GetCampaignVersions -> QueryString
toQuery GetCampaignVersions' {Maybe Text
Text
campaignId :: Text
applicationId :: Text
pageSize :: Maybe Text
token :: Maybe Text
$sel:campaignId:GetCampaignVersions' :: GetCampaignVersions -> Text
$sel:applicationId:GetCampaignVersions' :: GetCampaignVersions -> Text
$sel:pageSize:GetCampaignVersions' :: GetCampaignVersions -> Maybe Text
$sel:token:GetCampaignVersions' :: GetCampaignVersions -> 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 GetCampaignVersionsResponse = GetCampaignVersionsResponse'
{
GetCampaignVersionsResponse -> Int
httpStatus :: Prelude.Int,
GetCampaignVersionsResponse -> CampaignsResponse
campaignsResponse :: CampaignsResponse
}
deriving (GetCampaignVersionsResponse -> GetCampaignVersionsResponse -> Bool
(GetCampaignVersionsResponse
-> GetCampaignVersionsResponse -> Bool)
-> (GetCampaignVersionsResponse
-> GetCampaignVersionsResponse -> Bool)
-> Eq GetCampaignVersionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCampaignVersionsResponse -> GetCampaignVersionsResponse -> Bool
$c/= :: GetCampaignVersionsResponse -> GetCampaignVersionsResponse -> Bool
== :: GetCampaignVersionsResponse -> GetCampaignVersionsResponse -> Bool
$c== :: GetCampaignVersionsResponse -> GetCampaignVersionsResponse -> Bool
Prelude.Eq, ReadPrec [GetCampaignVersionsResponse]
ReadPrec GetCampaignVersionsResponse
Int -> ReadS GetCampaignVersionsResponse
ReadS [GetCampaignVersionsResponse]
(Int -> ReadS GetCampaignVersionsResponse)
-> ReadS [GetCampaignVersionsResponse]
-> ReadPrec GetCampaignVersionsResponse
-> ReadPrec [GetCampaignVersionsResponse]
-> Read GetCampaignVersionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCampaignVersionsResponse]
$creadListPrec :: ReadPrec [GetCampaignVersionsResponse]
readPrec :: ReadPrec GetCampaignVersionsResponse
$creadPrec :: ReadPrec GetCampaignVersionsResponse
readList :: ReadS [GetCampaignVersionsResponse]
$creadList :: ReadS [GetCampaignVersionsResponse]
readsPrec :: Int -> ReadS GetCampaignVersionsResponse
$creadsPrec :: Int -> ReadS GetCampaignVersionsResponse
Prelude.Read, Int -> GetCampaignVersionsResponse -> ShowS
[GetCampaignVersionsResponse] -> ShowS
GetCampaignVersionsResponse -> String
(Int -> GetCampaignVersionsResponse -> ShowS)
-> (GetCampaignVersionsResponse -> String)
-> ([GetCampaignVersionsResponse] -> ShowS)
-> Show GetCampaignVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCampaignVersionsResponse] -> ShowS
$cshowList :: [GetCampaignVersionsResponse] -> ShowS
show :: GetCampaignVersionsResponse -> String
$cshow :: GetCampaignVersionsResponse -> String
showsPrec :: Int -> GetCampaignVersionsResponse -> ShowS
$cshowsPrec :: Int -> GetCampaignVersionsResponse -> ShowS
Prelude.Show, (forall x.
GetCampaignVersionsResponse -> Rep GetCampaignVersionsResponse x)
-> (forall x.
Rep GetCampaignVersionsResponse x -> GetCampaignVersionsResponse)
-> Generic GetCampaignVersionsResponse
forall x.
Rep GetCampaignVersionsResponse x -> GetCampaignVersionsResponse
forall x.
GetCampaignVersionsResponse -> Rep GetCampaignVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCampaignVersionsResponse x -> GetCampaignVersionsResponse
$cfrom :: forall x.
GetCampaignVersionsResponse -> Rep GetCampaignVersionsResponse x
Prelude.Generic)
newGetCampaignVersionsResponse ::
Prelude.Int ->
CampaignsResponse ->
GetCampaignVersionsResponse
newGetCampaignVersionsResponse :: Int -> CampaignsResponse -> GetCampaignVersionsResponse
newGetCampaignVersionsResponse
Int
pHttpStatus_
CampaignsResponse
pCampaignsResponse_ =
GetCampaignVersionsResponse' :: Int -> CampaignsResponse -> GetCampaignVersionsResponse
GetCampaignVersionsResponse'
{ $sel:httpStatus:GetCampaignVersionsResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:campaignsResponse:GetCampaignVersionsResponse' :: CampaignsResponse
campaignsResponse = CampaignsResponse
pCampaignsResponse_
}
getCampaignVersionsResponse_httpStatus :: Lens.Lens' GetCampaignVersionsResponse Prelude.Int
getCampaignVersionsResponse_httpStatus :: (Int -> f Int)
-> GetCampaignVersionsResponse -> f GetCampaignVersionsResponse
getCampaignVersionsResponse_httpStatus = (GetCampaignVersionsResponse -> Int)
-> (GetCampaignVersionsResponse
-> Int -> GetCampaignVersionsResponse)
-> Lens
GetCampaignVersionsResponse GetCampaignVersionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignVersionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCampaignVersionsResponse' :: GetCampaignVersionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCampaignVersionsResponse
s@GetCampaignVersionsResponse' {} Int
a -> GetCampaignVersionsResponse
s {$sel:httpStatus:GetCampaignVersionsResponse' :: Int
httpStatus = Int
a} :: GetCampaignVersionsResponse)
getCampaignVersionsResponse_campaignsResponse :: Lens.Lens' GetCampaignVersionsResponse CampaignsResponse
getCampaignVersionsResponse_campaignsResponse :: (CampaignsResponse -> f CampaignsResponse)
-> GetCampaignVersionsResponse -> f GetCampaignVersionsResponse
getCampaignVersionsResponse_campaignsResponse = (GetCampaignVersionsResponse -> CampaignsResponse)
-> (GetCampaignVersionsResponse
-> CampaignsResponse -> GetCampaignVersionsResponse)
-> Lens
GetCampaignVersionsResponse
GetCampaignVersionsResponse
CampaignsResponse
CampaignsResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignVersionsResponse' {CampaignsResponse
campaignsResponse :: CampaignsResponse
$sel:campaignsResponse:GetCampaignVersionsResponse' :: GetCampaignVersionsResponse -> CampaignsResponse
campaignsResponse} -> CampaignsResponse
campaignsResponse) (\s :: GetCampaignVersionsResponse
s@GetCampaignVersionsResponse' {} CampaignsResponse
a -> GetCampaignVersionsResponse
s {$sel:campaignsResponse:GetCampaignVersionsResponse' :: CampaignsResponse
campaignsResponse = CampaignsResponse
a} :: GetCampaignVersionsResponse)
instance Prelude.NFData GetCampaignVersionsResponse