{-# 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.Rekognition.GetCelebrityInfo
(
GetCelebrityInfo (..),
newGetCelebrityInfo,
getCelebrityInfo_id,
GetCelebrityInfoResponse (..),
newGetCelebrityInfoResponse,
getCelebrityInfoResponse_urls,
getCelebrityInfoResponse_knownGender,
getCelebrityInfoResponse_name,
getCelebrityInfoResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Rekognition.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetCelebrityInfo = GetCelebrityInfo'
{
GetCelebrityInfo -> Text
id :: Prelude.Text
}
deriving (GetCelebrityInfo -> GetCelebrityInfo -> Bool
(GetCelebrityInfo -> GetCelebrityInfo -> Bool)
-> (GetCelebrityInfo -> GetCelebrityInfo -> Bool)
-> Eq GetCelebrityInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCelebrityInfo -> GetCelebrityInfo -> Bool
$c/= :: GetCelebrityInfo -> GetCelebrityInfo -> Bool
== :: GetCelebrityInfo -> GetCelebrityInfo -> Bool
$c== :: GetCelebrityInfo -> GetCelebrityInfo -> Bool
Prelude.Eq, ReadPrec [GetCelebrityInfo]
ReadPrec GetCelebrityInfo
Int -> ReadS GetCelebrityInfo
ReadS [GetCelebrityInfo]
(Int -> ReadS GetCelebrityInfo)
-> ReadS [GetCelebrityInfo]
-> ReadPrec GetCelebrityInfo
-> ReadPrec [GetCelebrityInfo]
-> Read GetCelebrityInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCelebrityInfo]
$creadListPrec :: ReadPrec [GetCelebrityInfo]
readPrec :: ReadPrec GetCelebrityInfo
$creadPrec :: ReadPrec GetCelebrityInfo
readList :: ReadS [GetCelebrityInfo]
$creadList :: ReadS [GetCelebrityInfo]
readsPrec :: Int -> ReadS GetCelebrityInfo
$creadsPrec :: Int -> ReadS GetCelebrityInfo
Prelude.Read, Int -> GetCelebrityInfo -> ShowS
[GetCelebrityInfo] -> ShowS
GetCelebrityInfo -> String
(Int -> GetCelebrityInfo -> ShowS)
-> (GetCelebrityInfo -> String)
-> ([GetCelebrityInfo] -> ShowS)
-> Show GetCelebrityInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCelebrityInfo] -> ShowS
$cshowList :: [GetCelebrityInfo] -> ShowS
show :: GetCelebrityInfo -> String
$cshow :: GetCelebrityInfo -> String
showsPrec :: Int -> GetCelebrityInfo -> ShowS
$cshowsPrec :: Int -> GetCelebrityInfo -> ShowS
Prelude.Show, (forall x. GetCelebrityInfo -> Rep GetCelebrityInfo x)
-> (forall x. Rep GetCelebrityInfo x -> GetCelebrityInfo)
-> Generic GetCelebrityInfo
forall x. Rep GetCelebrityInfo x -> GetCelebrityInfo
forall x. GetCelebrityInfo -> Rep GetCelebrityInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetCelebrityInfo x -> GetCelebrityInfo
$cfrom :: forall x. GetCelebrityInfo -> Rep GetCelebrityInfo x
Prelude.Generic)
newGetCelebrityInfo ::
Prelude.Text ->
GetCelebrityInfo
newGetCelebrityInfo :: Text -> GetCelebrityInfo
newGetCelebrityInfo Text
pId_ =
GetCelebrityInfo' :: Text -> GetCelebrityInfo
GetCelebrityInfo' {$sel:id:GetCelebrityInfo' :: Text
id = Text
pId_}
getCelebrityInfo_id :: Lens.Lens' GetCelebrityInfo Prelude.Text
getCelebrityInfo_id :: (Text -> f Text) -> GetCelebrityInfo -> f GetCelebrityInfo
getCelebrityInfo_id = (GetCelebrityInfo -> Text)
-> (GetCelebrityInfo -> Text -> GetCelebrityInfo)
-> Lens GetCelebrityInfo GetCelebrityInfo Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCelebrityInfo' {Text
id :: Text
$sel:id:GetCelebrityInfo' :: GetCelebrityInfo -> Text
id} -> Text
id) (\s :: GetCelebrityInfo
s@GetCelebrityInfo' {} Text
a -> GetCelebrityInfo
s {$sel:id:GetCelebrityInfo' :: Text
id = Text
a} :: GetCelebrityInfo)
instance Core.AWSRequest GetCelebrityInfo where
type
AWSResponse GetCelebrityInfo =
GetCelebrityInfoResponse
request :: GetCelebrityInfo -> Request GetCelebrityInfo
request = Service -> GetCelebrityInfo -> Request GetCelebrityInfo
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetCelebrityInfo
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCelebrityInfo)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetCelebrityInfo))
-> Logger
-> Service
-> Proxy GetCelebrityInfo
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetCelebrityInfo)))
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 [Text]
-> Maybe KnownGender
-> Maybe Text
-> Int
-> GetCelebrityInfoResponse
GetCelebrityInfoResponse'
(Maybe [Text]
-> Maybe KnownGender
-> Maybe Text
-> Int
-> GetCelebrityInfoResponse)
-> Either String (Maybe [Text])
-> Either
String
(Maybe KnownGender
-> Maybe Text -> Int -> GetCelebrityInfoResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Urls" Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
Either
String
(Maybe KnownGender
-> Maybe Text -> Int -> GetCelebrityInfoResponse)
-> Either String (Maybe KnownGender)
-> Either String (Maybe Text -> Int -> GetCelebrityInfoResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe KnownGender)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"KnownGender")
Either String (Maybe Text -> Int -> GetCelebrityInfoResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetCelebrityInfoResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Name")
Either String (Int -> GetCelebrityInfoResponse)
-> Either String Int -> Either String GetCelebrityInfoResponse
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 GetCelebrityInfo
instance Prelude.NFData GetCelebrityInfo
instance Core.ToHeaders GetCelebrityInfo where
toHeaders :: GetCelebrityInfo -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetCelebrityInfo -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"RekognitionService.GetCelebrityInfo" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON GetCelebrityInfo where
toJSON :: GetCelebrityInfo -> Value
toJSON GetCelebrityInfo' {Text
id :: Text
$sel:id:GetCelebrityInfo' :: GetCelebrityInfo -> 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
"Id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
id)])
instance Core.ToPath GetCelebrityInfo where
toPath :: GetCelebrityInfo -> ByteString
toPath = ByteString -> GetCelebrityInfo -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetCelebrityInfo where
toQuery :: GetCelebrityInfo -> QueryString
toQuery = QueryString -> GetCelebrityInfo -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetCelebrityInfoResponse = GetCelebrityInfoResponse'
{
GetCelebrityInfoResponse -> Maybe [Text]
urls :: Prelude.Maybe [Prelude.Text],
GetCelebrityInfoResponse -> Maybe KnownGender
knownGender :: Prelude.Maybe KnownGender,
GetCelebrityInfoResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
GetCelebrityInfoResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetCelebrityInfoResponse -> GetCelebrityInfoResponse -> Bool
(GetCelebrityInfoResponse -> GetCelebrityInfoResponse -> Bool)
-> (GetCelebrityInfoResponse -> GetCelebrityInfoResponse -> Bool)
-> Eq GetCelebrityInfoResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCelebrityInfoResponse -> GetCelebrityInfoResponse -> Bool
$c/= :: GetCelebrityInfoResponse -> GetCelebrityInfoResponse -> Bool
== :: GetCelebrityInfoResponse -> GetCelebrityInfoResponse -> Bool
$c== :: GetCelebrityInfoResponse -> GetCelebrityInfoResponse -> Bool
Prelude.Eq, ReadPrec [GetCelebrityInfoResponse]
ReadPrec GetCelebrityInfoResponse
Int -> ReadS GetCelebrityInfoResponse
ReadS [GetCelebrityInfoResponse]
(Int -> ReadS GetCelebrityInfoResponse)
-> ReadS [GetCelebrityInfoResponse]
-> ReadPrec GetCelebrityInfoResponse
-> ReadPrec [GetCelebrityInfoResponse]
-> Read GetCelebrityInfoResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCelebrityInfoResponse]
$creadListPrec :: ReadPrec [GetCelebrityInfoResponse]
readPrec :: ReadPrec GetCelebrityInfoResponse
$creadPrec :: ReadPrec GetCelebrityInfoResponse
readList :: ReadS [GetCelebrityInfoResponse]
$creadList :: ReadS [GetCelebrityInfoResponse]
readsPrec :: Int -> ReadS GetCelebrityInfoResponse
$creadsPrec :: Int -> ReadS GetCelebrityInfoResponse
Prelude.Read, Int -> GetCelebrityInfoResponse -> ShowS
[GetCelebrityInfoResponse] -> ShowS
GetCelebrityInfoResponse -> String
(Int -> GetCelebrityInfoResponse -> ShowS)
-> (GetCelebrityInfoResponse -> String)
-> ([GetCelebrityInfoResponse] -> ShowS)
-> Show GetCelebrityInfoResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCelebrityInfoResponse] -> ShowS
$cshowList :: [GetCelebrityInfoResponse] -> ShowS
show :: GetCelebrityInfoResponse -> String
$cshow :: GetCelebrityInfoResponse -> String
showsPrec :: Int -> GetCelebrityInfoResponse -> ShowS
$cshowsPrec :: Int -> GetCelebrityInfoResponse -> ShowS
Prelude.Show, (forall x.
GetCelebrityInfoResponse -> Rep GetCelebrityInfoResponse x)
-> (forall x.
Rep GetCelebrityInfoResponse x -> GetCelebrityInfoResponse)
-> Generic GetCelebrityInfoResponse
forall x.
Rep GetCelebrityInfoResponse x -> GetCelebrityInfoResponse
forall x.
GetCelebrityInfoResponse -> Rep GetCelebrityInfoResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCelebrityInfoResponse x -> GetCelebrityInfoResponse
$cfrom :: forall x.
GetCelebrityInfoResponse -> Rep GetCelebrityInfoResponse x
Prelude.Generic)
newGetCelebrityInfoResponse ::
Prelude.Int ->
GetCelebrityInfoResponse
newGetCelebrityInfoResponse :: Int -> GetCelebrityInfoResponse
newGetCelebrityInfoResponse Int
pHttpStatus_ =
GetCelebrityInfoResponse' :: Maybe [Text]
-> Maybe KnownGender
-> Maybe Text
-> Int
-> GetCelebrityInfoResponse
GetCelebrityInfoResponse'
{ $sel:urls:GetCelebrityInfoResponse' :: Maybe [Text]
urls = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:knownGender:GetCelebrityInfoResponse' :: Maybe KnownGender
knownGender = Maybe KnownGender
forall a. Maybe a
Prelude.Nothing,
$sel:name:GetCelebrityInfoResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetCelebrityInfoResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getCelebrityInfoResponse_urls :: Lens.Lens' GetCelebrityInfoResponse (Prelude.Maybe [Prelude.Text])
getCelebrityInfoResponse_urls :: (Maybe [Text] -> f (Maybe [Text]))
-> GetCelebrityInfoResponse -> f GetCelebrityInfoResponse
getCelebrityInfoResponse_urls = (GetCelebrityInfoResponse -> Maybe [Text])
-> (GetCelebrityInfoResponse
-> Maybe [Text] -> GetCelebrityInfoResponse)
-> Lens
GetCelebrityInfoResponse
GetCelebrityInfoResponse
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCelebrityInfoResponse' {Maybe [Text]
urls :: Maybe [Text]
$sel:urls:GetCelebrityInfoResponse' :: GetCelebrityInfoResponse -> Maybe [Text]
urls} -> Maybe [Text]
urls) (\s :: GetCelebrityInfoResponse
s@GetCelebrityInfoResponse' {} Maybe [Text]
a -> GetCelebrityInfoResponse
s {$sel:urls:GetCelebrityInfoResponse' :: Maybe [Text]
urls = Maybe [Text]
a} :: GetCelebrityInfoResponse) ((Maybe [Text] -> f (Maybe [Text]))
-> GetCelebrityInfoResponse -> f GetCelebrityInfoResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> GetCelebrityInfoResponse
-> f GetCelebrityInfoResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getCelebrityInfoResponse_knownGender :: Lens.Lens' GetCelebrityInfoResponse (Prelude.Maybe KnownGender)
getCelebrityInfoResponse_knownGender :: (Maybe KnownGender -> f (Maybe KnownGender))
-> GetCelebrityInfoResponse -> f GetCelebrityInfoResponse
getCelebrityInfoResponse_knownGender = (GetCelebrityInfoResponse -> Maybe KnownGender)
-> (GetCelebrityInfoResponse
-> Maybe KnownGender -> GetCelebrityInfoResponse)
-> Lens
GetCelebrityInfoResponse
GetCelebrityInfoResponse
(Maybe KnownGender)
(Maybe KnownGender)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCelebrityInfoResponse' {Maybe KnownGender
knownGender :: Maybe KnownGender
$sel:knownGender:GetCelebrityInfoResponse' :: GetCelebrityInfoResponse -> Maybe KnownGender
knownGender} -> Maybe KnownGender
knownGender) (\s :: GetCelebrityInfoResponse
s@GetCelebrityInfoResponse' {} Maybe KnownGender
a -> GetCelebrityInfoResponse
s {$sel:knownGender:GetCelebrityInfoResponse' :: Maybe KnownGender
knownGender = Maybe KnownGender
a} :: GetCelebrityInfoResponse)
getCelebrityInfoResponse_name :: Lens.Lens' GetCelebrityInfoResponse (Prelude.Maybe Prelude.Text)
getCelebrityInfoResponse_name :: (Maybe Text -> f (Maybe Text))
-> GetCelebrityInfoResponse -> f GetCelebrityInfoResponse
getCelebrityInfoResponse_name = (GetCelebrityInfoResponse -> Maybe Text)
-> (GetCelebrityInfoResponse
-> Maybe Text -> GetCelebrityInfoResponse)
-> Lens
GetCelebrityInfoResponse
GetCelebrityInfoResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCelebrityInfoResponse' {Maybe Text
name :: Maybe Text
$sel:name:GetCelebrityInfoResponse' :: GetCelebrityInfoResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: GetCelebrityInfoResponse
s@GetCelebrityInfoResponse' {} Maybe Text
a -> GetCelebrityInfoResponse
s {$sel:name:GetCelebrityInfoResponse' :: Maybe Text
name = Maybe Text
a} :: GetCelebrityInfoResponse)
getCelebrityInfoResponse_httpStatus :: Lens.Lens' GetCelebrityInfoResponse Prelude.Int
getCelebrityInfoResponse_httpStatus :: (Int -> f Int)
-> GetCelebrityInfoResponse -> f GetCelebrityInfoResponse
getCelebrityInfoResponse_httpStatus = (GetCelebrityInfoResponse -> Int)
-> (GetCelebrityInfoResponse -> Int -> GetCelebrityInfoResponse)
-> Lens GetCelebrityInfoResponse GetCelebrityInfoResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCelebrityInfoResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetCelebrityInfoResponse' :: GetCelebrityInfoResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetCelebrityInfoResponse
s@GetCelebrityInfoResponse' {} Int
a -> GetCelebrityInfoResponse
s {$sel:httpStatus:GetCelebrityInfoResponse' :: Int
httpStatus = Int
a} :: GetCelebrityInfoResponse)
instance Prelude.NFData GetCelebrityInfoResponse