{-# 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.SESV2.ListEmailTemplates
(
ListEmailTemplates (..),
newListEmailTemplates,
listEmailTemplates_nextToken,
listEmailTemplates_pageSize,
ListEmailTemplatesResponse (..),
newListEmailTemplatesResponse,
listEmailTemplatesResponse_templatesMetadata,
listEmailTemplatesResponse_nextToken,
listEmailTemplatesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.SESV2.Types
data ListEmailTemplates = ListEmailTemplates'
{
ListEmailTemplates -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListEmailTemplates -> Maybe Int
pageSize :: Prelude.Maybe Prelude.Int
}
deriving (ListEmailTemplates -> ListEmailTemplates -> Bool
(ListEmailTemplates -> ListEmailTemplates -> Bool)
-> (ListEmailTemplates -> ListEmailTemplates -> Bool)
-> Eq ListEmailTemplates
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEmailTemplates -> ListEmailTemplates -> Bool
$c/= :: ListEmailTemplates -> ListEmailTemplates -> Bool
== :: ListEmailTemplates -> ListEmailTemplates -> Bool
$c== :: ListEmailTemplates -> ListEmailTemplates -> Bool
Prelude.Eq, ReadPrec [ListEmailTemplates]
ReadPrec ListEmailTemplates
Int -> ReadS ListEmailTemplates
ReadS [ListEmailTemplates]
(Int -> ReadS ListEmailTemplates)
-> ReadS [ListEmailTemplates]
-> ReadPrec ListEmailTemplates
-> ReadPrec [ListEmailTemplates]
-> Read ListEmailTemplates
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEmailTemplates]
$creadListPrec :: ReadPrec [ListEmailTemplates]
readPrec :: ReadPrec ListEmailTemplates
$creadPrec :: ReadPrec ListEmailTemplates
readList :: ReadS [ListEmailTemplates]
$creadList :: ReadS [ListEmailTemplates]
readsPrec :: Int -> ReadS ListEmailTemplates
$creadsPrec :: Int -> ReadS ListEmailTemplates
Prelude.Read, Int -> ListEmailTemplates -> ShowS
[ListEmailTemplates] -> ShowS
ListEmailTemplates -> String
(Int -> ListEmailTemplates -> ShowS)
-> (ListEmailTemplates -> String)
-> ([ListEmailTemplates] -> ShowS)
-> Show ListEmailTemplates
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEmailTemplates] -> ShowS
$cshowList :: [ListEmailTemplates] -> ShowS
show :: ListEmailTemplates -> String
$cshow :: ListEmailTemplates -> String
showsPrec :: Int -> ListEmailTemplates -> ShowS
$cshowsPrec :: Int -> ListEmailTemplates -> ShowS
Prelude.Show, (forall x. ListEmailTemplates -> Rep ListEmailTemplates x)
-> (forall x. Rep ListEmailTemplates x -> ListEmailTemplates)
-> Generic ListEmailTemplates
forall x. Rep ListEmailTemplates x -> ListEmailTemplates
forall x. ListEmailTemplates -> Rep ListEmailTemplates x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListEmailTemplates x -> ListEmailTemplates
$cfrom :: forall x. ListEmailTemplates -> Rep ListEmailTemplates x
Prelude.Generic)
newListEmailTemplates ::
ListEmailTemplates
newListEmailTemplates :: ListEmailTemplates
newListEmailTemplates =
ListEmailTemplates' :: Maybe Text -> Maybe Int -> ListEmailTemplates
ListEmailTemplates'
{ $sel:nextToken:ListEmailTemplates' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:pageSize:ListEmailTemplates' :: Maybe Int
pageSize = Maybe Int
forall a. Maybe a
Prelude.Nothing
}
listEmailTemplates_nextToken :: Lens.Lens' ListEmailTemplates (Prelude.Maybe Prelude.Text)
listEmailTemplates_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEmailTemplates -> f ListEmailTemplates
listEmailTemplates_nextToken = (ListEmailTemplates -> Maybe Text)
-> (ListEmailTemplates -> Maybe Text -> ListEmailTemplates)
-> Lens
ListEmailTemplates ListEmailTemplates (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEmailTemplates' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEmailTemplates' :: ListEmailTemplates -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEmailTemplates
s@ListEmailTemplates' {} Maybe Text
a -> ListEmailTemplates
s {$sel:nextToken:ListEmailTemplates' :: Maybe Text
nextToken = Maybe Text
a} :: ListEmailTemplates)
listEmailTemplates_pageSize :: Lens.Lens' ListEmailTemplates (Prelude.Maybe Prelude.Int)
listEmailTemplates_pageSize :: (Maybe Int -> f (Maybe Int))
-> ListEmailTemplates -> f ListEmailTemplates
listEmailTemplates_pageSize = (ListEmailTemplates -> Maybe Int)
-> (ListEmailTemplates -> Maybe Int -> ListEmailTemplates)
-> Lens
ListEmailTemplates ListEmailTemplates (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEmailTemplates' {Maybe Int
pageSize :: Maybe Int
$sel:pageSize:ListEmailTemplates' :: ListEmailTemplates -> Maybe Int
pageSize} -> Maybe Int
pageSize) (\s :: ListEmailTemplates
s@ListEmailTemplates' {} Maybe Int
a -> ListEmailTemplates
s {$sel:pageSize:ListEmailTemplates' :: Maybe Int
pageSize = Maybe Int
a} :: ListEmailTemplates)
instance Core.AWSRequest ListEmailTemplates where
type
AWSResponse ListEmailTemplates =
ListEmailTemplatesResponse
request :: ListEmailTemplates -> Request ListEmailTemplates
request = Service -> ListEmailTemplates -> Request ListEmailTemplates
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListEmailTemplates
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListEmailTemplates)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListEmailTemplates))
-> Logger
-> Service
-> Proxy ListEmailTemplates
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListEmailTemplates)))
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 ->
Maybe [EmailTemplateMetadata]
-> Maybe Text -> Int -> ListEmailTemplatesResponse
ListEmailTemplatesResponse'
(Maybe [EmailTemplateMetadata]
-> Maybe Text -> Int -> ListEmailTemplatesResponse)
-> Either String (Maybe [EmailTemplateMetadata])
-> Either String (Maybe Text -> Int -> ListEmailTemplatesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object
-> Text -> Either String (Maybe (Maybe [EmailTemplateMetadata]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TemplatesMetadata"
Either String (Maybe (Maybe [EmailTemplateMetadata]))
-> Maybe [EmailTemplateMetadata]
-> Either String (Maybe [EmailTemplateMetadata])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [EmailTemplateMetadata]
forall a. Monoid a => a
Prelude.mempty
)
Either String (Maybe Text -> Int -> ListEmailTemplatesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListEmailTemplatesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
Either String (Int -> ListEmailTemplatesResponse)
-> Either String Int -> Either String ListEmailTemplatesResponse
forall (f :: * -> *) a b. Applicative f => 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))
)
instance Prelude.Hashable ListEmailTemplates
instance Prelude.NFData ListEmailTemplates
instance Core.ToHeaders ListEmailTemplates where
toHeaders :: ListEmailTemplates -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListEmailTemplates -> 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 ListEmailTemplates where
toPath :: ListEmailTemplates -> ByteString
toPath = ByteString -> ListEmailTemplates -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v2/email/templates"
instance Core.ToQuery ListEmailTemplates where
toQuery :: ListEmailTemplates -> QueryString
toQuery ListEmailTemplates' {Maybe Int
Maybe Text
pageSize :: Maybe Int
nextToken :: Maybe Text
$sel:pageSize:ListEmailTemplates' :: ListEmailTemplates -> Maybe Int
$sel:nextToken:ListEmailTemplates' :: ListEmailTemplates -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"PageSize" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
pageSize
]
data ListEmailTemplatesResponse = ListEmailTemplatesResponse'
{
ListEmailTemplatesResponse -> Maybe [EmailTemplateMetadata]
templatesMetadata :: Prelude.Maybe [EmailTemplateMetadata],
ListEmailTemplatesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListEmailTemplatesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListEmailTemplatesResponse -> ListEmailTemplatesResponse -> Bool
(ListEmailTemplatesResponse -> ListEmailTemplatesResponse -> Bool)
-> (ListEmailTemplatesResponse
-> ListEmailTemplatesResponse -> Bool)
-> Eq ListEmailTemplatesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListEmailTemplatesResponse -> ListEmailTemplatesResponse -> Bool
$c/= :: ListEmailTemplatesResponse -> ListEmailTemplatesResponse -> Bool
== :: ListEmailTemplatesResponse -> ListEmailTemplatesResponse -> Bool
$c== :: ListEmailTemplatesResponse -> ListEmailTemplatesResponse -> Bool
Prelude.Eq, ReadPrec [ListEmailTemplatesResponse]
ReadPrec ListEmailTemplatesResponse
Int -> ReadS ListEmailTemplatesResponse
ReadS [ListEmailTemplatesResponse]
(Int -> ReadS ListEmailTemplatesResponse)
-> ReadS [ListEmailTemplatesResponse]
-> ReadPrec ListEmailTemplatesResponse
-> ReadPrec [ListEmailTemplatesResponse]
-> Read ListEmailTemplatesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListEmailTemplatesResponse]
$creadListPrec :: ReadPrec [ListEmailTemplatesResponse]
readPrec :: ReadPrec ListEmailTemplatesResponse
$creadPrec :: ReadPrec ListEmailTemplatesResponse
readList :: ReadS [ListEmailTemplatesResponse]
$creadList :: ReadS [ListEmailTemplatesResponse]
readsPrec :: Int -> ReadS ListEmailTemplatesResponse
$creadsPrec :: Int -> ReadS ListEmailTemplatesResponse
Prelude.Read, Int -> ListEmailTemplatesResponse -> ShowS
[ListEmailTemplatesResponse] -> ShowS
ListEmailTemplatesResponse -> String
(Int -> ListEmailTemplatesResponse -> ShowS)
-> (ListEmailTemplatesResponse -> String)
-> ([ListEmailTemplatesResponse] -> ShowS)
-> Show ListEmailTemplatesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListEmailTemplatesResponse] -> ShowS
$cshowList :: [ListEmailTemplatesResponse] -> ShowS
show :: ListEmailTemplatesResponse -> String
$cshow :: ListEmailTemplatesResponse -> String
showsPrec :: Int -> ListEmailTemplatesResponse -> ShowS
$cshowsPrec :: Int -> ListEmailTemplatesResponse -> ShowS
Prelude.Show, (forall x.
ListEmailTemplatesResponse -> Rep ListEmailTemplatesResponse x)
-> (forall x.
Rep ListEmailTemplatesResponse x -> ListEmailTemplatesResponse)
-> Generic ListEmailTemplatesResponse
forall x.
Rep ListEmailTemplatesResponse x -> ListEmailTemplatesResponse
forall x.
ListEmailTemplatesResponse -> Rep ListEmailTemplatesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListEmailTemplatesResponse x -> ListEmailTemplatesResponse
$cfrom :: forall x.
ListEmailTemplatesResponse -> Rep ListEmailTemplatesResponse x
Prelude.Generic)
newListEmailTemplatesResponse ::
Prelude.Int ->
ListEmailTemplatesResponse
newListEmailTemplatesResponse :: Int -> ListEmailTemplatesResponse
newListEmailTemplatesResponse Int
pHttpStatus_ =
ListEmailTemplatesResponse' :: Maybe [EmailTemplateMetadata]
-> Maybe Text -> Int -> ListEmailTemplatesResponse
ListEmailTemplatesResponse'
{ $sel:templatesMetadata:ListEmailTemplatesResponse' :: Maybe [EmailTemplateMetadata]
templatesMetadata =
Maybe [EmailTemplateMetadata]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListEmailTemplatesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListEmailTemplatesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listEmailTemplatesResponse_templatesMetadata :: Lens.Lens' ListEmailTemplatesResponse (Prelude.Maybe [EmailTemplateMetadata])
listEmailTemplatesResponse_templatesMetadata :: (Maybe [EmailTemplateMetadata]
-> f (Maybe [EmailTemplateMetadata]))
-> ListEmailTemplatesResponse -> f ListEmailTemplatesResponse
listEmailTemplatesResponse_templatesMetadata = (ListEmailTemplatesResponse -> Maybe [EmailTemplateMetadata])
-> (ListEmailTemplatesResponse
-> Maybe [EmailTemplateMetadata] -> ListEmailTemplatesResponse)
-> Lens
ListEmailTemplatesResponse
ListEmailTemplatesResponse
(Maybe [EmailTemplateMetadata])
(Maybe [EmailTemplateMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEmailTemplatesResponse' {Maybe [EmailTemplateMetadata]
templatesMetadata :: Maybe [EmailTemplateMetadata]
$sel:templatesMetadata:ListEmailTemplatesResponse' :: ListEmailTemplatesResponse -> Maybe [EmailTemplateMetadata]
templatesMetadata} -> Maybe [EmailTemplateMetadata]
templatesMetadata) (\s :: ListEmailTemplatesResponse
s@ListEmailTemplatesResponse' {} Maybe [EmailTemplateMetadata]
a -> ListEmailTemplatesResponse
s {$sel:templatesMetadata:ListEmailTemplatesResponse' :: Maybe [EmailTemplateMetadata]
templatesMetadata = Maybe [EmailTemplateMetadata]
a} :: ListEmailTemplatesResponse) ((Maybe [EmailTemplateMetadata]
-> f (Maybe [EmailTemplateMetadata]))
-> ListEmailTemplatesResponse -> f ListEmailTemplatesResponse)
-> ((Maybe [EmailTemplateMetadata]
-> f (Maybe [EmailTemplateMetadata]))
-> Maybe [EmailTemplateMetadata]
-> f (Maybe [EmailTemplateMetadata]))
-> (Maybe [EmailTemplateMetadata]
-> f (Maybe [EmailTemplateMetadata]))
-> ListEmailTemplatesResponse
-> f ListEmailTemplatesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[EmailTemplateMetadata]
[EmailTemplateMetadata]
[EmailTemplateMetadata]
[EmailTemplateMetadata]
-> Iso
(Maybe [EmailTemplateMetadata])
(Maybe [EmailTemplateMetadata])
(Maybe [EmailTemplateMetadata])
(Maybe [EmailTemplateMetadata])
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 AnIso
[EmailTemplateMetadata]
[EmailTemplateMetadata]
[EmailTemplateMetadata]
[EmailTemplateMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listEmailTemplatesResponse_nextToken :: Lens.Lens' ListEmailTemplatesResponse (Prelude.Maybe Prelude.Text)
listEmailTemplatesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListEmailTemplatesResponse -> f ListEmailTemplatesResponse
listEmailTemplatesResponse_nextToken = (ListEmailTemplatesResponse -> Maybe Text)
-> (ListEmailTemplatesResponse
-> Maybe Text -> ListEmailTemplatesResponse)
-> Lens
ListEmailTemplatesResponse
ListEmailTemplatesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEmailTemplatesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListEmailTemplatesResponse' :: ListEmailTemplatesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListEmailTemplatesResponse
s@ListEmailTemplatesResponse' {} Maybe Text
a -> ListEmailTemplatesResponse
s {$sel:nextToken:ListEmailTemplatesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListEmailTemplatesResponse)
listEmailTemplatesResponse_httpStatus :: Lens.Lens' ListEmailTemplatesResponse Prelude.Int
listEmailTemplatesResponse_httpStatus :: (Int -> f Int)
-> ListEmailTemplatesResponse -> f ListEmailTemplatesResponse
listEmailTemplatesResponse_httpStatus = (ListEmailTemplatesResponse -> Int)
-> (ListEmailTemplatesResponse
-> Int -> ListEmailTemplatesResponse)
-> Lens
ListEmailTemplatesResponse ListEmailTemplatesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListEmailTemplatesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListEmailTemplatesResponse' :: ListEmailTemplatesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListEmailTemplatesResponse
s@ListEmailTemplatesResponse' {} Int
a -> ListEmailTemplatesResponse
s {$sel:httpStatus:ListEmailTemplatesResponse' :: Int
httpStatus = Int
a} :: ListEmailTemplatesResponse)
instance Prelude.NFData ListEmailTemplatesResponse