{-# 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.AlexaBusiness.GetContact
(
GetContact (..),
newGetContact,
getContact_contactArn,
GetContactResponse (..),
newGetContactResponse,
getContactResponse_contact,
getContactResponse_httpStatus,
)
where
import Amazonka.AlexaBusiness.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetContact = GetContact'
{
GetContact -> Text
contactArn :: Prelude.Text
}
deriving (GetContact -> GetContact -> Bool
(GetContact -> GetContact -> Bool)
-> (GetContact -> GetContact -> Bool) -> Eq GetContact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContact -> GetContact -> Bool
$c/= :: GetContact -> GetContact -> Bool
== :: GetContact -> GetContact -> Bool
$c== :: GetContact -> GetContact -> Bool
Prelude.Eq, ReadPrec [GetContact]
ReadPrec GetContact
Int -> ReadS GetContact
ReadS [GetContact]
(Int -> ReadS GetContact)
-> ReadS [GetContact]
-> ReadPrec GetContact
-> ReadPrec [GetContact]
-> Read GetContact
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetContact]
$creadListPrec :: ReadPrec [GetContact]
readPrec :: ReadPrec GetContact
$creadPrec :: ReadPrec GetContact
readList :: ReadS [GetContact]
$creadList :: ReadS [GetContact]
readsPrec :: Int -> ReadS GetContact
$creadsPrec :: Int -> ReadS GetContact
Prelude.Read, Int -> GetContact -> ShowS
[GetContact] -> ShowS
GetContact -> String
(Int -> GetContact -> ShowS)
-> (GetContact -> String)
-> ([GetContact] -> ShowS)
-> Show GetContact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContact] -> ShowS
$cshowList :: [GetContact] -> ShowS
show :: GetContact -> String
$cshow :: GetContact -> String
showsPrec :: Int -> GetContact -> ShowS
$cshowsPrec :: Int -> GetContact -> ShowS
Prelude.Show, (forall x. GetContact -> Rep GetContact x)
-> (forall x. Rep GetContact x -> GetContact) -> Generic GetContact
forall x. Rep GetContact x -> GetContact
forall x. GetContact -> Rep GetContact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetContact x -> GetContact
$cfrom :: forall x. GetContact -> Rep GetContact x
Prelude.Generic)
newGetContact ::
Prelude.Text ->
GetContact
newGetContact :: Text -> GetContact
newGetContact Text
pContactArn_ =
GetContact' :: Text -> GetContact
GetContact' {$sel:contactArn:GetContact' :: Text
contactArn = Text
pContactArn_}
getContact_contactArn :: Lens.Lens' GetContact Prelude.Text
getContact_contactArn :: (Text -> f Text) -> GetContact -> f GetContact
getContact_contactArn = (GetContact -> Text)
-> (GetContact -> Text -> GetContact)
-> Lens GetContact GetContact Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContact' {Text
contactArn :: Text
$sel:contactArn:GetContact' :: GetContact -> Text
contactArn} -> Text
contactArn) (\s :: GetContact
s@GetContact' {} Text
a -> GetContact
s {$sel:contactArn:GetContact' :: Text
contactArn = Text
a} :: GetContact)
instance Core.AWSRequest GetContact where
type AWSResponse GetContact = GetContactResponse
request :: GetContact -> Request GetContact
request = Service -> GetContact -> Request GetContact
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetContact
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetContact)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetContact))
-> Logger
-> Service
-> Proxy GetContact
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetContact)))
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 Contact -> Int -> GetContactResponse
GetContactResponse'
(Maybe Contact -> Int -> GetContactResponse)
-> Either String (Maybe Contact)
-> Either String (Int -> GetContactResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Contact)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Contact")
Either String (Int -> GetContactResponse)
-> Either String Int -> Either String GetContactResponse
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 GetContact
instance Prelude.NFData GetContact
instance Core.ToHeaders GetContact where
toHeaders :: GetContact -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetContact -> 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
"AlexaForBusiness.GetContact" ::
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 GetContact where
toJSON :: GetContact -> Value
toJSON GetContact' {Text
contactArn :: Text
$sel:contactArn:GetContact' :: GetContact -> 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
"ContactArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
contactArn)]
)
instance Core.ToPath GetContact where
toPath :: GetContact -> ByteString
toPath = ByteString -> GetContact -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetContact where
toQuery :: GetContact -> QueryString
toQuery = QueryString -> GetContact -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetContactResponse = GetContactResponse'
{
GetContactResponse -> Maybe Contact
contact :: Prelude.Maybe Contact,
GetContactResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetContactResponse -> GetContactResponse -> Bool
(GetContactResponse -> GetContactResponse -> Bool)
-> (GetContactResponse -> GetContactResponse -> Bool)
-> Eq GetContactResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetContactResponse -> GetContactResponse -> Bool
$c/= :: GetContactResponse -> GetContactResponse -> Bool
== :: GetContactResponse -> GetContactResponse -> Bool
$c== :: GetContactResponse -> GetContactResponse -> Bool
Prelude.Eq, Int -> GetContactResponse -> ShowS
[GetContactResponse] -> ShowS
GetContactResponse -> String
(Int -> GetContactResponse -> ShowS)
-> (GetContactResponse -> String)
-> ([GetContactResponse] -> ShowS)
-> Show GetContactResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetContactResponse] -> ShowS
$cshowList :: [GetContactResponse] -> ShowS
show :: GetContactResponse -> String
$cshow :: GetContactResponse -> String
showsPrec :: Int -> GetContactResponse -> ShowS
$cshowsPrec :: Int -> GetContactResponse -> ShowS
Prelude.Show, (forall x. GetContactResponse -> Rep GetContactResponse x)
-> (forall x. Rep GetContactResponse x -> GetContactResponse)
-> Generic GetContactResponse
forall x. Rep GetContactResponse x -> GetContactResponse
forall x. GetContactResponse -> Rep GetContactResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetContactResponse x -> GetContactResponse
$cfrom :: forall x. GetContactResponse -> Rep GetContactResponse x
Prelude.Generic)
newGetContactResponse ::
Prelude.Int ->
GetContactResponse
newGetContactResponse :: Int -> GetContactResponse
newGetContactResponse Int
pHttpStatus_ =
GetContactResponse' :: Maybe Contact -> Int -> GetContactResponse
GetContactResponse'
{ $sel:contact:GetContactResponse' :: Maybe Contact
contact = Maybe Contact
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetContactResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getContactResponse_contact :: Lens.Lens' GetContactResponse (Prelude.Maybe Contact)
getContactResponse_contact :: (Maybe Contact -> f (Maybe Contact))
-> GetContactResponse -> f GetContactResponse
getContactResponse_contact = (GetContactResponse -> Maybe Contact)
-> (GetContactResponse -> Maybe Contact -> GetContactResponse)
-> Lens
GetContactResponse
GetContactResponse
(Maybe Contact)
(Maybe Contact)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContactResponse' {Maybe Contact
contact :: Maybe Contact
$sel:contact:GetContactResponse' :: GetContactResponse -> Maybe Contact
contact} -> Maybe Contact
contact) (\s :: GetContactResponse
s@GetContactResponse' {} Maybe Contact
a -> GetContactResponse
s {$sel:contact:GetContactResponse' :: Maybe Contact
contact = Maybe Contact
a} :: GetContactResponse)
getContactResponse_httpStatus :: Lens.Lens' GetContactResponse Prelude.Int
getContactResponse_httpStatus :: (Int -> f Int) -> GetContactResponse -> f GetContactResponse
getContactResponse_httpStatus = (GetContactResponse -> Int)
-> (GetContactResponse -> Int -> GetContactResponse)
-> Lens GetContactResponse GetContactResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetContactResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetContactResponse' :: GetContactResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetContactResponse
s@GetContactResponse' {} Int
a -> GetContactResponse
s {$sel:httpStatus:GetContactResponse' :: Int
httpStatus = Int
a} :: GetContactResponse)
instance Prelude.NFData GetContactResponse