{-# 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.AlexaBusiness.SearchContacts
(
SearchContacts (..),
newSearchContacts,
searchContacts_filters,
searchContacts_maxResults,
searchContacts_nextToken,
searchContacts_sortCriteria,
SearchContactsResponse (..),
newSearchContactsResponse,
searchContactsResponse_contacts,
searchContactsResponse_nextToken,
searchContactsResponse_totalCount,
searchContactsResponse_httpStatus,
)
where
import Amazonka.AlexaBusiness.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data SearchContacts = SearchContacts'
{
SearchContacts -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
SearchContacts -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
SearchContacts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
SearchContacts -> Maybe [Sort]
sortCriteria :: Prelude.Maybe [Sort]
}
deriving (SearchContacts -> SearchContacts -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchContacts -> SearchContacts -> Bool
$c/= :: SearchContacts -> SearchContacts -> Bool
== :: SearchContacts -> SearchContacts -> Bool
$c== :: SearchContacts -> SearchContacts -> Bool
Prelude.Eq, ReadPrec [SearchContacts]
ReadPrec SearchContacts
Int -> ReadS SearchContacts
ReadS [SearchContacts]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchContacts]
$creadListPrec :: ReadPrec [SearchContacts]
readPrec :: ReadPrec SearchContacts
$creadPrec :: ReadPrec SearchContacts
readList :: ReadS [SearchContacts]
$creadList :: ReadS [SearchContacts]
readsPrec :: Int -> ReadS SearchContacts
$creadsPrec :: Int -> ReadS SearchContacts
Prelude.Read, Int -> SearchContacts -> ShowS
[SearchContacts] -> ShowS
SearchContacts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchContacts] -> ShowS
$cshowList :: [SearchContacts] -> ShowS
show :: SearchContacts -> String
$cshow :: SearchContacts -> String
showsPrec :: Int -> SearchContacts -> ShowS
$cshowsPrec :: Int -> SearchContacts -> ShowS
Prelude.Show, forall x. Rep SearchContacts x -> SearchContacts
forall x. SearchContacts -> Rep SearchContacts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchContacts x -> SearchContacts
$cfrom :: forall x. SearchContacts -> Rep SearchContacts x
Prelude.Generic)
newSearchContacts ::
SearchContacts
newSearchContacts :: SearchContacts
newSearchContacts =
SearchContacts'
{ $sel:filters:SearchContacts' :: Maybe [Filter]
filters = forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:SearchContacts' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:SearchContacts' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:sortCriteria:SearchContacts' :: Maybe [Sort]
sortCriteria = forall a. Maybe a
Prelude.Nothing
}
searchContacts_filters :: Lens.Lens' SearchContacts (Prelude.Maybe [Filter])
searchContacts_filters :: Lens' SearchContacts (Maybe [Filter])
searchContacts_filters = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContacts' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:SearchContacts' :: SearchContacts -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: SearchContacts
s@SearchContacts' {} Maybe [Filter]
a -> SearchContacts
s {$sel:filters:SearchContacts' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: SearchContacts) 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
searchContacts_maxResults :: Lens.Lens' SearchContacts (Prelude.Maybe Prelude.Natural)
searchContacts_maxResults :: Lens' SearchContacts (Maybe Natural)
searchContacts_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContacts' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchContacts' :: SearchContacts -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchContacts
s@SearchContacts' {} Maybe Natural
a -> SearchContacts
s {$sel:maxResults:SearchContacts' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchContacts)
searchContacts_nextToken :: Lens.Lens' SearchContacts (Prelude.Maybe Prelude.Text)
searchContacts_nextToken :: Lens' SearchContacts (Maybe Text)
searchContacts_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContacts' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchContacts' :: SearchContacts -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchContacts
s@SearchContacts' {} Maybe Text
a -> SearchContacts
s {$sel:nextToken:SearchContacts' :: Maybe Text
nextToken = Maybe Text
a} :: SearchContacts)
searchContacts_sortCriteria :: Lens.Lens' SearchContacts (Prelude.Maybe [Sort])
searchContacts_sortCriteria :: Lens' SearchContacts (Maybe [Sort])
searchContacts_sortCriteria = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContacts' {Maybe [Sort]
sortCriteria :: Maybe [Sort]
$sel:sortCriteria:SearchContacts' :: SearchContacts -> Maybe [Sort]
sortCriteria} -> Maybe [Sort]
sortCriteria) (\s :: SearchContacts
s@SearchContacts' {} Maybe [Sort]
a -> SearchContacts
s {$sel:sortCriteria:SearchContacts' :: Maybe [Sort]
sortCriteria = Maybe [Sort]
a} :: SearchContacts) 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
instance Core.AWSRequest SearchContacts where
type
AWSResponse SearchContacts =
SearchContactsResponse
request :: (Service -> Service) -> SearchContacts -> Request SearchContacts
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 SearchContacts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SearchContacts)))
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 [ContactData]
-> Maybe Text -> Maybe Int -> Int -> SearchContactsResponse
SearchContactsResponse'
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
"Contacts" 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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"TotalCount")
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 SearchContacts where
hashWithSalt :: Int -> SearchContacts -> Int
hashWithSalt Int
_salt SearchContacts' {Maybe Natural
Maybe [Filter]
Maybe [Sort]
Maybe Text
sortCriteria :: Maybe [Sort]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
$sel:sortCriteria:SearchContacts' :: SearchContacts -> Maybe [Sort]
$sel:nextToken:SearchContacts' :: SearchContacts -> Maybe Text
$sel:maxResults:SearchContacts' :: SearchContacts -> Maybe Natural
$sel:filters:SearchContacts' :: SearchContacts -> Maybe [Filter]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Filter]
filters
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 [Sort]
sortCriteria
instance Prelude.NFData SearchContacts where
rnf :: SearchContacts -> ()
rnf SearchContacts' {Maybe Natural
Maybe [Filter]
Maybe [Sort]
Maybe Text
sortCriteria :: Maybe [Sort]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
$sel:sortCriteria:SearchContacts' :: SearchContacts -> Maybe [Sort]
$sel:nextToken:SearchContacts' :: SearchContacts -> Maybe Text
$sel:maxResults:SearchContacts' :: SearchContacts -> Maybe Natural
$sel:filters:SearchContacts' :: SearchContacts -> Maybe [Filter]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Filter]
filters
seq :: forall a b. a -> b -> b
`Prelude.seq` 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 [Sort]
sortCriteria
instance Data.ToHeaders SearchContacts where
toHeaders :: SearchContacts -> 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
"AlexaForBusiness.SearchContacts" ::
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 SearchContacts where
toJSON :: SearchContacts -> Value
toJSON SearchContacts' {Maybe Natural
Maybe [Filter]
Maybe [Sort]
Maybe Text
sortCriteria :: Maybe [Sort]
nextToken :: Maybe Text
maxResults :: Maybe Natural
filters :: Maybe [Filter]
$sel:sortCriteria:SearchContacts' :: SearchContacts -> Maybe [Sort]
$sel:nextToken:SearchContacts' :: SearchContacts -> Maybe Text
$sel:maxResults:SearchContacts' :: SearchContacts -> Maybe Natural
$sel:filters:SearchContacts' :: SearchContacts -> Maybe [Filter]
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Filters" 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 [Filter]
filters,
(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
"SortCriteria" 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 [Sort]
sortCriteria
]
)
instance Data.ToPath SearchContacts where
toPath :: SearchContacts -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery SearchContacts where
toQuery :: SearchContacts -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data SearchContactsResponse = SearchContactsResponse'
{
SearchContactsResponse -> Maybe [ContactData]
contacts :: Prelude.Maybe [ContactData],
SearchContactsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
SearchContactsResponse -> Maybe Int
totalCount :: Prelude.Maybe Prelude.Int,
SearchContactsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SearchContactsResponse -> SearchContactsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchContactsResponse -> SearchContactsResponse -> Bool
$c/= :: SearchContactsResponse -> SearchContactsResponse -> Bool
== :: SearchContactsResponse -> SearchContactsResponse -> Bool
$c== :: SearchContactsResponse -> SearchContactsResponse -> Bool
Prelude.Eq, Int -> SearchContactsResponse -> ShowS
[SearchContactsResponse] -> ShowS
SearchContactsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchContactsResponse] -> ShowS
$cshowList :: [SearchContactsResponse] -> ShowS
show :: SearchContactsResponse -> String
$cshow :: SearchContactsResponse -> String
showsPrec :: Int -> SearchContactsResponse -> ShowS
$cshowsPrec :: Int -> SearchContactsResponse -> ShowS
Prelude.Show, forall x. Rep SearchContactsResponse x -> SearchContactsResponse
forall x. SearchContactsResponse -> Rep SearchContactsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchContactsResponse x -> SearchContactsResponse
$cfrom :: forall x. SearchContactsResponse -> Rep SearchContactsResponse x
Prelude.Generic)
newSearchContactsResponse ::
Prelude.Int ->
SearchContactsResponse
newSearchContactsResponse :: Int -> SearchContactsResponse
newSearchContactsResponse Int
pHttpStatus_ =
SearchContactsResponse'
{ $sel:contacts:SearchContactsResponse' :: Maybe [ContactData]
contacts = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:SearchContactsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:totalCount:SearchContactsResponse' :: Maybe Int
totalCount = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:SearchContactsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
searchContactsResponse_contacts :: Lens.Lens' SearchContactsResponse (Prelude.Maybe [ContactData])
searchContactsResponse_contacts :: Lens' SearchContactsResponse (Maybe [ContactData])
searchContactsResponse_contacts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContactsResponse' {Maybe [ContactData]
contacts :: Maybe [ContactData]
$sel:contacts:SearchContactsResponse' :: SearchContactsResponse -> Maybe [ContactData]
contacts} -> Maybe [ContactData]
contacts) (\s :: SearchContactsResponse
s@SearchContactsResponse' {} Maybe [ContactData]
a -> SearchContactsResponse
s {$sel:contacts:SearchContactsResponse' :: Maybe [ContactData]
contacts = Maybe [ContactData]
a} :: SearchContactsResponse) 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
searchContactsResponse_nextToken :: Lens.Lens' SearchContactsResponse (Prelude.Maybe Prelude.Text)
searchContactsResponse_nextToken :: Lens' SearchContactsResponse (Maybe Text)
searchContactsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContactsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchContactsResponse' :: SearchContactsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchContactsResponse
s@SearchContactsResponse' {} Maybe Text
a -> SearchContactsResponse
s {$sel:nextToken:SearchContactsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SearchContactsResponse)
searchContactsResponse_totalCount :: Lens.Lens' SearchContactsResponse (Prelude.Maybe Prelude.Int)
searchContactsResponse_totalCount :: Lens' SearchContactsResponse (Maybe Int)
searchContactsResponse_totalCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContactsResponse' {Maybe Int
totalCount :: Maybe Int
$sel:totalCount:SearchContactsResponse' :: SearchContactsResponse -> Maybe Int
totalCount} -> Maybe Int
totalCount) (\s :: SearchContactsResponse
s@SearchContactsResponse' {} Maybe Int
a -> SearchContactsResponse
s {$sel:totalCount:SearchContactsResponse' :: Maybe Int
totalCount = Maybe Int
a} :: SearchContactsResponse)
searchContactsResponse_httpStatus :: Lens.Lens' SearchContactsResponse Prelude.Int
searchContactsResponse_httpStatus :: Lens' SearchContactsResponse Int
searchContactsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchContactsResponse' {Int
httpStatus :: Int
$sel:httpStatus:SearchContactsResponse' :: SearchContactsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SearchContactsResponse
s@SearchContactsResponse' {} Int
a -> SearchContactsResponse
s {$sel:httpStatus:SearchContactsResponse' :: Int
httpStatus = Int
a} :: SearchContactsResponse)
instance Prelude.NFData SearchContactsResponse where
rnf :: SearchContactsResponse -> ()
rnf SearchContactsResponse' {Int
Maybe Int
Maybe [ContactData]
Maybe Text
httpStatus :: Int
totalCount :: Maybe Int
nextToken :: Maybe Text
contacts :: Maybe [ContactData]
$sel:httpStatus:SearchContactsResponse' :: SearchContactsResponse -> Int
$sel:totalCount:SearchContactsResponse' :: SearchContactsResponse -> Maybe Int
$sel:nextToken:SearchContactsResponse' :: SearchContactsResponse -> Maybe Text
$sel:contacts:SearchContactsResponse' :: SearchContactsResponse -> Maybe [ContactData]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [ContactData]
contacts
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 Int
totalCount
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus