{-# 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.Pinpoint.GetVoiceChannel
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Retrieves information about the status and settings of the voice channel
-- for an application.
module Amazonka.Pinpoint.GetVoiceChannel
  ( -- * Creating a Request
    GetVoiceChannel (..),
    newGetVoiceChannel,

    -- * Request Lenses
    getVoiceChannel_applicationId,

    -- * Destructuring the Response
    GetVoiceChannelResponse (..),
    newGetVoiceChannelResponse,

    -- * Response Lenses
    getVoiceChannelResponse_httpStatus,
    getVoiceChannelResponse_voiceChannelResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Pinpoint.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetVoiceChannel' smart constructor.
data GetVoiceChannel = GetVoiceChannel'
  { -- | The unique identifier for the application. This identifier is displayed
    -- as the __Project ID__ on the Amazon Pinpoint console.
    GetVoiceChannel -> Text
applicationId :: Prelude.Text
  }
  deriving (GetVoiceChannel -> GetVoiceChannel -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetVoiceChannel -> GetVoiceChannel -> Bool
$c/= :: GetVoiceChannel -> GetVoiceChannel -> Bool
== :: GetVoiceChannel -> GetVoiceChannel -> Bool
$c== :: GetVoiceChannel -> GetVoiceChannel -> Bool
Prelude.Eq, ReadPrec [GetVoiceChannel]
ReadPrec GetVoiceChannel
Int -> ReadS GetVoiceChannel
ReadS [GetVoiceChannel]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetVoiceChannel]
$creadListPrec :: ReadPrec [GetVoiceChannel]
readPrec :: ReadPrec GetVoiceChannel
$creadPrec :: ReadPrec GetVoiceChannel
readList :: ReadS [GetVoiceChannel]
$creadList :: ReadS [GetVoiceChannel]
readsPrec :: Int -> ReadS GetVoiceChannel
$creadsPrec :: Int -> ReadS GetVoiceChannel
Prelude.Read, Int -> GetVoiceChannel -> ShowS
[GetVoiceChannel] -> ShowS
GetVoiceChannel -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetVoiceChannel] -> ShowS
$cshowList :: [GetVoiceChannel] -> ShowS
show :: GetVoiceChannel -> String
$cshow :: GetVoiceChannel -> String
showsPrec :: Int -> GetVoiceChannel -> ShowS
$cshowsPrec :: Int -> GetVoiceChannel -> ShowS
Prelude.Show, forall x. Rep GetVoiceChannel x -> GetVoiceChannel
forall x. GetVoiceChannel -> Rep GetVoiceChannel x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetVoiceChannel x -> GetVoiceChannel
$cfrom :: forall x. GetVoiceChannel -> Rep GetVoiceChannel x
Prelude.Generic)

-- |
-- Create a value of 'GetVoiceChannel' 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:
--
-- 'applicationId', 'getVoiceChannel_applicationId' - The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
newGetVoiceChannel ::
  -- | 'applicationId'
  Prelude.Text ->
  GetVoiceChannel
newGetVoiceChannel :: Text -> GetVoiceChannel
newGetVoiceChannel Text
pApplicationId_ =
  GetVoiceChannel' {$sel:applicationId:GetVoiceChannel' :: Text
applicationId = Text
pApplicationId_}

-- | The unique identifier for the application. This identifier is displayed
-- as the __Project ID__ on the Amazon Pinpoint console.
getVoiceChannel_applicationId :: Lens.Lens' GetVoiceChannel Prelude.Text
getVoiceChannel_applicationId :: Lens' GetVoiceChannel Text
getVoiceChannel_applicationId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceChannel' {Text
applicationId :: Text
$sel:applicationId:GetVoiceChannel' :: GetVoiceChannel -> Text
applicationId} -> Text
applicationId) (\s :: GetVoiceChannel
s@GetVoiceChannel' {} Text
a -> GetVoiceChannel
s {$sel:applicationId:GetVoiceChannel' :: Text
applicationId = Text
a} :: GetVoiceChannel)

instance Core.AWSRequest GetVoiceChannel where
  type
    AWSResponse GetVoiceChannel =
      GetVoiceChannelResponse
  request :: (Service -> Service) -> GetVoiceChannel -> Request GetVoiceChannel
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetVoiceChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetVoiceChannel)))
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 ->
          Int -> VoiceChannelResponse -> GetVoiceChannelResponse
GetVoiceChannelResponse'
            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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
      )

instance Prelude.Hashable GetVoiceChannel where
  hashWithSalt :: Int -> GetVoiceChannel -> Int
hashWithSalt Int
_salt GetVoiceChannel' {Text
applicationId :: Text
$sel:applicationId:GetVoiceChannel' :: GetVoiceChannel -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationId

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

instance Data.ToHeaders GetVoiceChannel where
  toHeaders :: GetVoiceChannel -> 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.ToPath GetVoiceChannel where
  toPath :: GetVoiceChannel -> ByteString
toPath GetVoiceChannel' {Text
applicationId :: Text
$sel:applicationId:GetVoiceChannel' :: GetVoiceChannel -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/apps/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
applicationId,
        ByteString
"/channels/voice"
      ]

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

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

-- |
-- Create a value of 'GetVoiceChannelResponse' 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', 'getVoiceChannelResponse_httpStatus' - The response's http status code.
--
-- 'voiceChannelResponse', 'getVoiceChannelResponse_voiceChannelResponse' - Undocumented member.
newGetVoiceChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'voiceChannelResponse'
  VoiceChannelResponse ->
  GetVoiceChannelResponse
newGetVoiceChannelResponse :: Int -> VoiceChannelResponse -> GetVoiceChannelResponse
newGetVoiceChannelResponse
  Int
pHttpStatus_
  VoiceChannelResponse
pVoiceChannelResponse_ =
    GetVoiceChannelResponse'
      { $sel:httpStatus:GetVoiceChannelResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:voiceChannelResponse:GetVoiceChannelResponse' :: VoiceChannelResponse
voiceChannelResponse = VoiceChannelResponse
pVoiceChannelResponse_
      }

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

-- | Undocumented member.
getVoiceChannelResponse_voiceChannelResponse :: Lens.Lens' GetVoiceChannelResponse VoiceChannelResponse
getVoiceChannelResponse_voiceChannelResponse :: Lens' GetVoiceChannelResponse VoiceChannelResponse
getVoiceChannelResponse_voiceChannelResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVoiceChannelResponse' {VoiceChannelResponse
voiceChannelResponse :: VoiceChannelResponse
$sel:voiceChannelResponse:GetVoiceChannelResponse' :: GetVoiceChannelResponse -> VoiceChannelResponse
voiceChannelResponse} -> VoiceChannelResponse
voiceChannelResponse) (\s :: GetVoiceChannelResponse
s@GetVoiceChannelResponse' {} VoiceChannelResponse
a -> GetVoiceChannelResponse
s {$sel:voiceChannelResponse:GetVoiceChannelResponse' :: VoiceChannelResponse
voiceChannelResponse = VoiceChannelResponse
a} :: GetVoiceChannelResponse)

instance Prelude.NFData GetVoiceChannelResponse where
  rnf :: GetVoiceChannelResponse -> ()
rnf GetVoiceChannelResponse' {Int
VoiceChannelResponse
voiceChannelResponse :: VoiceChannelResponse
httpStatus :: Int
$sel:voiceChannelResponse:GetVoiceChannelResponse' :: GetVoiceChannelResponse -> VoiceChannelResponse
$sel:httpStatus:GetVoiceChannelResponse' :: GetVoiceChannelResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf VoiceChannelResponse
voiceChannelResponse