{-# 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.CustomerProfiles.GetMatches
(
GetMatches (..),
newGetMatches,
getMatches_maxResults,
getMatches_nextToken,
getMatches_domainName,
GetMatchesResponse (..),
newGetMatchesResponse,
getMatchesResponse_matchGenerationDate,
getMatchesResponse_matches,
getMatchesResponse_nextToken,
getMatchesResponse_potentialMatches,
getMatchesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import Amazonka.CustomerProfiles.Types
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 GetMatches = GetMatches'
{
GetMatches -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
GetMatches -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetMatches -> Text
domainName :: Prelude.Text
}
deriving (GetMatches -> GetMatches -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMatches -> GetMatches -> Bool
$c/= :: GetMatches -> GetMatches -> Bool
== :: GetMatches -> GetMatches -> Bool
$c== :: GetMatches -> GetMatches -> Bool
Prelude.Eq, ReadPrec [GetMatches]
ReadPrec GetMatches
Int -> ReadS GetMatches
ReadS [GetMatches]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMatches]
$creadListPrec :: ReadPrec [GetMatches]
readPrec :: ReadPrec GetMatches
$creadPrec :: ReadPrec GetMatches
readList :: ReadS [GetMatches]
$creadList :: ReadS [GetMatches]
readsPrec :: Int -> ReadS GetMatches
$creadsPrec :: Int -> ReadS GetMatches
Prelude.Read, Int -> GetMatches -> ShowS
[GetMatches] -> ShowS
GetMatches -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMatches] -> ShowS
$cshowList :: [GetMatches] -> ShowS
show :: GetMatches -> String
$cshow :: GetMatches -> String
showsPrec :: Int -> GetMatches -> ShowS
$cshowsPrec :: Int -> GetMatches -> ShowS
Prelude.Show, forall x. Rep GetMatches x -> GetMatches
forall x. GetMatches -> Rep GetMatches x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMatches x -> GetMatches
$cfrom :: forall x. GetMatches -> Rep GetMatches x
Prelude.Generic)
newGetMatches ::
Prelude.Text ->
GetMatches
newGetMatches :: Text -> GetMatches
newGetMatches Text
pDomainName_ =
GetMatches'
{ $sel:maxResults:GetMatches' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetMatches' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:domainName:GetMatches' :: Text
domainName = Text
pDomainName_
}
getMatches_maxResults :: Lens.Lens' GetMatches (Prelude.Maybe Prelude.Natural)
getMatches_maxResults :: Lens' GetMatches (Maybe Natural)
getMatches_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMatches' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetMatches' :: GetMatches -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetMatches
s@GetMatches' {} Maybe Natural
a -> GetMatches
s {$sel:maxResults:GetMatches' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetMatches)
getMatches_nextToken :: Lens.Lens' GetMatches (Prelude.Maybe Prelude.Text)
getMatches_nextToken :: Lens' GetMatches (Maybe Text)
getMatches_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMatches' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetMatches' :: GetMatches -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetMatches
s@GetMatches' {} Maybe Text
a -> GetMatches
s {$sel:nextToken:GetMatches' :: Maybe Text
nextToken = Maybe Text
a} :: GetMatches)
getMatches_domainName :: Lens.Lens' GetMatches Prelude.Text
getMatches_domainName :: Lens' GetMatches Text
getMatches_domainName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMatches' {Text
domainName :: Text
$sel:domainName:GetMatches' :: GetMatches -> Text
domainName} -> Text
domainName) (\s :: GetMatches
s@GetMatches' {} Text
a -> GetMatches
s {$sel:domainName:GetMatches' :: Text
domainName = Text
a} :: GetMatches)
instance Core.AWSRequest GetMatches where
type AWSResponse GetMatches = GetMatchesResponse
request :: (Service -> Service) -> GetMatches -> Request GetMatches
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetMatches
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetMatches)))
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 POSIX
-> Maybe [MatchItem]
-> Maybe Text
-> Maybe Natural
-> Int
-> GetMatchesResponse
GetMatchesResponse'
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
"MatchGenerationDate")
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
"Matches" 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
"NextToken")
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
"PotentialMatches")
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 GetMatches where
hashWithSalt :: Int -> GetMatches -> Int
hashWithSalt Int
_salt GetMatches' {Maybe Natural
Maybe Text
Text
domainName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:domainName:GetMatches' :: GetMatches -> Text
$sel:nextToken:GetMatches' :: GetMatches -> Maybe Text
$sel:maxResults:GetMatches' :: GetMatches -> 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
domainName
instance Prelude.NFData GetMatches where
rnf :: GetMatches -> ()
rnf GetMatches' {Maybe Natural
Maybe Text
Text
domainName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:domainName:GetMatches' :: GetMatches -> Text
$sel:nextToken:GetMatches' :: GetMatches -> Maybe Text
$sel:maxResults:GetMatches' :: GetMatches -> 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
domainName
instance Data.ToHeaders GetMatches where
toHeaders :: GetMatches -> 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.ToPath GetMatches where
toPath :: GetMatches -> ByteString
toPath GetMatches' {Maybe Natural
Maybe Text
Text
domainName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:domainName:GetMatches' :: GetMatches -> Text
$sel:nextToken:GetMatches' :: GetMatches -> Maybe Text
$sel:maxResults:GetMatches' :: GetMatches -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/domains/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
domainName, ByteString
"/matches"]
instance Data.ToQuery GetMatches where
toQuery :: GetMatches -> QueryString
toQuery GetMatches' {Maybe Natural
Maybe Text
Text
domainName :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:domainName:GetMatches' :: GetMatches -> Text
$sel:nextToken:GetMatches' :: GetMatches -> Maybe Text
$sel:maxResults:GetMatches' :: GetMatches -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"max-results" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"next-token" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data GetMatchesResponse = GetMatchesResponse'
{
GetMatchesResponse -> Maybe POSIX
matchGenerationDate :: Prelude.Maybe Data.POSIX,
GetMatchesResponse -> Maybe [MatchItem]
matches :: Prelude.Maybe [MatchItem],
GetMatchesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetMatchesResponse -> Maybe Natural
potentialMatches :: Prelude.Maybe Prelude.Natural,
GetMatchesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetMatchesResponse -> GetMatchesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetMatchesResponse -> GetMatchesResponse -> Bool
$c/= :: GetMatchesResponse -> GetMatchesResponse -> Bool
== :: GetMatchesResponse -> GetMatchesResponse -> Bool
$c== :: GetMatchesResponse -> GetMatchesResponse -> Bool
Prelude.Eq, ReadPrec [GetMatchesResponse]
ReadPrec GetMatchesResponse
Int -> ReadS GetMatchesResponse
ReadS [GetMatchesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetMatchesResponse]
$creadListPrec :: ReadPrec [GetMatchesResponse]
readPrec :: ReadPrec GetMatchesResponse
$creadPrec :: ReadPrec GetMatchesResponse
readList :: ReadS [GetMatchesResponse]
$creadList :: ReadS [GetMatchesResponse]
readsPrec :: Int -> ReadS GetMatchesResponse
$creadsPrec :: Int -> ReadS GetMatchesResponse
Prelude.Read, Int -> GetMatchesResponse -> ShowS
[GetMatchesResponse] -> ShowS
GetMatchesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetMatchesResponse] -> ShowS
$cshowList :: [GetMatchesResponse] -> ShowS
show :: GetMatchesResponse -> String
$cshow :: GetMatchesResponse -> String
showsPrec :: Int -> GetMatchesResponse -> ShowS
$cshowsPrec :: Int -> GetMatchesResponse -> ShowS
Prelude.Show, forall x. Rep GetMatchesResponse x -> GetMatchesResponse
forall x. GetMatchesResponse -> Rep GetMatchesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetMatchesResponse x -> GetMatchesResponse
$cfrom :: forall x. GetMatchesResponse -> Rep GetMatchesResponse x
Prelude.Generic)
newGetMatchesResponse ::
Prelude.Int ->
GetMatchesResponse
newGetMatchesResponse :: Int -> GetMatchesResponse
newGetMatchesResponse Int
pHttpStatus_ =
GetMatchesResponse'
{ $sel:matchGenerationDate:GetMatchesResponse' :: Maybe POSIX
matchGenerationDate =
forall a. Maybe a
Prelude.Nothing,
$sel:matches:GetMatchesResponse' :: Maybe [MatchItem]
matches = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetMatchesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:potentialMatches:GetMatchesResponse' :: Maybe Natural
potentialMatches = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetMatchesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getMatchesResponse_matchGenerationDate :: Lens.Lens' GetMatchesResponse (Prelude.Maybe Prelude.UTCTime)
getMatchesResponse_matchGenerationDate :: Lens' GetMatchesResponse (Maybe UTCTime)
getMatchesResponse_matchGenerationDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMatchesResponse' {Maybe POSIX
matchGenerationDate :: Maybe POSIX
$sel:matchGenerationDate:GetMatchesResponse' :: GetMatchesResponse -> Maybe POSIX
matchGenerationDate} -> Maybe POSIX
matchGenerationDate) (\s :: GetMatchesResponse
s@GetMatchesResponse' {} Maybe POSIX
a -> GetMatchesResponse
s {$sel:matchGenerationDate:GetMatchesResponse' :: Maybe POSIX
matchGenerationDate = Maybe POSIX
a} :: GetMatchesResponse) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time
getMatchesResponse_matches :: Lens.Lens' GetMatchesResponse (Prelude.Maybe [MatchItem])
getMatchesResponse_matches :: Lens' GetMatchesResponse (Maybe [MatchItem])
getMatchesResponse_matches = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMatchesResponse' {Maybe [MatchItem]
matches :: Maybe [MatchItem]
$sel:matches:GetMatchesResponse' :: GetMatchesResponse -> Maybe [MatchItem]
matches} -> Maybe [MatchItem]
matches) (\s :: GetMatchesResponse
s@GetMatchesResponse' {} Maybe [MatchItem]
a -> GetMatchesResponse
s {$sel:matches:GetMatchesResponse' :: Maybe [MatchItem]
matches = Maybe [MatchItem]
a} :: GetMatchesResponse) 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
getMatchesResponse_nextToken :: Lens.Lens' GetMatchesResponse (Prelude.Maybe Prelude.Text)
getMatchesResponse_nextToken :: Lens' GetMatchesResponse (Maybe Text)
getMatchesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMatchesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetMatchesResponse' :: GetMatchesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetMatchesResponse
s@GetMatchesResponse' {} Maybe Text
a -> GetMatchesResponse
s {$sel:nextToken:GetMatchesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetMatchesResponse)
getMatchesResponse_potentialMatches :: Lens.Lens' GetMatchesResponse (Prelude.Maybe Prelude.Natural)
getMatchesResponse_potentialMatches :: Lens' GetMatchesResponse (Maybe Natural)
getMatchesResponse_potentialMatches = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMatchesResponse' {Maybe Natural
potentialMatches :: Maybe Natural
$sel:potentialMatches:GetMatchesResponse' :: GetMatchesResponse -> Maybe Natural
potentialMatches} -> Maybe Natural
potentialMatches) (\s :: GetMatchesResponse
s@GetMatchesResponse' {} Maybe Natural
a -> GetMatchesResponse
s {$sel:potentialMatches:GetMatchesResponse' :: Maybe Natural
potentialMatches = Maybe Natural
a} :: GetMatchesResponse)
getMatchesResponse_httpStatus :: Lens.Lens' GetMatchesResponse Prelude.Int
getMatchesResponse_httpStatus :: Lens' GetMatchesResponse Int
getMatchesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetMatchesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetMatchesResponse' :: GetMatchesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetMatchesResponse
s@GetMatchesResponse' {} Int
a -> GetMatchesResponse
s {$sel:httpStatus:GetMatchesResponse' :: Int
httpStatus = Int
a} :: GetMatchesResponse)
instance Prelude.NFData GetMatchesResponse where
rnf :: GetMatchesResponse -> ()
rnf GetMatchesResponse' {Int
Maybe Natural
Maybe [MatchItem]
Maybe Text
Maybe POSIX
httpStatus :: Int
potentialMatches :: Maybe Natural
nextToken :: Maybe Text
matches :: Maybe [MatchItem]
matchGenerationDate :: Maybe POSIX
$sel:httpStatus:GetMatchesResponse' :: GetMatchesResponse -> Int
$sel:potentialMatches:GetMatchesResponse' :: GetMatchesResponse -> Maybe Natural
$sel:nextToken:GetMatchesResponse' :: GetMatchesResponse -> Maybe Text
$sel:matches:GetMatchesResponse' :: GetMatchesResponse -> Maybe [MatchItem]
$sel:matchGenerationDate:GetMatchesResponse' :: GetMatchesResponse -> Maybe POSIX
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
matchGenerationDate
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [MatchItem]
matches
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 Maybe Natural
potentialMatches
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus