{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves information about a call analytics category.
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.Lens as Lens
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 category you want information about. This value is case
    -- sensitive.
    GetCallAnalyticsCategory -> Text
categoryName :: Prelude.Text
  }
  deriving (GetCallAnalyticsCategory -> GetCallAnalyticsCategory -> Bool
(GetCallAnalyticsCategory -> GetCallAnalyticsCategory -> Bool)
-> (GetCallAnalyticsCategory -> GetCallAnalyticsCategory -> Bool)
-> Eq GetCallAnalyticsCategory
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]
(Int -> ReadS GetCallAnalyticsCategory)
-> ReadS [GetCallAnalyticsCategory]
-> ReadPrec GetCallAnalyticsCategory
-> ReadPrec [GetCallAnalyticsCategory]
-> Read 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
(Int -> GetCallAnalyticsCategory -> ShowS)
-> (GetCallAnalyticsCategory -> String)
-> ([GetCallAnalyticsCategory] -> ShowS)
-> Show GetCallAnalyticsCategory
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.
 GetCallAnalyticsCategory -> Rep GetCallAnalyticsCategory x)
-> (forall x.
    Rep GetCallAnalyticsCategory x -> GetCallAnalyticsCategory)
-> Generic GetCallAnalyticsCategory
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 category you want information about. This value is case
-- sensitive.
newGetCallAnalyticsCategory ::
  -- | 'categoryName'
  Prelude.Text ->
  GetCallAnalyticsCategory
newGetCallAnalyticsCategory :: Text -> GetCallAnalyticsCategory
newGetCallAnalyticsCategory Text
pCategoryName_ =
  GetCallAnalyticsCategory' :: Text -> GetCallAnalyticsCategory
GetCallAnalyticsCategory'
    { $sel:categoryName:GetCallAnalyticsCategory' :: Text
categoryName =
        Text
pCategoryName_
    }

-- | The name of the category you want information about. This value is case
-- sensitive.
getCallAnalyticsCategory_categoryName :: Lens.Lens' GetCallAnalyticsCategory Prelude.Text
getCallAnalyticsCategory_categoryName :: (Text -> f Text)
-> GetCallAnalyticsCategory -> f GetCallAnalyticsCategory
getCallAnalyticsCategory_categoryName = (GetCallAnalyticsCategory -> Text)
-> (GetCallAnalyticsCategory -> Text -> GetCallAnalyticsCategory)
-> Lens GetCallAnalyticsCategory GetCallAnalyticsCategory Text Text
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 :: GetCallAnalyticsCategory -> Request GetCallAnalyticsCategory
request = Service
-> GetCallAnalyticsCategory -> Request GetCallAnalyticsCategory
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetCallAnalyticsCategory
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCallAnalyticsCategory)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetCallAnalyticsCategory))
-> Logger
-> Service
-> Proxy GetCallAnalyticsCategory
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetCallAnalyticsCategory)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe CategoryProperties -> Int -> GetCallAnalyticsCategoryResponse
GetCallAnalyticsCategoryResponse'
            (Maybe CategoryProperties
 -> Int -> GetCallAnalyticsCategoryResponse)
-> Either String (Maybe CategoryProperties)
-> Either String (Int -> GetCallAnalyticsCategoryResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe CategoryProperties)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CategoryProperties")
            Either String (Int -> GetCallAnalyticsCategoryResponse)
-> Either String Int
-> Either String GetCallAnalyticsCategoryResponse
forall (f :: * -> *) a b. Applicative f => 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 GetCallAnalyticsCategory

instance Prelude.NFData GetCallAnalyticsCategory

instance Core.ToHeaders GetCallAnalyticsCategory where
  toHeaders :: GetCallAnalyticsCategory -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetCallAnalyticsCategory -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"Transcribe.GetCallAnalyticsCategory" ::
                          Prelude.ByteString
                      ),
            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 GetCallAnalyticsCategory where
  toJSON :: GetCallAnalyticsCategory -> Value
toJSON GetCallAnalyticsCategory' {Text
categoryName :: Text
$sel:categoryName:GetCallAnalyticsCategory' :: GetCallAnalyticsCategory -> 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
"CategoryName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
categoryName)]
      )

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

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

-- | /See:/ 'newGetCallAnalyticsCategoryResponse' smart constructor.
data GetCallAnalyticsCategoryResponse = GetCallAnalyticsCategoryResponse'
  { -- | The rules you\'ve defined for a category.
    GetCallAnalyticsCategoryResponse -> Maybe CategoryProperties
categoryProperties :: Prelude.Maybe CategoryProperties,
    -- | The response's http status code.
    GetCallAnalyticsCategoryResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetCallAnalyticsCategoryResponse
-> GetCallAnalyticsCategoryResponse -> Bool
(GetCallAnalyticsCategoryResponse
 -> GetCallAnalyticsCategoryResponse -> Bool)
-> (GetCallAnalyticsCategoryResponse
    -> GetCallAnalyticsCategoryResponse -> Bool)
-> Eq GetCallAnalyticsCategoryResponse
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]
(Int -> ReadS GetCallAnalyticsCategoryResponse)
-> ReadS [GetCallAnalyticsCategoryResponse]
-> ReadPrec GetCallAnalyticsCategoryResponse
-> ReadPrec [GetCallAnalyticsCategoryResponse]
-> Read 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
(Int -> GetCallAnalyticsCategoryResponse -> ShowS)
-> (GetCallAnalyticsCategoryResponse -> String)
-> ([GetCallAnalyticsCategoryResponse] -> ShowS)
-> Show GetCallAnalyticsCategoryResponse
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.
 GetCallAnalyticsCategoryResponse
 -> Rep GetCallAnalyticsCategoryResponse x)
-> (forall x.
    Rep GetCallAnalyticsCategoryResponse x
    -> GetCallAnalyticsCategoryResponse)
-> Generic GetCallAnalyticsCategoryResponse
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' - The rules you\'ve defined for a category.
--
-- 'httpStatus', 'getCallAnalyticsCategoryResponse_httpStatus' - The response's http status code.
newGetCallAnalyticsCategoryResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetCallAnalyticsCategoryResponse
newGetCallAnalyticsCategoryResponse :: Int -> GetCallAnalyticsCategoryResponse
newGetCallAnalyticsCategoryResponse Int
pHttpStatus_ =
  GetCallAnalyticsCategoryResponse' :: Maybe CategoryProperties -> Int -> GetCallAnalyticsCategoryResponse
GetCallAnalyticsCategoryResponse'
    { $sel:categoryProperties:GetCallAnalyticsCategoryResponse' :: Maybe CategoryProperties
categoryProperties =
        Maybe CategoryProperties
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetCallAnalyticsCategoryResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The rules you\'ve defined for a category.
getCallAnalyticsCategoryResponse_categoryProperties :: Lens.Lens' GetCallAnalyticsCategoryResponse (Prelude.Maybe CategoryProperties)
getCallAnalyticsCategoryResponse_categoryProperties :: (Maybe CategoryProperties -> f (Maybe CategoryProperties))
-> GetCallAnalyticsCategoryResponse
-> f GetCallAnalyticsCategoryResponse
getCallAnalyticsCategoryResponse_categoryProperties = (GetCallAnalyticsCategoryResponse -> Maybe CategoryProperties)
-> (GetCallAnalyticsCategoryResponse
    -> Maybe CategoryProperties -> GetCallAnalyticsCategoryResponse)
-> Lens
     GetCallAnalyticsCategoryResponse
     GetCallAnalyticsCategoryResponse
     (Maybe CategoryProperties)
     (Maybe 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 :: (Int -> f Int)
-> GetCallAnalyticsCategoryResponse
-> f GetCallAnalyticsCategoryResponse
getCallAnalyticsCategoryResponse_httpStatus = (GetCallAnalyticsCategoryResponse -> Int)
-> (GetCallAnalyticsCategoryResponse
    -> Int -> GetCallAnalyticsCategoryResponse)
-> Lens
     GetCallAnalyticsCategoryResponse
     GetCallAnalyticsCategoryResponse
     Int
     Int
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