{-# 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.GetBaiduChannel
-- 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 Baidu channel
-- for an application.
module Amazonka.Pinpoint.GetBaiduChannel
  ( -- * Creating a Request
    GetBaiduChannel (..),
    newGetBaiduChannel,

    -- * Request Lenses
    getBaiduChannel_applicationId,

    -- * Destructuring the Response
    GetBaiduChannelResponse (..),
    newGetBaiduChannelResponse,

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

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

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

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

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

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

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

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

-- |
-- Create a value of 'GetBaiduChannelResponse' 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', 'getBaiduChannelResponse_httpStatus' - The response's http status code.
--
-- 'baiduChannelResponse', 'getBaiduChannelResponse_baiduChannelResponse' - Undocumented member.
newGetBaiduChannelResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'baiduChannelResponse'
  BaiduChannelResponse ->
  GetBaiduChannelResponse
newGetBaiduChannelResponse :: Int -> BaiduChannelResponse -> GetBaiduChannelResponse
newGetBaiduChannelResponse
  Int
pHttpStatus_
  BaiduChannelResponse
pBaiduChannelResponse_ =
    GetBaiduChannelResponse'
      { $sel:httpStatus:GetBaiduChannelResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:baiduChannelResponse:GetBaiduChannelResponse' :: BaiduChannelResponse
baiduChannelResponse = BaiduChannelResponse
pBaiduChannelResponse_
      }

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

-- | Undocumented member.
getBaiduChannelResponse_baiduChannelResponse :: Lens.Lens' GetBaiduChannelResponse BaiduChannelResponse
getBaiduChannelResponse_baiduChannelResponse :: Lens' GetBaiduChannelResponse BaiduChannelResponse
getBaiduChannelResponse_baiduChannelResponse = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBaiduChannelResponse' {BaiduChannelResponse
baiduChannelResponse :: BaiduChannelResponse
$sel:baiduChannelResponse:GetBaiduChannelResponse' :: GetBaiduChannelResponse -> BaiduChannelResponse
baiduChannelResponse} -> BaiduChannelResponse
baiduChannelResponse) (\s :: GetBaiduChannelResponse
s@GetBaiduChannelResponse' {} BaiduChannelResponse
a -> GetBaiduChannelResponse
s {$sel:baiduChannelResponse:GetBaiduChannelResponse' :: BaiduChannelResponse
baiduChannelResponse = BaiduChannelResponse
a} :: GetBaiduChannelResponse)

instance Prelude.NFData GetBaiduChannelResponse where
  rnf :: GetBaiduChannelResponse -> ()
rnf GetBaiduChannelResponse' {Int
BaiduChannelResponse
baiduChannelResponse :: BaiduChannelResponse
httpStatus :: Int
$sel:baiduChannelResponse:GetBaiduChannelResponse' :: GetBaiduChannelResponse -> BaiduChannelResponse
$sel:httpStatus:GetBaiduChannelResponse' :: GetBaiduChannelResponse -> 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 BaiduChannelResponse
baiduChannelResponse