{-# 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.StopContactStreaming
-- 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 message streaming on a specified contact. To restart message
-- streaming on that contact, call the
-- <https://docs.aws.amazon.com/connect/latest/APIReference/API_StartContactStreaming.html StartContactStreaming>
-- API.
module Amazonka.Connect.StopContactStreaming
  ( -- * Creating a Request
    StopContactStreaming (..),
    newStopContactStreaming,

    -- * Request Lenses
    stopContactStreaming_instanceId,
    stopContactStreaming_contactId,
    stopContactStreaming_streamingId,

    -- * Destructuring the Response
    StopContactStreamingResponse (..),
    newStopContactStreamingResponse,

    -- * Response Lenses
    stopContactStreamingResponse_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:/ 'newStopContactStreaming' smart constructor.
data StopContactStreaming = StopContactStreaming'
  { -- | The identifier of the Amazon Connect instance. You can find the
    -- instanceId in the ARN of the instance.
    StopContactStreaming -> Text
instanceId :: Prelude.Text,
    -- | The identifier of the contact. This is the identifier of the contact
    -- that is associated with the first interaction with the contact center.
    StopContactStreaming -> Text
contactId :: Prelude.Text,
    -- | The identifier of the streaming configuration enabled.
    StopContactStreaming -> Text
streamingId :: Prelude.Text
  }
  deriving (StopContactStreaming -> StopContactStreaming -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopContactStreaming -> StopContactStreaming -> Bool
$c/= :: StopContactStreaming -> StopContactStreaming -> Bool
== :: StopContactStreaming -> StopContactStreaming -> Bool
$c== :: StopContactStreaming -> StopContactStreaming -> Bool
Prelude.Eq, ReadPrec [StopContactStreaming]
ReadPrec StopContactStreaming
Int -> ReadS StopContactStreaming
ReadS [StopContactStreaming]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopContactStreaming]
$creadListPrec :: ReadPrec [StopContactStreaming]
readPrec :: ReadPrec StopContactStreaming
$creadPrec :: ReadPrec StopContactStreaming
readList :: ReadS [StopContactStreaming]
$creadList :: ReadS [StopContactStreaming]
readsPrec :: Int -> ReadS StopContactStreaming
$creadsPrec :: Int -> ReadS StopContactStreaming
Prelude.Read, Int -> StopContactStreaming -> ShowS
[StopContactStreaming] -> ShowS
StopContactStreaming -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopContactStreaming] -> ShowS
$cshowList :: [StopContactStreaming] -> ShowS
show :: StopContactStreaming -> String
$cshow :: StopContactStreaming -> String
showsPrec :: Int -> StopContactStreaming -> ShowS
$cshowsPrec :: Int -> StopContactStreaming -> ShowS
Prelude.Show, forall x. Rep StopContactStreaming x -> StopContactStreaming
forall x. StopContactStreaming -> Rep StopContactStreaming x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopContactStreaming x -> StopContactStreaming
$cfrom :: forall x. StopContactStreaming -> Rep StopContactStreaming x
Prelude.Generic)

-- |
-- Create a value of 'StopContactStreaming' 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:
--
-- 'instanceId', 'stopContactStreaming_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'contactId', 'stopContactStreaming_contactId' - The identifier of the contact. This is the identifier of the contact
-- that is associated with the first interaction with the contact center.
--
-- 'streamingId', 'stopContactStreaming_streamingId' - The identifier of the streaming configuration enabled.
newStopContactStreaming ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'contactId'
  Prelude.Text ->
  -- | 'streamingId'
  Prelude.Text ->
  StopContactStreaming
newStopContactStreaming :: Text -> Text -> Text -> StopContactStreaming
newStopContactStreaming
  Text
pInstanceId_
  Text
pContactId_
  Text
pStreamingId_ =
    StopContactStreaming'
      { $sel:instanceId:StopContactStreaming' :: Text
instanceId = Text
pInstanceId_,
        $sel:contactId:StopContactStreaming' :: Text
contactId = Text
pContactId_,
        $sel:streamingId:StopContactStreaming' :: Text
streamingId = Text
pStreamingId_
      }

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

-- | The identifier of the contact. This is the identifier of the contact
-- that is associated with the first interaction with the contact center.
stopContactStreaming_contactId :: Lens.Lens' StopContactStreaming Prelude.Text
stopContactStreaming_contactId :: Lens' StopContactStreaming Text
stopContactStreaming_contactId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopContactStreaming' {Text
contactId :: Text
$sel:contactId:StopContactStreaming' :: StopContactStreaming -> Text
contactId} -> Text
contactId) (\s :: StopContactStreaming
s@StopContactStreaming' {} Text
a -> StopContactStreaming
s {$sel:contactId:StopContactStreaming' :: Text
contactId = Text
a} :: StopContactStreaming)

-- | The identifier of the streaming configuration enabled.
stopContactStreaming_streamingId :: Lens.Lens' StopContactStreaming Prelude.Text
stopContactStreaming_streamingId :: Lens' StopContactStreaming Text
stopContactStreaming_streamingId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopContactStreaming' {Text
streamingId :: Text
$sel:streamingId:StopContactStreaming' :: StopContactStreaming -> Text
streamingId} -> Text
streamingId) (\s :: StopContactStreaming
s@StopContactStreaming' {} Text
a -> StopContactStreaming
s {$sel:streamingId:StopContactStreaming' :: Text
streamingId = Text
a} :: StopContactStreaming)

instance Core.AWSRequest StopContactStreaming where
  type
    AWSResponse StopContactStreaming =
      StopContactStreamingResponse
  request :: (Service -> Service)
-> StopContactStreaming -> Request StopContactStreaming
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 StopContactStreaming
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopContactStreaming)))
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 -> StopContactStreamingResponse
StopContactStreamingResponse'
            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 StopContactStreaming where
  hashWithSalt :: Int -> StopContactStreaming -> Int
hashWithSalt Int
_salt StopContactStreaming' {Text
streamingId :: Text
contactId :: Text
instanceId :: Text
$sel:streamingId:StopContactStreaming' :: StopContactStreaming -> Text
$sel:contactId:StopContactStreaming' :: StopContactStreaming -> Text
$sel:instanceId:StopContactStreaming' :: StopContactStreaming -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
contactId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
streamingId

instance Prelude.NFData StopContactStreaming where
  rnf :: StopContactStreaming -> ()
rnf StopContactStreaming' {Text
streamingId :: Text
contactId :: Text
instanceId :: Text
$sel:streamingId:StopContactStreaming' :: StopContactStreaming -> Text
$sel:contactId:StopContactStreaming' :: StopContactStreaming -> Text
$sel:instanceId:StopContactStreaming' :: StopContactStreaming -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
instanceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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
streamingId

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

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

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

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

-- |
-- Create a value of 'StopContactStreamingResponse' 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', 'stopContactStreamingResponse_httpStatus' - The response's http status code.
newStopContactStreamingResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StopContactStreamingResponse
newStopContactStreamingResponse :: Int -> StopContactStreamingResponse
newStopContactStreamingResponse Int
pHttpStatus_ =
  StopContactStreamingResponse'
    { $sel:httpStatus:StopContactStreamingResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

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