{-# 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.GetJourney
(
GetJourney (..),
newGetJourney,
getJourney_journeyId,
getJourney_applicationId,
GetJourneyResponse (..),
newGetJourneyResponse,
getJourneyResponse_httpStatus,
getJourneyResponse_journeyResponse,
)
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 GetJourney = GetJourney'
{
GetJourney -> Text
journeyId :: Prelude.Text,
GetJourney -> Text
applicationId :: Prelude.Text
}
deriving (GetJourney -> GetJourney -> Bool
(GetJourney -> GetJourney -> Bool)
-> (GetJourney -> GetJourney -> Bool) -> Eq GetJourney
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetJourney -> GetJourney -> Bool
$c/= :: GetJourney -> GetJourney -> Bool
== :: GetJourney -> GetJourney -> Bool
$c== :: GetJourney -> GetJourney -> Bool
Prelude.Eq, ReadPrec [GetJourney]
ReadPrec GetJourney
Int -> ReadS GetJourney
ReadS [GetJourney]
(Int -> ReadS GetJourney)
-> ReadS [GetJourney]
-> ReadPrec GetJourney
-> ReadPrec [GetJourney]
-> Read GetJourney
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetJourney]
$creadListPrec :: ReadPrec [GetJourney]
readPrec :: ReadPrec GetJourney
$creadPrec :: ReadPrec GetJourney
readList :: ReadS [GetJourney]
$creadList :: ReadS [GetJourney]
readsPrec :: Int -> ReadS GetJourney
$creadsPrec :: Int -> ReadS GetJourney
Prelude.Read, Int -> GetJourney -> ShowS
[GetJourney] -> ShowS
GetJourney -> String
(Int -> GetJourney -> ShowS)
-> (GetJourney -> String)
-> ([GetJourney] -> ShowS)
-> Show GetJourney
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetJourney] -> ShowS
$cshowList :: [GetJourney] -> ShowS
show :: GetJourney -> String
$cshow :: GetJourney -> String
showsPrec :: Int -> GetJourney -> ShowS
$cshowsPrec :: Int -> GetJourney -> ShowS
Prelude.Show, (forall x. GetJourney -> Rep GetJourney x)
-> (forall x. Rep GetJourney x -> GetJourney) -> Generic GetJourney
forall x. Rep GetJourney x -> GetJourney
forall x. GetJourney -> Rep GetJourney x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetJourney x -> GetJourney
$cfrom :: forall x. GetJourney -> Rep GetJourney x
Prelude.Generic)
newGetJourney ::
Prelude.Text ->
Prelude.Text ->
GetJourney
newGetJourney :: Text -> Text -> GetJourney
newGetJourney Text
pJourneyId_ Text
pApplicationId_ =
GetJourney' :: Text -> Text -> GetJourney
GetJourney'
{ $sel:journeyId:GetJourney' :: Text
journeyId = Text
pJourneyId_,
$sel:applicationId:GetJourney' :: Text
applicationId = Text
pApplicationId_
}
getJourney_journeyId :: Lens.Lens' GetJourney Prelude.Text
getJourney_journeyId :: (Text -> f Text) -> GetJourney -> f GetJourney
getJourney_journeyId = (GetJourney -> Text)
-> (GetJourney -> Text -> GetJourney)
-> Lens GetJourney GetJourney Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJourney' {Text
journeyId :: Text
$sel:journeyId:GetJourney' :: GetJourney -> Text
journeyId} -> Text
journeyId) (\s :: GetJourney
s@GetJourney' {} Text
a -> GetJourney
s {$sel:journeyId:GetJourney' :: Text
journeyId = Text
a} :: GetJourney)
getJourney_applicationId :: Lens.Lens' GetJourney Prelude.Text
getJourney_applicationId :: (Text -> f Text) -> GetJourney -> f GetJourney
getJourney_applicationId = (GetJourney -> Text)
-> (GetJourney -> Text -> GetJourney)
-> Lens GetJourney GetJourney Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJourney' {Text
applicationId :: Text
$sel:applicationId:GetJourney' :: GetJourney -> Text
applicationId} -> Text
applicationId) (\s :: GetJourney
s@GetJourney' {} Text
a -> GetJourney
s {$sel:applicationId:GetJourney' :: Text
applicationId = Text
a} :: GetJourney)
instance Core.AWSRequest GetJourney where
type AWSResponse GetJourney = GetJourneyResponse
request :: GetJourney -> Request GetJourney
request = Service -> GetJourney -> Request GetJourney
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetJourney
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetJourney)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetJourney))
-> Logger
-> Service
-> Proxy GetJourney
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetJourney)))
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 -> JourneyResponse -> GetJourneyResponse
GetJourneyResponse'
(Int -> JourneyResponse -> GetJourneyResponse)
-> Either String Int
-> Either String (JourneyResponse -> GetJourneyResponse)
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 (JourneyResponse -> GetJourneyResponse)
-> Either String JourneyResponse
-> Either String GetJourneyResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String JourneyResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetJourney
instance Prelude.NFData GetJourney
instance Core.ToHeaders GetJourney where
toHeaders :: GetJourney -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetJourney -> 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 GetJourney where
toPath :: GetJourney -> ByteString
toPath GetJourney' {Text
applicationId :: Text
journeyId :: Text
$sel:applicationId:GetJourney' :: GetJourney -> Text
$sel:journeyId:GetJourney' :: GetJourney -> 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
"/journeys/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
journeyId
]
instance Core.ToQuery GetJourney where
toQuery :: GetJourney -> QueryString
toQuery = QueryString -> GetJourney -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetJourneyResponse = GetJourneyResponse'
{
GetJourneyResponse -> Int
httpStatus :: Prelude.Int,
GetJourneyResponse -> JourneyResponse
journeyResponse :: JourneyResponse
}
deriving (GetJourneyResponse -> GetJourneyResponse -> Bool
(GetJourneyResponse -> GetJourneyResponse -> Bool)
-> (GetJourneyResponse -> GetJourneyResponse -> Bool)
-> Eq GetJourneyResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetJourneyResponse -> GetJourneyResponse -> Bool
$c/= :: GetJourneyResponse -> GetJourneyResponse -> Bool
== :: GetJourneyResponse -> GetJourneyResponse -> Bool
$c== :: GetJourneyResponse -> GetJourneyResponse -> Bool
Prelude.Eq, ReadPrec [GetJourneyResponse]
ReadPrec GetJourneyResponse
Int -> ReadS GetJourneyResponse
ReadS [GetJourneyResponse]
(Int -> ReadS GetJourneyResponse)
-> ReadS [GetJourneyResponse]
-> ReadPrec GetJourneyResponse
-> ReadPrec [GetJourneyResponse]
-> Read GetJourneyResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetJourneyResponse]
$creadListPrec :: ReadPrec [GetJourneyResponse]
readPrec :: ReadPrec GetJourneyResponse
$creadPrec :: ReadPrec GetJourneyResponse
readList :: ReadS [GetJourneyResponse]
$creadList :: ReadS [GetJourneyResponse]
readsPrec :: Int -> ReadS GetJourneyResponse
$creadsPrec :: Int -> ReadS GetJourneyResponse
Prelude.Read, Int -> GetJourneyResponse -> ShowS
[GetJourneyResponse] -> ShowS
GetJourneyResponse -> String
(Int -> GetJourneyResponse -> ShowS)
-> (GetJourneyResponse -> String)
-> ([GetJourneyResponse] -> ShowS)
-> Show GetJourneyResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetJourneyResponse] -> ShowS
$cshowList :: [GetJourneyResponse] -> ShowS
show :: GetJourneyResponse -> String
$cshow :: GetJourneyResponse -> String
showsPrec :: Int -> GetJourneyResponse -> ShowS
$cshowsPrec :: Int -> GetJourneyResponse -> ShowS
Prelude.Show, (forall x. GetJourneyResponse -> Rep GetJourneyResponse x)
-> (forall x. Rep GetJourneyResponse x -> GetJourneyResponse)
-> Generic GetJourneyResponse
forall x. Rep GetJourneyResponse x -> GetJourneyResponse
forall x. GetJourneyResponse -> Rep GetJourneyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetJourneyResponse x -> GetJourneyResponse
$cfrom :: forall x. GetJourneyResponse -> Rep GetJourneyResponse x
Prelude.Generic)
newGetJourneyResponse ::
Prelude.Int ->
JourneyResponse ->
GetJourneyResponse
newGetJourneyResponse :: Int -> JourneyResponse -> GetJourneyResponse
newGetJourneyResponse Int
pHttpStatus_ JourneyResponse
pJourneyResponse_ =
GetJourneyResponse' :: Int -> JourneyResponse -> GetJourneyResponse
GetJourneyResponse'
{ $sel:httpStatus:GetJourneyResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:journeyResponse:GetJourneyResponse' :: JourneyResponse
journeyResponse = JourneyResponse
pJourneyResponse_
}
getJourneyResponse_httpStatus :: Lens.Lens' GetJourneyResponse Prelude.Int
getJourneyResponse_httpStatus :: (Int -> f Int) -> GetJourneyResponse -> f GetJourneyResponse
getJourneyResponse_httpStatus = (GetJourneyResponse -> Int)
-> (GetJourneyResponse -> Int -> GetJourneyResponse)
-> Lens GetJourneyResponse GetJourneyResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJourneyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetJourneyResponse' :: GetJourneyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetJourneyResponse
s@GetJourneyResponse' {} Int
a -> GetJourneyResponse
s {$sel:httpStatus:GetJourneyResponse' :: Int
httpStatus = Int
a} :: GetJourneyResponse)
getJourneyResponse_journeyResponse :: Lens.Lens' GetJourneyResponse JourneyResponse
getJourneyResponse_journeyResponse :: (JourneyResponse -> f JourneyResponse)
-> GetJourneyResponse -> f GetJourneyResponse
getJourneyResponse_journeyResponse = (GetJourneyResponse -> JourneyResponse)
-> (GetJourneyResponse -> JourneyResponse -> GetJourneyResponse)
-> Lens
GetJourneyResponse
GetJourneyResponse
JourneyResponse
JourneyResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetJourneyResponse' {JourneyResponse
journeyResponse :: JourneyResponse
$sel:journeyResponse:GetJourneyResponse' :: GetJourneyResponse -> JourneyResponse
journeyResponse} -> JourneyResponse
journeyResponse) (\s :: GetJourneyResponse
s@GetJourneyResponse' {} JourneyResponse
a -> GetJourneyResponse
s {$sel:journeyResponse:GetJourneyResponse' :: JourneyResponse
journeyResponse = JourneyResponse
a} :: GetJourneyResponse)
instance Prelude.NFData GetJourneyResponse