{-# 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.Transcribe.GetCallAnalyticsCategory
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Provides information about the specified Call Analytics category.
--
-- To get a list of your Call Analytics categories, use the operation.
module Amazonka.Transcribe.GetCallAnalyticsCategory
  ( -- * Creating a Request
    GetCallAnalyticsCategory (..),
    newGetCallAnalyticsCategory,

    -- * Request Lenses
    getCallAnalyticsCategory_categoryName,

    -- * Destructuring the Response
    GetCallAnalyticsCategoryResponse (..),
    newGetCallAnalyticsCategoryResponse,

    -- * Response Lenses
    getCallAnalyticsCategoryResponse_categoryProperties,
    getCallAnalyticsCategoryResponse_httpStatus,
  )
where

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
import Amazonka.Transcribe.Types

-- | /See:/ 'newGetCallAnalyticsCategory' smart constructor.
data GetCallAnalyticsCategory = GetCallAnalyticsCategory'
  { -- | The name of the Call Analytics category you want information about.
    -- Category names are case sensitive.
    GetCallAnalyticsCategory -> Text
categoryName :: Prelude.Text
  }
  deriving (GetCallAnalyticsCategory -> GetCallAnalyticsCategory -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCallAnalyticsCategory -> GetCallAnalyticsCategory -> Bool
$c/= :: GetCallAnalyticsCategory -> GetCallAnalyticsCategory -> Bool
== :: GetCallAnalyticsCategory -> GetCallAnalyticsCategory -> Bool
$c== :: GetCallAnalyticsCategory -> GetCallAnalyticsCategory -> Bool
Prelude.Eq, ReadPrec [GetCallAnalyticsCategory]
ReadPrec GetCallAnalyticsCategory
Int -> ReadS GetCallAnalyticsCategory
ReadS [GetCallAnalyticsCategory]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCallAnalyticsCategory]
$creadListPrec :: ReadPrec [GetCallAnalyticsCategory]
readPrec :: ReadPrec GetCallAnalyticsCategory
$creadPrec :: ReadPrec GetCallAnalyticsCategory
readList :: ReadS [GetCallAnalyticsCategory]
$creadList :: ReadS [GetCallAnalyticsCategory]
readsPrec :: Int -> ReadS GetCallAnalyticsCategory
$creadsPrec :: Int -> ReadS GetCallAnalyticsCategory
Prelude.Read, Int -> GetCallAnalyticsCategory -> ShowS
[GetCallAnalyticsCategory] -> ShowS
GetCallAnalyticsCategory -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCallAnalyticsCategory] -> ShowS
$cshowList :: [GetCallAnalyticsCategory] -> ShowS
show :: GetCallAnalyticsCategory -> String
$cshow :: GetCallAnalyticsCategory -> String
showsPrec :: Int -> GetCallAnalyticsCategory -> ShowS
$cshowsPrec :: Int -> GetCallAnalyticsCategory -> ShowS
Prelude.Show, forall x.
Rep GetCallAnalyticsCategory x -> GetCallAnalyticsCategory
forall x.
GetCallAnalyticsCategory -> Rep GetCallAnalyticsCategory x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCallAnalyticsCategory x -> GetCallAnalyticsCategory
$cfrom :: forall x.
GetCallAnalyticsCategory -> Rep GetCallAnalyticsCategory x
Prelude.Generic)

-- |
-- Create a value of 'GetCallAnalyticsCategory' 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:
--
-- 'categoryName', 'getCallAnalyticsCategory_categoryName' - The name of the Call Analytics category you want information about.
-- Category names are case sensitive.
newGetCallAnalyticsCategory ::
  -- | 'categoryName'
  Prelude.Text ->
  GetCallAnalyticsCategory
newGetCallAnalyticsCategory :: Text -> GetCallAnalyticsCategory
newGetCallAnalyticsCategory Text
pCategoryName_ =
  GetCallAnalyticsCategory'
    { $sel:categoryName:GetCallAnalyticsCategory' :: Text
categoryName =
        Text
pCategoryName_
    }

-- | The name of the Call Analytics category you want information about.
-- Category names are case sensitive.
getCallAnalyticsCategory_categoryName :: Lens.Lens' GetCallAnalyticsCategory Prelude.Text
getCallAnalyticsCategory_categoryName :: Lens' GetCallAnalyticsCategory Text
getCallAnalyticsCategory_categoryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCallAnalyticsCategory' {Text
categoryName :: Text
$sel:categoryName:GetCallAnalyticsCategory' :: GetCallAnalyticsCategory -> Text
categoryName} -> Text
categoryName) (\s :: GetCallAnalyticsCategory
s@GetCallAnalyticsCategory' {} Text
a -> GetCallAnalyticsCategory
s {$sel:categoryName:GetCallAnalyticsCategory' :: Text
categoryName = Text
a} :: GetCallAnalyticsCategory)

instance Core.AWSRequest GetCallAnalyticsCategory where
  type
    AWSResponse GetCallAnalyticsCategory =
      GetCallAnalyticsCategoryResponse
  request :: (Service -> Service)
-> GetCallAnalyticsCategory -> Request GetCallAnalyticsCategory
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 GetCallAnalyticsCategory
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCallAnalyticsCategory)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe CategoryProperties -> Int -> GetCallAnalyticsCategoryResponse
GetCallAnalyticsCategoryResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"CategoryProperties")
            forall (f :: * -> *) a b. Applicative f => 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 GetCallAnalyticsCategory where
  hashWithSalt :: Int -> GetCallAnalyticsCategory -> Int
hashWithSalt Int
_salt GetCallAnalyticsCategory' {Text
categoryName :: Text
$sel:categoryName:GetCallAnalyticsCategory' :: GetCallAnalyticsCategory -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
categoryName

instance Prelude.NFData GetCallAnalyticsCategory where
  rnf :: GetCallAnalyticsCategory -> ()
rnf GetCallAnalyticsCategory' {Text
categoryName :: Text
$sel:categoryName:GetCallAnalyticsCategory' :: GetCallAnalyticsCategory -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
categoryName

instance Data.ToHeaders GetCallAnalyticsCategory where
  toHeaders :: GetCallAnalyticsCategory -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Transcribe.GetCallAnalyticsCategory" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON GetCallAnalyticsCategory where
  toJSON :: GetCallAnalyticsCategory -> Value
toJSON GetCallAnalyticsCategory' {Text
categoryName :: Text
$sel:categoryName:GetCallAnalyticsCategory' :: GetCallAnalyticsCategory -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"CategoryName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
categoryName)]
      )

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

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

-- | /See:/ 'newGetCallAnalyticsCategoryResponse' smart constructor.
data GetCallAnalyticsCategoryResponse = GetCallAnalyticsCategoryResponse'
  { -- | Provides you with the properties of the Call Analytics category you
    -- specified in your @GetCallAnalyticsCategory@ request.
    GetCallAnalyticsCategoryResponse -> Maybe CategoryProperties
categoryProperties :: Prelude.Maybe CategoryProperties,
    -- | The response's http status code.
    GetCallAnalyticsCategoryResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetCallAnalyticsCategoryResponse
-> GetCallAnalyticsCategoryResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetCallAnalyticsCategoryResponse
-> GetCallAnalyticsCategoryResponse -> Bool
$c/= :: GetCallAnalyticsCategoryResponse
-> GetCallAnalyticsCategoryResponse -> Bool
== :: GetCallAnalyticsCategoryResponse
-> GetCallAnalyticsCategoryResponse -> Bool
$c== :: GetCallAnalyticsCategoryResponse
-> GetCallAnalyticsCategoryResponse -> Bool
Prelude.Eq, ReadPrec [GetCallAnalyticsCategoryResponse]
ReadPrec GetCallAnalyticsCategoryResponse
Int -> ReadS GetCallAnalyticsCategoryResponse
ReadS [GetCallAnalyticsCategoryResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetCallAnalyticsCategoryResponse]
$creadListPrec :: ReadPrec [GetCallAnalyticsCategoryResponse]
readPrec :: ReadPrec GetCallAnalyticsCategoryResponse
$creadPrec :: ReadPrec GetCallAnalyticsCategoryResponse
readList :: ReadS [GetCallAnalyticsCategoryResponse]
$creadList :: ReadS [GetCallAnalyticsCategoryResponse]
readsPrec :: Int -> ReadS GetCallAnalyticsCategoryResponse
$creadsPrec :: Int -> ReadS GetCallAnalyticsCategoryResponse
Prelude.Read, Int -> GetCallAnalyticsCategoryResponse -> ShowS
[GetCallAnalyticsCategoryResponse] -> ShowS
GetCallAnalyticsCategoryResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetCallAnalyticsCategoryResponse] -> ShowS
$cshowList :: [GetCallAnalyticsCategoryResponse] -> ShowS
show :: GetCallAnalyticsCategoryResponse -> String
$cshow :: GetCallAnalyticsCategoryResponse -> String
showsPrec :: Int -> GetCallAnalyticsCategoryResponse -> ShowS
$cshowsPrec :: Int -> GetCallAnalyticsCategoryResponse -> ShowS
Prelude.Show, forall x.
Rep GetCallAnalyticsCategoryResponse x
-> GetCallAnalyticsCategoryResponse
forall x.
GetCallAnalyticsCategoryResponse
-> Rep GetCallAnalyticsCategoryResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetCallAnalyticsCategoryResponse x
-> GetCallAnalyticsCategoryResponse
$cfrom :: forall x.
GetCallAnalyticsCategoryResponse
-> Rep GetCallAnalyticsCategoryResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetCallAnalyticsCategoryResponse' 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:
--
-- 'categoryProperties', 'getCallAnalyticsCategoryResponse_categoryProperties' - Provides you with the properties of the Call Analytics category you
-- specified in your @GetCallAnalyticsCategory@ request.
--
-- 'httpStatus', 'getCallAnalyticsCategoryResponse_httpStatus' - The response's http status code.
newGetCallAnalyticsCategoryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetCallAnalyticsCategoryResponse
newGetCallAnalyticsCategoryResponse :: Int -> GetCallAnalyticsCategoryResponse
newGetCallAnalyticsCategoryResponse Int
pHttpStatus_ =
  GetCallAnalyticsCategoryResponse'
    { $sel:categoryProperties:GetCallAnalyticsCategoryResponse' :: Maybe CategoryProperties
categoryProperties =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetCallAnalyticsCategoryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Provides you with the properties of the Call Analytics category you
-- specified in your @GetCallAnalyticsCategory@ request.
getCallAnalyticsCategoryResponse_categoryProperties :: Lens.Lens' GetCallAnalyticsCategoryResponse (Prelude.Maybe CategoryProperties)
getCallAnalyticsCategoryResponse_categoryProperties :: Lens' GetCallAnalyticsCategoryResponse (Maybe CategoryProperties)
getCallAnalyticsCategoryResponse_categoryProperties = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetCallAnalyticsCategoryResponse' {Maybe CategoryProperties
categoryProperties :: Maybe CategoryProperties
$sel:categoryProperties:GetCallAnalyticsCategoryResponse' :: GetCallAnalyticsCategoryResponse -> Maybe CategoryProperties
categoryProperties} -> Maybe CategoryProperties
categoryProperties) (\s :: GetCallAnalyticsCategoryResponse
s@GetCallAnalyticsCategoryResponse' {} Maybe CategoryProperties
a -> GetCallAnalyticsCategoryResponse
s {$sel:categoryProperties:GetCallAnalyticsCategoryResponse' :: Maybe CategoryProperties
categoryProperties = Maybe CategoryProperties
a} :: GetCallAnalyticsCategoryResponse)

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

instance
  Prelude.NFData
    GetCallAnalyticsCategoryResponse
  where
  rnf :: GetCallAnalyticsCategoryResponse -> ()
rnf GetCallAnalyticsCategoryResponse' {Int
Maybe CategoryProperties
httpStatus :: Int
categoryProperties :: Maybe CategoryProperties
$sel:httpStatus:GetCallAnalyticsCategoryResponse' :: GetCallAnalyticsCategoryResponse -> Int
$sel:categoryProperties:GetCallAnalyticsCategoryResponse' :: GetCallAnalyticsCategoryResponse -> Maybe CategoryProperties
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CategoryProperties
categoryProperties
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus