{-# 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 #-}
module Amazonka.ChimeSdkMeetings.BatchCreateAttendee
(
BatchCreateAttendee (..),
newBatchCreateAttendee,
batchCreateAttendee_meetingId,
batchCreateAttendee_attendees,
BatchCreateAttendeeResponse (..),
newBatchCreateAttendeeResponse,
batchCreateAttendeeResponse_attendees,
batchCreateAttendeeResponse_errors,
batchCreateAttendeeResponse_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
data BatchCreateAttendee = BatchCreateAttendee'
{
BatchCreateAttendee -> Text
meetingId :: Prelude.Text,
BatchCreateAttendee -> NonEmpty CreateAttendeeRequestItem
attendees :: Prelude.NonEmpty CreateAttendeeRequestItem
}
deriving (BatchCreateAttendee -> BatchCreateAttendee -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchCreateAttendee -> BatchCreateAttendee -> Bool
$c/= :: BatchCreateAttendee -> BatchCreateAttendee -> Bool
== :: BatchCreateAttendee -> BatchCreateAttendee -> Bool
$c== :: BatchCreateAttendee -> BatchCreateAttendee -> Bool
Prelude.Eq, Int -> BatchCreateAttendee -> ShowS
[BatchCreateAttendee] -> ShowS
BatchCreateAttendee -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchCreateAttendee] -> ShowS
$cshowList :: [BatchCreateAttendee] -> ShowS
show :: BatchCreateAttendee -> String
$cshow :: BatchCreateAttendee -> String
showsPrec :: Int -> BatchCreateAttendee -> ShowS
$cshowsPrec :: Int -> BatchCreateAttendee -> ShowS
Prelude.Show, forall x. Rep BatchCreateAttendee x -> BatchCreateAttendee
forall x. BatchCreateAttendee -> Rep BatchCreateAttendee x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchCreateAttendee x -> BatchCreateAttendee
$cfrom :: forall x. BatchCreateAttendee -> Rep BatchCreateAttendee x
Prelude.Generic)
newBatchCreateAttendee ::
Prelude.Text ->
Prelude.NonEmpty CreateAttendeeRequestItem ->
BatchCreateAttendee
newBatchCreateAttendee :: Text -> NonEmpty CreateAttendeeRequestItem -> BatchCreateAttendee
newBatchCreateAttendee Text
pMeetingId_ NonEmpty CreateAttendeeRequestItem
pAttendees_ =
BatchCreateAttendee'
{ $sel:meetingId:BatchCreateAttendee' :: Text
meetingId = Text
pMeetingId_,
$sel:attendees:BatchCreateAttendee' :: NonEmpty CreateAttendeeRequestItem
attendees = forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty CreateAttendeeRequestItem
pAttendees_
}
batchCreateAttendee_meetingId :: Lens.Lens' BatchCreateAttendee Prelude.Text
batchCreateAttendee_meetingId :: Lens' BatchCreateAttendee Text
batchCreateAttendee_meetingId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateAttendee' {Text
meetingId :: Text
$sel:meetingId:BatchCreateAttendee' :: BatchCreateAttendee -> Text
meetingId} -> Text
meetingId) (\s :: BatchCreateAttendee
s@BatchCreateAttendee' {} Text
a -> BatchCreateAttendee
s {$sel:meetingId:BatchCreateAttendee' :: Text
meetingId = Text
a} :: BatchCreateAttendee)
batchCreateAttendee_attendees :: Lens.Lens' BatchCreateAttendee (Prelude.NonEmpty CreateAttendeeRequestItem)
batchCreateAttendee_attendees :: Lens' BatchCreateAttendee (NonEmpty CreateAttendeeRequestItem)
batchCreateAttendee_attendees = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateAttendee' {NonEmpty CreateAttendeeRequestItem
attendees :: NonEmpty CreateAttendeeRequestItem
$sel:attendees:BatchCreateAttendee' :: BatchCreateAttendee -> NonEmpty CreateAttendeeRequestItem
attendees} -> NonEmpty CreateAttendeeRequestItem
attendees) (\s :: BatchCreateAttendee
s@BatchCreateAttendee' {} NonEmpty CreateAttendeeRequestItem
a -> BatchCreateAttendee
s {$sel:attendees:BatchCreateAttendee' :: NonEmpty CreateAttendeeRequestItem
attendees = NonEmpty CreateAttendeeRequestItem
a} :: BatchCreateAttendee) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest BatchCreateAttendee where
type
AWSResponse BatchCreateAttendee =
BatchCreateAttendeeResponse
request :: (Service -> Service)
-> BatchCreateAttendee -> Request BatchCreateAttendee
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy BatchCreateAttendee
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchCreateAttendee)))
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 [CreateAttendeeError]
-> Int
-> BatchCreateAttendeeResponse
BatchCreateAttendeeResponse'
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
"Errors" 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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable BatchCreateAttendee where
hashWithSalt :: Int -> BatchCreateAttendee -> Int
hashWithSalt Int
_salt BatchCreateAttendee' {NonEmpty CreateAttendeeRequestItem
Text
attendees :: NonEmpty CreateAttendeeRequestItem
meetingId :: Text
$sel:attendees:BatchCreateAttendee' :: BatchCreateAttendee -> NonEmpty CreateAttendeeRequestItem
$sel:meetingId:BatchCreateAttendee' :: BatchCreateAttendee -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
meetingId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty CreateAttendeeRequestItem
attendees
instance Prelude.NFData BatchCreateAttendee where
rnf :: BatchCreateAttendee -> ()
rnf BatchCreateAttendee' {NonEmpty CreateAttendeeRequestItem
Text
attendees :: NonEmpty CreateAttendeeRequestItem
meetingId :: Text
$sel:attendees:BatchCreateAttendee' :: BatchCreateAttendee -> NonEmpty CreateAttendeeRequestItem
$sel:meetingId:BatchCreateAttendee' :: BatchCreateAttendee -> 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 NonEmpty CreateAttendeeRequestItem
attendees
instance Data.ToHeaders BatchCreateAttendee where
toHeaders :: BatchCreateAttendee -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToJSON BatchCreateAttendee where
toJSON :: BatchCreateAttendee -> Value
toJSON BatchCreateAttendee' {NonEmpty CreateAttendeeRequestItem
Text
attendees :: NonEmpty CreateAttendeeRequestItem
meetingId :: Text
$sel:attendees:BatchCreateAttendee' :: BatchCreateAttendee -> NonEmpty CreateAttendeeRequestItem
$sel:meetingId:BatchCreateAttendee' :: BatchCreateAttendee -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"Attendees" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty CreateAttendeeRequestItem
attendees)]
)
instance Data.ToPath BatchCreateAttendee where
toPath :: BatchCreateAttendee -> ByteString
toPath BatchCreateAttendee' {NonEmpty CreateAttendeeRequestItem
Text
attendees :: NonEmpty CreateAttendeeRequestItem
meetingId :: Text
$sel:attendees:BatchCreateAttendee' :: BatchCreateAttendee -> NonEmpty CreateAttendeeRequestItem
$sel:meetingId:BatchCreateAttendee' :: BatchCreateAttendee -> Text
..} =
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 BatchCreateAttendee where
toQuery :: BatchCreateAttendee -> QueryString
toQuery =
forall a b. a -> b -> a
Prelude.const
(forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"operation=batch-create"])
data BatchCreateAttendeeResponse = BatchCreateAttendeeResponse'
{
BatchCreateAttendeeResponse -> Maybe [Attendee]
attendees :: Prelude.Maybe [Attendee],
BatchCreateAttendeeResponse -> Maybe [CreateAttendeeError]
errors :: Prelude.Maybe [CreateAttendeeError],
BatchCreateAttendeeResponse -> Int
httpStatus :: Prelude.Int
}
deriving (BatchCreateAttendeeResponse -> BatchCreateAttendeeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchCreateAttendeeResponse -> BatchCreateAttendeeResponse -> Bool
$c/= :: BatchCreateAttendeeResponse -> BatchCreateAttendeeResponse -> Bool
== :: BatchCreateAttendeeResponse -> BatchCreateAttendeeResponse -> Bool
$c== :: BatchCreateAttendeeResponse -> BatchCreateAttendeeResponse -> Bool
Prelude.Eq, Int -> BatchCreateAttendeeResponse -> ShowS
[BatchCreateAttendeeResponse] -> ShowS
BatchCreateAttendeeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchCreateAttendeeResponse] -> ShowS
$cshowList :: [BatchCreateAttendeeResponse] -> ShowS
show :: BatchCreateAttendeeResponse -> String
$cshow :: BatchCreateAttendeeResponse -> String
showsPrec :: Int -> BatchCreateAttendeeResponse -> ShowS
$cshowsPrec :: Int -> BatchCreateAttendeeResponse -> ShowS
Prelude.Show, forall x.
Rep BatchCreateAttendeeResponse x -> BatchCreateAttendeeResponse
forall x.
BatchCreateAttendeeResponse -> Rep BatchCreateAttendeeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchCreateAttendeeResponse x -> BatchCreateAttendeeResponse
$cfrom :: forall x.
BatchCreateAttendeeResponse -> Rep BatchCreateAttendeeResponse x
Prelude.Generic)
newBatchCreateAttendeeResponse ::
Prelude.Int ->
BatchCreateAttendeeResponse
newBatchCreateAttendeeResponse :: Int -> BatchCreateAttendeeResponse
newBatchCreateAttendeeResponse Int
pHttpStatus_ =
BatchCreateAttendeeResponse'
{ $sel:attendees:BatchCreateAttendeeResponse' :: Maybe [Attendee]
attendees =
forall a. Maybe a
Prelude.Nothing,
$sel:errors:BatchCreateAttendeeResponse' :: Maybe [CreateAttendeeError]
errors = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchCreateAttendeeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchCreateAttendeeResponse_attendees :: Lens.Lens' BatchCreateAttendeeResponse (Prelude.Maybe [Attendee])
batchCreateAttendeeResponse_attendees :: Lens' BatchCreateAttendeeResponse (Maybe [Attendee])
batchCreateAttendeeResponse_attendees = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateAttendeeResponse' {Maybe [Attendee]
attendees :: Maybe [Attendee]
$sel:attendees:BatchCreateAttendeeResponse' :: BatchCreateAttendeeResponse -> Maybe [Attendee]
attendees} -> Maybe [Attendee]
attendees) (\s :: BatchCreateAttendeeResponse
s@BatchCreateAttendeeResponse' {} Maybe [Attendee]
a -> BatchCreateAttendeeResponse
s {$sel:attendees:BatchCreateAttendeeResponse' :: Maybe [Attendee]
attendees = Maybe [Attendee]
a} :: BatchCreateAttendeeResponse) 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
batchCreateAttendeeResponse_errors :: Lens.Lens' BatchCreateAttendeeResponse (Prelude.Maybe [CreateAttendeeError])
batchCreateAttendeeResponse_errors :: Lens' BatchCreateAttendeeResponse (Maybe [CreateAttendeeError])
batchCreateAttendeeResponse_errors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateAttendeeResponse' {Maybe [CreateAttendeeError]
errors :: Maybe [CreateAttendeeError]
$sel:errors:BatchCreateAttendeeResponse' :: BatchCreateAttendeeResponse -> Maybe [CreateAttendeeError]
errors} -> Maybe [CreateAttendeeError]
errors) (\s :: BatchCreateAttendeeResponse
s@BatchCreateAttendeeResponse' {} Maybe [CreateAttendeeError]
a -> BatchCreateAttendeeResponse
s {$sel:errors:BatchCreateAttendeeResponse' :: Maybe [CreateAttendeeError]
errors = Maybe [CreateAttendeeError]
a} :: BatchCreateAttendeeResponse) 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
batchCreateAttendeeResponse_httpStatus :: Lens.Lens' BatchCreateAttendeeResponse Prelude.Int
batchCreateAttendeeResponse_httpStatus :: Lens' BatchCreateAttendeeResponse Int
batchCreateAttendeeResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateAttendeeResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchCreateAttendeeResponse' :: BatchCreateAttendeeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchCreateAttendeeResponse
s@BatchCreateAttendeeResponse' {} Int
a -> BatchCreateAttendeeResponse
s {$sel:httpStatus:BatchCreateAttendeeResponse' :: Int
httpStatus = Int
a} :: BatchCreateAttendeeResponse)
instance Prelude.NFData BatchCreateAttendeeResponse where
rnf :: BatchCreateAttendeeResponse -> ()
rnf BatchCreateAttendeeResponse' {Int
Maybe [CreateAttendeeError]
Maybe [Attendee]
httpStatus :: Int
errors :: Maybe [CreateAttendeeError]
attendees :: Maybe [Attendee]
$sel:httpStatus:BatchCreateAttendeeResponse' :: BatchCreateAttendeeResponse -> Int
$sel:errors:BatchCreateAttendeeResponse' :: BatchCreateAttendeeResponse -> Maybe [CreateAttendeeError]
$sel:attendees:BatchCreateAttendeeResponse' :: BatchCreateAttendeeResponse -> 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 [CreateAttendeeError]
errors
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus