{-# 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.SearchAddressBooks
-- 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 address books and lists the ones that meet a set of filter and
-- sort criteria.
module Amazonka.AlexaBusiness.SearchAddressBooks
  ( -- * Creating a Request
    SearchAddressBooks (..),
    newSearchAddressBooks,

    -- * Request Lenses
    searchAddressBooks_filters,
    searchAddressBooks_sortCriteria,
    searchAddressBooks_nextToken,
    searchAddressBooks_maxResults,

    -- * Destructuring the Response
    SearchAddressBooksResponse (..),
    newSearchAddressBooksResponse,

    -- * Response Lenses
    searchAddressBooksResponse_nextToken,
    searchAddressBooksResponse_addressBooks,
    searchAddressBooksResponse_totalCount,
    searchAddressBooksResponse_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:/ 'newSearchAddressBooks' smart constructor.
data SearchAddressBooks = SearchAddressBooks'
  { -- | The filters to use to list a specified set of address books. The
    -- supported filter key is AddressBookName.
    SearchAddressBooks -> Maybe [Filter]
filters :: Prelude.Maybe [Filter],
    -- | The sort order to use in listing the specified set of address books. The
    -- supported sort key is AddressBookName.
    SearchAddressBooks -> 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.
    SearchAddressBooks -> 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.
    SearchAddressBooks -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (SearchAddressBooks -> SearchAddressBooks -> Bool
(SearchAddressBooks -> SearchAddressBooks -> Bool)
-> (SearchAddressBooks -> SearchAddressBooks -> Bool)
-> Eq SearchAddressBooks
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchAddressBooks -> SearchAddressBooks -> Bool
$c/= :: SearchAddressBooks -> SearchAddressBooks -> Bool
== :: SearchAddressBooks -> SearchAddressBooks -> Bool
$c== :: SearchAddressBooks -> SearchAddressBooks -> Bool
Prelude.Eq, ReadPrec [SearchAddressBooks]
ReadPrec SearchAddressBooks
Int -> ReadS SearchAddressBooks
ReadS [SearchAddressBooks]
(Int -> ReadS SearchAddressBooks)
-> ReadS [SearchAddressBooks]
-> ReadPrec SearchAddressBooks
-> ReadPrec [SearchAddressBooks]
-> Read SearchAddressBooks
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchAddressBooks]
$creadListPrec :: ReadPrec [SearchAddressBooks]
readPrec :: ReadPrec SearchAddressBooks
$creadPrec :: ReadPrec SearchAddressBooks
readList :: ReadS [SearchAddressBooks]
$creadList :: ReadS [SearchAddressBooks]
readsPrec :: Int -> ReadS SearchAddressBooks
$creadsPrec :: Int -> ReadS SearchAddressBooks
Prelude.Read, Int -> SearchAddressBooks -> ShowS
[SearchAddressBooks] -> ShowS
SearchAddressBooks -> String
(Int -> SearchAddressBooks -> ShowS)
-> (SearchAddressBooks -> String)
-> ([SearchAddressBooks] -> ShowS)
-> Show SearchAddressBooks
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchAddressBooks] -> ShowS
$cshowList :: [SearchAddressBooks] -> ShowS
show :: SearchAddressBooks -> String
$cshow :: SearchAddressBooks -> String
showsPrec :: Int -> SearchAddressBooks -> ShowS
$cshowsPrec :: Int -> SearchAddressBooks -> ShowS
Prelude.Show, (forall x. SearchAddressBooks -> Rep SearchAddressBooks x)
-> (forall x. Rep SearchAddressBooks x -> SearchAddressBooks)
-> Generic SearchAddressBooks
forall x. Rep SearchAddressBooks x -> SearchAddressBooks
forall x. SearchAddressBooks -> Rep SearchAddressBooks x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SearchAddressBooks x -> SearchAddressBooks
$cfrom :: forall x. SearchAddressBooks -> Rep SearchAddressBooks x
Prelude.Generic)

-- |
-- Create a value of 'SearchAddressBooks' 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', 'searchAddressBooks_filters' - The filters to use to list a specified set of address books. The
-- supported filter key is AddressBookName.
--
-- 'sortCriteria', 'searchAddressBooks_sortCriteria' - The sort order to use in listing the specified set of address books. The
-- supported sort key is AddressBookName.
--
-- 'nextToken', 'searchAddressBooks_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', 'searchAddressBooks_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.
newSearchAddressBooks ::
  SearchAddressBooks
newSearchAddressBooks :: SearchAddressBooks
newSearchAddressBooks =
  SearchAddressBooks' :: Maybe [Filter]
-> Maybe [Sort]
-> Maybe Text
-> Maybe Natural
-> SearchAddressBooks
SearchAddressBooks'
    { $sel:filters:SearchAddressBooks' :: Maybe [Filter]
filters = Maybe [Filter]
forall a. Maybe a
Prelude.Nothing,
      $sel:sortCriteria:SearchAddressBooks' :: Maybe [Sort]
sortCriteria = Maybe [Sort]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:SearchAddressBooks' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchAddressBooks' :: 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 key is AddressBookName.
searchAddressBooks_filters :: Lens.Lens' SearchAddressBooks (Prelude.Maybe [Filter])
searchAddressBooks_filters :: (Maybe [Filter] -> f (Maybe [Filter]))
-> SearchAddressBooks -> f SearchAddressBooks
searchAddressBooks_filters = (SearchAddressBooks -> Maybe [Filter])
-> (SearchAddressBooks -> Maybe [Filter] -> SearchAddressBooks)
-> Lens
     SearchAddressBooks
     SearchAddressBooks
     (Maybe [Filter])
     (Maybe [Filter])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchAddressBooks' {Maybe [Filter]
filters :: Maybe [Filter]
$sel:filters:SearchAddressBooks' :: SearchAddressBooks -> Maybe [Filter]
filters} -> Maybe [Filter]
filters) (\s :: SearchAddressBooks
s@SearchAddressBooks' {} Maybe [Filter]
a -> SearchAddressBooks
s {$sel:filters:SearchAddressBooks' :: Maybe [Filter]
filters = Maybe [Filter]
a} :: SearchAddressBooks) ((Maybe [Filter] -> f (Maybe [Filter]))
 -> SearchAddressBooks -> f SearchAddressBooks)
