{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.AlexaBusiness.SearchContacts
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Searches contacts and lists the ones that meet a set of filter and sort
-- criteria.
module Amazonka.AlexaBusiness.SearchContacts
  ( -- * Creating a Request
    SearchContacts (..),
    newSearchContacts,

    -- * Request Lenses
    searchContacts_filters,
    searchContacts_sortCriteria,
    searchContacts_nextToken,
    searchContacts_maxResults,

    -- * Destructuring the Response
    SearchContactsResponse (..),
    newSearchContactsResponse,

    -- * Response Lenses
    searchContactsResponse_nextToken,
    searchContactsResponse_contacts,
    searchContactsResponse_totalCount,
    searchContactsResponse_httpStatus,
  )
where

import Amazonka.AlexaBusiness.Types
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

-- | /See:/ 'newSearchContacts' smart constructor.
data SearchContacts = SearchContacts'
  { -- | The filters to use to list a specified set of address books. The
    -- supported filter keys are DisplayName, FirstName, LastName, and
    -- AddressBookArns.
    SearchContacts -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | The sort order to use in listing the specified set of contacts. The
    -- supported sort keys are DisplayName, FirstName, and LastName.
    SearchContacts -> Maybe [Sort]
sortCriteria :: Prelude.Maybe [Sort],
    -- | An optional token returned from a prior request. Use this token for
    -- pagination of results from this action. If this parameter is specified,
    -- the response only includes results beyond the token, up to the value
    -- specified by MaxResults.
    SearchContacts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to include in the response. If more
    -- results exist than the specified MaxResults value, a token is included
    -- in the response so that the remaining results can be retrieved.
    SearchContacts -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (SearchContacts -> SearchContacts -> Bool
(SearchContacts -> SearchContacts -> Bool)
-> (SearchContacts -> SearchContacts -> Bool) -> Eq SearchContacts
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]
(Int -> ReadS SearchContacts)
-> ReadS [SearchContacts]
-> ReadPrec SearchContacts
-> ReadPrec [SearchContacts]
-> Read 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
(Int -> SearchContacts -> ShowS)
-> (SearchContacts -> String)
-> ([SearchContacts] -> ShowS)
-> Show SearchContacts
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. SearchContacts -> Rep SearchContacts x)
-> (forall x. Rep SearchContacts x -> SearchContacts)
-> Generic SearchContacts
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)

-- |
-- Create a value of 'SearchContacts' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'filters', 'searchContacts_filters' - The filters to use to list a specified set of address books. The
-- supported filter keys are DisplayName, FirstName, LastName, and
-- AddressBookArns.
--
-- 'sortCriteria', 'searchContacts_sortCriteria' - The sort order to use in listing the specified set of contacts. The
-- supported sort keys are DisplayName, FirstName, and LastName.
--
-- 'nextToken', 'searchContacts_nextToken' - An optional token returned from a prior request. Use this token for
-- pagination of results from this action. If this parameter is specified,
-- the response only includes results beyond the token, up to the value
-- specified by MaxResults.
--
-- 'maxResults', 'searchContacts_maxResults' - The maximum number of results to include in the response. If more
-- results exist than the specified MaxResults value, a token is included
-- in the response so that the remaining results can be retrieved.
newSearchContacts ::
  SearchContacts
newSearchContacts :: SearchContacts
newSearchContacts =
  SearchContacts' :: Maybe [Filter]
-> Maybe [Sort] -> Maybe Text -> Maybe Natural -> SearchContacts
SearchContacts'
    { $sel:filters:SearchContacts' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:sortCriteria:SearchContacts' :: Maybe [Sort]
sortCriteria = Maybe [Sort]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchContacts' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchContacts' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The filters to use to list a specified set of address books. The
-- supported filter keys are DisplayName, FirstName, LastName, and
-- AddressBookArns.
searchContacts_filters :: Lens.Lens' SearchContacts (Prelude.Maybe [Filter])
searchContacts_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> SearchContacts -> f SearchContacts
searchContacts_filters = (SearchContacts -> Maybe [Filter])
-> (SearchContacts -> Maybe [Filter] -> SearchContacts)
-> Lens
     SearchContacts SearchContacts (Maybe [Filter]) (Maybe [Filter])
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) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> SearchContacts -> f SearchContacts)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> SearchContacts
-> f SearchContacts
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Filter] [Filter] [Filter] [Filter]
-> Iso
     (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter]) (Maybe [Filter])
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 [Filter] [Filter] [Filter] [Filter]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The sort order to use in listing the specified set of contacts. The
-- supported sort keys are DisplayName, FirstName, and LastName.
searchContacts_sortCriteria :: Lens.Lens' SearchContacts (Prelude.Maybe [Sort])
searchContacts_sortCriteria :: (Maybe [Sort] -> f (Maybe [Sort]))
-> SearchContacts -> f SearchContacts
searchContacts_sortCriteria = (SearchContacts -> Maybe [Sort])
-> (SearchContacts -> Maybe [Sort] -> SearchContacts)
-> Lens SearchContacts SearchContacts (Maybe [Sort]) (Maybe [Sort])
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) ((Maybe [Sort] -> f (Maybe [Sort]))
 -> SearchContacts -> f SearchContacts)
-> ((Maybe [Sort] -> f (Maybe [Sort]))
    -> Maybe [Sort] -> f (Maybe [Sort]))
-> (Maybe [Sort] -> f (Maybe [Sort]))
-> SearchContacts
-> f SearchContacts
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Sort] [Sort] [Sort] [Sort]
-> Iso (Maybe [Sort]) (Maybe [Sort]) (Maybe [Sort]) (Maybe [Sort])
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 [Sort] [Sort] [Sort] [Sort]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An optional token returned from a prior request. Use this token for
-- pagination of results from this action. If this parameter is specified,
-- the response only includes results beyond the token, up to the value
-- specified by MaxResults.
searchContacts_nextToken :: Lens.Lens' SearchContacts (Prelude.Maybe Prelude.Text)
searchContacts_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchContacts -> f SearchContacts
searchContacts_nextToken = (SearchContacts -> Maybe Text)
-> (SearchContacts -> Maybe Text -> SearchContacts)
-> Lens SearchContacts SearchContacts (Maybe Text) (Maybe Text)
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)

-- | The maximum number of results to include in the response. If more
-- results exist than the specified MaxResults value, a token is included
-- in the response so that the remaining results can be retrieved.
searchContacts_maxResults :: Lens.Lens' SearchContacts (Prelude.Maybe Prelude.Natural)
searchContacts_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> SearchContacts -> f SearchContacts
searchContacts_maxResults = (SearchContacts -> Maybe Natural)
-> (SearchContacts -> Maybe Natural -> SearchContacts)
-> Lens
     SearchContacts SearchContacts (Maybe Natural) (Maybe Natural)
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)

instance Core.AWSRequest SearchContacts where
  type
    AWSResponse SearchContacts =
      SearchContactsResponse
  request :: SearchContacts -> Request SearchContacts
request = Service -> SearchContacts -> Request SearchContacts
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy SearchContacts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SearchContacts)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse SearchContacts))
-> Logger
-> Service
-> Proxy SearchContacts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SearchContacts)))
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 [ContactData]
-> Maybe Int
-> Int
-> SearchContactsResponse
SearchContactsResponse'
            (Maybe Text
 -> Maybe [ContactData]
 -> Maybe Int
 -> Int
 -> SearchContactsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe [ContactData] -> Maybe Int -> Int -> SearchContactsResponse)
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 [ContactData] -> Maybe Int -> Int -> SearchContactsResponse)
-> Either String (Maybe [ContactData])
-> Either String (Maybe Int -> Int -> SearchContactsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [ContactData]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Contacts" Either String (Maybe (Maybe [ContactData]))
-> Maybe [ContactData] -> Either String (Maybe [ContactData])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [ContactData]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Int -> Int -> SearchContactsResponse)
-> Either String (Maybe Int)
-> Either String (Int -> SearchContactsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Int)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TotalCount")
            Either String (Int -> SearchContactsResponse)
-> Either String Int -> Either String SearchContactsResponse
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 SearchContacts

instance Prelude.NFData SearchContacts

instance Core.ToHeaders SearchContacts where
  toHeaders :: SearchContacts -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SearchContacts -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AlexaForBusiness.SearchContacts" ::
                          Prelude.ByteString
                      ),
            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.ToJSON SearchContacts where
  toJSON :: SearchContacts -> Value
toJSON SearchContacts' {Maybe Natural
Maybe [Filter]
Maybe [Sort]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
sortCriteria :: Maybe [Sort]
filters :: Maybe [Filter]
$sel:maxResults:SearchContacts' :: SearchContacts -> Maybe Natural
$sel:nextToken:SearchContacts' :: SearchContacts -> Maybe Text
$sel:sortCriteria:SearchContacts' :: SearchContacts -> Maybe [Sort]
$sel:filters:SearchContacts' :: SearchContacts -> Maybe [Filter]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Filters" Text -> [Filter] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Filter] -> Pair) -> Maybe [Filter] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Filter]
filters,
            (Text
"SortCriteria" Text -> [Sort] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Sort] -> Pair) -> Maybe [Sort] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Sort]
sortCriteria,
            (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
          ]
      )

instance Core.ToPath SearchContacts where
  toPath :: SearchContacts -> ByteString
toPath = ByteString -> SearchContacts -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery SearchContacts where
  toQuery :: SearchContacts -> QueryString
toQuery = QueryString -> SearchContacts -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newSearchContactsResponse' smart constructor.
data SearchContactsResponse = SearchContactsResponse'
  { -- | The token returned to indicate that there is more data available.
    SearchContactsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The contacts that meet the specified set of filter criteria, in sort
    -- order.
    SearchContactsResponse -> Maybe [ContactData]
contacts :: Prelude.Maybe [ContactData],
    -- | The total number of contacts returned.
    SearchContactsResponse -> Maybe Int
totalCount :: Prelude.Maybe Prelude.Int,
    -- | The response's http status code.
    SearchContactsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SearchContactsResponse -> SearchContactsResponse -> Bool
(SearchContactsResponse -> SearchContactsResponse -> Bool)
-> (SearchContactsResponse -> SearchContactsResponse -> Bool)
-> Eq SearchContactsResponse
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
(Int -> SearchContactsResponse -> ShowS)
-> (SearchContactsResponse -> String)
-> ([SearchContactsResponse] -> ShowS)
-> Show SearchContactsResponse
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. SearchContactsResponse -> Rep SearchContactsResponse x)
-> (forall x.
    Rep SearchContactsResponse x -> SearchContactsResponse)
-> Generic SearchContactsResponse
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)

-- |
-- Create a value of 'SearchContactsResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'nextToken', 'searchContactsResponse_nextToken' - The token returned to indicate that there is more data available.
--
-- 'contacts', 'searchContactsResponse_contacts' - The contacts that meet the specified set of filter criteria, in sort
-- order.
--
-- 'totalCount', 'searchContactsResponse_totalCount' - The total number of contacts returned.
--
-- 'httpStatus', 'searchContactsResponse_httpStatus' - The response's http status code.
newSearchContactsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchContactsResponse
newSearchContactsResponse :: Int -> SearchContactsResponse
newSearchContactsResponse Int
pHttpStatus_ =
  SearchContactsResponse' :: Maybe Text
-> Maybe [ContactData]
-> Maybe Int
-> Int
-> SearchContactsResponse
SearchContactsResponse'
    { $sel:nextToken:SearchContactsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:contacts:SearchContactsResponse' :: Maybe [ContactData]
contacts = Maybe [ContactData]
forall a. Maybe a
Prelude.Nothing,
      $sel:totalCount:SearchContactsResponse' :: Maybe Int
totalCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchContactsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token returned to indicate that there is more data available.
searchContactsResponse_nextToken :: Lens.Lens' SearchContactsResponse (Prelude.Maybe Prelude.Text)
searchContactsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchContactsResponse -> f SearchContactsResponse
searchContactsResponse_nextToken = (SearchContactsResponse -> Maybe Text)
-> (SearchContactsResponse -> Maybe Text -> SearchContactsResponse)
-> Lens
     SearchContactsResponse
     SearchContactsResponse
     (Maybe Text)
     (Maybe Text)
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)

-- | The contacts that meet the specified set of filter criteria, in sort
-- order.
searchContactsResponse_contacts :: Lens.Lens' SearchContactsResponse (Prelude.Maybe [ContactData])
searchContactsResponse_contacts :: (Maybe [ContactData] -> f (Maybe [ContactData]))
-> SearchContactsResponse -> f SearchContactsResponse
searchContactsResponse_contacts = (SearchContactsResponse -> Maybe [ContactData])
-> (SearchContactsResponse
    -> Maybe [ContactData] -> SearchContactsResponse)
-> Lens
     SearchContactsResponse
     SearchContactsResponse
     (Maybe [ContactData])
     (Maybe [ContactData])
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) ((Maybe [ContactData] -> f (Maybe [ContactData]))
 -> SearchContactsResponse -> f SearchContactsResponse)
-> ((Maybe [ContactData] -> f (Maybe [ContactData]))
    -> Maybe [ContactData] -> f (Maybe [ContactData]))
-> (Maybe [ContactData] -> f (Maybe [ContactData]))
-> SearchContactsResponse
-> f SearchContactsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ContactData] [ContactData] [ContactData] [ContactData]
-> Iso
     (Maybe [ContactData])
     (Maybe [ContactData])
     (Maybe [ContactData])
     (Maybe [ContactData])
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 [ContactData] [ContactData] [ContactData] [ContactData]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The total number of contacts returned.
searchContactsResponse_totalCount :: Lens.Lens' SearchContactsResponse (Prelude.Maybe Prelude.Int)
searchContactsResponse_totalCount :: (Maybe Int -> f (Maybe Int))
-> SearchContactsResponse -> f SearchContactsResponse
searchContactsResponse_totalCount = (SearchContactsResponse -> Maybe Int)
-> (SearchContactsResponse -> Maybe Int -> SearchContactsResponse)
-> Lens
     SearchContactsResponse
     SearchContactsResponse
     (Maybe Int)
     (Maybe Int)
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)

-- | The response's http status code.
searchContactsResponse_httpStatus :: Lens.Lens' SearchContactsResponse Prelude.Int
searchContactsResponse_httpStatus :: (Int -> f Int)
-> SearchContactsResponse -> f SearchContactsResponse
searchContactsResponse_httpStatus = (SearchContactsResponse -> Int)
-> (SearchContactsResponse -> Int -> SearchContactsResponse)
-> Lens SearchContactsResponse SearchContactsResponse Int Int
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