{-# 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.ResumeContactRecording
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- When a contact is being recorded, and the recording has been suspended
-- using SuspendContactRecording, this API resumes recording the call.
--
-- Only voice recordings are supported at this time.
module Amazonka.Connect.ResumeContactRecording
  ( -- * Creating a Request
    ResumeContactRecording (..),
    newResumeContactRecording,

    -- * Request Lenses
    resumeContactRecording_instanceId,
    resumeContactRecording_contactId,
    resumeContactRecording_initialContactId,

    -- * Destructuring the Response
    ResumeContactRecordingResponse (..),
    newResumeContactRecordingResponse,

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

-- |
-- Create a value of 'ResumeContactRecording' 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', 'resumeContactRecording_instanceId' - The identifier of the Amazon Connect instance. You can find the
-- instanceId in the ARN of the instance.
--
-- 'contactId', 'resumeContactRecording_contactId' - The identifier of the contact.
--
-- 'initialContactId', 'resumeContactRecording_initialContactId' - The identifier of the contact. This is the identifier of the contact
-- associated with the first interaction with the contact center.
newResumeContactRecording ::
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'contactId'
  Prelude.Text ->
  -- | 'initialContactId'
  Prelude.Text ->
  ResumeContactRecording
newResumeContactRecording :: Text -> Text -> Text -> ResumeContactRecording
newResumeContactRecording
  Text
pInstanceId_
  Text
pContactId_
  Text
pInitialContactId_ =
    ResumeContactRecording'
      { $sel:instanceId:ResumeContactRecording' :: Text
instanceId = Text
pInstanceId_,
        $sel:contactId:ResumeContactRecording' :: Text
contactId = Text
pContactId_,
        $sel:initialContactId:ResumeContactRecording' :: Text
initialContactId = Text
pInitialContactId_
      }

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

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

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

instance Core.AWSRequest ResumeContactRecording where
  type
    AWSResponse ResumeContactRecording =
      ResumeContactRecordingResponse
  request :: (Service -> Service)
-> ResumeContactRecording -> Request ResumeContactRecording
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 ResumeContactRecording
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ResumeContactRecording)))
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 -> ResumeContactRecordingResponse
ResumeContactRecordingResponse'
            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 ResumeContactRecording where
  hashWithSalt :: Int -> ResumeContactRecording -> Int
hashWithSalt Int
_salt ResumeContactRecording' {Text
initialContactId :: Text
contactId :: Text
instanceId :: Text
$sel:initialContactId:ResumeContactRecording' :: ResumeContactRecording -> Text
$sel:contactId:ResumeContactRecording' :: ResumeContactRecording -> Text
$sel:instanceId:ResumeContactRecording' :: ResumeContactRecording -> 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
initialContactId

instance Prelude.NFData ResumeContactRecording where
  rnf :: ResumeContactRecording -> ()
rnf ResumeContactRecording' {Text
initialContactId :: Text
contactId :: Text
instanceId :: Text
$sel:initialContactId:ResumeContactRecording' :: ResumeContactRecording -> Text
$sel:contactId:ResumeContactRecording' :: ResumeContactRecording -> Text
$sel:instanceId:ResumeContactRecording' :: ResumeContactRecording -> 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
initialContactId

instance Data.ToHeaders ResumeContactRecording where
  toHeaders :: ResumeContactRecording -> 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 ResumeContactRecording where
  toJSON :: ResumeContactRecording -> Value
toJSON ResumeContactRecording' {Text
initialContactId :: Text
contactId :: Text
instanceId :: Text
$sel:initialContactId:ResumeContactRecording' :: ResumeContactRecording -> Text
$sel:contactId:ResumeContactRecording' :: ResumeContactRecording -> Text
$sel:instanceId:ResumeContactRecording' :: ResumeContactRecording -> 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
"InitialContactId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
initialContactId)
          ]
      )

instance Data.ToPath ResumeContactRecording where
  toPath :: ResumeContactRecording -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/contact/resume-recording"

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

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

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

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

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