{-# 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.GetAttendee
-- 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)
--
-- Gets the Amazon Chime SDK attendee details for a specified meeting ID
-- and attendee ID. 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.GetAttendee
  ( -- * Creating a Request
    GetAttendee (..),
    newGetAttendee,

    -- * Request Lenses
    getAttendee_meetingId,
    getAttendee_attendeeId,

    -- * Destructuring the Response
    GetAttendeeResponse (..),
    newGetAttendeeResponse,

    -- * Response Lenses
    getAttendeeResponse_attendee,
    getAttendeeResponse_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:/ 'newGetAttendee' smart constructor.
data GetAttendee = GetAttendee'
  { -- | The Amazon Chime SDK meeting ID.
    GetAttendee -> Text
meetingId :: Prelude.Text,
    -- | The Amazon Chime SDK attendee ID.
    GetAttendee -> Text
attendeeId :: Prelude.Text
  }
  deriving (GetAttendee -> GetAttendee -> Bool
(GetAttendee -> GetAttendee -> Bool)
-> (GetAttendee -> GetAttendee -> Bool) -> Eq GetAttendee
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAttendee -> GetAttendee -> Bool
$c/= :: GetAttendee -> GetAttendee -> Bool
== :: GetAttendee -> GetAttendee -> Bool
$c== :: GetAttendee -> GetAttendee -> Bool
Prelude.Eq, ReadPrec [GetAttendee]
ReadPrec GetAttendee
Int -> ReadS GetAttendee
ReadS [GetAttendee]
(Int -> ReadS GetAttendee)
-> ReadS [GetAttendee]
-> ReadPrec GetAttendee
-> ReadPrec [GetAttendee]
-> Read GetAttendee
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetAttendee]
$creadListPrec :: ReadPrec [GetAttendee]
readPrec :: ReadPrec GetAttendee
$creadPrec :: ReadPrec GetAttendee
readList :: ReadS [GetAttendee]
$creadList :: ReadS [GetAttendee]
readsPrec :: Int -> ReadS GetAttendee
$creadsPrec :: Int -> ReadS GetAttendee
Prelude.Read, Int -> GetAttendee -> ShowS
[GetAttendee] -> ShowS
GetAttendee -> String
(Int -> GetAttendee -> ShowS)
-> (GetAttendee -> String)
-> ([GetAttendee] -> ShowS)
-> Show GetAttendee
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAttendee] -> ShowS
$cshowList :: [GetAttendee] -> ShowS
show :: GetAttendee -> String
$cshow :: GetAttendee -> String
showsPrec :: Int -> GetAttendee -> ShowS
$cshowsPrec :: Int -> GetAttendee -> ShowS
Prelude.Show, (forall x. GetAttendee -> Rep GetAttendee x)
-> (forall x. Rep GetAttendee x -> GetAttendee)
-> Generic GetAttendee
forall x. Rep GetAttendee x -> GetAttendee
forall x. GetAttendee -> Rep GetAttendee x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAttendee x -> GetAttendee
$cfrom :: forall x. GetAttendee -> Rep GetAttendee x
Prelude.Generic)

-- |
-- Create a value of 'GetAttendee' 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:
--
-- 'meetingId', 'getAttendee_meetingId' - The Amazon Chime SDK meeting ID.
--
-- 'attendeeId', 'getAttendee_attendeeId' - The Amazon Chime SDK attendee ID.
newGetAttendee ::
  -- | 'meetingId'
  Prelude.Text ->
  -- | 'attendeeId'
  Prelude.Text ->
  GetAttendee
newGetAttendee :: Text -> Text -> GetAttendee
newGetAttendee Text
pMeetingId_ Text
pAttendeeId_ =
  GetAttendee' :: Text -> Text -> GetAttendee
GetAttendee'
    { $sel:meetingId:GetAttendee' :: Text
meetingId = Text
pMeetingId_,
      $sel:attendeeId:GetAttendee' :: Text
attendeeId = Text
pAttendeeId_
    }

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

-- | The Amazon Chime SDK attendee ID.
getAttendee_attendeeId :: Lens.Lens' GetAttendee Prelude.Text
getAttendee_attendeeId :: (Text -> f Text) -> GetAttendee -> f GetAttendee
getAttendee_attendeeId = (GetAttendee -> Text)
-> (GetAttendee -> Text -> GetAttendee)
-> Lens GetAttendee GetAttendee Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttendee' {Text
attendeeId :: Text
$sel:attendeeId:GetAttendee' :: GetAttendee -> Text
attendeeId} -> Text
attendeeId) (\s :: GetAttendee
s@GetAttendee' {} Text
a -> GetAttendee
s {$sel:attendeeId:GetAttendee' :: Text
attendeeId = Text
a} :: GetAttendee)

instance Core.AWSRequest GetAttendee where
  type AWSResponse GetAttendee = GetAttendeeResponse
  request :: GetAttendee -> Request GetAttendee
request = Service -> GetAttendee -> Request GetAttendee
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetAttendee
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAttendee)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetAttendee))
-> Logger
-> Service
-> Proxy GetAttendee
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAttendee)))
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 -> Int -> GetAttendeeResponse
GetAttendeeResponse'
            (Maybe Attendee -> Int -> GetAttendeeResponse)
-> Either String (Maybe Attendee)
-> Either String (Int -> GetAttendeeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Attendee)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Attendee")
            Either String (Int -> GetAttendeeResponse)
-> Either String Int -> Either String GetAttendeeResponse
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 GetAttendee

instance Prelude.NFData GetAttendee

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

instance Core.ToPath GetAttendee where
  toPath :: GetAttendee -> ByteString
toPath GetAttendee' {Text
attendeeId :: Text
meetingId :: Text
$sel:attendeeId:GetAttendee' :: GetAttendee -> Text
$sel:meetingId:GetAttendee' :: GetAttendee -> 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/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
attendeeId
      ]

instance Core.ToQuery GetAttendee where
  toQuery :: GetAttendee -> QueryString
toQuery = QueryString -> GetAttendee -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newGetAttendeeResponse' smart constructor.
data GetAttendeeResponse = GetAttendeeResponse'
  { -- | The Amazon Chime SDK attendee information.
    GetAttendeeResponse -> Maybe Attendee
attendee :: Prelude.Maybe Attendee,
    -- | The response's http status code.
    GetAttendeeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetAttendeeResponse -> GetAttendeeResponse -> Bool
(GetAttendeeResponse -> GetAttendeeResponse -> Bool)
-> (GetAttendeeResponse -> GetAttendeeResponse -> Bool)
-> Eq GetAttendeeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetAttendeeResponse -> GetAttendeeResponse -> Bool
$c/= :: GetAttendeeResponse -> GetAttendeeResponse -> Bool
== :: GetAttendeeResponse -> GetAttendeeResponse -> Bool
$c== :: GetAttendeeResponse -> GetAttendeeResponse -> Bool
Prelude.Eq, Int -> GetAttendeeResponse -> ShowS
[GetAttendeeResponse] -> ShowS
GetAttendeeResponse -> String
(Int -> GetAttendeeResponse -> ShowS)
-> (GetAttendeeResponse -> String)
-> ([GetAttendeeResponse] -> ShowS)
-> Show GetAttendeeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetAttendeeResponse] -> ShowS
$cshowList :: [GetAttendeeResponse] -> ShowS
show :: GetAttendeeResponse -> String
$cshow :: GetAttendeeResponse -> String
showsPrec :: Int -> GetAttendeeResponse -> ShowS
$cshowsPrec :: Int -> GetAttendeeResponse -> ShowS
Prelude.Show, (forall x. GetAttendeeResponse -> Rep GetAttendeeResponse x)
-> (forall x. Rep GetAttendeeResponse x -> GetAttendeeResponse)
-> Generic GetAttendeeResponse
forall x. Rep GetAttendeeResponse x -> GetAttendeeResponse
forall x. GetAttendeeResponse -> Rep GetAttendeeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetAttendeeResponse x -> GetAttendeeResponse
$cfrom :: forall x. GetAttendeeResponse -> Rep GetAttendeeResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetAttendeeResponse' 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:
--
-- 'attendee', 'getAttendeeResponse_attendee' - The Amazon Chime SDK attendee information.
--
-- 'httpStatus', 'getAttendeeResponse_httpStatus' - The response's http status code.
newGetAttendeeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetAttendeeResponse
newGetAttendeeResponse :: Int -> GetAttendeeResponse
newGetAttendeeResponse Int
pHttpStatus_ =
  GetAttendeeResponse' :: Maybe Attendee -> Int -> GetAttendeeResponse
GetAttendeeResponse'
    { $sel:attendee:GetAttendeeResponse' :: Maybe Attendee
attendee = Maybe Attendee
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetAttendeeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Chime SDK attendee information.
getAttendeeResponse_attendee :: Lens.Lens' GetAttendeeResponse (Prelude.Maybe Attendee)
getAttendeeResponse_attendee :: (Maybe Attendee -> f (Maybe Attendee))
-> GetAttendeeResponse -> f GetAttendeeResponse
getAttendeeResponse_attendee = (GetAttendeeResponse -> Maybe Attendee)
-> (GetAttendeeResponse -> Maybe Attendee -> GetAttendeeResponse)
-> Lens
     GetAttendeeResponse
     GetAttendeeResponse
     (Maybe Attendee)
     (Maybe Attendee)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetAttendeeResponse' {Maybe Attendee
attendee :: Maybe Attendee
$sel:attendee:GetAttendeeResponse' :: GetAttendeeResponse -> Maybe Attendee
attendee} -> Maybe Attendee
attendee) (\s :: GetAttendeeResponse
s@GetAttendeeResponse' {} Maybe Attendee
a -> GetAttendeeResponse
s {$sel:attendee:GetAttendeeResponse' :: Maybe Attendee
attendee = Maybe Attendee
a} :: GetAttendeeResponse)

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

instance Prelude.NFData GetAttendeeResponse