{-# 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.Chime.ListMeetings
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Lists up to 100 active Amazon Chime SDK meetings. For more information
-- about the Amazon Chime SDK, see
-- <https://docs.aws.amazon.com/chime/latest/dg/meetings-sdk.html Using the Amazon Chime SDK>
-- in the /Amazon Chime Developer Guide/.
module Amazonka.Chime.ListMeetings
  ( -- * Creating a Request
    ListMeetings (..),
    newListMeetings,

    -- * Request Lenses
    listMeetings_maxResults,
    listMeetings_nextToken,

    -- * Destructuring the Response
    ListMeetingsResponse (..),
    newListMeetingsResponse,

    -- * Response Lenses
    listMeetingsResponse_meetings,
    listMeetingsResponse_nextToken,
    listMeetingsResponse_httpStatus,
  )
where

import Amazonka.Chime.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:/ 'newListMeetings' smart constructor.
data ListMeetings = ListMeetings'
  { -- | The maximum number of results to return in a single call.
    ListMeetings -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The token to use to retrieve the next page of results.
    ListMeetings -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
  }
  deriving (ListMeetings -> ListMeetings -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMeetings -> ListMeetings -> Bool
$c/= :: ListMeetings -> ListMeetings -> Bool
== :: ListMeetings -> ListMeetings -> Bool
$c== :: ListMeetings -> ListMeetings -> Bool
Prelude.Eq, ReadPrec [ListMeetings]
ReadPrec ListMeetings
Int -> ReadS ListMeetings
ReadS [ListMeetings]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListMeetings]
$creadListPrec :: ReadPrec [ListMeetings]
readPrec :: ReadPrec ListMeetings
$creadPrec :: ReadPrec ListMeetings
readList :: ReadS [ListMeetings]
$creadList :: ReadS [ListMeetings]
readsPrec :: Int -> ReadS ListMeetings
$creadsPrec :: Int -> ReadS ListMeetings
Prelude.Read, Int -> ListMeetings -> ShowS
[ListMeetings] -> ShowS
ListMeetings -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMeetings] -> ShowS
$cshowList :: [ListMeetings] -> ShowS
show :: ListMeetings -> String
$cshow :: ListMeetings -> String
showsPrec :: Int -> ListMeetings -> ShowS
$cshowsPrec :: Int -> ListMeetings -> ShowS
Prelude.Show, forall x. Rep ListMeetings x -> ListMeetings
forall x. ListMeetings -> Rep ListMeetings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMeetings x -> ListMeetings
$cfrom :: forall x. ListMeetings -> Rep ListMeetings x
Prelude.Generic)

-- |
-- Create a value of 'ListMeetings' 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', 'listMeetings_maxResults' - The maximum number of results to return in a single call.
--
-- 'nextToken', 'listMeetings_nextToken' - The token to use to retrieve the next page of results.
newListMeetings ::
  ListMeetings
newListMeetings :: ListMeetings
newListMeetings =
  ListMeetings'
    { $sel:maxResults:ListMeetings' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListMeetings' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
    }

-- | The maximum number of results to return in a single call.
listMeetings_maxResults :: Lens.Lens' ListMeetings (Prelude.Maybe Prelude.Natural)
listMeetings_maxResults :: Lens' ListMeetings (Maybe Natural)
listMeetings_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMeetings' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListMeetings' :: ListMeetings -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListMeetings
s@ListMeetings' {} Maybe Natural
a -> ListMeetings
s {$sel:maxResults:ListMeetings' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListMeetings)

-- | The token to use to retrieve the next page of results.
listMeetings_nextToken :: Lens.Lens' ListMeetings (Prelude.Maybe Prelude.Text)
listMeetings_nextToken :: Lens' ListMeetings (Maybe Text)
listMeetings_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMeetings' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMeetings' :: ListMeetings -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMeetings
s@ListMeetings' {} Maybe Text
a -> ListMeetings
s {$sel:nextToken:ListMeetings' :: Maybe Text
nextToken = Maybe Text
a} :: ListMeetings)

instance Core.AWSRequest ListMeetings where
  type AWSResponse ListMeetings = ListMeetingsResponse
  request :: (Service -> Service) -> ListMeetings -> Request ListMeetings
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 ListMeetings
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListMeetings)))
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 [Meeting] -> Maybe Text -> Int -> ListMeetingsResponse
ListMeetingsResponse'
            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
"Meetings" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable ListMeetings where
  hashWithSalt :: Int -> ListMeetings -> Int
hashWithSalt Int
_salt ListMeetings' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListMeetings' :: ListMeetings -> Maybe Text
$sel:maxResults:ListMeetings' :: ListMeetings -> 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 ListMeetings where
  rnf :: ListMeetings -> ()
rnf ListMeetings' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListMeetings' :: ListMeetings -> Maybe Text
$sel:maxResults:ListMeetings' :: ListMeetings -> 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 ListMeetings where
  toHeaders :: ListMeetings -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath ListMeetings where
  toPath :: ListMeetings -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/meetings"

instance Data.ToQuery ListMeetings where
  toQuery :: ListMeetings -> QueryString
toQuery ListMeetings' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListMeetings' :: ListMeetings -> Maybe Text
$sel:maxResults:ListMeetings' :: ListMeetings -> 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:/ 'newListMeetingsResponse' smart constructor.
data ListMeetingsResponse = ListMeetingsResponse'
  { -- | The Amazon Chime SDK meeting information.
    ListMeetingsResponse -> Maybe [Meeting]
meetings :: Prelude.Maybe [Meeting],
    -- | The token to use to retrieve the next page of results.
    ListMeetingsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListMeetingsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListMeetingsResponse -> ListMeetingsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListMeetingsResponse -> ListMeetingsResponse -> Bool
$c/= :: ListMeetingsResponse -> ListMeetingsResponse -> Bool
== :: ListMeetingsResponse -> ListMeetingsResponse -> Bool
$c== :: ListMeetingsResponse -> ListMeetingsResponse -> Bool
Prelude.Eq, Int -> ListMeetingsResponse -> ShowS
[ListMeetingsResponse] -> ShowS
ListMeetingsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListMeetingsResponse] -> ShowS
$cshowList :: [ListMeetingsResponse] -> ShowS
show :: ListMeetingsResponse -> String
$cshow :: ListMeetingsResponse -> String
showsPrec :: Int -> ListMeetingsResponse -> ShowS
$cshowsPrec :: Int -> ListMeetingsResponse -> ShowS
Prelude.Show, forall x. Rep ListMeetingsResponse x -> ListMeetingsResponse
forall x. ListMeetingsResponse -> Rep ListMeetingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListMeetingsResponse x -> ListMeetingsResponse
$cfrom :: forall x. ListMeetingsResponse -> Rep ListMeetingsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListMeetingsResponse' 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:
--
-- 'meetings', 'listMeetingsResponse_meetings' - The Amazon Chime SDK meeting information.
--
-- 'nextToken', 'listMeetingsResponse_nextToken' - The token to use to retrieve the next page of results.
--
-- 'httpStatus', 'listMeetingsResponse_httpStatus' - The response's http status code.
newListMeetingsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListMeetingsResponse
newListMeetingsResponse :: Int -> ListMeetingsResponse
newListMeetingsResponse Int
pHttpStatus_ =
  ListMeetingsResponse'
    { $sel:meetings:ListMeetingsResponse' :: Maybe [Meeting]
meetings = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListMeetingsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListMeetingsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Chime SDK meeting information.
listMeetingsResponse_meetings :: Lens.Lens' ListMeetingsResponse (Prelude.Maybe [Meeting])
listMeetingsResponse_meetings :: Lens' ListMeetingsResponse (Maybe [Meeting])
listMeetingsResponse_meetings = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMeetingsResponse' {Maybe [Meeting]
meetings :: Maybe [Meeting]
$sel:meetings:ListMeetingsResponse' :: ListMeetingsResponse -> Maybe [Meeting]
meetings} -> Maybe [Meeting]
meetings) (\s :: ListMeetingsResponse
s@ListMeetingsResponse' {} Maybe [Meeting]
a -> ListMeetingsResponse
s {$sel:meetings:ListMeetingsResponse' :: Maybe [Meeting]
meetings = Maybe [Meeting]
a} :: ListMeetingsResponse) 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 token to use to retrieve the next page of results.
listMeetingsResponse_nextToken :: Lens.Lens' ListMeetingsResponse (Prelude.Maybe Prelude.Text)
listMeetingsResponse_nextToken :: Lens' ListMeetingsResponse (Maybe Text)
listMeetingsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListMeetingsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListMeetingsResponse' :: ListMeetingsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListMeetingsResponse
s@ListMeetingsResponse' {} Maybe Text
a -> ListMeetingsResponse
s {$sel:nextToken:ListMeetingsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListMeetingsResponse)

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

instance Prelude.NFData ListMeetingsResponse where
  rnf :: ListMeetingsResponse -> ()
rnf ListMeetingsResponse' {Int
Maybe [Meeting]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
meetings :: Maybe [Meeting]
$sel:httpStatus:ListMeetingsResponse' :: ListMeetingsResponse -> Int
$sel:nextToken:ListMeetingsResponse' :: ListMeetingsResponse -> Maybe Text
$sel:meetings:ListMeetingsResponse' :: ListMeetingsResponse -> Maybe [Meeting]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Meeting]
meetings
      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 Int
httpStatus