{-# 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.GetSegmentVersions
(
GetSegmentVersions (..),
newGetSegmentVersions,
getSegmentVersions_token,
getSegmentVersions_pageSize,
getSegmentVersions_segmentId,
getSegmentVersions_applicationId,
GetSegmentVersionsResponse (..),
newGetSegmentVersionsResponse,
getSegmentVersionsResponse_httpStatus,
getSegmentVersionsResponse_segmentsResponse,
)
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 GetSegmentVersions = GetSegmentVersions'
{
GetSegmentVersions -> Maybe Text
token :: Prelude.Maybe Prelude.Text,
GetSegmentVersions -> Maybe Text
pageSize :: Prelude.Maybe Prelude.Text,
GetSegmentVersions -> Text
segmentId :: Prelude.Text,
GetSegmentVersions -> Text
applicationId :: Prelude.Text
}
deriving (GetSegmentVersions -> GetSegmentVersions -> Bool
(GetSegmentVersions -> GetSegmentVersions -> Bool)
-> (GetSegmentVersions -> GetSegmentVersions -> Bool)
-> Eq GetSegmentVersions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSegmentVersions -> GetSegmentVersions -> Bool
$c/= :: GetSegmentVersions -> GetSegmentVersions -> Bool
== :: GetSegmentVersions -> GetSegmentVersions -> Bool
$c== :: GetSegmentVersions -> GetSegmentVersions -> Bool
Prelude.Eq, ReadPrec [GetSegmentVersions]
ReadPrec GetSegmentVersions
Int -> ReadS GetSegmentVersions
ReadS [GetSegmentVersions]
(Int -> ReadS GetSegmentVersions)
-> ReadS [GetSegmentVersions]
-> ReadPrec GetSegmentVersions
-> ReadPrec [GetSegmentVersions]
-> Read GetSegmentVersions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSegmentVersions]
$creadListPrec :: ReadPrec [GetSegmentVersions]
readPrec :: ReadPrec GetSegmentVersions
$creadPrec :: ReadPrec GetSegmentVersions
readList :: ReadS [GetSegmentVersions]
$creadList :: ReadS [GetSegmentVersions]
readsPrec :: Int -> ReadS GetSegmentVersions
$creadsPrec :: Int -> ReadS GetSegmentVersions
Prelude.Read, Int -> GetSegmentVersions -> ShowS
[GetSegmentVersions] -> ShowS
GetSegmentVersions -> String
(Int -> GetSegmentVersions -> ShowS)
-> (GetSegmentVersions -> String)
-> ([GetSegmentVersions] -> ShowS)
-> Show GetSegmentVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSegmentVersions] -> ShowS
$cshowList :: [GetSegmentVersions] -> ShowS
show :: GetSegmentVersions -> String
$cshow :: GetSegmentVersions -> String
showsPrec :: Int -> GetSegmentVersions -> ShowS
$cshowsPrec :: Int -> GetSegmentVersions -> ShowS
Prelude.Show, (forall x. GetSegmentVersions -> Rep GetSegmentVersions x)
-> (forall x. Rep GetSegmentVersions x -> GetSegmentVersions)
-> Generic GetSegmentVersions
forall x. Rep GetSegmentVersions x -> GetSegmentVersions
forall x. GetSegmentVersions -> Rep GetSegmentVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetSegmentVersions x -> GetSegmentVersions
$cfrom :: forall x. GetSegmentVersions -> Rep GetSegmentVersions x
Prelude.Generic)
newGetSegmentVersions ::
Prelude.Text ->
Prelude.Text ->
GetSegmentVersions
newGetSegmentVersions :: Text -> Text -> GetSegmentVersions
newGetSegmentVersions Text
pSegmentId_ Text
pApplicationId_ =
GetSegmentVersions' :: Maybe Text -> Maybe Text -> Text -> Text -> GetSegmentVersions
GetSegmentVersions'
{ $sel:token:GetSegmentVersions' :: Maybe Text
token = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:pageSize:GetSegmentVersions' :: Maybe Text
pageSize = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:segmentId:GetSegmentVersions' :: Text
segmentId = Text
pSegmentId_,
$sel:applicationId:GetSegmentVersions' :: Text
applicationId = Text
pApplicationId_
}
getSegmentVersions_token :: Lens.Lens' GetSegmentVersions (Prelude.Maybe Prelude.Text)
getSegmentVersions_token :: (Maybe Text -> f (Maybe Text))
-> GetSegmentVersions -> f GetSegmentVersions
getSegmentVersions_token = (GetSegmentVersions -> Maybe Text)
-> (GetSegmentVersions -> Maybe Text -> GetSegmentVersions)
-> Lens
GetSegmentVersions GetSegmentVersions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentVersions' {Maybe Text
token :: Maybe Text
$sel:token:GetSegmentVersions' :: GetSegmentVersions -> Maybe Text
token} -> Maybe Text
token) (\s :: GetSegmentVersions
s@GetSegmentVersions' {} Maybe Text
a -> GetSegmentVersions
s {$sel:token:GetSegmentVersions' :: Maybe Text
token = Maybe Text
a} :: GetSegmentVersions)
getSegmentVersions_pageSize :: Lens.Lens' GetSegmentVersions (Prelude.Maybe Prelude.Text)
getSegmentVersions_pageSize :: (Maybe Text -> f (Maybe Text))
-> GetSegmentVersions -> f GetSegmentVersions
getSegmentVersions_pageSize = (GetSegmentVersions -> Maybe Text)
-> (GetSegmentVersions -> Maybe Text -> GetSegmentVersions)
-> Lens
GetSegmentVersions GetSegmentVersions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentVersions' {Maybe Text
pageSize :: Maybe Text
$sel:pageSize:GetSegmentVersions' :: GetSegmentVersions -> Maybe Text
pageSize} -> Maybe Text
pageSize) (\s :: GetSegmentVersions
s@GetSegmentVersions' {} Maybe Text
a -> GetSegmentVersions
s {$sel:pageSize:GetSegmentVersions' :: Maybe Text
pageSize = Maybe Text
a} :: GetSegmentVersions)
getSegmentVersions_segmentId :: Lens.Lens' GetSegmentVersions Prelude.Text
getSegmentVersions_segmentId :: (Text -> f Text) -> GetSegmentVersions -> f GetSegmentVersions
getSegmentVersions_segmentId = (GetSegmentVersions -> Text)
-> (GetSegmentVersions -> Text -> GetSegmentVersions)
-> Lens GetSegmentVersions GetSegmentVersions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentVersions' {Text
segmentId :: Text
$sel:segmentId:GetSegmentVersions' :: GetSegmentVersions -> Text
segmentId} -> Text
segmentId) (\s :: GetSegmentVersions
s@GetSegmentVersions' {} Text
a -> GetSegmentVersions
s {$sel:segmentId:GetSegmentVersions' :: Text
segmentId = Text
a} :: GetSegmentVersions)
getSegmentVersions_applicationId :: Lens.Lens' GetSegmentVersions Prelude.Text
getSegmentVersions_applicationId :: (Text -> f Text) -> GetSegmentVersions -> f GetSegmentVersions
getSegmentVersions_applicationId = (GetSegmentVersions -> Text)
-> (GetSegmentVersions -> Text -> GetSegmentVersions)
-> Lens GetSegmentVersions GetSegmentVersions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentVersions' {Text
applicationId :: Text
$sel:applicationId:GetSegmentVersions' :: GetSegmentVersions -> Text
applicationId} -> Text
applicationId) (\s :: GetSegmentVersions
s@GetSegmentVersions' {} Text
a -> GetSegmentVersions
s {$sel:applicationId:GetSegmentVersions' :: Text
applicationId = Text
a} :: GetSegmentVersions)
instance Core.AWSRequest GetSegmentVersions where
type
AWSResponse GetSegmentVersions =
GetSegmentVersionsResponse
request :: GetSegmentVersions -> Request GetSegmentVersions
request = Service -> GetSegmentVersions -> Request GetSegmentVersions
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetSegmentVersions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSegmentVersions)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetSegmentVersions))
-> Logger
-> Service
-> Proxy GetSegmentVersions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetSegmentVersions)))
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 -> SegmentsResponse -> GetSegmentVersionsResponse
GetSegmentVersionsResponse'
(Int -> SegmentsResponse -> GetSegmentVersionsResponse)
-> Either String Int
-> Either String (SegmentsResponse -> GetSegmentVersionsResponse)
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 (SegmentsResponse -> GetSegmentVersionsResponse)
-> Either String SegmentsResponse
-> Either String GetSegmentVersionsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String SegmentsResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
)
instance Prelude.Hashable GetSegmentVersions
instance Prelude.NFData GetSegmentVersions
instance Core.ToHeaders GetSegmentVersions where
toHeaders :: GetSegmentVersions -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetSegmentVersions -> 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 GetSegmentVersions where
toPath :: GetSegmentVersions -> ByteString
toPath GetSegmentVersions' {Maybe Text
Text
applicationId :: Text
segmentId :: Text
pageSize :: Maybe Text
token :: Maybe Text
$sel:applicationId:GetSegmentVersions' :: GetSegmentVersions -> Text
$sel:segmentId:GetSegmentVersions' :: GetSegmentVersions -> Text
$sel:pageSize:GetSegmentVersions' :: GetSegmentVersions -> Maybe Text
$sel:token:GetSegmentVersions' :: GetSegmentVersions -> 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
"/segments/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
segmentId,
ByteString
"/versions"
]
instance Core.ToQuery GetSegmentVersions where
toQuery :: GetSegmentVersions -> QueryString
toQuery GetSegmentVersions' {Maybe Text
Text
applicationId :: Text
segmentId :: Text
pageSize :: Maybe Text
token :: Maybe Text
$sel:applicationId:GetSegmentVersions' :: GetSegmentVersions -> Text
$sel:segmentId:GetSegmentVersions' :: GetSegmentVersions -> Text
$sel:pageSize:GetSegmentVersions' :: GetSegmentVersions -> Maybe Text
$sel:token:GetSegmentVersions' :: GetSegmentVersions -> 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 GetSegmentVersionsResponse = GetSegmentVersionsResponse'
{
GetSegmentVersionsResponse -> Int
httpStatus :: Prelude.Int,
GetSegmentVersionsResponse -> SegmentsResponse
segmentsResponse :: SegmentsResponse
}
deriving (GetSegmentVersionsResponse -> GetSegmentVersionsResponse -> Bool
(GetSegmentVersionsResponse -> GetSegmentVersionsResponse -> Bool)
-> (GetSegmentVersionsResponse
-> GetSegmentVersionsResponse -> Bool)
-> Eq GetSegmentVersionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetSegmentVersionsResponse -> GetSegmentVersionsResponse -> Bool
$c/= :: GetSegmentVersionsResponse -> GetSegmentVersionsResponse -> Bool
== :: GetSegmentVersionsResponse -> GetSegmentVersionsResponse -> Bool
$c== :: GetSegmentVersionsResponse -> GetSegmentVersionsResponse -> Bool
Prelude.Eq, ReadPrec [GetSegmentVersionsResponse]
ReadPrec GetSegmentVersionsResponse
Int -> ReadS GetSegmentVersionsResponse
ReadS [GetSegmentVersionsResponse]
(Int -> ReadS GetSegmentVersionsResponse)
-> ReadS [GetSegmentVersionsResponse]
-> ReadPrec GetSegmentVersionsResponse
-> ReadPrec [GetSegmentVersionsResponse]
-> Read GetSegmentVersionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetSegmentVersionsResponse]
$creadListPrec :: ReadPrec [GetSegmentVersionsResponse]
readPrec :: ReadPrec GetSegmentVersionsResponse
$creadPrec :: ReadPrec GetSegmentVersionsResponse
readList :: ReadS [GetSegmentVersionsResponse]
$creadList :: ReadS [GetSegmentVersionsResponse]
readsPrec :: Int -> ReadS GetSegmentVersionsResponse
$creadsPrec :: Int -> ReadS GetSegmentVersionsResponse
Prelude.Read, Int -> GetSegmentVersionsResponse -> ShowS
[GetSegmentVersionsResponse] -> ShowS
GetSegmentVersionsResponse -> String
(Int -> GetSegmentVersionsResponse -> ShowS)
-> (GetSegmentVersionsResponse -> String)
-> ([GetSegmentVersionsResponse] -> ShowS)
-> Show GetSegmentVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetSegmentVersionsResponse] -> ShowS
$cshowList :: [GetSegmentVersionsResponse] -> ShowS
show :: GetSegmentVersionsResponse -> String
$cshow :: GetSegmentVersionsResponse -> String
showsPrec :: Int -> GetSegmentVersionsResponse -> ShowS
$cshowsPrec :: Int -> GetSegmentVersionsResponse -> ShowS
Prelude.Show, (forall x.
GetSegmentVersionsResponse -> Rep GetSegmentVersionsResponse x)
-> (forall x.
Rep GetSegmentVersionsResponse x -> GetSegmentVersionsResponse)
-> Generic GetSegmentVersionsResponse
forall x.
Rep GetSegmentVersionsResponse x -> GetSegmentVersionsResponse
forall x.
GetSegmentVersionsResponse -> Rep GetSegmentVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetSegmentVersionsResponse x -> GetSegmentVersionsResponse
$cfrom :: forall x.
GetSegmentVersionsResponse -> Rep GetSegmentVersionsResponse x
Prelude.Generic)
newGetSegmentVersionsResponse ::
Prelude.Int ->
SegmentsResponse ->
GetSegmentVersionsResponse
newGetSegmentVersionsResponse :: Int -> SegmentsResponse -> GetSegmentVersionsResponse
newGetSegmentVersionsResponse
Int
pHttpStatus_
SegmentsResponse
pSegmentsResponse_ =
GetSegmentVersionsResponse' :: Int -> SegmentsResponse -> GetSegmentVersionsResponse
GetSegmentVersionsResponse'
{ $sel:httpStatus:GetSegmentVersionsResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:segmentsResponse:GetSegmentVersionsResponse' :: SegmentsResponse
segmentsResponse = SegmentsResponse
pSegmentsResponse_
}
getSegmentVersionsResponse_httpStatus :: Lens.Lens' GetSegmentVersionsResponse Prelude.Int
getSegmentVersionsResponse_httpStatus :: (Int -> f Int)
-> GetSegmentVersionsResponse -> f GetSegmentVersionsResponse
getSegmentVersionsResponse_httpStatus = (GetSegmentVersionsResponse -> Int)
-> (GetSegmentVersionsResponse
-> Int -> GetSegmentVersionsResponse)
-> Lens
GetSegmentVersionsResponse GetSegmentVersionsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentVersionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetSegmentVersionsResponse' :: GetSegmentVersionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetSegmentVersionsResponse
s@GetSegmentVersionsResponse' {} Int
a -> GetSegmentVersionsResponse
s {$sel:httpStatus:GetSegmentVersionsResponse' :: Int
httpStatus = Int
a} :: GetSegmentVersionsResponse)
getSegmentVersionsResponse_segmentsResponse :: Lens.Lens' GetSegmentVersionsResponse SegmentsResponse
getSegmentVersionsResponse_segmentsResponse :: (SegmentsResponse -> f SegmentsResponse)
-> GetSegmentVersionsResponse -> f GetSegmentVersionsResponse
getSegmentVersionsResponse_segmentsResponse = (GetSegmentVersionsResponse -> SegmentsResponse)
-> (GetSegmentVersionsResponse
-> SegmentsResponse -> GetSegmentVersionsResponse)
-> Lens
GetSegmentVersionsResponse
GetSegmentVersionsResponse
SegmentsResponse
SegmentsResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetSegmentVersionsResponse' {SegmentsResponse
segmentsResponse :: SegmentsResponse
$sel:segmentsResponse:GetSegmentVersionsResponse' :: GetSegmentVersionsResponse -> SegmentsResponse
segmentsResponse} -> SegmentsResponse
segmentsResponse) (\s :: GetSegmentVersionsResponse
s@GetSegmentVersionsResponse' {} SegmentsResponse
a -> GetSegmentVersionsResponse
s {$sel:segmentsResponse:GetSegmentVersionsResponse' :: SegmentsResponse
segmentsResponse = SegmentsResponse
a} :: GetSegmentVersionsResponse)
instance Prelude.NFData GetSegmentVersionsResponse