{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Connect.StopContact
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Ends the specified contact. This call does not work for the following
-- initiation methods:
--
-- -   DISCONNECT
--
-- -   TRANSFER
--
-- -   QUEUE_TRANSFER
module Amazonka.Connect.StopContact
  ( -- * Creating a Request
    StopContact (..),
    newStopContact,

    -- * Request Lenses
    stopContact_contactId,
    stopContact_instanceId,

    -- * Destructuring the Response
    StopContactResponse (..),
    newStopContactResponse,

    -- * Response Lenses
    stopContactResponse_httpStatus,
  )
where

import Amazonka.Connect.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

-- | /See:/ 'newStopContact' smart constructor.
data StopContact = StopContact'
  { -- | The ID of the contact.
    StopContact -> Text
contactId :: Prelude.Text,
    -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    StopContact -> Text
instanceId :: Prelude.Text
  }
  deriving (StopContact -> StopContact -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopContact -> StopContact -> Bool
$c/= :: StopContact -> StopContact -> Bool
== :: StopContact -> StopContact -> Bool
$c== :: StopContact -> StopContact -> Bool
Prelude.Eq, ReadPrec [StopContact]
ReadPrec StopContact
Int -> ReadS StopContact
ReadS [StopContact]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopContact]
$creadListPrec :: ReadPrec [StopContact]
readPrec :: ReadPrec StopContact
$creadPrec :: ReadPrec StopContact
readList :: ReadS [StopContact]
$creadList :: ReadS [StopContact]
readsPrec :: Int -> ReadS StopContact
$creadsPrec :: Int -> ReadS StopContact
Prelude.Read, Int -> StopContact -> ShowS
[StopContact] -> ShowS
StopContact -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopContact] -> ShowS
$cshowList :: [StopContact] -> ShowS
show :: StopContact -> String
$cshow :: StopContact -> String
showsPrec :: Int -> StopContact -> ShowS
$cshowsPrec :: Int -> StopContact -> ShowS
Prelude.Show, forall x. Rep StopContact x -> StopContact
forall x. StopContact -> Rep StopContact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopContact x -> StopContact
$cfrom :: forall x. StopContact -> Rep StopContact x
Prelude.Generic)

-- |
-- Create a value of 'StopContact' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'contactId', 'stopContact_contactId' - The ID of the contact.
--
-- 'instanceId', 'stopContact_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
newStopContact ::
  -- | 'contactId'
  Prelude.Text ->
  -- | 'instanceId'
  Prelude.Text ->
  StopContact
newStopContact :: Text -> Text -> StopContact
newStopContact Text
pContactId_ Text
pInstanceId_ =
  StopContact'
    { $sel:contactId:StopContact' :: Text
contactId = Text
pContactId_,
      $sel:instanceId:StopContact' :: Text
instanceId = Text
pInstanceId_
    }

-- | The ID of the contact.
stopContact_contactId :: Lens.Lens' StopContact Prelude.Text
stopContact_contactId :: Lens' StopContact Text
stopContact_contactId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopContact' {Text
contactId :: Text
$sel:contactId:StopContact' :: StopContact -> Text
contactId} -> Text
contactId) (\s :: StopContact
s@StopContact' {} Text
a -> StopContact
s {$sel:contactId:StopContact' :: Text
contactId = Text
a} :: StopContact)

-- | The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
stopContact_instanceId :: Lens.Lens' StopContact Prelude.Text
stopContact_instanceId :: Lens' StopContact Text
stopContact_instanceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopContact' {Text
instanceId :: Text
$sel:instanceId:StopContact' :: StopContact -> Text
instanceId} -> Text
instanceId) (\s :: StopContact
s@StopContact' {} Text
a -> StopContact
s {$sel:instanceId:StopContact' :: Text
instanceId = Text
a} :: StopContact)

instance Core.AWSRequest StopContact where
  type AWSResponse StopContact = StopContactResponse
  request :: (Service -> Service) -> StopContact -> Request StopContact
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 StopContact
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopContact)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> StopContactResponse
StopContactResponse'
            forall (f :: * -> *) a b. Functor 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 StopContact where
  hashWithSalt :: Int -> StopContact -> Int
hashWithSalt Int
_salt StopContact' {Text
instanceId :: Text
contactId :: Text
$sel:instanceId:StopContact' :: StopContact -> Text
$sel:contactId:StopContact' :: StopContact -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId

instance Prelude.NFData StopContact where
  rnf :: StopContact -> ()
rnf StopContact' {Text
instanceId :: Text
contactId :: Text
$sel:instanceId:StopContact' :: StopContact -> Text
$sel:contactId:StopContact' :: StopContact -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
contactId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId

instance Data.ToHeaders StopContact where
  toHeaders :: StopContact -> 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 StopContact where
  toJSON :: StopContact -> Value
toJSON StopContact' {Text
instanceId :: Text
contactId :: Text
$sel:instanceId:StopContact' :: StopContact -> Text
$sel:contactId:StopContact' :: StopContact -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"ContactId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
contactId),
            forall a. a -> Maybe a
Prelude.Just (Key
"InstanceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
instanceId)
          ]
      )

instance Data.ToPath StopContact where
  toPath :: StopContact -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/contact/stop"

instance Data.ToQuery StopContact where
  toQuery :: StopContact -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newStopContactResponse' smart constructor.
data StopContactResponse = StopContactResponse'
  { -- | The response's http status code.
    StopContactResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StopContactResponse -> StopContactResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopContactResponse -> StopContactResponse -> Bool
$c/= :: StopContactResponse -> StopContactResponse -> Bool
== :: StopContactResponse -> StopContactResponse -> Bool
$c== :: StopContactResponse -> StopContactResponse -> Bool
Prelude.Eq, ReadPrec [StopContactResponse]
ReadPrec StopContactResponse
Int -> ReadS StopContactResponse
ReadS [StopContactResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopContactResponse]
$creadListPrec :: ReadPrec [StopContactResponse]
readPrec :: ReadPrec StopContactResponse
$creadPrec :: ReadPrec StopContactResponse
readList :: ReadS [StopContactResponse]
$creadList :: ReadS [StopContactResponse]
readsPrec :: Int -> ReadS StopContactResponse
$creadsPrec :: Int -> ReadS StopContactResponse
Prelude.Read, Int -> StopContactResponse -> ShowS
[StopContactResponse] -> ShowS
StopContactResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopContactResponse] -> ShowS
$cshowList :: [StopContactResponse] -> ShowS
show :: StopContactResponse -> String
$cshow :: StopContactResponse -> String
showsPrec :: Int -> StopContactResponse -> ShowS
$cshowsPrec :: Int -> StopContactResponse -> ShowS
Prelude.Show, forall x. Rep StopContactResponse x -> StopContactResponse
forall x. StopContactResponse -> Rep StopContactResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopContactResponse x -> StopContactResponse
$cfrom :: forall x. StopContactResponse -> Rep StopContactResponse x
Prelude.Generic)

-- |
-- Create a value of 'StopContactResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'stopContactResponse_httpStatus' - The response's http status code.
newStopContactResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StopContactResponse
newStopContactResponse :: Int -> StopContactResponse
newStopContactResponse Int
pHttpStatus_ =
  StopContactResponse' {$sel:httpStatus:StopContactResponse' :: Int
httpStatus = Int
pHttpStatus_}

-- | The response's http status code.
stopContactResponse_httpStatus :: Lens.Lens' StopContactResponse Prelude.Int
stopContactResponse_httpStatus :: Lens' StopContactResponse Int
stopContactResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopContactResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopContactResponse' :: StopContactResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StopContactResponse
s@StopContactResponse' {} Int
a -> StopContactResponse
s {$sel:httpStatus:StopContactResponse' :: Int
httpStatus = Int
a} :: StopContactResponse)

instance Prelude.NFData StopContactResponse where
  rnf :: StopContactResponse -> ()
rnf StopContactResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopContactResponse' :: StopContactResponse -> Int
..} = forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus