{-# 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.Chime.BatchCreateAttendee
(
BatchCreateAttendee (..),
newBatchCreateAttendee,
batchCreateAttendee_meetingId,
batchCreateAttendee_attendees,
BatchCreateAttendeeResponse (..),
newBatchCreateAttendeeResponse,
batchCreateAttendeeResponse_attendees,
batchCreateAttendeeResponse_errors,
batchCreateAttendeeResponse_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
data BatchCreateAttendee = BatchCreateAttendee'
{
BatchCreateAttendee -> Text
meetingId :: Prelude.Text,
BatchCreateAttendee -> [CreateAttendeeRequestItem]
attendees :: [CreateAttendeeRequestItem]
}
deriving (BatchCreateAttendee -> BatchCreateAttendee -> Bool
(BatchCreateAttendee -> BatchCreateAttendee -> Bool)
-> (BatchCreateAttendee -> BatchCreateAttendee -> Bool)
-> Eq BatchCreateAttendee
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
(Int -> BatchCreateAttendee -> ShowS)
-> (BatchCreateAttendee -> String)
-> ([BatchCreateAttendee] -> ShowS)
-> Show BatchCreateAttendee
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. BatchCreateAttendee -> Rep BatchCreateAttendee x)
-> (forall x. Rep BatchCreateAttendee x -> BatchCreateAttendee)
-> Generic BatchCreateAttendee
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 ->
BatchCreateAttendee
newBatchCreateAttendee :: Text -> BatchCreateAttendee
newBatchCreateAttendee Text
pMeetingId_ =
BatchCreateAttendee' :: Text -> [CreateAttendeeRequestItem] -> BatchCreateAttendee
BatchCreateAttendee'
{ $sel:meetingId:BatchCreateAttendee' :: Text
meetingId = Text
pMeetingId_,
$sel:attendees:BatchCreateAttendee' :: [CreateAttendeeRequestItem]
attendees = [CreateAttendeeRequestItem]
forall a. Monoid a => a
Prelude.mempty
}
batchCreateAttendee_meetingId :: Lens.Lens' BatchCreateAttendee Prelude.Text
batchCreateAttendee_meetingId :: (Text -> f Text) -> BatchCreateAttendee -> f BatchCreateAttendee
batchCreateAttendee_meetingId = (BatchCreateAttendee -> Text)
-> (BatchCreateAttendee -> Text -> BatchCreateAttendee)
-> Lens BatchCreateAttendee BatchCreateAttendee Text Text
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 [CreateAttendeeRequestItem]
batchCreateAttendee_attendees :: ([CreateAttendeeRequestItem] -> f [CreateAttendeeRequestItem])
-> BatchCreateAttendee -> f BatchCreateAttendee
batchCreateAttendee_attendees = (BatchCreateAttendee -> [CreateAttendeeRequestItem])
-> (BatchCreateAttendee
-> [CreateAttendeeRequestItem] -> BatchCreateAttendee)
-> Lens
BatchCreateAttendee
BatchCreateAttendee
[CreateAttendeeRequestItem]
[CreateAttendeeRequestItem]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchCreateAttendee' {[CreateAttendeeRequestItem]
attendees :: [CreateAttendeeRequestItem]
$sel:attendees:BatchCreateAttendee' :: BatchCreateAttendee -> [CreateAttendeeRequestItem]
attendees} -> [CreateAttendeeRequestItem]
attendees) (\s :: BatchCreateAttendee
s@BatchCreateAttendee' {} [CreateAttendeeRequestItem]
a -> BatchCreateAttendee
s {$sel:attendees:BatchCreateAttendee' :: [CreateAttendeeRequestItem]
attendees = [CreateAttendeeRequestItem]
a} :: BatchCreateAttendee) (([CreateAttendeeRequestItem] -> f [CreateAttendeeRequestItem])
-> BatchCreateAttendee -> f BatchCreateAttendee)
-> (([CreateAttendeeRequestItem] -> f [CreateAttendeeRequestItem])
-> [CreateAttendeeRequestItem] -> f [CreateAttendeeRequestItem])
-> ([CreateAttendeeRequestItem] -> f [CreateAttendeeRequestItem])
-> BatchCreateAttendee
-> f BatchCreateAttendee
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([CreateAttendeeRequestItem] -> f [CreateAttendeeRequestItem])
-> [CreateAttendeeRequestItem] -> f [CreateAttendeeRequestItem]
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 :: BatchCreateAttendee -> Request BatchCreateAttendee
request = Service -> BatchCreateAttendee -> Request BatchCreateAttendee
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchCreateAttendee
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchCreateAttendee)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchCreateAttendee))
-> Logger
-> Service
-> Proxy BatchCreateAttendee
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchCreateAttendee)))
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 [CreateAttendeeError]
-> Int
-> BatchCreateAttendeeResponse
BatchCreateAttendeeResponse'
(Maybe [Attendee]
-> Maybe [CreateAttendeeError]
-> Int
-> BatchCreateAttendeeResponse)
-> Either String (Maybe [Attendee])
-> Either
String
(Maybe [CreateAttendeeError] -> Int -> BatchCreateAttendeeResponse)
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 [CreateAttendeeError] -> Int -> BatchCreateAttendeeResponse)
-> Either String (Maybe [CreateAttendeeError])
-> Either String (Int -> BatchCreateAttendeeResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (Maybe [CreateAttendeeError]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Errors" Either String (Maybe (Maybe [CreateAttendeeError]))
-> Maybe [CreateAttendeeError]
-> Either String (Maybe [CreateAttendeeError])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [CreateAttendeeError]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> BatchCreateAttendeeResponse)
-> Either String Int -> Either String BatchCreateAttendeeResponse
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 BatchCreateAttendee
instance Prelude.NFData BatchCreateAttendee
instance Core.ToHeaders BatchCreateAttendee where
toHeaders :: BatchCreateAttendee -> ResponseHeaders
toHeaders = ResponseHeaders -> BatchCreateAttendee -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToJSON BatchCreateAttendee where
toJSON :: BatchCreateAttendee -> Value
toJSON BatchCreateAttendee' {[CreateAttendeeRequestItem]
Text
attendees :: [CreateAttendeeRequestItem]
meetingId :: Text
$sel:attendees:BatchCreateAttendee' :: BatchCreateAttendee -> [CreateAttendeeRequestItem]
$sel:meetingId:BatchCreateAttendee' :: BatchCreateAttendee -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Attendees" Text -> [CreateAttendeeRequestItem] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [CreateAttendeeRequestItem]
attendees)]
)
instance Core.ToPath BatchCreateAttendee where
toPath :: BatchCreateAttendee -> ByteString
toPath BatchCreateAttendee' {[CreateAttendeeRequestItem]
Text
attendees :: [CreateAttendeeRequestItem]
meetingId :: Text
$sel:attendees:BatchCreateAttendee' :: BatchCreateAttendee -> [CreateAttendeeRequestItem]
$sel:meetingId:BatchCreateAttendee' :: BatchCreateAttendee -> 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 BatchCreateAttendee where
toQuery :: BatchCreateAttendee -> QueryString
toQuery =
QueryString -> BatchCreateAttendee -> QueryString
forall a b. a -> b -> a
Prelude.const
([QueryString] -> QueryString
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
(BatchCreateAttendeeResponse
-> BatchCreateAttendeeResponse -> Bool)
-> (BatchCreateAttendeeResponse
-> BatchCreateAttendeeResponse -> Bool)
-> Eq BatchCreateAttendeeResponse
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
(Int -> BatchCreateAttendeeResponse -> ShowS)
-> (BatchCreateAttendeeResponse -> String)
-> ([BatchCreateAttendeeResponse] -> ShowS)
-> Show BatchCreateAttendeeResponse
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.
BatchCreateAttendeeResponse -> Rep BatchCreateAttendeeResponse x)
-> (forall x.
Rep BatchCreateAttendeeResponse x -> BatchCreateAttendeeResponse)
-> Generic BatchCreateAttendeeResponse
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' :: Maybe [Attendee]
-> Maybe [CreateAttendeeError]
-> Int
-> BatchCreateAttendeeResponse
BatchCreateAttendeeResponse'
{ $sel:attendees:BatchCreateAttendeeResponse' :: Maybe [Attendee]
attendees =
Maybe [Attendee]
forall a. Maybe a
Prelude.Nothing,
$sel:errors:BatchCreateAttendeeResponse' :: Maybe [CreateAttendeeError]
errors = Maybe [CreateAttendeeError]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:BatchCreateAttendeeResponse' :: Int
httpStatus = Int
pHttpStatus_
}
batchCreateAttendeeResponse_attendees :: Lens.Lens' BatchCreateAttendeeResponse (Prelude.Maybe [Attendee])
batchCreateAttendeeResponse_attendees :: (Maybe [Attendee] -> f (Maybe [Attendee]))
-> BatchCreateAttendeeResponse -> f BatchCreateAttendeeResponse
batchCreateAttendeeResponse_attendees = (BatchCreateAttendeeResponse -> Maybe [Attendee])
-> (BatchCreateAttendeeResponse
-> Maybe [Attendee] -> BatchCreateAttendeeResponse)
-> Lens
BatchCreateAttendeeResponse
BatchCreateAttendeeResponse
(Maybe [Attendee])
(Maybe [Attendee])
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) ((Maybe [Attendee] -> f (Maybe [Attendee]))
-> BatchCreateAttendeeResponse -> f BatchCreateAttendeeResponse)
-> ((Maybe [Attendee] -> f (Maybe [Attendee]))
-> Maybe [Attendee] -> f (Maybe [Attendee]))
-> (Maybe [Attendee] -> f (Maybe [Attendee]))
-> BatchCreateAttendeeResponse
-> f BatchCreateAttendeeResponse
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
batchCreateAttendeeResponse_errors :: Lens.Lens' BatchCreateAttendeeResponse (Prelude.Maybe [CreateAttendeeError])
batchCreateAttendeeResponse_errors :: (Maybe [CreateAttendeeError] -> f (Maybe [CreateAttendeeError]))
-> BatchCreateAttendeeResponse -> f BatchCreateAttendeeResponse
batchCreateAttendeeResponse_errors = (BatchCreateAttendeeResponse -> Maybe [CreateAttendeeError])
-> (BatchCreateAttendeeResponse
-> Maybe [CreateAttendeeError] -> BatchCreateAttendeeResponse)
-> Lens
BatchCreateAttendeeResponse
BatchCreateAttendeeResponse
(Maybe [CreateAttendeeError])
(Maybe [CreateAttendeeError])
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) ((Maybe [CreateAttendeeError] -> f (Maybe [CreateAttendeeError]))
-> BatchCreateAttendeeResponse -> f BatchCreateAttendeeResponse)
-> ((Maybe [CreateAttendeeError]
-> f (Maybe [CreateAttendeeError]))
-> Maybe [CreateAttendeeError] -> f (Maybe [CreateAttendeeError]))
-> (Maybe [CreateAttendeeError] -> f (Maybe [CreateAttendeeError]))
-> BatchCreateAttendeeResponse
-> f BatchCreateAttendeeResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[CreateAttendeeError]
[CreateAttendeeError]
[CreateAttendeeError]
[CreateAttendeeError]
-> Iso
(Maybe [CreateAttendeeError])
(Maybe [CreateAttendeeError])
(Maybe [CreateAttendeeError])
(Maybe [CreateAttendeeError])
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
[CreateAttendeeError]
[CreateAttendeeError]
[CreateAttendeeError]
[CreateAttendeeError]
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 :: (Int -> f Int)
-> BatchCreateAttendeeResponse -> f BatchCreateAttendeeResponse
batchCreateAttendeeResponse_httpStatus = (BatchCreateAttendeeResponse -> Int)
-> (BatchCreateAttendeeResponse
-> Int -> BatchCreateAttendeeResponse)
-> Lens
BatchCreateAttendeeResponse BatchCreateAttendeeResponse Int Int
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