{-# 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.GetAttendee
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.ChimeSdkMeetings.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.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:/ '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
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]
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
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. 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'
    { $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 :: Lens' GetAttendee Text
getAttendee_meetingId = 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 :: Lens' GetAttendee Text
getAttendee_attendeeId = 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 :: (Service -> Service) -> GetAttendee -> Request GetAttendee
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 GetAttendee
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetAttendee)))
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 -> Int -> GetAttendeeResponse
GetAttendeeResponse'
            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
"Attendee")
            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 GetAttendee where
  hashWithSalt :: Int -> GetAttendee -> Int
hashWithSalt Int
_salt GetAttendee' {Text
attendeeId :: Text
meetingId :: Text
$sel:attendeeId:GetAttendee' :: GetAttendee -> Text
$sel:meetingId:GetAttendee' :: GetAttendee -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
meetingId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
attendeeId

instance Prelude.NFData GetAttendee where
  rnf :: GetAttendee -> ()
rnf GetAttendee' {Text
attendeeId :: Text
meetingId :: Text
$sel:attendeeId:GetAttendee' :: GetAttendee -> Text
$sel:meetingId:GetAttendee' :: GetAttendee -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
meetingId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
attendeeId

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

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

instance Data.ToQuery GetAttendee where
  toQuery :: GetAttendee -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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
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. 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'
    { $sel:attendee:GetAttendeeResponse' :: Maybe Attendee
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 :: Lens' GetAttendeeResponse (Maybe Attendee)
getAttendeeResponse_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 :: Lens' GetAttendeeResponse Int
getAttendeeResponse_httpStatus = 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 where
  rnf :: GetAttendeeResponse -> ()
rnf GetAttendeeResponse' {Int
Maybe Attendee
httpStatus :: Int
attendee :: Maybe Attendee
$sel:httpStatus:GetAttendeeResponse' :: GetAttendeeResponse -> Int
$sel:attendee:GetAttendeeResponse' :: GetAttendeeResponse -> Maybe Attendee
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Attendee
attendee
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus