{-# 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.Connect.UpdateContactAttributes
(
UpdateContactAttributes (..),
newUpdateContactAttributes,
updateContactAttributes_initialContactId,
updateContactAttributes_instanceId,
updateContactAttributes_attributes,
UpdateContactAttributesResponse (..),
newUpdateContactAttributesResponse,
updateContactAttributesResponse_httpStatus,
)
where
import Amazonka.Connect.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 UpdateContactAttributes = UpdateContactAttributes'
{
UpdateContactAttributes -> Text
initialContactId :: Prelude.Text,
UpdateContactAttributes -> Text
instanceId :: Prelude.Text,
UpdateContactAttributes -> HashMap Text Text
attributes :: Prelude.HashMap Prelude.Text Prelude.Text
}
deriving (UpdateContactAttributes -> UpdateContactAttributes -> Bool
(UpdateContactAttributes -> UpdateContactAttributes -> Bool)
-> (UpdateContactAttributes -> UpdateContactAttributes -> Bool)
-> Eq UpdateContactAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateContactAttributes -> UpdateContactAttributes -> Bool
$c/= :: UpdateContactAttributes -> UpdateContactAttributes -> Bool
== :: UpdateContactAttributes -> UpdateContactAttributes -> Bool
$c== :: UpdateContactAttributes -> UpdateContactAttributes -> Bool
Prelude.Eq, ReadPrec [UpdateContactAttributes]
ReadPrec UpdateContactAttributes
Int -> ReadS UpdateContactAttributes
ReadS [UpdateContactAttributes]
(Int -> ReadS UpdateContactAttributes)
-> ReadS [UpdateContactAttributes]
-> ReadPrec UpdateContactAttributes
-> ReadPrec [UpdateContactAttributes]
-> Read UpdateContactAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateContactAttributes]
$creadListPrec :: ReadPrec [UpdateContactAttributes]
readPrec :: ReadPrec UpdateContactAttributes
$creadPrec :: ReadPrec UpdateContactAttributes
readList :: ReadS [UpdateContactAttributes]
$creadList :: ReadS [UpdateContactAttributes]
readsPrec :: Int -> ReadS UpdateContactAttributes
$creadsPrec :: Int -> ReadS UpdateContactAttributes
Prelude.Read, Int -> UpdateContactAttributes -> ShowS
[UpdateContactAttributes] -> ShowS
UpdateContactAttributes -> String
(Int -> UpdateContactAttributes -> ShowS)
-> (UpdateContactAttributes -> String)
-> ([UpdateContactAttributes] -> ShowS)
-> Show UpdateContactAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateContactAttributes] -> ShowS
$cshowList :: [UpdateContactAttributes] -> ShowS
show :: UpdateContactAttributes -> String
$cshow :: UpdateContactAttributes -> String
showsPrec :: Int -> UpdateContactAttributes -> ShowS
$cshowsPrec :: Int -> UpdateContactAttributes -> ShowS
Prelude.Show, (forall x.
UpdateContactAttributes -> Rep UpdateContactAttributes x)
-> (forall x.
Rep UpdateContactAttributes x -> UpdateContactAttributes)
-> Generic UpdateContactAttributes
forall x. Rep UpdateContactAttributes x -> UpdateContactAttributes
forall x. UpdateContactAttributes -> Rep UpdateContactAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateContactAttributes x -> UpdateContactAttributes
$cfrom :: forall x. UpdateContactAttributes -> Rep UpdateContactAttributes x
Prelude.Generic)
newUpdateContactAttributes ::
Prelude.Text ->
Prelude.Text ->
UpdateContactAttributes
newUpdateContactAttributes :: Text -> Text -> UpdateContactAttributes
newUpdateContactAttributes
Text
pInitialContactId_
Text
pInstanceId_ =
UpdateContactAttributes' :: Text -> Text -> HashMap Text Text -> UpdateContactAttributes
UpdateContactAttributes'
{ $sel:initialContactId:UpdateContactAttributes' :: Text
initialContactId =
Text
pInitialContactId_,
$sel:instanceId:UpdateContactAttributes' :: Text
instanceId = Text
pInstanceId_,
$sel:attributes:UpdateContactAttributes' :: HashMap Text Text
attributes = HashMap Text Text
forall a. Monoid a => a
Prelude.mempty
}
updateContactAttributes_initialContactId :: Lens.Lens' UpdateContactAttributes Prelude.Text
updateContactAttributes_initialContactId :: (Text -> f Text)
-> UpdateContactAttributes -> f UpdateContactAttributes
updateContactAttributes_initialContactId = (UpdateContactAttributes -> Text)
-> (UpdateContactAttributes -> Text -> UpdateContactAttributes)
-> Lens UpdateContactAttributes UpdateContactAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContactAttributes' {Text
initialContactId :: Text
$sel:initialContactId:UpdateContactAttributes' :: UpdateContactAttributes -> Text
initialContactId} -> Text
initialContactId) (\s :: UpdateContactAttributes
s@UpdateContactAttributes' {} Text
a -> UpdateContactAttributes
s {$sel:initialContactId:UpdateContactAttributes' :: Text
initialContactId = Text
a} :: UpdateContactAttributes)
updateContactAttributes_instanceId :: Lens.Lens' UpdateContactAttributes Prelude.Text
updateContactAttributes_instanceId :: (Text -> f Text)
-> UpdateContactAttributes -> f UpdateContactAttributes
updateContactAttributes_instanceId = (UpdateContactAttributes -> Text)
-> (UpdateContactAttributes -> Text -> UpdateContactAttributes)
-> Lens UpdateContactAttributes UpdateContactAttributes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContactAttributes' {Text
instanceId :: Text
$sel:instanceId:UpdateContactAttributes' :: UpdateContactAttributes -> Text
instanceId} -> Text
instanceId) (\s :: UpdateContactAttributes
s@UpdateContactAttributes' {} Text
a -> UpdateContactAttributes
s {$sel:instanceId:UpdateContactAttributes' :: Text
instanceId = Text
a} :: UpdateContactAttributes)
updateContactAttributes_attributes :: Lens.Lens' UpdateContactAttributes (Prelude.HashMap Prelude.Text Prelude.Text)
updateContactAttributes_attributes :: (HashMap Text Text -> f (HashMap Text Text))
-> UpdateContactAttributes -> f UpdateContactAttributes
updateContactAttributes_attributes = (UpdateContactAttributes -> HashMap Text Text)
-> (UpdateContactAttributes
-> HashMap Text Text -> UpdateContactAttributes)
-> Lens
UpdateContactAttributes
UpdateContactAttributes
(HashMap Text Text)
(HashMap Text Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContactAttributes' {HashMap Text Text
attributes :: HashMap Text Text
$sel:attributes:UpdateContactAttributes' :: UpdateContactAttributes -> HashMap Text Text
attributes} -> HashMap Text Text
attributes) (\s :: UpdateContactAttributes
s@UpdateContactAttributes' {} HashMap Text Text
a -> UpdateContactAttributes
s {$sel:attributes:UpdateContactAttributes' :: HashMap Text Text
attributes = HashMap Text Text
a} :: UpdateContactAttributes) ((HashMap Text Text -> f (HashMap Text Text))
-> UpdateContactAttributes -> f UpdateContactAttributes)
-> ((HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text))
-> (HashMap Text Text -> f (HashMap Text Text))
-> UpdateContactAttributes
-> f UpdateContactAttributes
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text Text -> f (HashMap Text Text))
-> HashMap Text Text -> f (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest UpdateContactAttributes where
type
AWSResponse UpdateContactAttributes =
UpdateContactAttributesResponse
request :: UpdateContactAttributes -> Request UpdateContactAttributes
request = Service
-> UpdateContactAttributes -> Request UpdateContactAttributes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateContactAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateContactAttributes)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateContactAttributes))
-> Logger
-> Service
-> Proxy UpdateContactAttributes
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateContactAttributes)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateContactAttributesResponse
UpdateContactAttributesResponse'
(Int -> UpdateContactAttributesResponse)
-> Either String Int
-> Either String UpdateContactAttributesResponse
forall (f :: * -> *) a b. Functor 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 UpdateContactAttributes
instance Prelude.NFData UpdateContactAttributes
instance Core.ToHeaders UpdateContactAttributes where
toHeaders :: UpdateContactAttributes -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateContactAttributes -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 UpdateContactAttributes where
toJSON :: UpdateContactAttributes -> Value
toJSON UpdateContactAttributes' {Text
HashMap Text Text
attributes :: HashMap Text Text
instanceId :: Text
initialContactId :: Text
$sel:attributes:UpdateContactAttributes' :: UpdateContactAttributes -> HashMap Text Text
$sel:instanceId:UpdateContactAttributes' :: UpdateContactAttributes -> Text
$sel:initialContactId:UpdateContactAttributes' :: UpdateContactAttributes -> 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
"InitialContactId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
initialContactId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Attributes" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= HashMap Text Text
attributes)
]
)
instance Core.ToPath UpdateContactAttributes where
toPath :: UpdateContactAttributes -> ByteString
toPath = ByteString -> UpdateContactAttributes -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/contact/attributes"
instance Core.ToQuery UpdateContactAttributes where
toQuery :: UpdateContactAttributes -> QueryString
toQuery = QueryString -> UpdateContactAttributes -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateContactAttributesResponse = UpdateContactAttributesResponse'
{
UpdateContactAttributesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateContactAttributesResponse
-> UpdateContactAttributesResponse -> Bool
(UpdateContactAttributesResponse
-> UpdateContactAttributesResponse -> Bool)
-> (UpdateContactAttributesResponse
-> UpdateContactAttributesResponse -> Bool)
-> Eq UpdateContactAttributesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateContactAttributesResponse
-> UpdateContactAttributesResponse -> Bool
$c/= :: UpdateContactAttributesResponse
-> UpdateContactAttributesResponse -> Bool
== :: UpdateContactAttributesResponse
-> UpdateContactAttributesResponse -> Bool
$c== :: UpdateContactAttributesResponse
-> UpdateContactAttributesResponse -> Bool
Prelude.Eq, ReadPrec [UpdateContactAttributesResponse]
ReadPrec UpdateContactAttributesResponse
Int -> ReadS UpdateContactAttributesResponse
ReadS [UpdateContactAttributesResponse]
(Int -> ReadS UpdateContactAttributesResponse)
-> ReadS [UpdateContactAttributesResponse]
-> ReadPrec UpdateContactAttributesResponse
-> ReadPrec [UpdateContactAttributesResponse]
-> Read UpdateContactAttributesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateContactAttributesResponse]
$creadListPrec :: ReadPrec [UpdateContactAttributesResponse]
readPrec :: ReadPrec UpdateContactAttributesResponse
$creadPrec :: ReadPrec UpdateContactAttributesResponse
readList :: ReadS [UpdateContactAttributesResponse]
$creadList :: ReadS [UpdateContactAttributesResponse]
readsPrec :: Int -> ReadS UpdateContactAttributesResponse
$creadsPrec :: Int -> ReadS UpdateContactAttributesResponse
Prelude.Read, Int -> UpdateContactAttributesResponse -> ShowS
[UpdateContactAttributesResponse] -> ShowS
UpdateContactAttributesResponse -> String
(Int -> UpdateContactAttributesResponse -> ShowS)
-> (UpdateContactAttributesResponse -> String)
-> ([UpdateContactAttributesResponse] -> ShowS)
-> Show UpdateContactAttributesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateContactAttributesResponse] -> ShowS
$cshowList :: [UpdateContactAttributesResponse] -> ShowS
show :: UpdateContactAttributesResponse -> String
$cshow :: UpdateContactAttributesResponse -> String
showsPrec :: Int -> UpdateContactAttributesResponse -> ShowS
$cshowsPrec :: Int -> UpdateContactAttributesResponse -> ShowS
Prelude.Show, (forall x.
UpdateContactAttributesResponse
-> Rep UpdateContactAttributesResponse x)
-> (forall x.
Rep UpdateContactAttributesResponse x
-> UpdateContactAttributesResponse)
-> Generic UpdateContactAttributesResponse
forall x.
Rep UpdateContactAttributesResponse x
-> UpdateContactAttributesResponse
forall x.
UpdateContactAttributesResponse
-> Rep UpdateContactAttributesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateContactAttributesResponse x
-> UpdateContactAttributesResponse
$cfrom :: forall x.
UpdateContactAttributesResponse
-> Rep UpdateContactAttributesResponse x
Prelude.Generic)
newUpdateContactAttributesResponse ::
Prelude.Int ->
UpdateContactAttributesResponse
newUpdateContactAttributesResponse :: Int -> UpdateContactAttributesResponse
newUpdateContactAttributesResponse Int
pHttpStatus_ =
UpdateContactAttributesResponse' :: Int -> UpdateContactAttributesResponse
UpdateContactAttributesResponse'
{ $sel:httpStatus:UpdateContactAttributesResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateContactAttributesResponse_httpStatus :: Lens.Lens' UpdateContactAttributesResponse Prelude.Int
updateContactAttributesResponse_httpStatus :: (Int -> f Int)
-> UpdateContactAttributesResponse
-> f UpdateContactAttributesResponse
updateContactAttributesResponse_httpStatus = (UpdateContactAttributesResponse -> Int)
-> (UpdateContactAttributesResponse
-> Int -> UpdateContactAttributesResponse)
-> Lens
UpdateContactAttributesResponse
UpdateContactAttributesResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateContactAttributesResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateContactAttributesResponse' :: UpdateContactAttributesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateContactAttributesResponse
s@UpdateContactAttributesResponse' {} Int
a -> UpdateContactAttributesResponse
s {$sel:httpStatus:UpdateContactAttributesResponse' :: Int
httpStatus = Int
a} :: UpdateContactAttributesResponse)
instance
Prelude.NFData
UpdateContactAttributesResponse