-> ((Maybe [Filter] -> f (Maybe [Filter]))
    -> Maybe [Filter] -> f (Maybe [Filter]))
-> (Maybe [Filter] -> f (Maybe [Filter]))
-> SearchAddressBooks
-> f SearchAddressBooks
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 address books. The
-- supported sort key is AddressBookName.
searchAddressBooks_sortCriteria :: Lens.Lens' SearchAddressBooks (Prelude.Maybe [Sort])
searchAddressBooks_sortCriteria :: (Maybe [Sort] -> f (Maybe [Sort]))
-> SearchAddressBooks -> f SearchAddressBooks
searchAddressBooks_sortCriteria = (SearchAddressBooks -> Maybe [Sort])
-> (SearchAddressBooks -> Maybe [Sort] -> SearchAddressBooks)
-> Lens
     SearchAddressBooks SearchAddressBooks (Maybe [Sort]) (Maybe [Sort])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchAddressBooks' {Maybe [Sort]
sortCriteria :: Maybe [Sort]
$sel:sortCriteria:SearchAddressBooks' :: SearchAddressBooks -> Maybe [Sort]
sortCriteria} -> Maybe [Sort]
sortCriteria) (\s :: SearchAddressBooks
s@SearchAddressBooks' {} Maybe [Sort]
a -> SearchAddressBooks
s {$sel:sortCriteria:SearchAddressBooks' :: Maybe [Sort]
sortCriteria = Maybe [Sort]
a} :: SearchAddressBooks) ((Maybe [Sort] -> f (Maybe [Sort]))
 -> SearchAddressBooks -> f SearchAddressBooks)
-> ((Maybe [Sort] -> f (Maybe [Sort]))
    -> Maybe [Sort] -> f (Maybe [Sort]))
-> (Maybe [Sort] -> f (Maybe [Sort]))
-> SearchAddressBooks
-> f SearchAddressBooks
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.
searchAddressBooks_nextToken :: Lens.Lens' SearchAddressBooks (Prelude.Maybe Prelude.Text)
searchAddressBooks_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchAddressBooks -> f SearchAddressBooks
searchAddressBooks_nextToken = (SearchAddressBooks -> Maybe Text)
-> (SearchAddressBooks -> Maybe Text -> SearchAddressBooks)
-> Lens
     SearchAddressBooks SearchAddressBooks (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchAddressBooks' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchAddressBooks' :: SearchAddressBooks -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchAddressBooks
s@SearchAddressBooks' {} Maybe Text
a -> SearchAddressBooks
s {$sel:nextToken:SearchAddressBooks' :: Maybe Text
nextToken = Maybe Text
a} :: SearchAddressBooks)

-- | 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.
searchAddressBooks_maxResults :: Lens.Lens' SearchAddressBooks (Prelude.Maybe Prelude.Natural)
searchAddressBooks_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> SearchAddressBooks -> f SearchAddressBooks
searchAddressBooks_maxResults = (SearchAddressBooks -> Maybe Natural)
-> (SearchAddressBooks -> Maybe Natural -> SearchAddressBooks)
-> Lens
     SearchAddressBooks
     SearchAddressBooks
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchAddressBooks' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchAddressBooks' :: SearchAddressBooks -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchAddressBooks
s@SearchAddressBooks' {} Maybe Natural
a -> SearchAddressBooks
s {$sel:maxResults:SearchAddressBooks' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchAddressBooks)

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

instance Prelude.NFData SearchAddressBooks

instance Core.ToHeaders SearchAddressBooks where
  toHeaders :: SearchAddressBooks -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SearchAddressBooks -> 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.SearchAddressBooks" ::
                          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 SearchAddressBooks where
  toJSON :: SearchAddressBooks -> Value
toJSON SearchAddressBooks' {Maybe Natural
Maybe [Filter]
Maybe [Sort]
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
sortCriteria :: Maybe [Sort]
filters :: Maybe [Filter]
$sel:maxResults:SearchAddressBooks' :: SearchAddressBooks -> Maybe Natural
$sel:nextToken:SearchAddressBooks' :: SearchAddressBooks -> Maybe Text
$sel:sortCriteria:SearchAddressBooks' :: SearchAddressBooks -> Maybe [Sort]
$sel:filters:SearchAddressBooks' :: SearchAddressBooks -> 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 SearchAddressBooks where
  toPath :: SearchAddressBooks -> ByteString
toPath = ByteString -> SearchAddressBooks -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newSearchAddressBooksResponse' smart constructor.
data SearchAddressBooksResponse = SearchAddressBooksResponse'
  { -- | The token returned to indicate that there is more data available.
    SearchAddressBooksResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The address books that meet the specified set of filter criteria, in
    -- sort order.
    SearchAddressBooksResponse -> Maybe [AddressBookData]
addressBooks :: Prelude.Maybe [AddressBookData],
    -- | The total number of address books returned.
    SearchAddressBooksResponse -> Maybe Int
totalCount :: Prelude.Maybe Prelude.Int,
    -- | The response's http status code.
    SearchAddressBooksResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (SearchAddressBooksResponse -> SearchAddressBooksResponse -> Bool
(SearchAddressBooksResponse -> SearchAddressBooksResponse -> Bool)
-> (SearchAddressBooksResponse
    -> SearchAddressBooksResponse -> Bool)
-> Eq SearchAddressBooksResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchAddressBooksResponse -> SearchAddressBooksResponse -> Bool
$c/= :: SearchAddressBooksResponse -> SearchAddressBooksResponse -> Bool
== :: SearchAddressBooksResponse -> SearchAddressBooksResponse -> Bool
$c== :: SearchAddressBooksResponse -> SearchAddressBooksResponse -> Bool
Prelude.Eq, ReadPrec [SearchAddressBooksResponse]
ReadPrec SearchAddressBooksResponse
Int -> ReadS SearchAddressBooksResponse
ReadS [SearchAddressBooksResponse]
(Int -> ReadS SearchAddressBooksResponse)
-> ReadS [SearchAddressBooksResponse]
-> ReadPrec SearchAddressBooksResponse
-> ReadPrec [SearchAddressBooksResponse]
-> Read SearchAddressBooksResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SearchAddressBooksResponse]
$creadListPrec :: ReadPrec [SearchAddressBooksResponse]
readPrec :: ReadPrec SearchAddressBooksResponse
$creadPrec :: ReadPrec SearchAddressBooksResponse
readList :: ReadS [SearchAddressBooksResponse]
$creadList :: ReadS [SearchAddressBooksResponse]
readsPrec :: Int -> ReadS SearchAddressBooksResponse
$creadsPrec :: Int -> ReadS SearchAddressBooksResponse
Prelude.Read, Int -> SearchAddressBooksResponse -> ShowS
[SearchAddressBooksResponse] -> ShowS
SearchAddressBooksResponse -> String
(Int -> SearchAddressBooksResponse -> ShowS)
-> (SearchAddressBooksResponse -> String)
-> ([SearchAddressBooksResponse] -> ShowS)
-> Show SearchAddressBooksResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchAddressBooksResponse] -> ShowS
$cshowList :: [SearchAddressBooksResponse] -> ShowS
show :: SearchAddressBooksResponse -> String
$cshow :: SearchAddressBooksResponse -> String
showsPrec :: Int -> SearchAddressBooksResponse -> ShowS
$cshowsPrec :: Int -> SearchAddressBooksResponse -> ShowS
Prelude.Show, (forall x.
 SearchAddressBooksResponse -> Rep SearchAddressBooksResponse x)
-> (forall x.
    Rep SearchAddressBooksResponse x -> SearchAddressBooksResponse)
-> Generic SearchAddressBooksResponse
forall x.
Rep SearchAddressBooksResponse x -> SearchAddressBooksResponse
forall x.
SearchAddressBooksResponse -> Rep SearchAddressBooksResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SearchAddressBooksResponse x -> SearchAddressBooksResponse
$cfrom :: forall x.
SearchAddressBooksResponse -> Rep SearchAddressBooksResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchAddressBooksResponse' 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', 'searchAddressBooksResponse_nextToken' - The token returned to indicate that there is more data available.
--
-- 'addressBooks', 'searchAddressBooksResponse_addressBooks' - The address books that meet the specified set of filter criteria, in
-- sort order.
--
-- 'totalCount', 'searchAddressBooksResponse_totalCount' - The total number of address books returned.
--
-- 'httpStatus', 'searchAddressBooksResponse_httpStatus' - The response's http status code.
newSearchAddressBooksResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  SearchAddressBooksResponse
newSearchAddressBooksResponse :: Int -> SearchAddressBooksResponse
newSearchAddressBooksResponse Int
pHttpStatus_ =
  SearchAddressBooksResponse' :: Maybe Text
-> Maybe [AddressBookData]
-> Maybe Int
-> Int
-> SearchAddressBooksResponse
SearchAddressBooksResponse'
    { $sel:nextToken:SearchAddressBooksResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:addressBooks:SearchAddressBooksResponse' :: Maybe [AddressBookData]
addressBooks = Maybe [AddressBookData]
forall a. Maybe a
Prelude.Nothing,
      $sel:totalCount:SearchAddressBooksResponse' :: Maybe Int
totalCount = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:SearchAddressBooksResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The token returned to indicate that there is more data available.
searchAddressBooksResponse_nextToken :: Lens.Lens' SearchAddressBooksResponse (Prelude.Maybe Prelude.Text)
searchAddressBooksResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> SearchAddressBooksResponse -> f SearchAddressBooksResponse
searchAddressBooksResponse_nextToken = (SearchAddressBooksResponse -> Maybe Text)
-> (SearchAddressBooksResponse
    -> Maybe Text -> SearchAddressBooksResponse)
-> Lens
     SearchAddressBooksResponse
     SearchAddressBooksResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchAddressBooksResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:SearchAddressBooksResponse' :: SearchAddressBooksResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: SearchAddressBooksResponse
s@SearchAddressBooksResponse' {} Maybe Text
a -> SearchAddressBooksResponse
s {$sel:nextToken:SearchAddressBooksResponse' :: Maybe Text
nextToken = Maybe Text
a} :: SearchAddressBooksResponse)

-- | The address books that meet the specified set of filter criteria, in
-- sort order.
searchAddressBooksResponse_addressBooks :: Lens.Lens' SearchAddressBooksResponse (Prelude.Maybe [AddressBookData])
searchAddressBooksResponse_addressBooks :: (Maybe [AddressBookData] -> f (Maybe [AddressBookData]))
-> SearchAddressBooksResponse -> f SearchAddressBooksResponse
searchAddressBooksResponse_addressBooks = (SearchAddressBooksResponse -> Maybe [AddressBookData])
-> (SearchAddressBooksResponse
    -> Maybe [AddressBookData] -> SearchAddressBooksResponse)
-> Lens
     SearchAddressBooksResponse
     SearchAddressBooksResponse
     (Maybe [AddressBookData])
     (Maybe [AddressBookData])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchAddressBooksResponse' {Maybe [AddressBookData]
addressBooks :: Maybe [AddressBookData]
$sel:addressBooks:SearchAddressBooksResponse' :: SearchAddressBooksResponse -> Maybe [AddressBookData]
addressBooks} -> Maybe [AddressBookData]
addressBooks) (\s :: SearchAddressBooksResponse
s@SearchAddressBooksResponse' {} Maybe [AddressBookData]
a -> SearchAddressBooksResponse
s {$sel:addressBooks:SearchAddressBooksResponse' :: Maybe [AddressBookData]
addressBooks = Maybe [AddressBookData]
a} :: SearchAddressBooksResponse) ((Maybe [AddressBookData] -> f (Maybe [AddressBookData]))
 -> SearchAddressBooksResponse -> f SearchAddressBooksResponse)
-> ((Maybe [AddressBookData] -> f (Maybe [AddressBookData]))
    -> Maybe [AddressBookData] -> f (Maybe [AddressBookData]))
-> (Maybe [AddressBookData] -> f (Maybe [AddressBookData]))
-> SearchAddressBooksResponse
-> f SearchAddressBooksResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [AddressBookData]
  [AddressBookData]
  [AddressBookData]
  [AddressBookData]
-> Iso
     (Maybe [AddressBookData])
     (Maybe [AddressBookData])
     (Maybe [AddressBookData])
     (Maybe [AddressBookData])
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
  [AddressBookData]
  [AddressBookData]
  [AddressBookData]
  [AddressBookData]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The total number of address books returned.
searchAddressBooksResponse_totalCount :: Lens.Lens' SearchAddressBooksResponse (Prelude.Maybe Prelude.Int)
searchAddressBooksResponse_totalCount :: (Maybe Int -> f (Maybe Int))
-> SearchAddressBooksResponse -> f SearchAddressBooksResponse
searchAddressBooksResponse_totalCount = (SearchAddressBooksResponse -> Maybe Int)
-> (SearchAddressBooksResponse
    -> Maybe Int -> SearchAddressBooksResponse)
-> Lens
     SearchAddressBooksResponse
     SearchAddressBooksResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchAddressBooksResponse' {Maybe Int
totalCount :: Maybe Int
$sel:totalCount:SearchAddressBooksResponse' :: SearchAddressBooksResponse -> Maybe Int
totalCount} -> Maybe Int
totalCount) (\s :: SearchAddressBooksResponse
s@SearchAddressBooksResponse' {} Maybe Int
a -> SearchAddressBooksResponse
s {$sel:totalCount:SearchAddressBooksResponse' :: Maybe Int
totalCount = Maybe Int
a} :: SearchAddressBooksResponse)

-- | The response's http status code.
searchAddressBooksResponse_httpStatus :: Lens.Lens' SearchAddressBooksResponse Prelude.Int
searchAddressBooksResponse_httpStatus :: (Int -> f Int)
-> SearchAddressBooksResponse -> f SearchAddressBooksResponse
searchAddressBooksResponse_httpStatus = (SearchAddressBooksResponse -> Int)
-> (SearchAddressBooksResponse
    -> Int -> SearchAddressBooksResponse)
-> Lens
     SearchAddressBooksResponse SearchAddressBooksResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchAddressBooksResponse' {Int
httpStatus :: Int
$sel:httpStatus:SearchAddressBooksResponse' :: SearchAddressBooksResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SearchAddressBooksResponse
s@SearchAddressBooksResponse' {} Int
a -> SearchAddressBooksResponse
s {$sel:httpStatus:SearchAddressBooksResponse' :: Int
httpStatus = Int
a} :: SearchAddressBooksResponse)

instance Prelude.NFData SearchAddressBooksResponse