{-# 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.Personalize.ListCampaigns
(
ListCampaigns (..),
newListCampaigns,
listCampaigns_maxResults,
listCampaigns_nextToken,
listCampaigns_solutionArn,
ListCampaignsResponse (..),
newListCampaignsResponse,
listCampaignsResponse_campaigns,
listCampaignsResponse_nextToken,
listCampaignsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Personalize.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListCampaigns = ListCampaigns'
{
ListCampaigns -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListCampaigns -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListCampaigns -> Maybe Text
solutionArn :: Prelude.Maybe Prelude.Text
}
deriving (ListCampaigns -> ListCampaigns -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCampaigns -> ListCampaigns -> Bool
$c/= :: ListCampaigns -> ListCampaigns -> Bool
== :: ListCampaigns -> ListCampaigns -> Bool
$c== :: ListCampaigns -> ListCampaigns -> Bool
Prelude.Eq, ReadPrec [ListCampaigns]
ReadPrec ListCampaigns
Int -> ReadS ListCampaigns
ReadS [ListCampaigns]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCampaigns]
$creadListPrec :: ReadPrec [ListCampaigns]
readPrec :: ReadPrec ListCampaigns
$creadPrec :: ReadPrec ListCampaigns
readList :: ReadS [ListCampaigns]
$creadList :: ReadS [ListCampaigns]
readsPrec :: Int -> ReadS ListCampaigns
$creadsPrec :: Int -> ReadS ListCampaigns
Prelude.Read, Int -> ListCampaigns -> ShowS
[ListCampaigns] -> ShowS
ListCampaigns -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCampaigns] -> ShowS
$cshowList :: [ListCampaigns] -> ShowS
show :: ListCampaigns -> String
$cshow :: ListCampaigns -> String
showsPrec :: Int -> ListCampaigns -> ShowS
$cshowsPrec :: Int -> ListCampaigns -> ShowS
Prelude.Show, forall x. Rep ListCampaigns x -> ListCampaigns
forall x. ListCampaigns -> Rep ListCampaigns x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListCampaigns x -> ListCampaigns
$cfrom :: forall x. ListCampaigns -> Rep ListCampaigns x
Prelude.Generic)
newListCampaigns ::
ListCampaigns
newListCampaigns :: ListCampaigns
newListCampaigns =
ListCampaigns'
{ $sel:maxResults:ListCampaigns' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListCampaigns' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:solutionArn:ListCampaigns' :: Maybe Text
solutionArn = forall a. Maybe a
Prelude.Nothing
}
listCampaigns_maxResults :: Lens.Lens' ListCampaigns (Prelude.Maybe Prelude.Natural)
listCampaigns_maxResults :: Lens' ListCampaigns (Maybe Natural)
listCampaigns_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCampaigns' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListCampaigns' :: ListCampaigns -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListCampaigns
s@ListCampaigns' {} Maybe Natural
a -> ListCampaigns
s {$sel:maxResults:ListCampaigns' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListCampaigns)
listCampaigns_nextToken :: Lens.Lens' ListCampaigns (Prelude.Maybe Prelude.Text)
listCampaigns_nextToken :: Lens' ListCampaigns (Maybe Text)
listCampaigns_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCampaigns' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCampaigns' :: ListCampaigns -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCampaigns
s@ListCampaigns' {} Maybe Text
a -> ListCampaigns
s {$sel:nextToken:ListCampaigns' :: Maybe Text
nextToken = Maybe Text
a} :: ListCampaigns)
listCampaigns_solutionArn :: Lens.Lens' ListCampaigns (Prelude.Maybe Prelude.Text)
listCampaigns_solutionArn :: Lens' ListCampaigns (Maybe Text)
listCampaigns_solutionArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCampaigns' {Maybe Text
solutionArn :: Maybe Text
$sel:solutionArn:ListCampaigns' :: ListCampaigns -> Maybe Text
solutionArn} -> Maybe Text
solutionArn) (\s :: ListCampaigns
s@ListCampaigns' {} Maybe Text
a -> ListCampaigns
s {$sel:solutionArn:ListCampaigns' :: Maybe Text
solutionArn = Maybe Text
a} :: ListCampaigns)
instance Core.AWSPager ListCampaigns where
page :: ListCampaigns -> AWSResponse ListCampaigns -> Maybe ListCampaigns
page ListCampaigns
rq AWSResponse ListCampaigns
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListCampaigns
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListCampaignsResponse (Maybe Text)
listCampaignsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListCampaigns
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListCampaignsResponse (Maybe [CampaignSummary])
listCampaignsResponse_campaigns
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListCampaigns
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListCampaigns (Maybe Text)
listCampaigns_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListCampaigns
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListCampaignsResponse (Maybe Text)
listCampaignsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListCampaigns where
type
AWSResponse ListCampaigns =
ListCampaignsResponse
request :: (Service -> Service) -> ListCampaigns -> Request ListCampaigns
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListCampaigns
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListCampaigns)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [CampaignSummary]
-> Maybe Text -> Int -> ListCampaignsResponse
ListCampaignsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"campaigns" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"nextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListCampaigns where
hashWithSalt :: Int -> ListCampaigns -> Int
hashWithSalt Int
_salt ListCampaigns' {Maybe Natural
Maybe Text
solutionArn :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:solutionArn:ListCampaigns' :: ListCampaigns -> Maybe Text
$sel:nextToken:ListCampaigns' :: ListCampaigns -> Maybe Text
$sel:maxResults:ListCampaigns' :: ListCampaigns -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
solutionArn
instance Prelude.NFData ListCampaigns where
rnf :: ListCampaigns -> ()
rnf ListCampaigns' {Maybe Natural
Maybe Text
solutionArn :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:solutionArn:ListCampaigns' :: ListCampaigns -> Maybe Text
$sel:nextToken:ListCampaigns' :: ListCampaigns -> Maybe Text
$sel:maxResults:ListCampaigns' :: ListCampaigns -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
solutionArn
instance Data.ToHeaders ListCampaigns where
toHeaders :: ListCampaigns -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"AmazonPersonalize.ListCampaigns" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListCampaigns where
toJSON :: ListCampaigns -> Value
toJSON ListCampaigns' {Maybe Natural
Maybe Text
solutionArn :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:solutionArn:ListCampaigns' :: ListCampaigns -> Maybe Text
$sel:nextToken:ListCampaigns' :: ListCampaigns -> Maybe Text
$sel:maxResults:ListCampaigns' :: ListCampaigns -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Key
"solutionArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
solutionArn
]
)
instance Data.ToPath ListCampaigns where
toPath :: ListCampaigns -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListCampaigns where
toQuery :: ListCampaigns -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListCampaignsResponse = ListCampaignsResponse'
{
ListCampaignsResponse -> Maybe [CampaignSummary]
campaigns :: Prelude.Maybe [CampaignSummary],
ListCampaignsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListCampaignsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListCampaignsResponse -> ListCampaignsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCampaignsResponse -> ListCampaignsResponse -> Bool
$c/= :: ListCampaignsResponse -> ListCampaignsResponse -> Bool
== :: ListCampaignsResponse -> ListCampaignsResponse -> Bool
$c== :: ListCampaignsResponse -> ListCampaignsResponse -> Bool
Prelude.Eq, ReadPrec [ListCampaignsResponse]
ReadPrec ListCampaignsResponse
Int -> ReadS ListCampaignsResponse
ReadS [ListCampaignsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCampaignsResponse]
$creadListPrec :: ReadPrec [ListCampaignsResponse]
readPrec :: ReadPrec ListCampaignsResponse
$creadPrec :: ReadPrec ListCampaignsResponse
readList :: ReadS [ListCampaignsResponse]
$creadList :: ReadS [ListCampaignsResponse]
readsPrec :: Int -> ReadS ListCampaignsResponse
$creadsPrec :: Int -> ReadS ListCampaignsResponse
Prelude.Read, Int -> ListCampaignsResponse -> ShowS
[ListCampaignsResponse] -> ShowS
ListCampaignsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCampaignsResponse] -> ShowS
$cshowList :: [ListCampaignsResponse] -> ShowS
show :: ListCampaignsResponse -> String
$cshow :: ListCampaignsResponse -> String
showsPrec :: Int -> ListCampaignsResponse -> ShowS
$cshowsPrec :: Int -> ListCampaignsResponse -> ShowS
Prelude.Show, forall x. Rep ListCampaignsResponse x -> ListCampaignsResponse
forall x. ListCampaignsResponse -> Rep ListCampaignsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListCampaignsResponse x -> ListCampaignsResponse
$cfrom :: forall x. ListCampaignsResponse -> Rep ListCampaignsResponse x
Prelude.Generic)
newListCampaignsResponse ::
Prelude.Int ->
ListCampaignsResponse
newListCampaignsResponse :: Int -> ListCampaignsResponse
newListCampaignsResponse Int
pHttpStatus_ =
ListCampaignsResponse'
{ $sel:campaigns:ListCampaignsResponse' :: Maybe [CampaignSummary]
campaigns = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListCampaignsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListCampaignsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listCampaignsResponse_campaigns :: Lens.Lens' ListCampaignsResponse (Prelude.Maybe [CampaignSummary])
listCampaignsResponse_campaigns :: Lens' ListCampaignsResponse (Maybe [CampaignSummary])
listCampaignsResponse_campaigns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCampaignsResponse' {Maybe [CampaignSummary]
campaigns :: Maybe [CampaignSummary]
$sel:campaigns:ListCampaignsResponse' :: ListCampaignsResponse -> Maybe [CampaignSummary]
campaigns} -> Maybe [CampaignSummary]
campaigns) (\s :: ListCampaignsResponse
s@ListCampaignsResponse' {} Maybe [CampaignSummary]
a -> ListCampaignsResponse
s {$sel:campaigns:ListCampaignsResponse' :: Maybe [CampaignSummary]
campaigns = Maybe [CampaignSummary]
a} :: ListCampaignsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listCampaignsResponse_nextToken :: Lens.Lens' ListCampaignsResponse (Prelude.Maybe Prelude.Text)
listCampaignsResponse_nextToken :: Lens' ListCampaignsResponse (Maybe Text)
listCampaignsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCampaignsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCampaignsResponse' :: ListCampaignsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCampaignsResponse
s@ListCampaignsResponse' {} Maybe Text
a -> ListCampaignsResponse
s {$sel:nextToken:ListCampaignsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListCampaignsResponse)
listCampaignsResponse_httpStatus :: Lens.Lens' ListCampaignsResponse Prelude.Int
listCampaignsResponse_httpStatus :: Lens' ListCampaignsResponse Int
listCampaignsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCampaignsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListCampaignsResponse' :: ListCampaignsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListCampaignsResponse
s@ListCampaignsResponse' {} Int
a -> ListCampaignsResponse
s {$sel:httpStatus:ListCampaignsResponse' :: Int
httpStatus = Int
a} :: ListCampaignsResponse)
instance Prelude.NFData ListCampaignsResponse where
rnf :: ListCampaignsResponse -> ()
rnf ListCampaignsResponse' {Int
Maybe [CampaignSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
campaigns :: Maybe [CampaignSummary]
$sel:httpStatus:ListCampaignsResponse' :: ListCampaignsResponse -> Int
$sel:nextToken:ListCampaignsResponse' :: ListCampaignsResponse -> Maybe Text
$sel:campaigns:ListCampaignsResponse' :: ListCampaignsResponse -> Maybe [CampaignSummary]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [CampaignSummary]
campaigns
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus