{-# 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.Connect.ListPhoneNumbers
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Provides information about the phone numbers for the specified Amazon
-- Connect instance.
--
-- For more information about phone numbers, see
-- <https://docs.aws.amazon.com/connect/latest/adminguide/contact-center-phone-number.html Set Up Phone Numbers for Your Contact Center>
-- in the /Amazon Connect Administrator Guide/.
--
-- The phone number @Arn@ value that is returned from each of the items in
-- the
-- <https://docs.aws.amazon.com/connect/latest/APIReference/API_ListPhoneNumbers.html#connect-ListPhoneNumbers-response-PhoneNumberSummaryList PhoneNumberSummaryList>
-- cannot be used to tag phone number resources. It will fail with a
-- @ResourceNotFoundException@. Instead, use the
-- <https://docs.aws.amazon.com/connect/latest/APIReference/API_ListPhoneNumbersV2.html ListPhoneNumbersV2>
-- API. It returns the new phone number ARN that can be used to tag phone
-- number resources.
--
-- This operation returns paginated results.
module Amazonka.Connect.ListPhoneNumbers
  ( -- * Creating a Request
    ListPhoneNumbers (..),
    newListPhoneNumbers,

    -- * Request Lenses
    listPhoneNumbers_maxResults,
    listPhoneNumbers_nextToken,
    listPhoneNumbers_phoneNumberCountryCodes,
    listPhoneNumbers_phoneNumberTypes,
    listPhoneNumbers_instanceId,

    -- * Destructuring the Response
    ListPhoneNumbersResponse (..),
    newListPhoneNumbersResponse,

    -- * Response Lenses
    listPhoneNumbersResponse_nextToken,
    listPhoneNumbersResponse_phoneNumberSummaryList,
    listPhoneNumbersResponse_httpStatus,
  )
where

import Amazonka.Connect.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

-- | /See:/ 'newListPhoneNumbers' smart constructor.
data ListPhoneNumbers = ListPhoneNumbers'
  { -- | The maximum number of results to return per page. The default MaxResult
    -- size is 100.
    ListPhoneNumbers -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token for the next set of results. Use the value returned in the
    -- previous response in the next request to retrieve the next set of
    -- results.
    ListPhoneNumbers -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The ISO country code.
    ListPhoneNumbers -> Maybe [PhoneNumberCountryCode]
phoneNumberCountryCodes :: Prelude.Maybe [PhoneNumberCountryCode],
    -- | The type of phone number.
    ListPhoneNumbers -> Maybe [PhoneNumberType]
phoneNumberTypes :: Prelude.Maybe [PhoneNumberType],
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    ListPhoneNumbers -> Text
instanceId :: Prelude.Text
  }
  deriving (ListPhoneNumbers -> ListPhoneNumbers -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPhoneNumbers -> ListPhoneNumbers -> Bool
$c/= :: ListPhoneNumbers -> ListPhoneNumbers -> Bool
== :: ListPhoneNumbers -> ListPhoneNumbers -> Bool
$c== :: ListPhoneNumbers -> ListPhoneNumbers -> Bool
Prelude.Eq, ReadPrec [ListPhoneNumbers]
ReadPrec ListPhoneNumbers
Int -> ReadS ListPhoneNumbers
ReadS [ListPhoneNumbers]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPhoneNumbers]
$creadListPrec :: ReadPrec [ListPhoneNumbers]
readPrec :: ReadPrec ListPhoneNumbers
$creadPrec :: ReadPrec ListPhoneNumbers
readList :: ReadS [ListPhoneNumbers]
$creadList :: ReadS [ListPhoneNumbers]
readsPrec :: Int -> ReadS ListPhoneNumbers
$creadsPrec :: Int -> ReadS ListPhoneNumbers
Prelude.Read, Int -> ListPhoneNumbers -> ShowS
[ListPhoneNumbers] -> ShowS
ListPhoneNumbers -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPhoneNumbers] -> ShowS
$cshowList :: [ListPhoneNumbers] -> ShowS
show :: ListPhoneNumbers -> String
$cshow :: ListPhoneNumbers -> String
showsPrec :: Int -> ListPhoneNumbers -> ShowS
$cshowsPrec :: Int -> ListPhoneNumbers -> ShowS
Prelude.Show, forall x. Rep ListPhoneNumbers x -> ListPhoneNumbers
forall x. ListPhoneNumbers -> Rep ListPhoneNumbers x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPhoneNumbers x -> ListPhoneNumbers
$cfrom :: forall x. ListPhoneNumbers -> Rep ListPhoneNumbers x
Prelude.Generic)

-- |
-- Create a value of 'ListPhoneNumbers' 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:
--
-- 'maxResults', 'listPhoneNumbers_maxResults' - The maximum number of results to return per page. The default MaxResult
-- size is 100.
--
-- 'nextToken', 'listPhoneNumbers_nextToken' - The token for the next set of results. Use the value returned in the
-- previous response in the next request to retrieve the next set of
-- results.
--
-- 'phoneNumberCountryCodes', 'listPhoneNumbers_phoneNumberCountryCodes' - The ISO country code.
--
-- 'phoneNumberTypes', 'listPhoneNumbers_phoneNumberTypes' - The type of phone number.
--
-- 'instanceId', 'listPhoneNumbers_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
newListPhoneNumbers ::
  -- | 'instanceId'
  Prelude.Text ->
  ListPhoneNumbers
newListPhoneNumbers :: Text -> ListPhoneNumbers
newListPhoneNumbers Text
pInstanceId_ =
  ListPhoneNumbers'
    { $sel:maxResults:ListPhoneNumbers' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListPhoneNumbers' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumberCountryCodes:ListPhoneNumbers' :: Maybe [PhoneNumberCountryCode]
phoneNumberCountryCodes = forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumberTypes:ListPhoneNumbers' :: Maybe [PhoneNumberType]
phoneNumberTypes = forall a. Maybe a
Prelude.Nothing,
      $sel:instanceId:ListPhoneNumbers' :: Text
instanceId = Text
pInstanceId_
    }

-- | The maximum number of results to return per page. The default MaxResult
-- size is 100.
listPhoneNumbers_maxResults :: Lens.Lens' ListPhoneNumbers (Prelude.Maybe Prelude.Natural)
listPhoneNumbers_maxResults :: Lens' ListPhoneNumbers (Maybe Natural)
listPhoneNumbers_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPhoneNumbers' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPhoneNumbers
s@ListPhoneNumbers' {} Maybe Natural
a -> ListPhoneNumbers
s {$sel:maxResults:ListPhoneNumbers' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPhoneNumbers)

-- | The token for the next set of results. Use the value returned in the
-- previous response in the next request to retrieve the next set of
-- results.
listPhoneNumbers_nextToken :: Lens.Lens' ListPhoneNumbers (Prelude.Maybe Prelude.Text)
listPhoneNumbers_nextToken :: Lens' ListPhoneNumbers (Maybe Text)
listPhoneNumbers_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPhoneNumbers' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPhoneNumbers
s@ListPhoneNumbers' {} Maybe Text
a -> ListPhoneNumbers
s {$sel:nextToken:ListPhoneNumbers' :: Maybe Text
nextToken = Maybe Text
a} :: ListPhoneNumbers)

-- | The ISO country code.
listPhoneNumbers_phoneNumberCountryCodes :: Lens.Lens' ListPhoneNumbers (Prelude.Maybe [PhoneNumberCountryCode])
listPhoneNumbers_phoneNumberCountryCodes :: Lens' ListPhoneNumbers (Maybe [PhoneNumberCountryCode])
listPhoneNumbers_phoneNumberCountryCodes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPhoneNumbers' {Maybe [PhoneNumberCountryCode]
phoneNumberCountryCodes :: Maybe [PhoneNumberCountryCode]
$sel:phoneNumberCountryCodes:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe [PhoneNumberCountryCode]
phoneNumberCountryCodes} -> Maybe [PhoneNumberCountryCode]
phoneNumberCountryCodes) (\s :: ListPhoneNumbers
s@ListPhoneNumbers' {} Maybe [PhoneNumberCountryCode]
a -> ListPhoneNumbers
s {$sel:phoneNumberCountryCodes:ListPhoneNumbers' :: Maybe [PhoneNumberCountryCode]
phoneNumberCountryCodes = Maybe [PhoneNumberCountryCode]
a} :: ListPhoneNumbers) 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

-- | The type of phone number.
listPhoneNumbers_phoneNumberTypes :: Lens.Lens' ListPhoneNumbers (Prelude.Maybe [PhoneNumberType])
listPhoneNumbers_phoneNumberTypes :: Lens' ListPhoneNumbers (Maybe [PhoneNumberType])
listPhoneNumbers_phoneNumberTypes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPhoneNumbers' {Maybe [PhoneNumberType]
phoneNumberTypes :: Maybe [PhoneNumberType]
$sel:phoneNumberTypes:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe [PhoneNumberType]
phoneNumberTypes} -> Maybe [PhoneNumberType]
phoneNumberTypes) (\s :: ListPhoneNumbers
s@ListPhoneNumbers' {} Maybe [PhoneNumberType]
a -> ListPhoneNumbers
s {$sel:phoneNumberTypes:ListPhoneNumbers' :: Maybe [PhoneNumberType]
phoneNumberTypes = Maybe [PhoneNumberType]
a} :: ListPhoneNumbers) 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

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
listPhoneNumbers_instanceId :: Lens.Lens' ListPhoneNumbers Prelude.Text
listPhoneNumbers_instanceId :: Lens' ListPhoneNumbers Text
listPhoneNumbers_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPhoneNumbers' {Text
instanceId :: Text
$sel:instanceId:ListPhoneNumbers' :: ListPhoneNumbers -> Text
instanceId} -> Text
instanceId) (\s :: ListPhoneNumbers
s@ListPhoneNumbers' {} Text
a -> ListPhoneNumbers
s {$sel:instanceId:ListPhoneNumbers' :: Text
instanceId = Text
a} :: ListPhoneNumbers)

instance Core.AWSPager ListPhoneNumbers where
  page :: ListPhoneNumbers
-> AWSResponse ListPhoneNumbers -> Maybe ListPhoneNumbers
page ListPhoneNumbers
rq AWSResponse ListPhoneNumbers
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPhoneNumbers
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPhoneNumbersResponse (Maybe Text)
listPhoneNumbersResponse_nextToken
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPhoneNumbers
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPhoneNumbersResponse (Maybe [PhoneNumberSummary])
listPhoneNumbersResponse_phoneNumberSummaryList
            forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListPhoneNumbers
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListPhoneNumbers (Maybe Text)
listPhoneNumbers_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPhoneNumbers
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPhoneNumbersResponse (Maybe Text)
listPhoneNumbersResponse_nextToken
          forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListPhoneNumbers where
  type
    AWSResponse ListPhoneNumbers =
      ListPhoneNumbersResponse
  request :: (Service -> Service)
-> ListPhoneNumbers -> Request ListPhoneNumbers
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListPhoneNumbers
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPhoneNumbers)))
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 Text
-> Maybe [PhoneNumberSummary] -> Int -> ListPhoneNumbersResponse
ListPhoneNumbersResponse'
            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
"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
"PhoneNumberSummaryList"
                            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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListPhoneNumbers where
  hashWithSalt :: Int -> ListPhoneNumbers -> Int
hashWithSalt Int
_salt ListPhoneNumbers' {Maybe Natural
Maybe [PhoneNumberCountryCode]
Maybe [PhoneNumberType]
Maybe Text
Text
instanceId :: Text
phoneNumberTypes :: Maybe [PhoneNumberType]
phoneNumberCountryCodes :: Maybe [PhoneNumberCountryCode]
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:instanceId:ListPhoneNumbers' :: ListPhoneNumbers -> Text
$sel:phoneNumberTypes:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe [PhoneNumberType]
$sel:phoneNumberCountryCodes:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe [PhoneNumberCountryCode]
$sel:nextToken:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe Text
$sel:maxResults:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe Natural
..} =
    Int
_salt
      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 [PhoneNumberCountryCode]
phoneNumberCountryCodes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [PhoneNumberType]
phoneNumberTypes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId

instance Prelude.NFData ListPhoneNumbers where
  rnf :: ListPhoneNumbers -> ()
rnf ListPhoneNumbers' {Maybe Natural
Maybe [PhoneNumberCountryCode]
Maybe [PhoneNumberType]
Maybe Text
Text
instanceId :: Text
phoneNumberTypes :: Maybe [PhoneNumberType]
phoneNumberCountryCodes :: Maybe [PhoneNumberCountryCode]
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:instanceId:ListPhoneNumbers' :: ListPhoneNumbers -> Text
$sel:phoneNumberTypes:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe [PhoneNumberType]
$sel:phoneNumberCountryCodes:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe [PhoneNumberCountryCode]
$sel:nextToken:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe Text
$sel:maxResults:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe Natural
..} =
    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 [PhoneNumberCountryCode]
