{-# 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-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 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.Lens as Lens
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
(GetBaiduChannel -> GetBaiduChannel -> Bool)
-> (GetBaiduChannel -> GetBaiduChannel -> Bool)
-> Eq GetBaiduChannel
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]
(Int -> ReadS GetBaiduChannel)
-> ReadS [GetBaiduChannel]
-> ReadPrec GetBaiduChannel
-> ReadPrec [GetBaiduChannel]
-> Read 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
(Int -> GetBaiduChannel -> ShowS)
-> (GetBaiduChannel -> String)
-> ([GetBaiduChannel] -> ShowS)
-> Show GetBaiduChannel
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. GetBaiduChannel -> Rep GetBaiduChannel x)
-> (forall x. Rep GetBaiduChannel x -> GetBaiduChannel)
-> Generic GetBaiduChannel
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' :: Text -> GetBaiduChannel
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 :: (Text -> f Text) -> GetBaiduChannel -> f GetBaiduChannel
getBaiduChannel_applicationId = (GetBaiduChannel -> Text)
-> (GetBaiduChannel -> Text -> GetBaiduChannel)
-> Lens GetBaiduChannel GetBaiduChannel Text Text
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 :: GetBaiduChannel -> Request GetBaiduChannel
request = Service -> GetBaiduChannel -> Request GetBaiduChannel
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetBaiduChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBaiduChannel)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetBaiduChannel))
-> Logger
-> Service
-> Proxy GetBaiduChannel
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetBaiduChannel)))
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 ->
          Int -> BaiduChannelResponse -> GetBaiduChannelResponse
GetBaiduChannelResponse'
            (Int -> BaiduChannelResponse -> GetBaiduChannelResponse)
-> Either String Int
-> Either String (BaiduChannelResponse -> GetBaiduChannelResponse)
forall (f :: * -> *) a b. Functor 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))
            Either String (BaiduChannelResponse -> GetBaiduChannelResponse)
-> Either String BaiduChannelResponse
-> Either String GetBaiduChannelResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String BaiduChannelResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance Prelude.Hashable GetBaiduChannel

instance Prelude.NFData GetBaiduChannel

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

instance Core.ToQuery GetBaiduChannel where
  toQuery :: GetBaiduChannel -> QueryString
toQuery = QueryString -> GetBaiduChannel -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(GetBaiduChannelResponse -> GetBaiduChannelResponse -> Bool)
-> (GetBaiduChannelResponse -> GetBaiduChannelResponse -> Bool)
-> Eq GetBaiduChannelResponse
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]
(Int -> ReadS GetBaiduChannelResponse)
-> ReadS [GetBaiduChannelResponse]
-> ReadPrec GetBaiduChannelResponse
-> ReadPrec [GetBaiduChannelResponse]
-> Read 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
(Int -> GetBaiduChannelResponse -> ShowS)
-> (GetBaiduChannelResponse -> String)
-> ([GetBaiduChannelResponse] -> ShowS)
-> Show GetBaiduChannelResponse
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.
 GetBaiduChannelResponse -> Rep GetBaiduChannelResponse x)
-> (forall x.
    Rep GetBaiduChannelResponse x -> GetBaiduChannelResponse)
-> Generic GetBaiduChannelResponse
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' :: Int -> BaiduChannelResponse -> GetBaiduChannelResponse
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 :: (Int -> f Int)
-> GetBaiduChannelResponse -> f GetBaiduChannelResponse
getBaiduChannelResponse_httpStatus = (GetBaiduChannelResponse -> Int)
-> (GetBaiduChannelResponse -> Int -> GetBaiduChannelResponse)
-> Lens GetBaiduChannelResponse GetBaiduChannelResponse Int Int
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 :: (BaiduChannelResponse -> f BaiduChannelResponse)
-> GetBaiduChannelResponse -> f GetBaiduChannelResponse
getBaiduChannelResponse_baiduChannelResponse = (GetBaiduChannelResponse -> BaiduChannelResponse)
-> (GetBaiduChannelResponse
    -> BaiduChannelResponse -> GetBaiduChannelResponse)
-> Lens
     GetBaiduChannelResponse
     GetBaiduChannelResponse
     BaiduChannelResponse
     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