{-# 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.ChimeSdkMeetings.ListAttendees
-- 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 the attendees for the specified Amazon Chime SDK meeting. 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.ChimeSdkMeetings.ListAttendees
  ( -- * Creating a Request
    ListAttendees (..),
    newListAttendees,

    -- * Request Lenses
    listAttendees_maxResults,
    listAttendees_nextToken,
    listAttendees_meetingId,

    -- * Destructuring the Response
    ListAttendeesResponse (..),
    newListAttendeesResponse,

    -- * Response Lenses
    listAttendeesResponse_attendees,
    listAttendeesResponse_nextToken,
    listAttendeesResponse_httpStatus,
  )
where

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

-- |
-- Create a value of 'ListAttendees' 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', 'listAttendees_maxResults' - The maximum number of results to return in a single call.
--
-- 'nextToken', 'listAttendees_nextToken' - The token to use to retrieve the next page of results.
--
-- 'meetingId', 'listAttendees_meetingId' - The Amazon Chime SDK meeting ID.
newListAttendees ::
  -- | 'meetingId'
  Prelude.Text ->
  ListAttendees
newListAttendees :: Text -> ListAttendees
newListAttendees Text
pMeetingId_ =
  ListAttendees'
    { $sel:maxResults:ListAttendees' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAttendees' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:meetingId:ListAttendees' :: Text
meetingId = Text
pMeetingId_
    }

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

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

-- | The Amazon Chime SDK meeting ID.
listAttendees_meetingId :: Lens.Lens' ListAttendees Prelude.Text
listAttendees_meetingId :: Lens' ListAttendees Text
listAttendees_meetingId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttendees' {Text
meetingId :: Text
$sel:meetingId:ListAttendees' :: ListAttendees -> Text
meetingId} -> Text
meetingId) (\s :: ListAttendees
s@ListAttendees' {} Text
a -> ListAttendees
s {$sel:meetingId:ListAttendees' :: Text
meetingId = Text
a} :: ListAttendees)

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

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

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

instance Data.ToPath ListAttendees where
  toPath :: ListAttendees -> ByteString
toPath ListAttendees' {Maybe Natural
Maybe Text
Text
meetingId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:meetingId:ListAttendees' :: ListAttendees -> Text
$sel:nextToken:ListAttendees' :: ListAttendees -> Maybe Text
$sel:maxResults:ListAttendees' :: ListAttendees -> Maybe Natural
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/meetings/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
meetingId, ByteString
"/attendees"]

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

-- |
-- Create a value of 'ListAttendeesResponse' 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:
--
-- 'attendees', 'listAttendeesResponse_attendees' - The Amazon Chime SDK attendee information.
--
-- 'nextToken', 'listAttendeesResponse_nextToken' - The token to use to retrieve the next page of results.
--
-- 'httpStatus', 'listAttendeesResponse_httpStatus' - The response's http status code.
newListAttendeesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListAttendeesResponse
newListAttendeesResponse :: Int -> ListAttendeesResponse
newListAttendeesResponse Int
pHttpStatus_ =
  ListAttendeesResponse'
    { $sel:attendees:ListAttendeesResponse' :: Maybe [Attendee]
attendees = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAttendeesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListAttendeesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Chime SDK attendee information.
listAttendeesResponse_attendees :: Lens.Lens' ListAttendeesResponse (Prelude.Maybe [Attendee])
listAttendeesResponse_attendees :: Lens' ListAttendeesResponse (Maybe [Attendee])
listAttendeesResponse_attendees = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttendeesResponse' {Maybe [Attendee]
attendees :: Maybe [Attendee]
$sel:attendees:ListAttendeesResponse' :: ListAttendeesResponse -> Maybe [Attendee]
attendees} -> Maybe [Attendee]
attendees) (\s :: ListAttendeesResponse
s@ListAttendeesResponse' {} Maybe [Attendee]
a -> ListAttendeesResponse
s {$sel:attendees:ListAttendeesResponse' :: Maybe [Attendee]
attendees = Maybe [Attendee]
a} :: ListAttendeesResponse) 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.
listAttendeesResponse_nextToken :: Lens.Lens' ListAttendeesResponse (Prelude.Maybe Prelude.Text)
listAttendeesResponse_nextToken :: Lens' ListAttendeesResponse (Maybe Text)
listAttendeesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListAttendeesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListAttendeesResponse' :: ListAttendeesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListAttendeesResponse
s@ListAttendeesResponse' {} Maybe Text
a -> ListAttendeesResponse
s {$sel:nextToken:ListAttendeesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListAttendeesResponse)

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

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