phoneNumberCountryCodes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [PhoneNumberType]
phoneNumberTypes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId

instance Data.ToHeaders ListPhoneNumbers where
  toHeaders :: ListPhoneNumbers -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToPath ListPhoneNumbers where
  toPath :: ListPhoneNumbers -> ByteString
toPath ListPhoneNumbers' {Maybe Natural
Maybe [PhoneNumberCountryCode]
Maybe [PhoneNumberType]
Maybe Text
Text
instanceId :: Text
phoneNumberTypes :: Maybe [PhoneNumberType]
phoneNumberCountryCodes :: Maybe [PhoneNumberCountryCode]
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:instanceId:ListPhoneNumbers' :: ListPhoneNumbers -> Text
$sel:phoneNumberTypes:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe [PhoneNumberType]
$sel:phoneNumberCountryCodes:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe [PhoneNumberCountryCode]
$sel:nextToken:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe Text
$sel:maxResults:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/phone-numbers-summary/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
instanceId]

instance Data.ToQuery ListPhoneNumbers where
  toQuery :: ListPhoneNumbers -> QueryString
toQuery ListPhoneNumbers' {Maybe Natural
Maybe [PhoneNumberCountryCode]
Maybe [PhoneNumberType]
Maybe Text
Text
instanceId :: Text
phoneNumberTypes :: Maybe [PhoneNumberType]
phoneNumberCountryCodes :: Maybe [PhoneNumberCountryCode]
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:instanceId:ListPhoneNumbers' :: ListPhoneNumbers -> Text
$sel:phoneNumberTypes:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe [PhoneNumberType]
$sel:phoneNumberCountryCodes:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe [PhoneNumberCountryCode]
$sel:nextToken:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe Text
$sel:maxResults:ListPhoneNumbers' :: ListPhoneNumbers -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
        ByteString
"phoneNumberCountryCodes"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
            ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member"
                forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PhoneNumberCountryCode]
phoneNumberCountryCodes
            ),
        ByteString
"phoneNumberTypes"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
            ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member"
                forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PhoneNumberType]
phoneNumberTypes
            )
      ]

-- | /See:/ 'newListPhoneNumbersResponse' smart constructor.
data ListPhoneNumbersResponse = ListPhoneNumbersResponse'
  { -- | If there are additional results, this is the token for the next set of
    -- results.
    ListPhoneNumbersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Information about the phone numbers.
    ListPhoneNumbersResponse -> Maybe [PhoneNumberSummary]
phoneNumberSummaryList :: Prelude.Maybe [PhoneNumberSummary],
    -- | The response's http status code.
    ListPhoneNumbersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPhoneNumbersResponse -> ListPhoneNumbersResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPhoneNumbersResponse -> ListPhoneNumbersResponse -> Bool
$c/= :: ListPhoneNumbersResponse -> ListPhoneNumbersResponse -> Bool
== :: ListPhoneNumbersResponse -> ListPhoneNumbersResponse -> Bool
$c== :: ListPhoneNumbersResponse -> ListPhoneNumbersResponse -> Bool
Prelude.Eq, ReadPrec [ListPhoneNumbersResponse]
ReadPrec ListPhoneNumbersResponse
Int -> ReadS ListPhoneNumbersResponse
ReadS [ListPhoneNumbersResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPhoneNumbersResponse]
$creadListPrec :: ReadPrec [ListPhoneNumbersResponse]
readPrec :: ReadPrec ListPhoneNumbersResponse
$creadPrec :: ReadPrec ListPhoneNumbersResponse
readList :: ReadS [ListPhoneNumbersResponse]
$creadList :: ReadS [ListPhoneNumbersResponse]
readsPrec :: Int -> ReadS ListPhoneNumbersResponse
$creadsPrec :: Int -> ReadS ListPhoneNumbersResponse
Prelude.Read, Int -> ListPhoneNumbersResponse -> ShowS
[ListPhoneNumbersResponse] -> ShowS
ListPhoneNumbersResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPhoneNumbersResponse] -> ShowS
$cshowList :: [ListPhoneNumbersResponse] -> ShowS
show :: ListPhoneNumbersResponse -> String
$cshow :: ListPhoneNumbersResponse -> String
showsPrec :: Int -> ListPhoneNumbersResponse -> ShowS
$cshowsPrec :: Int -> ListPhoneNumbersResponse -> ShowS
Prelude.Show, forall x.
Rep ListPhoneNumbersResponse x -> ListPhoneNumbersResponse
forall x.
ListPhoneNumbersResponse -> Rep ListPhoneNumbersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPhoneNumbersResponse x -> ListPhoneNumbersResponse
$cfrom :: forall x.
ListPhoneNumbersResponse -> Rep ListPhoneNumbersResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPhoneNumbersResponse' 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', 'listPhoneNumbersResponse_nextToken' - If there are additional results, this is the token for the next set of
-- results.
--
-- 'phoneNumberSummaryList', 'listPhoneNumbersResponse_phoneNumberSummaryList' - Information about the phone numbers.
--
-- 'httpStatus', 'listPhoneNumbersResponse_httpStatus' - The response's http status code.
newListPhoneNumbersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPhoneNumbersResponse
newListPhoneNumbersResponse :: Int -> ListPhoneNumbersResponse
newListPhoneNumbersResponse Int
pHttpStatus_ =
  ListPhoneNumbersResponse'
    { $sel:nextToken:ListPhoneNumbersResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumberSummaryList:ListPhoneNumbersResponse' :: Maybe [PhoneNumberSummary]
phoneNumberSummaryList = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPhoneNumbersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | If there are additional results, this is the token for the next set of
-- results.
listPhoneNumbersResponse_nextToken :: Lens.Lens' ListPhoneNumbersResponse (Prelude.Maybe Prelude.Text)
listPhoneNumbersResponse_nextToken :: Lens' ListPhoneNumbersResponse (Maybe Text)
listPhoneNumbersResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPhoneNumbersResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPhoneNumbersResponse' :: ListPhoneNumbersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPhoneNumbersResponse
s@ListPhoneNumbersResponse' {} Maybe Text
a -> ListPhoneNumbersResponse
s {$sel:nextToken:ListPhoneNumbersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPhoneNumbersResponse)

-- | Information about the phone numbers.
listPhoneNumbersResponse_phoneNumberSummaryList :: Lens.Lens' ListPhoneNumbersResponse (Prelude.Maybe [PhoneNumberSummary])
listPhoneNumbersResponse_phoneNumberSummaryList :: Lens' ListPhoneNumbersResponse (Maybe [PhoneNumberSummary])
listPhoneNumbersResponse_phoneNumberSummaryList = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPhoneNumbersResponse' {Maybe [PhoneNumberSummary]
phoneNumberSummaryList :: Maybe [PhoneNumberSummary]
$sel:phoneNumberSummaryList:ListPhoneNumbersResponse' :: ListPhoneNumbersResponse -> Maybe [PhoneNumberSummary]
phoneNumberSummaryList} -> Maybe [PhoneNumberSummary]
phoneNumberSummaryList) (\s :: ListPhoneNumbersResponse
s@ListPhoneNumbersResponse' {} Maybe [PhoneNumberSummary]
a -> ListPhoneNumbersResponse
s {$sel:phoneNumberSummaryList:ListPhoneNumbersResponse' :: Maybe [PhoneNumberSummary]
phoneNumberSummaryList = Maybe [PhoneNumberSummary]
a} :: ListPhoneNumbersResponse) 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

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

instance Prelude.NFData ListPhoneNumbersResponse where
  rnf :: ListPhoneNumbersResponse -> ()
rnf ListPhoneNumbersResponse' {Int
Maybe [PhoneNumberSummary]
Maybe Text
httpStatus :: Int
phoneNumberSummaryList :: Maybe [PhoneNumberSummary]
nextToken :: Maybe Text
$sel:httpStatus:ListPhoneNumbersResponse' :: ListPhoneNumbersResponse -> Int
$sel:phoneNumberSummaryList:ListPhoneNumbersResponse' :: ListPhoneNumbersResponse -> Maybe [PhoneNumberSummary]
$sel:nextToken:ListPhoneNumbersResponse' :: ListPhoneNumbersResponse -> Maybe Text
..} =
    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 [PhoneNumberSummary]
phoneNumberSummaryList
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus