{-# 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.ListAttendees
-- 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 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.Chime.ListAttendees
  ( -- * Creating a Request
    ListAttendees (..),
    newListAttendees,

    -- * Request Lenses
    listAttendees_nextToken,
    listAttendees_maxResults,
    listAttendees_meetingId,

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

    -- * Response Lenses
    listAttendeesResponse_attendees,
    listAttendeesResponse_nextToken,
    listAttendeesResponse_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:/ 'newListAttendees' smart constructor.
data ListAttendees = ListAttendees'
  { -- | The token to use to retrieve the next page of results.
    ListAttendees -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results to return in a single call.
    ListAttendees -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The Amazon Chime SDK meeting ID.
    ListAttendees -> Text
meetingId :: Prelude.Text
  }
  deriving (ListAttendees -> ListAttendees -> Bool
(ListAttendees -> ListAttendees -> Bool)
-> (ListAttendees -> ListAttendees -> Bool) -> Eq ListAttendees
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]
(Int -> ReadS ListAttendees)
-> ReadS [ListAttendees]
-> ReadPrec ListAttendees
-> ReadPrec [ListAttendees]
-> Read 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
(Int -> ListAttendees -> ShowS)
-> (ListAttendees -> String)
-> ([ListAttendees] -> ShowS)
-> Show ListAttendees
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. ListAttendees -> Rep ListAttendees x)
-> (forall x. Rep ListAttendees x -> ListAttendees)
-> Generic ListAttendees
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:
--
-- 'nextToken', 'listAttendees_nextToken' - The token to use to retrieve the next page of results.
--
-- 'maxResults', 'listAttendees_maxResults' - The maximum number of results to return in a single call.
--
-- 'meetingId', 'listAttendees_meetingId' - The Amazon Chime SDK meeting ID.
newListAttendees ::
  -- | 'meetingId'
  Prelude.Text ->
  ListAttendees
newListAttendees :: Text -> ListAttendees
newListAttendees Text
pMeetingId_ =
  ListAttendees' :: Maybe Text -> Maybe Natural -> Text -> ListAttendees
ListAttendees'
    { $sel:nextToken:ListAttendees' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListAttendees' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:meetingId:ListAttendees' :: Text
meetingId = Text
pMeetingId_
    }

-- | The token to use to retrieve the next page of results.
listAttendees_nextToken :: Lens.Lens' ListAttendees (Prelude.Maybe Prelude.Text)
listAttendees_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListAttendees -> f ListAttendees
listAttendees_nextToken = (ListAttendees -> Maybe Text)
-> (ListAttendees -> Maybe Text -> ListAttendees)
-> Lens ListAttendees ListAttendees (Maybe Text) (Maybe Text)
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 maximum number of results to return in a single call.
listAttendees_maxResults :: Lens.Lens' ListAttendees (Prelude.Maybe Prelude.Natural)
listAttendees_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListAttendees -> f ListAttendees
listAttendees_maxResults = (ListAttendees -> Maybe Natural)
-> (ListAttendees -> Maybe Natural -> ListAttendees)
-> Lens ListAttendees ListAttendees (Maybe Natural) (Maybe Natural)
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 Amazon Chime SDK meeting ID.
listAttendees_meetingId :: Lens.Lens' ListAttendees Prelude.Text
listAttendees_meetingId :: (Text -> f Text) -> ListAttendees -> f ListAttendees
listAttendees_meetingId = (ListAttendees -> Text)
-> (ListAttendees -> Text -> ListAttendees)
-> Lens ListAttendees ListAttendees Text Text
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 :: ListAttendees -> Request ListAttendees
request = Service -> ListAttendees -> Request ListAttendees
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListAttendees
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAttendees)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListAttendees))
-> Logger
-> Service
-> Proxy ListAttendees
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListAttendees)))
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 [Attendee] -> Maybe Text -> Int -> ListAttendeesResponse
ListAttendeesResponse'
            (Maybe [Attendee] -> Maybe Text -> Int -> ListAttendeesResponse)
-> Either String (Maybe [Attendee])
-> Either String (Maybe Text -> Int -> ListAttendeesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Attendee]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Attendees" Either String (Maybe (Maybe [Attendee]))
-> Maybe [Attendee] -> Either String (Maybe [Attendee])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Attendee]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> ListAttendeesResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListAttendeesResponse)
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 -> ListAttendeesResponse)
-> Either String Int -> Either String ListAttendeesResponse
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 ListAttendees

instance Prelude.NFData ListAttendees

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

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

instance Core.ToQuery ListAttendees where
  toQuery :: ListAttendees -> QueryString
toQuery ListAttendees' {Maybe Natural
Maybe Text
Text
meetingId :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:meetingId:ListAttendees' :: ListAttendees -> Text
$sel:maxResults:ListAttendees' :: ListAttendees -> Maybe Natural
$sel:nextToken:ListAttendees' :: ListAttendees -> 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:/ '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
(ListAttendeesResponse -> ListAttendeesResponse -> Bool)
-> (ListAttendeesResponse -> ListAttendeesResponse -> Bool)
-> Eq ListAttendeesResponse
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
(Int -> ListAttendeesResponse -> ShowS)
-> (ListAttendeesResponse -> String)
-> ([ListAttendeesResponse] -> ShowS)
-> Show ListAttendeesResponse
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. ListAttendeesResponse -> Rep ListAttendeesResponse x)
-> (forall x. Rep ListAttendeesResponse x -> ListAttendeesResponse)
-> Generic ListAttendeesResponse
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' :: Maybe [Attendee] -> Maybe Text -> Int -> ListAttendeesResponse
ListAttendeesResponse'
    { $sel:attendees:ListAttendeesResponse' :: Maybe [Attendee]
attendees = Maybe [Attendee]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListAttendeesResponse' :: Maybe Text
nextToken = Maybe Text
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 :: (Maybe [Attendee] -> f (Maybe [Attendee]))
-> ListAttendeesResponse -> f ListAttendeesResponse
listAttendeesResponse_attendees = (ListAttendeesResponse -> Maybe [Attendee])
-> (ListAttendeesResponse
    -> Maybe [Attendee] -> ListAttendeesResponse)
-> Lens
     ListAttendeesResponse
     ListAttendeesResponse
     (Maybe [Attendee])
     (Maybe [Attendee])
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) ((Maybe [Attendee] -> f (Maybe [Attendee]))
 -> ListAttendeesResponse -> f ListAttendeesResponse)
-> ((Maybe [Attendee] -> f (Maybe [Attendee]))
    -> Maybe [Attendee] -> f (Maybe [Attendee]))
-> (Maybe [Attendee] -> f (Maybe [Attendee]))
-> ListAttendeesResponse
-> f ListAttendeesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Attendee] [Attendee] [Attendee] [Attendee]
-> Iso
     (Maybe [Attendee])
     (Maybe [Attendee])
     (Maybe [Attendee])
     (Maybe [Attendee])
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 [Attendee] [Attendee] [Attendee] [Attendee]
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 :: (Maybe Text -> f (Maybe Text))
-> ListAttendeesResponse -> f ListAttendeesResponse
listAttendeesResponse_nextToken = (ListAttendeesResponse -> Maybe Text)
-> (ListAttendeesResponse -> Maybe Text -> ListAttendeesResponse)
-> Lens
     ListAttendeesResponse
     ListAttendeesResponse
     (Maybe Text)
     (Maybe Text)
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 :: (Int -> f Int) -> ListAttendeesResponse -> f ListAttendeesResponse
listAttendeesResponse_httpStatus = (ListAttendeesResponse -> Int)
-> (ListAttendeesResponse -> Int -> ListAttendeesResponse)
-> Lens ListAttendeesResponse ListAttendeesResponse Int Int
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