{-# 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.ChimeSdkVoice.ListPhoneNumberOrders
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- -- | Undocumented operation.
module Amazonka.ChimeSdkVoice.ListPhoneNumberOrders
  ( -- * Creating a Request
    ListPhoneNumberOrders (..),
    newListPhoneNumberOrders,

    -- * Request Lenses
    listPhoneNumberOrders_maxResults,
    listPhoneNumberOrders_nextToken,

    -- * Destructuring the Response
    ListPhoneNumberOrdersResponse (..),
    newListPhoneNumberOrdersResponse,

    -- * Response Lenses
    listPhoneNumberOrdersResponse_nextToken,
    listPhoneNumberOrdersResponse_phoneNumberOrders,
    listPhoneNumberOrdersResponse_httpStatus,
  )
where

import Amazonka.ChimeSdkVoice.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:/ 'newListPhoneNumberOrders' smart constructor.
data ListPhoneNumberOrders = ListPhoneNumberOrders'
  { ListPhoneNumberOrders -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    ListPhoneNumberOrders -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListPhoneNumberOrders -> ListPhoneNumberOrders -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPhoneNumberOrders -> ListPhoneNumberOrders -> Bool
$c/= :: ListPhoneNumberOrders -> ListPhoneNumberOrders -> Bool
== :: ListPhoneNumberOrders -> ListPhoneNumberOrders -> Bool
$c== :: ListPhoneNumberOrders -> ListPhoneNumberOrders -> Bool
Prelude.Eq, ReadPrec [ListPhoneNumberOrders]
ReadPrec ListPhoneNumberOrders
Int -> ReadS ListPhoneNumberOrders
ReadS [ListPhoneNumberOrders]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPhoneNumberOrders]
$creadListPrec :: ReadPrec [ListPhoneNumberOrders]
readPrec :: ReadPrec ListPhoneNumberOrders
$creadPrec :: ReadPrec ListPhoneNumberOrders
readList :: ReadS [ListPhoneNumberOrders]
$creadList :: ReadS [ListPhoneNumberOrders]
readsPrec :: Int -> ReadS ListPhoneNumberOrders
$creadsPrec :: Int -> ReadS ListPhoneNumberOrders
Prelude.Read, Int -> ListPhoneNumberOrders -> ShowS
[ListPhoneNumberOrders] -> ShowS
ListPhoneNumberOrders -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPhoneNumberOrders] -> ShowS
$cshowList :: [ListPhoneNumberOrders] -> ShowS
show :: ListPhoneNumberOrders -> String
$cshow :: ListPhoneNumberOrders -> String
showsPrec :: Int -> ListPhoneNumberOrders -> ShowS
$cshowsPrec :: Int -> ListPhoneNumberOrders -> ShowS
Prelude.Show, forall x. Rep ListPhoneNumberOrders x -> ListPhoneNumberOrders
forall x. ListPhoneNumberOrders -> Rep ListPhoneNumberOrders x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPhoneNumberOrders x -> ListPhoneNumberOrders
$cfrom :: forall x. ListPhoneNumberOrders -> Rep ListPhoneNumberOrders x
Prelude.Generic)

-- |
-- Create a value of 'ListPhoneNumberOrders' 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', 'listPhoneNumberOrders_maxResults' - Undocumented member.
--
-- 'nextToken', 'listPhoneNumberOrders_nextToken' - Undocumented member.
newListPhoneNumberOrders ::
  ListPhoneNumberOrders
newListPhoneNumberOrders :: ListPhoneNumberOrders
newListPhoneNumberOrders =
  ListPhoneNumberOrders'
    { $sel:maxResults:ListPhoneNumberOrders' :: Maybe Natural
maxResults =
        forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListPhoneNumberOrders' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | Undocumented member.
listPhoneNumberOrders_maxResults :: Lens.Lens' ListPhoneNumberOrders (Prelude.Maybe Prelude.Natural)
listPhoneNumberOrders_maxResults :: Lens' ListPhoneNumberOrders (Maybe Natural)
listPhoneNumberOrders_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPhoneNumberOrders' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPhoneNumberOrders' :: ListPhoneNumberOrders -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPhoneNumberOrders
s@ListPhoneNumberOrders' {} Maybe Natural
a -> ListPhoneNumberOrders
s {$sel:maxResults:ListPhoneNumberOrders' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPhoneNumberOrders)

-- | Undocumented member.
listPhoneNumberOrders_nextToken :: Lens.Lens' ListPhoneNumberOrders (Prelude.Maybe Prelude.Text)
listPhoneNumberOrders_nextToken :: Lens' ListPhoneNumberOrders (Maybe Text)
listPhoneNumberOrders_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPhoneNumberOrders' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPhoneNumberOrders' :: ListPhoneNumberOrders -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPhoneNumberOrders
s@ListPhoneNumberOrders' {} Maybe Text
a -> ListPhoneNumberOrders
s {$sel:nextToken:ListPhoneNumberOrders' :: Maybe Text
nextToken = Maybe Text
a} :: ListPhoneNumberOrders)

instance Core.AWSRequest ListPhoneNumberOrders where
  type
    AWSResponse ListPhoneNumberOrders =
      ListPhoneNumberOrdersResponse
  request :: (Service -> Service)
-> ListPhoneNumberOrders -> Request ListPhoneNumberOrders
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 ListPhoneNumberOrders
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ListPhoneNumberOrders)))
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 [PhoneNumberOrder] -> Int -> ListPhoneNumberOrdersResponse
ListPhoneNumberOrdersResponse'
            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
"PhoneNumberOrders"
                            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 ListPhoneNumberOrders where
  hashWithSalt :: Int -> ListPhoneNumberOrders -> Int
hashWithSalt Int
_salt ListPhoneNumberOrders' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListPhoneNumberOrders' :: ListPhoneNumberOrders -> Maybe Text
$sel:maxResults:ListPhoneNumberOrders' :: ListPhoneNumberOrders -> 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

instance Prelude.NFData ListPhoneNumberOrders where
  rnf :: ListPhoneNumberOrders -> ()
rnf ListPhoneNumberOrders' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListPhoneNumberOrders' :: ListPhoneNumberOrders -> Maybe Text
$sel:maxResults:ListPhoneNumberOrders' :: ListPhoneNumberOrders -> 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

instance Data.ToHeaders ListPhoneNumberOrders where
  toHeaders :: ListPhoneNumberOrders -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath ListPhoneNumberOrders where
  toPath :: ListPhoneNumberOrders -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/phone-number-orders"

instance Data.ToQuery ListPhoneNumberOrders where
  toQuery :: ListPhoneNumberOrders -> QueryString
toQuery ListPhoneNumberOrders' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListPhoneNumberOrders' :: ListPhoneNumberOrders -> Maybe Text
$sel:maxResults:ListPhoneNumberOrders' :: ListPhoneNumberOrders -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"max-results" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
        ByteString
"next-token" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
      ]

-- | /See:/ 'newListPhoneNumberOrdersResponse' smart constructor.
data ListPhoneNumberOrdersResponse = ListPhoneNumberOrdersResponse'
  { ListPhoneNumberOrdersResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    ListPhoneNumberOrdersResponse -> Maybe [PhoneNumberOrder]
phoneNumberOrders :: Prelude.Maybe [PhoneNumberOrder],
    -- | The response's http status code.
    ListPhoneNumberOrdersResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListPhoneNumberOrdersResponse
-> ListPhoneNumberOrdersResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPhoneNumberOrdersResponse
-> ListPhoneNumberOrdersResponse -> Bool
$c/= :: ListPhoneNumberOrdersResponse
-> ListPhoneNumberOrdersResponse -> Bool
== :: ListPhoneNumberOrdersResponse
-> ListPhoneNumberOrdersResponse -> Bool
$c== :: ListPhoneNumberOrdersResponse
-> ListPhoneNumberOrdersResponse -> Bool
Prelude.Eq, Int -> ListPhoneNumberOrdersResponse -> ShowS
[ListPhoneNumberOrdersResponse] -> ShowS
ListPhoneNumberOrdersResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPhoneNumberOrdersResponse] -> ShowS
$cshowList :: [ListPhoneNumberOrdersResponse] -> ShowS
show :: ListPhoneNumberOrdersResponse -> String
$cshow :: ListPhoneNumberOrdersResponse -> String
showsPrec :: Int -> ListPhoneNumberOrdersResponse -> ShowS
$cshowsPrec :: Int -> ListPhoneNumberOrdersResponse -> ShowS
Prelude.Show, forall x.
Rep ListPhoneNumberOrdersResponse x
-> ListPhoneNumberOrdersResponse
forall x.
ListPhoneNumberOrdersResponse
-> Rep ListPhoneNumberOrdersResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPhoneNumberOrdersResponse x
-> ListPhoneNumberOrdersResponse
$cfrom :: forall x.
ListPhoneNumberOrdersResponse
-> Rep ListPhoneNumberOrdersResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPhoneNumberOrdersResponse' 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', 'listPhoneNumberOrdersResponse_nextToken' - Undocumented member.
--
-- 'phoneNumberOrders', 'listPhoneNumberOrdersResponse_phoneNumberOrders' - Undocumented member.
--
-- 'httpStatus', 'listPhoneNumberOrdersResponse_httpStatus' - The response's http status code.
newListPhoneNumberOrdersResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPhoneNumberOrdersResponse
newListPhoneNumberOrdersResponse :: Int -> ListPhoneNumberOrdersResponse
newListPhoneNumberOrdersResponse Int
pHttpStatus_ =
  ListPhoneNumberOrdersResponse'
    { $sel:nextToken:ListPhoneNumberOrdersResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:phoneNumberOrders:ListPhoneNumberOrdersResponse' :: Maybe [PhoneNumberOrder]
phoneNumberOrders = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPhoneNumberOrdersResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
listPhoneNumberOrdersResponse_nextToken :: Lens.Lens' ListPhoneNumberOrdersResponse (Prelude.Maybe Prelude.Text)
listPhoneNumberOrdersResponse_nextToken :: Lens' ListPhoneNumberOrdersResponse (Maybe Text)
listPhoneNumberOrdersResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPhoneNumberOrdersResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPhoneNumberOrdersResponse' :: ListPhoneNumberOrdersResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPhoneNumberOrdersResponse
s@ListPhoneNumberOrdersResponse' {} Maybe Text
a -> ListPhoneNumberOrdersResponse
s {$sel:nextToken:ListPhoneNumberOrdersResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPhoneNumberOrdersResponse)

-- | Undocumented member.
listPhoneNumberOrdersResponse_phoneNumberOrders :: Lens.Lens' ListPhoneNumberOrdersResponse (Prelude.Maybe [PhoneNumberOrder])
listPhoneNumberOrdersResponse_phoneNumberOrders :: Lens' ListPhoneNumberOrdersResponse (Maybe [PhoneNumberOrder])
listPhoneNumberOrdersResponse_phoneNumberOrders = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPhoneNumberOrdersResponse' {Maybe [PhoneNumberOrder]
phoneNumberOrders :: Maybe [PhoneNumberOrder]
$sel:phoneNumberOrders:ListPhoneNumberOrdersResponse' :: ListPhoneNumberOrdersResponse -> Maybe [PhoneNumberOrder]
phoneNumberOrders} -> Maybe [PhoneNumberOrder]
phoneNumberOrders) (\s :: ListPhoneNumberOrdersResponse
s@ListPhoneNumberOrdersResponse' {} Maybe [PhoneNumberOrder]
a -> ListPhoneNumberOrdersResponse
s {$sel:phoneNumberOrders:ListPhoneNumberOrdersResponse' :: Maybe [PhoneNumberOrder]
phoneNumberOrders = Maybe [PhoneNumberOrder]
a} :: ListPhoneNumberOrdersResponse) 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.
listPhoneNumberOrdersResponse_httpStatus :: Lens.Lens' ListPhoneNumberOrdersResponse Prelude.Int
listPhoneNumberOrdersResponse_httpStatus :: Lens' ListPhoneNumberOrdersResponse Int
listPhoneNumberOrdersResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPhoneNumberOrdersResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListPhoneNumberOrdersResponse' :: ListPhoneNumberOrdersResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListPhoneNumberOrdersResponse
s@ListPhoneNumberOrdersResponse' {} Int
a -> ListPhoneNumberOrdersResponse
s {$sel:httpStatus:ListPhoneNumberOrdersResponse' :: Int
httpStatus = Int
a} :: ListPhoneNumberOrdersResponse)

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