{-# 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.ListCasesForContact
(
ListCasesForContact (..),
newListCasesForContact,
listCasesForContact_maxResults,
listCasesForContact_nextToken,
listCasesForContact_contactArn,
listCasesForContact_domainId,
ListCasesForContactResponse (..),
newListCasesForContactResponse,
listCasesForContactResponse_nextToken,
listCasesForContactResponse_httpStatus,
listCasesForContactResponse_cases,
)
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 ListCasesForContact = ListCasesForContact'
{
ListCasesForContact -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListCasesForContact -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListCasesForContact -> Text
contactArn :: Prelude.Text,
ListCasesForContact -> Text
domainId :: Prelude.Text
}
deriving (ListCasesForContact -> ListCasesForContact -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCasesForContact -> ListCasesForContact -> Bool
$c/= :: ListCasesForContact -> ListCasesForContact -> Bool
== :: ListCasesForContact -> ListCasesForContact -> Bool
$c== :: ListCasesForContact -> ListCasesForContact -> Bool
Prelude.Eq, ReadPrec [ListCasesForContact]
ReadPrec ListCasesForContact
Int -> ReadS ListCasesForContact
ReadS [ListCasesForContact]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCasesForContact]
$creadListPrec :: ReadPrec [ListCasesForContact]
readPrec :: ReadPrec ListCasesForContact
$creadPrec :: ReadPrec ListCasesForContact
readList :: ReadS [ListCasesForContact]
$creadList :: ReadS [ListCasesForContact]
readsPrec :: Int -> ReadS ListCasesForContact
$creadsPrec :: Int -> ReadS ListCasesForContact
Prelude.Read, Int -> ListCasesForContact -> ShowS
[ListCasesForContact] -> ShowS
ListCasesForContact -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCasesForContact] -> ShowS
$cshowList :: [ListCasesForContact] -> ShowS
show :: ListCasesForContact -> String
$cshow :: ListCasesForContact -> String
showsPrec :: Int -> ListCasesForContact -> ShowS
$cshowsPrec :: Int -> ListCasesForContact -> ShowS
Prelude.Show, forall x. Rep ListCasesForContact x -> ListCasesForContact
forall x. ListCasesForContact -> Rep ListCasesForContact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListCasesForContact x -> ListCasesForContact
$cfrom :: forall x. ListCasesForContact -> Rep ListCasesForContact x
Prelude.Generic)
newListCasesForContact ::
Prelude.Text ->
Prelude.Text ->
ListCasesForContact
newListCasesForContact :: Text -> Text -> ListCasesForContact
newListCasesForContact Text
pContactArn_ Text
pDomainId_ =
ListCasesForContact'
{ $sel:maxResults:ListCasesForContact' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListCasesForContact' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:contactArn:ListCasesForContact' :: Text
contactArn = Text
pContactArn_,
$sel:domainId:ListCasesForContact' :: Text
domainId = Text
pDomainId_
}
listCasesForContact_maxResults :: Lens.Lens' ListCasesForContact (Prelude.Maybe Prelude.Natural)
listCasesForContact_maxResults :: Lens' ListCasesForContact (Maybe Natural)
listCasesForContact_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCasesForContact' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListCasesForContact' :: ListCasesForContact -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListCasesForContact
s@ListCasesForContact' {} Maybe Natural
a -> ListCasesForContact
s {$sel:maxResults:ListCasesForContact' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListCasesForContact)
listCasesForContact_nextToken :: Lens.Lens' ListCasesForContact (Prelude.Maybe Prelude.Text)
listCasesForContact_nextToken :: Lens' ListCasesForContact (Maybe Text)
listCasesForContact_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCasesForContact' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCasesForContact' :: ListCasesForContact -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCasesForContact
s@ListCasesForContact' {} Maybe Text
a -> ListCasesForContact
s {$sel:nextToken:ListCasesForContact' :: Maybe Text
nextToken = Maybe Text
a} :: ListCasesForContact)
listCasesForContact_contactArn :: Lens.Lens' ListCasesForContact Prelude.Text
listCasesForContact_contactArn :: Lens' ListCasesForContact Text
listCasesForContact_contactArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCasesForContact' {Text
contactArn :: Text
$sel:contactArn:ListCasesForContact' :: ListCasesForContact -> Text
contactArn} -> Text
contactArn) (\s :: ListCasesForContact
s@ListCasesForContact' {} Text
a -> ListCasesForContact
s {$sel:contactArn:ListCasesForContact' :: Text
contactArn = Text
a} :: ListCasesForContact)
listCasesForContact_domainId :: Lens.Lens' ListCasesForContact Prelude.Text
listCasesForContact_domainId :: Lens' ListCasesForContact Text
listCasesForContact_domainId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCasesForContact' {Text
domainId :: Text
$sel:domainId:ListCasesForContact' :: ListCasesForContact -> Text
domainId} -> Text
domainId) (\s :: ListCasesForContact
s@ListCasesForContact' {} Text
a -> ListCasesForContact
s {$sel:domainId:ListCasesForContact' :: Text
domainId = Text
a} :: ListCasesForContact)
instance Core.AWSRequest ListCasesForContact where
type
AWSResponse ListCasesForContact =
ListCasesForContactResponse
request :: (Service -> Service)
-> ListCasesForContact -> Request ListCasesForContact
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 ListCasesForContact
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListCasesForContact)))
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 -> [CaseSummary] -> ListCasesForContactResponse
ListCasesForContactResponse'
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
"cases" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListCasesForContact where
hashWithSalt :: Int -> ListCasesForContact -> Int
hashWithSalt Int
_salt ListCasesForContact' {Maybe Natural
Maybe Text
Text
domainId :: Text
contactArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:domainId:ListCasesForContact' :: ListCasesForContact -> Text
$sel:contactArn:ListCasesForContact' :: ListCasesForContact -> Text
$sel:nextToken:ListCasesForContact' :: ListCasesForContact -> Maybe Text
$sel:maxResults:ListCasesForContact' :: ListCasesForContact -> 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
contactArn
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
domainId
instance Prelude.NFData ListCasesForContact where
rnf :: ListCasesForContact -> ()
rnf ListCasesForContact' {Maybe Natural
Maybe Text
Text
domainId :: Text
contactArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:domainId:ListCasesForContact' :: ListCasesForContact -> Text
$sel:contactArn:ListCasesForContact' :: ListCasesForContact -> Text
$sel:nextToken:ListCasesForContact' :: ListCasesForContact -> Maybe Text
$sel:maxResults:ListCasesForContact' :: ListCasesForContact -> 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
contactArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
domainId
instance Data.ToHeaders ListCasesForContact where
toHeaders :: ListCasesForContact -> 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 ListCasesForContact where
toJSON :: ListCasesForContact -> Value
toJSON ListCasesForContact' {Maybe Natural
Maybe Text
Text
domainId :: Text
contactArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:domainId:ListCasesForContact' :: ListCasesForContact -> Text
$sel:contactArn:ListCasesForContact' :: ListCasesForContact -> Text
$sel:nextToken:ListCasesForContact' :: ListCasesForContact -> Maybe Text
$sel:maxResults:ListCasesForContact' :: ListCasesForContact -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
forall a. a -> Maybe a
Prelude.Just (Key
"contactArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
contactArn)
]
)
instance Data.ToPath ListCasesForContact where
toPath :: ListCasesForContact -> ByteString
toPath ListCasesForContact' {Maybe Natural
Maybe Text
Text
domainId :: Text
contactArn :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:domainId:ListCasesForContact' :: ListCasesForContact -> Text
$sel:contactArn:ListCasesForContact' :: ListCasesForContact -> Text
$sel:nextToken:ListCasesForContact' :: ListCasesForContact -> Maybe Text
$sel:maxResults:ListCasesForContact' :: ListCasesForContact -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/domains/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
domainId,
ByteString
"/list-cases-for-contact"
]
instance Data.ToQuery ListCasesForContact where
toQuery :: ListCasesForContact -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListCasesForContactResponse = ListCasesForContactResponse'
{
ListCasesForContactResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListCasesForContactResponse -> Int
httpStatus :: Prelude.Int,
ListCasesForContactResponse -> [CaseSummary]
cases :: [CaseSummary]
}
deriving (ListCasesForContactResponse -> ListCasesForContactResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCasesForContactResponse -> ListCasesForContactResponse -> Bool
$c/= :: ListCasesForContactResponse -> ListCasesForContactResponse -> Bool
== :: ListCasesForContactResponse -> ListCasesForContactResponse -> Bool
$c== :: ListCasesForContactResponse -> ListCasesForContactResponse -> Bool
Prelude.Eq, ReadPrec [ListCasesForContactResponse]
ReadPrec ListCasesForContactResponse
Int -> ReadS ListCasesForContactResponse
ReadS [ListCasesForContactResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCasesForContactResponse]
$creadListPrec :: ReadPrec [ListCasesForContactResponse]
readPrec :: ReadPrec ListCasesForContactResponse
$creadPrec :: ReadPrec ListCasesForContactResponse
readList :: ReadS [ListCasesForContactResponse]
$creadList :: ReadS [ListCasesForContactResponse]
readsPrec :: Int -> ReadS ListCasesForContactResponse
$creadsPrec :: Int -> ReadS ListCasesForContactResponse
Prelude.Read, Int -> ListCasesForContactResponse -> ShowS
[ListCasesForContactResponse] -> ShowS
ListCasesForContactResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCasesForContactResponse] -> ShowS
$cshowList :: [ListCasesForContactResponse] -> ShowS
show :: ListCasesForContactResponse -> String
$cshow :: ListCasesForContactResponse -> String
showsPrec :: Int -> ListCasesForContactResponse -> ShowS
$cshowsPrec :: Int -> ListCasesForContactResponse -> ShowS
Prelude.Show, forall x.
Rep ListCasesForContactResponse x -> ListCasesForContactResponse
forall x.
ListCasesForContactResponse -> Rep ListCasesForContactResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListCasesForContactResponse x -> ListCasesForContactResponse
$cfrom :: forall x.
ListCasesForContactResponse -> Rep ListCasesForContactResponse x
Prelude.Generic)
newListCasesForContactResponse ::
Prelude.Int ->
ListCasesForContactResponse
newListCasesForContactResponse :: Int -> ListCasesForContactResponse
newListCasesForContactResponse Int
pHttpStatus_ =
ListCasesForContactResponse'
{ $sel:nextToken:ListCasesForContactResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListCasesForContactResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:cases:ListCasesForContactResponse' :: [CaseSummary]
cases = forall a. Monoid a => a
Prelude.mempty
}
listCasesForContactResponse_nextToken :: Lens.Lens' ListCasesForContactResponse (Prelude.Maybe Prelude.Text)
listCasesForContactResponse_nextToken :: Lens' ListCasesForContactResponse (Maybe Text)
listCasesForContactResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCasesForContactResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCasesForContactResponse' :: ListCasesForContactResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCasesForContactResponse
s@ListCasesForContactResponse' {} Maybe Text
a -> ListCasesForContactResponse
s {$sel:nextToken:ListCasesForContactResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListCasesForContactResponse)
listCasesForContactResponse_httpStatus :: Lens.Lens' ListCasesForContactResponse Prelude.Int
listCasesForContactResponse_httpStatus :: Lens' ListCasesForContactResponse Int
listCasesForContactResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCasesForContactResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListCasesForContactResponse' :: ListCasesForContactResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListCasesForContactResponse
s@ListCasesForContactResponse' {} Int
a -> ListCasesForContactResponse
s {$sel:httpStatus:ListCasesForContactResponse' :: Int
httpStatus = Int
a} :: ListCasesForContactResponse)
listCasesForContactResponse_cases :: Lens.Lens' ListCasesForContactResponse [CaseSummary]
listCasesForContactResponse_cases :: Lens' ListCasesForContactResponse [CaseSummary]
listCasesForContactResponse_cases = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCasesForContactResponse' {[CaseSummary]
cases :: [CaseSummary]
$sel:cases:ListCasesForContactResponse' :: ListCasesForContactResponse -> [CaseSummary]
cases} -> [CaseSummary]
cases) (\s :: ListCasesForContactResponse
s@ListCasesForContactResponse' {} [CaseSummary]
a -> ListCasesForContactResponse
s {$sel:cases:ListCasesForContactResponse' :: [CaseSummary]
cases = [CaseSummary]
a} :: ListCasesForContactResponse) 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 ListCasesForContactResponse where
rnf :: ListCasesForContactResponse -> ()
rnf ListCasesForContactResponse' {Int
[CaseSummary]
Maybe Text
cases :: [CaseSummary]
httpStatus :: Int
nextToken :: Maybe Text
$sel:cases:ListCasesForContactResponse' :: ListCasesForContactResponse -> [CaseSummary]
$sel:httpStatus:ListCasesForContactResponse' :: ListCasesForContactResponse -> Int
$sel:nextToken:ListCasesForContactResponse' :: ListCasesForContactResponse -> 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 [CaseSummary]
cases