{-# 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.ListContacts
(
ListContacts (..),
newListContacts,
listContacts_nextToken,
listContacts_filter,
listContacts_pageSize,
listContacts_contactListName,
ListContactsResponse (..),
newListContactsResponse,
listContactsResponse_nextToken,
listContactsResponse_contacts,
listContactsResponse_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 ListContacts = ListContacts'
{
ListContacts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListContacts -> Maybe ListContactsFilter
filter' :: Prelude.Maybe ListContactsFilter,
ListContacts -> Maybe Int
pageSize :: Prelude.Maybe Prelude.Int,
ListContacts -> Text
contactListName :: Prelude.Text
}
deriving (ListContacts -> ListContacts -> Bool
(ListContacts -> ListContacts -> Bool)
-> (ListContacts -> ListContacts -> Bool) -> Eq ListContacts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListContacts -> ListContacts -> Bool
$c/= :: ListContacts -> ListContacts -> Bool
== :: ListContacts -> ListContacts -> Bool
$c== :: ListContacts -> ListContacts -> Bool
Prelude.Eq, ReadPrec [ListContacts]
ReadPrec ListContacts
Int -> ReadS ListContacts
ReadS [ListContacts]
(Int -> ReadS ListContacts)
-> ReadS [ListContacts]
-> ReadPrec ListContacts
-> ReadPrec [ListContacts]
-> Read ListContacts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListContacts]
$creadListPrec :: ReadPrec [ListContacts]
readPrec :: ReadPrec ListContacts
$creadPrec :: ReadPrec ListContacts
readList :: ReadS [ListContacts]
$creadList :: ReadS [ListContacts]
readsPrec :: Int -> ReadS ListContacts
$creadsPrec :: Int -> ReadS ListContacts
Prelude.Read, Int -> ListContacts -> ShowS
[ListContacts] -> ShowS
ListContacts -> String
(Int -> ListContacts -> ShowS)
-> (ListContacts -> String)
-> ([ListContacts] -> ShowS)
-> Show ListContacts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListContacts] -> ShowS
$cshowList :: [ListContacts] -> ShowS
show :: ListContacts -> String
$cshow :: ListContacts -> String
showsPrec :: Int -> ListContacts -> ShowS
$cshowsPrec :: Int -> ListContacts -> ShowS
Prelude.Show, (forall x. ListContacts -> Rep ListContacts x)
-> (forall x. Rep ListContacts x -> ListContacts)
-> Generic ListContacts
forall x. Rep ListContacts x -> ListContacts
forall x. ListContacts -> Rep ListContacts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListContacts x -> ListContacts
$cfrom :: forall x. ListContacts -> Rep ListContacts x
Prelude.Generic)
newListContacts ::
Prelude.Text ->
ListContacts
newListContacts :: Text -> ListContacts
newListContacts Text
pContactListName_ =
ListContacts' :: Maybe Text
-> Maybe ListContactsFilter -> Maybe Int -> Text -> ListContacts
ListContacts'
{ $sel:nextToken:ListContacts' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:filter':ListContacts' :: Maybe ListContactsFilter
filter' = Maybe ListContactsFilter
forall a. Maybe a
Prelude.Nothing,
$sel:pageSize:ListContacts' :: Maybe Int
pageSize = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:contactListName:ListContacts' :: Text
contactListName = Text
pContactListName_
}
listContacts_nextToken :: Lens.Lens' ListContacts (Prelude.Maybe Prelude.Text)
listContacts_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListContacts -> f ListContacts
listContacts_nextToken = (ListContacts -> Maybe Text)
-> (ListContacts -> Maybe Text -> ListContacts)
-> Lens ListContacts ListContacts (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContacts' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListContacts' :: ListContacts -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListContacts
s@ListContacts' {} Maybe Text
a -> ListContacts
s {$sel:nextToken:ListContacts' :: Maybe Text
nextToken = Maybe Text
a} :: ListContacts)
listContacts_filter :: Lens.Lens' ListContacts (Prelude.Maybe ListContactsFilter)
listContacts_filter :: (Maybe ListContactsFilter -> f (Maybe ListContactsFilter))
-> ListContacts -> f ListContacts
listContacts_filter = (ListContacts -> Maybe ListContactsFilter)
-> (ListContacts -> Maybe ListContactsFilter -> ListContacts)
-> Lens
ListContacts
ListContacts
(Maybe ListContactsFilter)
(Maybe ListContactsFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContacts' {Maybe ListContactsFilter
filter' :: Maybe ListContactsFilter
$sel:filter':ListContacts' :: ListContacts -> Maybe ListContactsFilter
filter'} -> Maybe ListContactsFilter
filter') (\s :: ListContacts
s@ListContacts' {} Maybe ListContactsFilter
a -> ListContacts
s {$sel:filter':ListContacts' :: Maybe ListContactsFilter
filter' = Maybe ListContactsFilter
a} :: ListContacts)
listContacts_pageSize :: Lens.Lens' ListContacts (Prelude.Maybe Prelude.Int)
listContacts_pageSize :: (Maybe Int -> f (Maybe Int)) -> ListContacts -> f ListContacts
listContacts_pageSize = (ListContacts -> Maybe Int)
-> (ListContacts -> Maybe Int -> ListContacts)
-> Lens ListContacts ListContacts (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContacts' {Maybe Int
pageSize :: Maybe Int
$sel:pageSize:ListContacts' :: ListContacts -> Maybe Int
pageSize} -> Maybe Int
pageSize) (\s :: ListContacts
s@ListContacts' {} Maybe Int
a -> ListContacts
s {$sel:pageSize:ListContacts' :: Maybe Int
pageSize = Maybe Int
a} :: ListContacts)
listContacts_contactListName :: Lens.Lens' ListContacts Prelude.Text
listContacts_contactListName :: (Text -> f Text) -> ListContacts -> f ListContacts
listContacts_contactListName = (ListContacts -> Text)
-> (ListContacts -> Text -> ListContacts)
-> Lens ListContacts ListContacts Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContacts' {Text
contactListName :: Text
$sel:contactListName:ListContacts' :: ListContacts -> Text
contactListName} -> Text
contactListName) (\s :: ListContacts
s@ListContacts' {} Text
a -> ListContacts
s {$sel:contactListName:ListContacts' :: Text
contactListName = Text
a} :: ListContacts)
instance Core.AWSRequest ListContacts where
type AWSResponse ListContacts = ListContactsResponse
request :: ListContacts -> Request ListContacts
request = Service -> ListContacts -> Request ListContacts
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListContacts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListContacts)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListContacts))
-> Logger
-> Service
-> Proxy ListContacts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListContacts)))
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 Text -> Maybe [Contact] -> Int -> ListContactsResponse
ListContactsResponse'
(Maybe Text -> Maybe [Contact] -> Int -> ListContactsResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Contact] -> Int -> ListContactsResponse)
forall (f :: * -> *) a b. Functor 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 (Maybe [Contact] -> Int -> ListContactsResponse)
-> Either String (Maybe [Contact])
-> Either String (Int -> ListContactsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Contact]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Contacts" Either String (Maybe (Maybe [Contact]))
-> Maybe [Contact] -> Either String (Maybe [Contact])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Contact]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListContactsResponse)
-> Either String Int -> Either String ListContactsResponse
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 ListContacts
instance Prelude.NFData ListContacts
instance Core.ToHeaders ListContacts where
toHeaders :: ListContacts -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListContacts -> 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 ListContacts where
toPath :: ListContacts -> ByteString
toPath ListContacts' {Maybe Int
Maybe Text
Maybe ListContactsFilter
Text
contactListName :: Text
pageSize :: Maybe Int
filter' :: Maybe ListContactsFilter
nextToken :: Maybe Text
$sel:contactListName:ListContacts' :: ListContacts -> Text
$sel:pageSize:ListContacts' :: ListContacts -> Maybe Int
$sel:filter':ListContacts' :: ListContacts -> Maybe ListContactsFilter
$sel:nextToken:ListContacts' :: ListContacts -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/v2/email/contact-lists/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
contactListName,
ByteString
"/contacts"
]
instance Core.ToQuery ListContacts where
toQuery :: ListContacts -> QueryString
toQuery ListContacts' {Maybe Int
Maybe Text
Maybe ListContactsFilter
Text
contactListName :: Text
pageSize :: Maybe Int
filter' :: Maybe ListContactsFilter
nextToken :: Maybe Text
$sel:contactListName:ListContacts' :: ListContacts -> Text
$sel:pageSize:ListContacts' :: ListContacts -> Maybe Int
$sel:filter':ListContacts' :: ListContacts -> Maybe ListContactsFilter
$sel:nextToken:ListContacts' :: ListContacts -> 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 ListContactsResponse = ListContactsResponse'
{
ListContactsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListContactsResponse -> Maybe [Contact]
contacts :: Prelude.Maybe [Contact],
ListContactsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListContactsResponse -> ListContactsResponse -> Bool
(ListContactsResponse -> ListContactsResponse -> Bool)
-> (ListContactsResponse -> ListContactsResponse -> Bool)
-> Eq ListContactsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListContactsResponse -> ListContactsResponse -> Bool
$c/= :: ListContactsResponse -> ListContactsResponse -> Bool
== :: ListContactsResponse -> ListContactsResponse -> Bool
$c== :: ListContactsResponse -> ListContactsResponse -> Bool
Prelude.Eq, ReadPrec [ListContactsResponse]
ReadPrec ListContactsResponse
Int -> ReadS ListContactsResponse
ReadS [ListContactsResponse]
(Int -> ReadS ListContactsResponse)
-> ReadS [ListContactsResponse]
-> ReadPrec ListContactsResponse
-> ReadPrec [ListContactsResponse]
-> Read ListContactsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListContactsResponse]
$creadListPrec :: ReadPrec [ListContactsResponse]
readPrec :: ReadPrec ListContactsResponse
$creadPrec :: ReadPrec ListContactsResponse
readList :: ReadS [ListContactsResponse]
$creadList :: ReadS [ListContactsResponse]
readsPrec :: Int -> ReadS ListContactsResponse
$creadsPrec :: Int -> ReadS ListContactsResponse
Prelude.Read, Int -> ListContactsResponse -> ShowS
[ListContactsResponse] -> ShowS
ListContactsResponse -> String
(Int -> ListContactsResponse -> ShowS)
-> (ListContactsResponse -> String)
-> ([ListContactsResponse] -> ShowS)
-> Show ListContactsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListContactsResponse] -> ShowS
$cshowList :: [ListContactsResponse] -> ShowS
show :: ListContactsResponse -> String
$cshow :: ListContactsResponse -> String
showsPrec :: Int -> ListContactsResponse -> ShowS
$cshowsPrec :: Int -> ListContactsResponse -> ShowS
Prelude.Show, (forall x. ListContactsResponse -> Rep ListContactsResponse x)
-> (forall x. Rep ListContactsResponse x -> ListContactsResponse)
-> Generic ListContactsResponse
forall x. Rep ListContactsResponse x -> ListContactsResponse
forall x. ListContactsResponse -> Rep ListContactsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListContactsResponse x -> ListContactsResponse
$cfrom :: forall x. ListContactsResponse -> Rep ListContactsResponse x
Prelude.Generic)
newListContactsResponse ::
Prelude.Int ->
ListContactsResponse
newListContactsResponse :: Int -> ListContactsResponse
newListContactsResponse Int
pHttpStatus_ =
ListContactsResponse' :: Maybe Text -> Maybe [Contact] -> Int -> ListContactsResponse
ListContactsResponse'
{ $sel:nextToken:ListContactsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:contacts:ListContactsResponse' :: Maybe [Contact]
contacts = Maybe [Contact]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListContactsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listContactsResponse_nextToken :: Lens.Lens' ListContactsResponse (Prelude.Maybe Prelude.Text)
listContactsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListContactsResponse -> f ListContactsResponse
listContactsResponse_nextToken = (ListContactsResponse -> Maybe Text)
-> (ListContactsResponse -> Maybe Text -> ListContactsResponse)
-> Lens
ListContactsResponse ListContactsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContactsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListContactsResponse' :: ListContactsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListContactsResponse
s@ListContactsResponse' {} Maybe Text
a -> ListContactsResponse
s {$sel:nextToken:ListContactsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListContactsResponse)
listContactsResponse_contacts :: Lens.Lens' ListContactsResponse (Prelude.Maybe [Contact])
listContactsResponse_contacts :: (Maybe [Contact] -> f (Maybe [Contact]))
-> ListContactsResponse -> f ListContactsResponse
listContactsResponse_contacts = (ListContactsResponse -> Maybe [Contact])
-> (ListContactsResponse
-> Maybe [Contact] -> ListContactsResponse)
-> Lens
ListContactsResponse
ListContactsResponse
(Maybe [Contact])
(Maybe [Contact])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContactsResponse' {Maybe [Contact]
contacts :: Maybe [Contact]
$sel:contacts:ListContactsResponse' :: ListContactsResponse -> Maybe [Contact]
contacts} -> Maybe [Contact]
contacts) (\s :: ListContactsResponse
s@ListContactsResponse' {} Maybe [Contact]
a -> ListContactsResponse
s {$sel:contacts:ListContactsResponse' :: Maybe [Contact]
contacts = Maybe [Contact]
a} :: ListContactsResponse) ((Maybe [Contact] -> f (Maybe [Contact]))
-> ListContactsResponse -> f ListContactsResponse)
-> ((Maybe [Contact] -> f (Maybe [Contact]))
-> Maybe [Contact] -> f (Maybe [Contact]))
-> (Maybe [Contact] -> f (Maybe [Contact]))
-> ListContactsResponse
-> f ListContactsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Contact] [Contact] [Contact] [Contact]
-> Iso
(Maybe [Contact])
(Maybe [Contact])
(Maybe [Contact])
(Maybe [Contact])
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 [Contact] [Contact] [Contact] [Contact]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listContactsResponse_httpStatus :: Lens.Lens' ListContactsResponse Prelude.Int
listContactsResponse_httpStatus :: (Int -> f Int) -> ListContactsResponse -> f ListContactsResponse
listContactsResponse_httpStatus = (ListContactsResponse -> Int)
-> (ListContactsResponse -> Int -> ListContactsResponse)
-> Lens ListContactsResponse ListContactsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListContactsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListContactsResponse' :: ListContactsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListContactsResponse
s@ListContactsResponse' {} Int
a -> ListContactsResponse
s {$sel:httpStatus:ListContactsResponse' :: Int
httpStatus = Int
a} :: ListContactsResponse)
instance Prelude.NFData ListContactsResponse