{-# 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.ConnectCases.BatchGetField
(
BatchGetField (..),
newBatchGetField,
batchGetField_domainId,
batchGetField_fields,
BatchGetFieldResponse (..),
newBatchGetFieldResponse,
batchGetFieldResponse_httpStatus,
batchGetFieldResponse_errors,
batchGetFieldResponse_fields,
)
where
import Amazonka.ConnectCases.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 BatchGetField = BatchGetField'
{
BatchGetField -> Text
domainId :: Prelude.Text,
BatchGetField -> NonEmpty FieldIdentifier
fields :: Prelude.NonEmpty FieldIdentifier
}
deriving (BatchGetField -> BatchGetField -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetField -> BatchGetField -> Bool
$c/= :: BatchGetField -> BatchGetField -> Bool
== :: BatchGetField -> BatchGetField -> Bool
$c== :: BatchGetField -> BatchGetField -> Bool
Prelude.Eq, ReadPrec [BatchGetField]
ReadPrec BatchGetField
Int -> ReadS BatchGetField
ReadS [BatchGetField]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetField]
$creadListPrec :: ReadPrec [BatchGetField]
readPrec :: ReadPrec BatchGetField
$creadPrec :: ReadPrec BatchGetField
readList :: ReadS [BatchGetField]
$creadList :: ReadS [BatchGetField]
readsPrec :: Int -> ReadS BatchGetField
$creadsPrec :: Int -> ReadS BatchGetField
Prelude.Read, Int -> BatchGetField -> ShowS
[BatchGetField] -> ShowS
BatchGetField -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetField] -> ShowS
$cshowList :: [BatchGetField] -> ShowS
show :: BatchGetField -> String
$cshow :: BatchGetField -> String
showsPrec :: Int -> BatchGetField -> ShowS
$cshowsPrec :: Int -> BatchGetField -> ShowS
Prelude.Show, forall x. Rep BatchGetField x -> BatchGetField
forall x. BatchGetField -> Rep BatchGetField x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetField x -> BatchGetField
$cfrom :: forall x. BatchGetField -> Rep BatchGetField x
Prelude.Generic)
newBatchGetField ::
Prelude.Text ->
Prelude.NonEmpty FieldIdentifier ->
BatchGetField
newBatchGetField :: Text -> NonEmpty FieldIdentifier -> BatchGetField
newBatchGetField Text
pDomainId_ NonEmpty FieldIdentifier
pFields_ =
BatchGetField'
{ $sel:domainId:BatchGetField' :: Text
domainId = Text
pDomainId_,
$sel:fields:BatchGetField' :: NonEmpty FieldIdentifier
fields = 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 FieldIdentifier
pFields_
}
batchGetField_domainId :: Lens.Lens' BatchGetField Prelude.Text
batchGetField_domainId :: Lens' BatchGetField Text
batchGetField_domainId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetField' {Text
domainId :: Text
$sel:domainId:BatchGetField' :: BatchGetField -> Text
domainId} -> Text
domainId) (\s :: BatchGetField
s@BatchGetField' {} Text
a -> BatchGetField
s {$sel:domainId:BatchGetField' :: Text
domainId = Text
a} :: BatchGetField)
batchGetField_fields :: Lens.Lens' BatchGetField (Prelude.NonEmpty FieldIdentifier)
batchGetField_fields :: Lens' BatchGetField (NonEmpty FieldIdentifier)
batchGetField_fields = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetField' {NonEmpty FieldIdentifier
fields :: NonEmpty FieldIdentifier
$sel:fields:BatchGetField' :: BatchGetField -> NonEmpty FieldIdentifier
fields} -> NonEmpty FieldIdentifier
fields) (\s :: BatchGetField
s@BatchGetField' {} NonEmpty FieldIdentifier
a -> BatchGetField
s {$sel:fields:BatchGetField' :: NonEmpty FieldIdentifier
fields = NonEmpty FieldIdentifier
a} :: BatchGetField) 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 BatchGetField where
type
AWSResponse BatchGetField =
BatchGetFieldResponse
request :: (Service -> Service) -> BatchGetField -> Request BatchGetField
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 BatchGetField
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse BatchGetField)))
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 ->
Int -> [FieldError] -> [GetFieldResponse] -> BatchGetFieldResponse
BatchGetFieldResponse'
forall (f :: * -> *) a b. Functor 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))
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.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"fields" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable BatchGetField where
hashWithSalt :: Int -> BatchGetField -> Int
hashWithSalt Int
_salt BatchGetField' {NonEmpty FieldIdentifier
Text
fields :: NonEmpty FieldIdentifier
domainId :: Text
$sel:fields:BatchGetField' :: BatchGetField -> NonEmpty FieldIdentifier
$sel:domainId:BatchGetField' :: BatchGetField -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty FieldIdentifier
fields
instance Prelude.NFData BatchGetField where
rnf :: BatchGetField -> ()
rnf BatchGetField' {NonEmpty FieldIdentifier
Text
fields :: NonEmpty FieldIdentifier
domainId :: Text
$sel:fields:BatchGetField' :: BatchGetField -> NonEmpty FieldIdentifier
$sel:domainId:BatchGetField' :: BatchGetField -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
domainId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty FieldIdentifier
fields
instance Data.ToHeaders BatchGetField where
toHeaders :: BatchGetField -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON BatchGetField where
toJSON :: BatchGetField -> Value
toJSON BatchGetField' {NonEmpty FieldIdentifier
Text
fields :: NonEmpty FieldIdentifier
domainId :: Text
$sel:fields:BatchGetField' :: BatchGetField -> NonEmpty FieldIdentifier
$sel:domainId:BatchGetField' :: BatchGetField -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"fields" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty FieldIdentifier
fields)]
)
instance Data.ToPath BatchGetField where
toPath :: BatchGetField -> ByteString
toPath BatchGetField' {NonEmpty FieldIdentifier
Text
fields :: NonEmpty FieldIdentifier
domainId :: Text
$sel:fields:BatchGetField' :: BatchGetField -> NonEmpty FieldIdentifier
$sel:domainId:BatchGetField' :: BatchGetField -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/domains/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
domainId, ByteString
"/fields-batch"]
instance Data.ToQuery BatchGetField where
toQuery :: BatchGetField -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchGetFieldResponse = BatchGetFieldResponse'
{
BatchGetFieldResponse -> Int
httpStatus :: Prelude.Int,
BatchGetFieldResponse -> [FieldError]
errors :: [FieldError],
BatchGetFieldResponse -> [GetFieldResponse]
fields :: [GetFieldResponse]
}
deriving (BatchGetFieldResponse -> BatchGetFieldResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchGetFieldResponse -> BatchGetFieldResponse -> Bool
$c/= :: BatchGetFieldResponse -> BatchGetFieldResponse -> Bool
== :: BatchGetFieldResponse -> BatchGetFieldResponse -> Bool
$c== :: BatchGetFieldResponse -> BatchGetFieldResponse -> Bool
Prelude.Eq, ReadPrec [BatchGetFieldResponse]
ReadPrec BatchGetFieldResponse
Int -> ReadS BatchGetFieldResponse
ReadS [BatchGetFieldResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchGetFieldResponse]
$creadListPrec :: ReadPrec [BatchGetFieldResponse]
readPrec :: ReadPrec BatchGetFieldResponse
$creadPrec :: ReadPrec BatchGetFieldResponse
readList :: ReadS [BatchGetFieldResponse]
$creadList :: ReadS [BatchGetFieldResponse]
readsPrec :: Int -> ReadS BatchGetFieldResponse
$creadsPrec :: Int -> ReadS BatchGetFieldResponse
Prelude.Read, Int -> BatchGetFieldResponse -> ShowS
[BatchGetFieldResponse] -> ShowS
BatchGetFieldResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchGetFieldResponse] -> ShowS
$cshowList :: [BatchGetFieldResponse] -> ShowS
show :: BatchGetFieldResponse -> String
$cshow :: BatchGetFieldResponse -> String
showsPrec :: Int -> BatchGetFieldResponse -> ShowS
$cshowsPrec :: Int -> BatchGetFieldResponse -> ShowS
Prelude.Show, forall x. Rep BatchGetFieldResponse x -> BatchGetFieldResponse
forall x. BatchGetFieldResponse -> Rep BatchGetFieldResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchGetFieldResponse x -> BatchGetFieldResponse
$cfrom :: forall x. BatchGetFieldResponse -> Rep BatchGetFieldResponse x
Prelude.Generic)
newBatchGetFieldResponse ::
Prelude.Int ->
BatchGetFieldResponse
newBatchGetFieldResponse :: Int -> BatchGetFieldResponse
newBatchGetFieldResponse Int
pHttpStatus_ =
BatchGetFieldResponse'
{ $sel:httpStatus:BatchGetFieldResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:errors:BatchGetFieldResponse' :: [FieldError]
errors = forall a. Monoid a => a
Prelude.mempty,
$sel:fields:BatchGetFieldResponse' :: [GetFieldResponse]
fields = forall a. Monoid a => a
Prelude.mempty
}
batchGetFieldResponse_httpStatus :: Lens.Lens' BatchGetFieldResponse Prelude.Int
batchGetFieldResponse_httpStatus :: Lens' BatchGetFieldResponse Int
batchGetFieldResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetFieldResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchGetFieldResponse' :: BatchGetFieldResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchGetFieldResponse
s@BatchGetFieldResponse' {} Int
a -> BatchGetFieldResponse
s {$sel:httpStatus:BatchGetFieldResponse' :: Int
httpStatus = Int
a} :: BatchGetFieldResponse)
batchGetFieldResponse_errors :: Lens.Lens' BatchGetFieldResponse [FieldError]
batchGetFieldResponse_errors :: Lens' BatchGetFieldResponse [FieldError]
batchGetFieldResponse_errors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetFieldResponse' {[FieldError]
errors :: [FieldError]
$sel:errors:BatchGetFieldResponse' :: BatchGetFieldResponse -> [FieldError]
errors} -> [FieldError]
errors) (\s :: BatchGetFieldResponse
s@BatchGetFieldResponse' {} [FieldError]
a -> BatchGetFieldResponse
s {$sel:errors:BatchGetFieldResponse' :: [FieldError]
errors = [FieldError]
a} :: BatchGetFieldResponse) 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
batchGetFieldResponse_fields :: Lens.Lens' BatchGetFieldResponse [GetFieldResponse]
batchGetFieldResponse_fields :: Lens' BatchGetFieldResponse [GetFieldResponse]
batchGetFieldResponse_fields = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchGetFieldResponse' {[GetFieldResponse]
fields :: [GetFieldResponse]
$sel:fields:BatchGetFieldResponse' :: BatchGetFieldResponse -> [GetFieldResponse]
fields} -> [GetFieldResponse]
fields) (\s :: BatchGetFieldResponse
s@BatchGetFieldResponse' {} [GetFieldResponse]
a -> BatchGetFieldResponse
s {$sel:fields:BatchGetFieldResponse' :: [GetFieldResponse]
fields = [GetFieldResponse]
a} :: BatchGetFieldResponse) 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 Prelude.NFData BatchGetFieldResponse where
rnf :: BatchGetFieldResponse -> ()
rnf BatchGetFieldResponse' {Int
[FieldError]
[GetFieldResponse]
fields :: [GetFieldResponse]
errors :: [FieldError]
httpStatus :: Int
$sel:fields:BatchGetFieldResponse' :: BatchGetFieldResponse -> [GetFieldResponse]
$sel:errors:BatchGetFieldResponse' :: BatchGetFieldResponse -> [FieldError]
$sel:httpStatus:BatchGetFieldResponse' :: BatchGetFieldResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [FieldError]
errors
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [GetFieldResponse]
fields