{-# 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.ListFields
(
ListFields (..),
newListFields,
listFields_maxResults,
listFields_nextToken,
listFields_domainId,
ListFieldsResponse (..),
newListFieldsResponse,
listFieldsResponse_nextToken,
listFieldsResponse_httpStatus,
listFieldsResponse_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 ListFields = ListFields'
{
ListFields -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListFields -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListFields -> Text
domainId :: Prelude.Text
}
deriving (ListFields -> ListFields -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFields -> ListFields -> Bool
$c/= :: ListFields -> ListFields -> Bool
== :: ListFields -> ListFields -> Bool
$c== :: ListFields -> ListFields -> Bool
Prelude.Eq, ReadPrec [ListFields]
ReadPrec ListFields
Int -> ReadS ListFields
ReadS [ListFields]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFields]
$creadListPrec :: ReadPrec [ListFields]
readPrec :: ReadPrec ListFields
$creadPrec :: ReadPrec ListFields
readList :: ReadS [ListFields]
$creadList :: ReadS [ListFields]
readsPrec :: Int -> ReadS ListFields
$creadsPrec :: Int -> ReadS ListFields
Prelude.Read, Int -> ListFields -> ShowS
[ListFields] -> ShowS
ListFields -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFields] -> ShowS
$cshowList :: [ListFields] -> ShowS
show :: ListFields -> String
$cshow :: ListFields -> String
showsPrec :: Int -> ListFields -> ShowS
$cshowsPrec :: Int -> ListFields -> ShowS
Prelude.Show, forall x. Rep ListFields x -> ListFields
forall x. ListFields -> Rep ListFields x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFields x -> ListFields
$cfrom :: forall x. ListFields -> Rep ListFields x
Prelude.Generic)
newListFields ::
Prelude.Text ->
ListFields
newListFields :: Text -> ListFields
newListFields Text
pDomainId_ =
ListFields'
{ $sel:maxResults:ListFields' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListFields' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:domainId:ListFields' :: Text
domainId = Text
pDomainId_
}
listFields_maxResults :: Lens.Lens' ListFields (Prelude.Maybe Prelude.Natural)
listFields_maxResults :: Lens' ListFields (Maybe Natural)
listFields_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFields' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListFields' :: ListFields -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListFields
s@ListFields' {} Maybe Natural
a -> ListFields
s {$sel:maxResults:ListFields' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListFields)
listFields_nextToken :: Lens.Lens' ListFields (Prelude.Maybe Prelude.Text)
listFields_nextToken :: Lens' ListFields (Maybe Text)
listFields_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFields' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFields' :: ListFields -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFields
s@ListFields' {} Maybe Text
a -> ListFields
s {$sel:nextToken:ListFields' :: Maybe Text
nextToken = Maybe Text
a} :: ListFields)
listFields_domainId :: Lens.Lens' ListFields Prelude.Text
listFields_domainId :: Lens' ListFields Text
listFields_domainId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFields' {Text
domainId :: Text
$sel:domainId:ListFields' :: ListFields -> Text
domainId} -> Text
domainId) (\s :: ListFields
s@ListFields' {} Text
a -> ListFields
s {$sel:domainId:ListFields' :: Text
domainId = Text
a} :: ListFields)
instance Core.AWSRequest ListFields where
type AWSResponse ListFields = ListFieldsResponse
request :: (Service -> Service) -> ListFields -> Request ListFields
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 ListFields
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListFields)))
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 Text -> Int -> [FieldSummary] -> ListFieldsResponse
ListFieldsResponse'
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
"nextToken")
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))
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 ListFields where
hashWithSalt :: Int -> ListFields -> Int
hashWithSalt Int
_salt ListFields' {Maybe Natural
Maybe Text
Text
domainId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:domainId:ListFields' :: ListFields -> Text
$sel:nextToken:ListFields' :: ListFields -> Maybe Text
$sel:maxResults:ListFields' :: ListFields -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainId
instance Prelude.NFData ListFields where
rnf :: ListFields -> ()
rnf ListFields' {Maybe Natural
Maybe Text
Text
domainId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:domainId:ListFields' :: ListFields -> Text
$sel:nextToken:ListFields' :: ListFields -> Maybe Text
$sel:maxResults:ListFields' :: ListFields -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
domainId
instance Data.ToHeaders ListFields where
toHeaders :: ListFields -> 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 ListFields where
toJSON :: ListFields -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)
instance Data.ToPath ListFields where
toPath :: ListFields -> ByteString
toPath ListFields' {Maybe Natural
Maybe Text
Text
domainId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:domainId:ListFields' :: ListFields -> Text
$sel:nextToken:ListFields' :: ListFields -> Maybe Text
$sel:maxResults:ListFields' :: ListFields -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/domains/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
domainId, ByteString
"/fields-list"]
instance Data.ToQuery ListFields where
toQuery :: ListFields -> QueryString
toQuery ListFields' {Maybe Natural
Maybe Text
Text
domainId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:domainId:ListFields' :: ListFields -> Text
$sel:nextToken:ListFields' :: ListFields -> Maybe Text
$sel:maxResults:ListFields' :: ListFields -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListFieldsResponse = ListFieldsResponse'
{
ListFieldsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListFieldsResponse -> Int
httpStatus :: Prelude.Int,
ListFieldsResponse -> [FieldSummary]
fields :: [FieldSummary]
}
deriving (ListFieldsResponse -> ListFieldsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListFieldsResponse -> ListFieldsResponse -> Bool
$c/= :: ListFieldsResponse -> ListFieldsResponse -> Bool
== :: ListFieldsResponse -> ListFieldsResponse -> Bool
$c== :: ListFieldsResponse -> ListFieldsResponse -> Bool
Prelude.Eq, ReadPrec [ListFieldsResponse]
ReadPrec ListFieldsResponse
Int -> ReadS ListFieldsResponse
ReadS [ListFieldsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListFieldsResponse]
$creadListPrec :: ReadPrec [ListFieldsResponse]
readPrec :: ReadPrec ListFieldsResponse
$creadPrec :: ReadPrec ListFieldsResponse
readList :: ReadS [ListFieldsResponse]
$creadList :: ReadS [ListFieldsResponse]
readsPrec :: Int -> ReadS ListFieldsResponse
$creadsPrec :: Int -> ReadS ListFieldsResponse
Prelude.Read, Int -> ListFieldsResponse -> ShowS
[ListFieldsResponse] -> ShowS
ListFieldsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListFieldsResponse] -> ShowS
$cshowList :: [ListFieldsResponse] -> ShowS
show :: ListFieldsResponse -> String
$cshow :: ListFieldsResponse -> String
showsPrec :: Int -> ListFieldsResponse -> ShowS
$cshowsPrec :: Int -> ListFieldsResponse -> ShowS
Prelude.Show, forall x. Rep ListFieldsResponse x -> ListFieldsResponse
forall x. ListFieldsResponse -> Rep ListFieldsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListFieldsResponse x -> ListFieldsResponse
$cfrom :: forall x. ListFieldsResponse -> Rep ListFieldsResponse x
Prelude.Generic)
newListFieldsResponse ::
Prelude.Int ->
ListFieldsResponse
newListFieldsResponse :: Int -> ListFieldsResponse
newListFieldsResponse Int
pHttpStatus_ =
ListFieldsResponse'
{ $sel:nextToken:ListFieldsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListFieldsResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:fields:ListFieldsResponse' :: [FieldSummary]
fields = forall a. Monoid a => a
Prelude.mempty
}
listFieldsResponse_nextToken :: Lens.Lens' ListFieldsResponse (Prelude.Maybe Prelude.Text)
listFieldsResponse_nextToken :: Lens' ListFieldsResponse (Maybe Text)
listFieldsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFieldsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListFieldsResponse' :: ListFieldsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListFieldsResponse
s@ListFieldsResponse' {} Maybe Text
a -> ListFieldsResponse
s {$sel:nextToken:ListFieldsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListFieldsResponse)
listFieldsResponse_httpStatus :: Lens.Lens' ListFieldsResponse Prelude.Int
listFieldsResponse_httpStatus :: Lens' ListFieldsResponse Int
listFieldsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFieldsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListFieldsResponse' :: ListFieldsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListFieldsResponse
s@ListFieldsResponse' {} Int
a -> ListFieldsResponse
s {$sel:httpStatus:ListFieldsResponse' :: Int
httpStatus = Int
a} :: ListFieldsResponse)
listFieldsResponse_fields :: Lens.Lens' ListFieldsResponse [FieldSummary]
listFieldsResponse_fields :: Lens' ListFieldsResponse [FieldSummary]
listFieldsResponse_fields = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListFieldsResponse' {[FieldSummary]
fields :: [FieldSummary]
$sel:fields:ListFieldsResponse' :: ListFieldsResponse -> [FieldSummary]
fields} -> [FieldSummary]
fields) (\s :: ListFieldsResponse
s@ListFieldsResponse' {} [FieldSummary]
a -> ListFieldsResponse
s {$sel:fields:ListFieldsResponse' :: [FieldSummary]
fields = [FieldSummary]
a} :: ListFieldsResponse) 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 ListFieldsResponse where
rnf :: ListFieldsResponse -> ()
rnf ListFieldsResponse' {Int
[FieldSummary]
Maybe Text
fields :: [FieldSummary]
httpStatus :: Int
nextToken :: Maybe Text
$sel:fields:ListFieldsResponse' :: ListFieldsResponse -> [FieldSummary]
$sel:httpStatus:ListFieldsResponse' :: ListFieldsResponse -> Int
$sel:nextToken:ListFieldsResponse' :: ListFieldsResponse -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` 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 [FieldSummary]
fields