{-# 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-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)
--
-- 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_nextToken,
    listMeetings_maxResults,

    -- * 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.Lens as Lens
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 token to use to retrieve the next page of results.
    ListMeetings -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return in a single call.
    ListMeetings -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
  }
  deriving (ListMeetings -> ListMeetings -> Bool
(ListMeetings -> ListMeetings -> Bool)
-> (ListMeetings -> ListMeetings -> Bool) -> Eq ListMeetings
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]
(Int -> ReadS ListMeetings)
-> ReadS [ListMeetings]
-> ReadPrec ListMeetings
-> ReadPrec [ListMeetings]
-> Read 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
(Int -> ListMeetings -> ShowS)
-> (ListMeetings -> String)
-> ([ListMeetings] -> ShowS)
-> Show ListMeetings
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. ListMeetings -> Rep ListMeetings x)
-> (forall x. Rep ListMeetings x -> ListMeetings)
-> Generic ListMeetings
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:
--
-- 'nextToken', 'listMeetings_nextToken' - The token to use to retrieve the next page of results.
--
-- 'maxResults', 'listMeetings_maxResults' - The maximum number of results to return in a single call.
newListMeetings ::
  ListMeetings
newListMeetings :: ListMeetings
newListMeetings =
  ListMeetings' :: Maybe Text -> Maybe Natural -> ListMeetings
ListMeetings'
    { $sel:nextToken:ListMeetings' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListMeetings' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
    }

-- | The token to use to retrieve the next page of results.
listMeetings_nextToken :: Lens.Lens' ListMeetings (Prelude.Maybe Prelude.Text)
listMeetings_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListMeetings -> f ListMeetings
listMeetings_nextToken = (ListMeetings -> Maybe Text)
-> (ListMeetings -> Maybe Text -> ListMeetings)
-> Lens ListMeetings ListMeetings (Maybe Text) (Maybe Text)
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)

-- | The maximum number of results to return in a single call.
listMeetings_maxResults :: Lens.Lens' ListMeetings (Prelude.Maybe Prelude.Natural)
listMeetings_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListMeetings -> f ListMeetings
listMeetings_maxResults = (ListMeetings -> Maybe Natural)
-> (ListMeetings -> Maybe Natural -> ListMeetings)
-> Lens ListMeetings ListMeetings (Maybe Natural) (Maybe Natural)
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)

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

instance Prelude.NFData ListMeetings

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

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

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

-- | /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
(ListMeetingsResponse -> ListMeetingsResponse -> Bool)
-> (ListMeetingsResponse -> ListMeetingsResponse -> Bool)
-> Eq ListMeetingsResponse
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
(Int -> ListMeetingsResponse -> ShowS)
-> (ListMeetingsResponse -> String)
-> ([ListMeetingsResponse] -> ShowS)
-> Show ListMeetingsResponse
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. ListMeetingsResponse -> Rep ListMeetingsResponse x)
-> (forall x. Rep ListMeetingsResponse x -> ListMeetingsResponse)
-> Generic ListMeetingsResponse
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' :: Maybe [Meeting] -> Maybe Text -> Int -> ListMeetingsResponse
ListMeetingsResponse'
    { $sel:meetings:ListMeetingsResponse' :: Maybe [Meeting]
meetings = Maybe [Meeting]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListMeetingsResponse' :: Maybe Text
nextToken = Maybe Text
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 :: (Maybe [Meeting] -> f (Maybe [Meeting]))
-> ListMeetingsResponse -> f ListMeetingsResponse
listMeetingsResponse_meetings = (ListMeetingsResponse -> Maybe [Meeting])
-> (ListMeetingsResponse
    -> Maybe [Meeting] -> ListMeetingsResponse)
-> Lens
     ListMeetingsResponse
     ListMeetingsResponse
     (Maybe [Meeting])
     (Maybe [Meeting])
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) ((Maybe [Meeting] -> f (Maybe [Meeting]))
 -> ListMeetingsResponse -> f ListMeetingsResponse)
-> ((Maybe [Meeting] -> f (Maybe [Meeting]))
    -> Maybe [Meeting] -> f (Maybe [Meeting]))
-> (Maybe [Meeting] -> f (Maybe [Meeting]))
-> ListMeetingsResponse
-> f ListMeetingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Meeting] [Meeting] [Meeting] [Meeting]
-> Iso
     (Maybe [Meeting])
     (Maybe [Meeting])
     (Maybe [Meeting])
     (Maybe [Meeting])
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 [Meeting] [Meeting] [Meeting] [Meeting]
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 :: (Maybe Text -> f (Maybe Text))
-> ListMeetingsResponse -> f ListMeetingsResponse
listMeetingsResponse_nextToken = (ListMeetingsResponse -> Maybe Text)
-> (ListMeetingsResponse -> Maybe Text -> ListMeetingsResponse)
-> Lens
     ListMeetingsResponse ListMeetingsResponse (Maybe Text) (Maybe Text)
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 :: (Int -> f Int) -> ListMeetingsResponse -> f ListMeetingsResponse
listMeetingsResponse_httpStatus = (ListMeetingsResponse -> Int)
-> (ListMeetingsResponse -> Int -> ListMeetingsResponse)
-> Lens ListMeetingsResponse ListMeetingsResponse Int Int
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