{-# 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.GetCampaignVersion
(
GetCampaignVersion (..),
newGetCampaignVersion,
getCampaignVersion_version,
getCampaignVersion_applicationId,
getCampaignVersion_campaignId,
GetCampaignVersionResponse (..),
newGetCampaignVersionResponse,
getCampaignVersionResponse_httpStatus,
getCampaignVersionResponse_campaignResponse,
)
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 GetCampaignVersion = GetCampaignVersion'
{
GetCampaignVersion -> Text
version :: Prelude.Text,
GetCampaignVersion -> Text
applicationId :: Prelude.Text,
GetCampaignVersion -> Text
campaignId :: Prelude.Text
}
deriving (GetCampaignVersion -> GetCampaignVersion -> Bool
(GetCampaignVersion -> GetCampaignVersion -> Bool)
-> (GetCampaignVersion -> GetCampaignVersion -> Bool)
-> Eq GetCampaignVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCampaignVersion -> GetCampaignVersion -> Bool
$c/= :: GetCampaignVersion -> GetCampaignVersion -> Bool
== :: GetCampaignVersion -> GetCampaignVersion -> Bool
$c== :: GetCampaignVersion -> GetCampaignVersion -> Bool
Prelude.Eq, ReadPrec [GetCampaignVersion]
ReadPrec GetCampaignVersion
Int -> ReadS GetCampaignVersion
ReadS [GetCampaignVersion]
(Int -> ReadS GetCampaignVersion)
-> ReadS [GetCampaignVersion]
-> ReadPrec GetCampaignVersion
-> ReadPrec [GetCampaignVersion]
-> Read GetCampaignVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCampaignVersion]
$creadListPrec :: ReadPrec [GetCampaignVersion]
readPrec :: ReadPrec GetCampaignVersion
$creadPrec :: ReadPrec GetCampaignVersion
readList :: ReadS [GetCampaignVersion]
$creadList :: ReadS [GetCampaignVersion]
readsPrec :: Int -> ReadS GetCampaignVersion
$creadsPrec :: Int -> ReadS GetCampaignVersion
Prelude.Read, Int -> GetCampaignVersion -> ShowS
[GetCampaignVersion] -> ShowS
GetCampaignVersion -> String
(Int -> GetCampaignVersion -> ShowS)
-> (GetCampaignVersion -> String)
-> ([GetCampaignVersion] -> ShowS)
-> Show GetCampaignVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCampaignVersion] -> ShowS
$cshowList :: [GetCampaignVersion] -> ShowS
show :: GetCampaignVersion -> String
$cshow :: GetCampaignVersion -> String
showsPrec :: Int -> GetCampaignVersion -> ShowS
$cshowsPrec :: Int -> GetCampaignVersion -> ShowS
Prelude.Show, (forall x. GetCampaignVersion -> Rep GetCampaignVersion x)
-> (forall x. Rep GetCampaignVersion x -> GetCampaignVersion)
-> Generic GetCampaignVersion
forall x. Rep GetCampaignVersion x -> GetCampaignVersion
forall x. GetCampaignVersion -> Rep GetCampaignVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCampaignVersion x -> GetCampaignVersion
$cfrom :: forall x. GetCampaignVersion -> Rep GetCampaignVersion x
Prelude.Generic)
newGetCampaignVersion ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
GetCampaignVersion
newGetCampaignVersion :: Text -> Text -> Text -> GetCampaignVersion
newGetCampaignVersion
Text
pVersion_
Text
pApplicationId_
Text
pCampaignId_ =
GetCampaignVersion' :: Text -> Text -> Text -> GetCampaignVersion
GetCampaignVersion'
{ $sel:version:GetCampaignVersion' :: Text
version = Text
pVersion_,
$sel:applicationId:GetCampaignVersion' :: Text
applicationId = Text
pApplicationId_,
$sel:campaignId:GetCampaignVersion' :: Text
campaignId = Text
pCampaignId_
}
getCampaignVersion_version :: Lens.Lens' GetCampaignVersion Prelude.Text
getCampaignVersion_version :: (Text -> f Text) -> GetCampaignVersion -> f GetCampaignVersion
getCampaignVersion_version = (GetCampaignVersion -> Text)
-> (GetCampaignVersion -> Text -> GetCampaignVersion)
-> Lens GetCampaignVersion GetCampaignVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignVersion' {Text
version :: Text
$sel:version:GetCampaignVersion' :: GetCampaignVersion -> Text
version} -> Text
version) (\s :: GetCampaignVersion
s@GetCampaignVersion' {} Text
a -> GetCampaignVersion
s {$sel:version:GetCampaignVersion' :: Text
version = Text
a} :: GetCampaignVersion)
getCampaignVersion_applicationId :: Lens.Lens' GetCampaignVersion Prelude.Text
getCampaignVersion_applicationId :: (Text -> f Text) -> GetCampaignVersion -> f GetCampaignVersion
getCampaignVersion_applicationId = (GetCampaignVersion -> Text)
-> (GetCampaignVersion -> Text -> GetCampaignVersion)
-> Lens GetCampaignVersion GetCampaignVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignVersion' {Text
applicationId :: Text
$sel:applicationId:GetCampaignVersion' :: GetCampaignVersion -> Text
applicationId} -> Text
applicationId) (\s :: GetCampaignVersion
s@GetCampaignVersion' {} Text
a -> GetCampaignVersion
s {$sel:applicationId:GetCampaignVersion' :: Text
applicationId = Text
a} :: GetCampaignVersion)
getCampaignVersion_campaignId :: Lens.Lens' GetCampaignVersion Prelude.Text
getCampaignVersion_campaignId :: (Text -> f Text) -> GetCampaignVersion -> f GetCampaignVersion
getCampaignVersion_campaignId = (GetCampaignVersion -> Text)
-> (GetCampaignVersion -> Text -> GetCampaignVersion)
-> Lens GetCampaignVersion GetCampaignVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignVersion' {Text
campaignId :: Text
$sel:campaignId:GetCampaignVersion' :: GetCampaignVersion -> Text
campaignId} -> Text
campaignId) (\s :: GetCampaignVersion
s@GetCampaignVersion' {} Text
a -> GetCampaignVersion
s {$sel:campaignId:GetCampaignVersion' :: Text
campaignId = Text
a} :: GetCampaignVersion)
instance Core.AWSRequest GetCampaignVersion where
type
AWSResponse GetCampaignVersion =
GetCampaignVersionResponse
request :: GetCampaignVersion -> Request GetCampaignVersion
request = Service -> GetCampaignVersion -> Request GetCampaignVersion
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetCampaignVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCampaignVersion)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetCampaignVersion))
-> Logger
-> Service
-> Proxy GetCampaignVersion
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetCampaignVersion)))
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 -> CampaignResponse -> GetCampaignVersionResponse
GetCampaignVersionResponse'
(Int -> CampaignResponse -> GetCampaignVersionResponse)
-> Either String Int
-> Either String (CampaignResponse -> GetCampaignVersionResponse)
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 (CampaignResponse -> GetCampaignVersionResponse)
-> Either String CampaignResponse
-> Either String GetCampaignVersionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String CampaignResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetCampaignVersion
instance Prelude.NFData GetCampaignVersion
instance Core.ToHeaders GetCampaignVersion where
toHeaders :: GetCampaignVersion -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetCampaignVersion -> 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 GetCampaignVersion where
toPath :: GetCampaignVersion -> ByteString
toPath GetCampaignVersion' {Text
campaignId :: Text
applicationId :: Text
version :: Text
$sel:campaignId:GetCampaignVersion' :: GetCampaignVersion -> Text
$sel:applicationId:GetCampaignVersion' :: GetCampaignVersion -> Text
$sel:version:GetCampaignVersion' :: GetCampaignVersion -> 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/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
version
]
instance Core.ToQuery GetCampaignVersion where
toQuery :: GetCampaignVersion -> QueryString
toQuery = QueryString -> GetCampaignVersion -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetCampaignVersionResponse = GetCampaignVersionResponse'
{
GetCampaignVersionResponse -> Int
httpStatus :: Prelude.Int,
GetCampaignVersionResponse -> CampaignResponse
campaignResponse :: CampaignResponse
}
deriving (GetCampaignVersionResponse -> GetCampaignVersionResponse -> Bool
(GetCampaignVersionResponse -> GetCampaignVersionResponse -> Bool)
-> (GetCampaignVersionResponse
-> GetCampaignVersionResponse -> Bool)
-> Eq GetCampaignVersionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCampaignVersionResponse -> GetCampaignVersionResponse -> Bool
$c/= :: GetCampaignVersionResponse -> GetCampaignVersionResponse -> Bool
== :: GetCampaignVersionResponse -> GetCampaignVersionResponse -> Bool
$c== :: GetCampaignVersionResponse -> GetCampaignVersionResponse -> Bool
Prelude.Eq, ReadPrec [GetCampaignVersionResponse]
ReadPrec GetCampaignVersionResponse
Int -> ReadS GetCampaignVersionResponse
ReadS [GetCampaignVersionResponse]
(Int -> ReadS GetCampaignVersionResponse)
-> ReadS [GetCampaignVersionResponse]
-> ReadPrec GetCampaignVersionResponse
-> ReadPrec [GetCampaignVersionResponse]
-> Read GetCampaignVersionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCampaignVersionResponse]
$creadListPrec :: ReadPrec [GetCampaignVersionResponse]
readPrec :: ReadPrec GetCampaignVersionResponse
$creadPrec :: ReadPrec GetCampaignVersionResponse
readList :: ReadS [GetCampaignVersionResponse]
$creadList :: ReadS [GetCampaignVersionResponse]
readsPrec :: Int -> ReadS GetCampaignVersionResponse
$creadsPrec :: Int -> ReadS GetCampaignVersionResponse
Prelude.Read, Int -> GetCampaignVersionResponse -> ShowS
[GetCampaignVersionResponse] -> ShowS
GetCampaignVersionResponse -> String
(Int -> GetCampaignVersionResponse -> ShowS)
-> (GetCampaignVersionResponse -> String)
-> ([GetCampaignVersionResponse] -> ShowS)
-> Show GetCampaignVersionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCampaignVersionResponse] -> ShowS
$cshowList :: [GetCampaignVersionResponse] -> ShowS
show :: GetCampaignVersionResponse -> String
$cshow :: GetCampaignVersionResponse -> String
showsPrec :: Int -> GetCampaignVersionResponse -> ShowS
$cshowsPrec :: Int -> GetCampaignVersionResponse -> ShowS
Prelude.Show, (forall x.
GetCampaignVersionResponse -> Rep GetCampaignVersionResponse x)
-> (forall x.
Rep GetCampaignVersionResponse x -> GetCampaignVersionResponse)
-> Generic GetCampaignVersionResponse
forall x.
Rep GetCampaignVersionResponse x -> GetCampaignVersionResponse
forall x.
GetCampaignVersionResponse -> Rep GetCampaignVersionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCampaignVersionResponse x -> GetCampaignVersionResponse
$cfrom :: forall x.
GetCampaignVersionResponse -> Rep GetCampaignVersionResponse x
Prelude.Generic)
newGetCampaignVersionResponse ::
Prelude.Int ->
CampaignResponse ->
GetCampaignVersionResponse
newGetCampaignVersionResponse :: Int -> CampaignResponse -> GetCampaignVersionResponse
newGetCampaignVersionResponse
Int
pHttpStatus_
CampaignResponse
pCampaignResponse_ =
GetCampaignVersionResponse' :: Int -> CampaignResponse -> GetCampaignVersionResponse
GetCampaignVersionResponse'
{ $sel:httpStatus:GetCampaignVersionResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:campaignResponse:GetCampaignVersionResponse' :: CampaignResponse
campaignResponse = CampaignResponse
pCampaignResponse_
}
getCampaignVersionResponse_httpStatus :: Lens.Lens' GetCampaignVersionResponse Prelude.Int
getCampaignVersionResponse_httpStatus :: (Int -> f Int)
-> GetCampaignVersionResponse -> f GetCampaignVersionResponse
getCampaignVersionResponse_httpStatus = (GetCampaignVersionResponse -> Int)
-> (GetCampaignVersionResponse
-> Int -> GetCampaignVersionResponse)
-> Lens
GetCampaignVersionResponse GetCampaignVersionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignVersionResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCampaignVersionResponse' :: GetCampaignVersionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCampaignVersionResponse
s@GetCampaignVersionResponse' {} Int
a -> GetCampaignVersionResponse
s {$sel:httpStatus:GetCampaignVersionResponse' :: Int
httpStatus = Int
a} :: GetCampaignVersionResponse)
getCampaignVersionResponse_campaignResponse :: Lens.Lens' GetCampaignVersionResponse CampaignResponse
getCampaignVersionResponse_campaignResponse :: (CampaignResponse -> f CampaignResponse)
-> GetCampaignVersionResponse -> f GetCampaignVersionResponse
getCampaignVersionResponse_campaignResponse = (GetCampaignVersionResponse -> CampaignResponse)
-> (GetCampaignVersionResponse
-> CampaignResponse -> GetCampaignVersionResponse)
-> Lens
GetCampaignVersionResponse
GetCampaignVersionResponse
CampaignResponse
CampaignResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCampaignVersionResponse' {CampaignResponse
campaignResponse :: CampaignResponse
$sel:campaignResponse:GetCampaignVersionResponse' :: GetCampaignVersionResponse -> CampaignResponse
campaignResponse} -> CampaignResponse
campaignResponse) (\s :: GetCampaignVersionResponse
s@GetCampaignVersionResponse' {} CampaignResponse
a -> GetCampaignVersionResponse
s {$sel:campaignResponse:GetCampaignVersionResponse' :: CampaignResponse
campaignResponse = CampaignResponse
a} :: GetCampaignVersionResponse)
instance Prelude.NFData GetCampaignVersionResponse