{-# 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.GetRecommenderConfigurations
-- 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 all the recommender model configurations
-- that are associated with your Amazon Pinpoint account.
module Amazonka.Pinpoint.GetRecommenderConfigurations
  ( -- * Creating a Request
    GetRecommenderConfigurations (..),
    newGetRecommenderConfigurations,

    -- * Request Lenses
    getRecommenderConfigurations_token,
    getRecommenderConfigurations_pageSize,

    -- * Destructuring the Response
    GetRecommenderConfigurationsResponse (..),
    newGetRecommenderConfigurationsResponse,

    -- * Response Lenses
    getRecommenderConfigurationsResponse_httpStatus,
    getRecommenderConfigurationsResponse_listRecommenderConfigurationsResponse,
  )
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:/ 'newGetRecommenderConfigurations' smart constructor.
data GetRecommenderConfigurations = GetRecommenderConfigurations'
  { -- | The NextToken string that specifies which page of results to return in a
    -- paginated response.
    GetRecommenderConfigurations -> Maybe Text
token :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of items to include in each page of a paginated
    -- response. This parameter is not supported for application, campaign, and
    -- journey metrics.
    GetRecommenderConfigurations -> Maybe Text
pageSize :: Prelude.Maybe Prelude.Text
  }
  deriving (GetRecommenderConfigurations
-> GetRecommenderConfigurations -> Bool
(GetRecommenderConfigurations
 -> GetRecommenderConfigurations -> Bool)
-> (GetRecommenderConfigurations
    -> GetRecommenderConfigurations -> Bool)
-> Eq GetRecommenderConfigurations
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetRecommenderConfigurations
-> GetRecommenderConfigurations -> Bool
$c/= :: GetRecommenderConfigurations
-> GetRecommenderConfigurations -> Bool
== :: GetRecommenderConfigurations
-> GetRecommenderConfigurations -> Bool
$c== :: GetRecommenderConfigurations
-> GetRecommenderConfigurations -> Bool
Prelude.Eq, ReadPrec [GetRecommenderConfigurations]
ReadPrec GetRecommenderConfigurations
Int -> ReadS GetRecommenderConfigurations
ReadS [GetRecommenderConfigurations]
(Int -> ReadS GetRecommenderConfigurations)
-> ReadS [GetRecommenderConfigurations]
-> ReadPrec GetRecommenderConfigurations
-> ReadPrec [GetRecommenderConfigurations]
-> Read GetRecommenderConfigurations
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetRecommenderConfigurations]
$creadListPrec :: ReadPrec [GetRecommenderConfigurations]
readPrec :: ReadPrec GetRecommenderConfigurations
$creadPrec :: ReadPrec GetRecommenderConfigurations
readList :: ReadS [GetRecommenderConfigurations]
$creadList :: ReadS [GetRecommenderConfigurations]
readsPrec :: Int -> ReadS GetRecommenderConfigurations
$creadsPrec :: Int -> ReadS GetRecommenderConfigurations
Prelude.Read, Int -> GetRecommenderConfigurations -> ShowS
[GetRecommenderConfigurations] -> ShowS
GetRecommenderConfigurations -> String
(Int -> GetRecommenderConfigurations -> ShowS)
-> (GetRecommenderConfigurations -> String)
-> ([GetRecommenderConfigurations] -> ShowS)
-> Show GetRecommenderConfigurations
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetRecommenderConfigurations] -> ShowS
$cshowList :: [GetRecommenderConfigurations] -> ShowS
show :: GetRecommenderConfigurations -> String
$cshow :: GetRecommenderConfigurations -> String
showsPrec :: Int -> GetRecommenderConfigurations -> ShowS
$cshowsPrec :: Int -> GetRecommenderConfigurations -> ShowS
Prelude.Show, (forall x.
 GetRecommenderConfigurations -> Rep GetRecommenderConfigurations x)
-> (forall x.
    Rep GetRecommenderConfigurations x -> GetRecommenderConfigurations)
-> Generic GetRecommenderConfigurations
forall x.
Rep GetRecommenderConfigurations x -> GetRecommenderConfigurations
forall x.
GetRecommenderConfigurations -> Rep GetRecommenderConfigurations x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetRecommenderConfigurations x -> GetRecommenderConfigurations
$cfrom :: forall x.
GetRecommenderConfigurations -> Rep GetRecommenderConfigurations x
Prelude.Generic)

-- |
-- Create a value of 'GetRecommenderConfigurations' 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:
--
-- 'token', 'getRecommenderConfigurations_token' - The NextToken string that specifies which page of results to return in a
-- paginated response.
--
-- 'pageSize', 'getRecommenderConfigurations_pageSize' - The maximum number of items to include in each page of a paginated
-- response. This parameter is not supported for application, campaign, and
-- journey metrics.
newGetRecommenderConfigurations ::
  GetRecommenderConfigurations
newGetRecommenderConfigurations :: GetRecommenderConfigurations
newGetRecommenderConfigurations =
  GetRecommenderConfigurations' :: Maybe Text -> Maybe Text -> GetRecommenderConfigurations
GetRecommenderConfigurations'
    { $sel:token:GetRecommenderConfigurations' :: Maybe Text
token =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pageSize:GetRecommenderConfigurations' :: Maybe Text
pageSize = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The NextToken string that specifies which page of results to return in a
-- paginated response.
getRecommenderConfigurations_token :: Lens.Lens' GetRecommenderConfigurations (Prelude.Maybe Prelude.Text)
getRecommenderConfigurations_token :: (Maybe Text -> f (Maybe Text))
-> GetRecommenderConfigurations -> f GetRecommenderConfigurations
getRecommenderConfigurations_token = (GetRecommenderConfigurations -> Maybe Text)
-> (GetRecommenderConfigurations
    -> Maybe Text -> GetRecommenderConfigurations)
-> Lens
     GetRecommenderConfigurations
     GetRecommenderConfigurations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommenderConfigurations' {Maybe Text
token :: Maybe Text
$sel:token:GetRecommenderConfigurations' :: GetRecommenderConfigurations -> Maybe Text
token} -> Maybe Text
token) (\s :: GetRecommenderConfigurations
s@GetRecommenderConfigurations' {} Maybe Text
a -> GetRecommenderConfigurations
s {$sel:token:GetRecommenderConfigurations' :: Maybe Text
token = Maybe Text
a} :: GetRecommenderConfigurations)

-- | The maximum number of items to include in each page of a paginated
-- response. This parameter is not supported for application, campaign, and
-- journey metrics.
getRecommenderConfigurations_pageSize :: Lens.Lens' GetRecommenderConfigurations (Prelude.Maybe Prelude.Text)
getRecommenderConfigurations_pageSize :: (Maybe Text -> f (Maybe Text))
-> GetRecommenderConfigurations -> f GetRecommenderConfigurations
getRecommenderConfigurations_pageSize = (GetRecommenderConfigurations -> Maybe Text)
-> (GetRecommenderConfigurations
    -> Maybe Text -> GetRecommenderConfigurations)
-> Lens
     GetRecommenderConfigurations
     GetRecommenderConfigurations
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommenderConfigurations' {Maybe Text
pageSize :: Maybe Text
$sel:pageSize:GetRecommenderConfigurations' :: GetRecommenderConfigurations -> Maybe Text
pageSize} -> Maybe Text
pageSize) (\s :: GetRecommenderConfigurations
s@GetRecommenderConfigurations' {} Maybe Text
a -> GetRecommenderConfigurations
s {$sel:pageSize:GetRecommenderConfigurations' :: Maybe Text
pageSize = Maybe Text
a} :: GetRecommenderConfigurations)

instance Core.AWSRequest GetRecommenderConfigurations where
  type
    AWSResponse GetRecommenderConfigurations =
      GetRecommenderConfigurationsResponse
  request :: GetRecommenderConfigurations
-> Request GetRecommenderConfigurations
request = Service
-> GetRecommenderConfigurations
-> Request GetRecommenderConfigurations
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetRecommenderConfigurations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetRecommenderConfigurations)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetRecommenderConfigurations))
-> Logger
-> Service
-> Proxy GetRecommenderConfigurations
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetRecommenderConfigurations)))
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
-> ListRecommenderConfigurationsResponse
-> GetRecommenderConfigurationsResponse
GetRecommenderConfigurationsResponse'
            (Int
 -> ListRecommenderConfigurationsResponse
 -> GetRecommenderConfigurationsResponse)
-> Either String Int
-> Either
     String
     (ListRecommenderConfigurationsResponse
      -> GetRecommenderConfigurationsResponse)
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
  (ListRecommenderConfigurationsResponse
   -> GetRecommenderConfigurationsResponse)
-> Either String ListRecommenderConfigurationsResponse
-> Either String GetRecommenderConfigurationsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object -> Either String ListRecommenderConfigurationsResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)
      )

instance
  Prelude.Hashable
    GetRecommenderConfigurations

instance Prelude.NFData GetRecommenderConfigurations

instance Core.ToHeaders GetRecommenderConfigurations where
  toHeaders :: GetRecommenderConfigurations -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetRecommenderConfigurations -> 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 GetRecommenderConfigurations where
  toPath :: GetRecommenderConfigurations -> ByteString
toPath = ByteString -> GetRecommenderConfigurations -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/v1/recommenders"

instance Core.ToQuery GetRecommenderConfigurations where
  toQuery :: GetRecommenderConfigurations -> QueryString
toQuery GetRecommenderConfigurations' {Maybe Text
pageSize :: Maybe Text
token :: Maybe Text
$sel:pageSize:GetRecommenderConfigurations' :: GetRecommenderConfigurations -> Maybe Text
$sel:token:GetRecommenderConfigurations' :: GetRecommenderConfigurations -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"token" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
token, ByteString
"page-size" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
pageSize]

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

-- |
-- Create a value of 'GetRecommenderConfigurationsResponse' 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', 'getRecommenderConfigurationsResponse_httpStatus' - The response's http status code.
--
-- 'listRecommenderConfigurationsResponse', 'getRecommenderConfigurationsResponse_listRecommenderConfigurationsResponse' - Undocumented member.
newGetRecommenderConfigurationsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'listRecommenderConfigurationsResponse'
  ListRecommenderConfigurationsResponse ->
  GetRecommenderConfigurationsResponse
newGetRecommenderConfigurationsResponse :: Int
-> ListRecommenderConfigurationsResponse
-> GetRecommenderConfigurationsResponse
newGetRecommenderConfigurationsResponse
  Int
pHttpStatus_
  ListRecommenderConfigurationsResponse
pListRecommenderConfigurationsResponse_ =
    GetRecommenderConfigurationsResponse' :: Int
-> ListRecommenderConfigurationsResponse
-> GetRecommenderConfigurationsResponse
GetRecommenderConfigurationsResponse'
      { $sel:httpStatus:GetRecommenderConfigurationsResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:listRecommenderConfigurationsResponse:GetRecommenderConfigurationsResponse' :: ListRecommenderConfigurationsResponse
listRecommenderConfigurationsResponse =
          ListRecommenderConfigurationsResponse
pListRecommenderConfigurationsResponse_
      }

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

-- | Undocumented member.
getRecommenderConfigurationsResponse_listRecommenderConfigurationsResponse :: Lens.Lens' GetRecommenderConfigurationsResponse ListRecommenderConfigurationsResponse
getRecommenderConfigurationsResponse_listRecommenderConfigurationsResponse :: (ListRecommenderConfigurationsResponse
 -> f ListRecommenderConfigurationsResponse)
-> GetRecommenderConfigurationsResponse
-> f GetRecommenderConfigurationsResponse
getRecommenderConfigurationsResponse_listRecommenderConfigurationsResponse = (GetRecommenderConfigurationsResponse
 -> ListRecommenderConfigurationsResponse)
-> (GetRecommenderConfigurationsResponse
    -> ListRecommenderConfigurationsResponse
    -> GetRecommenderConfigurationsResponse)
-> Lens
     GetRecommenderConfigurationsResponse
     GetRecommenderConfigurationsResponse
     ListRecommenderConfigurationsResponse
     ListRecommenderConfigurationsResponse
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetRecommenderConfigurationsResponse' {ListRecommenderConfigurationsResponse
listRecommenderConfigurationsResponse :: ListRecommenderConfigurationsResponse
$sel:listRecommenderConfigurationsResponse:GetRecommenderConfigurationsResponse' :: GetRecommenderConfigurationsResponse
-> ListRecommenderConfigurationsResponse
listRecommenderConfigurationsResponse} -> ListRecommenderConfigurationsResponse
listRecommenderConfigurationsResponse) (\s :: GetRecommenderConfigurationsResponse
s@GetRecommenderConfigurationsResponse' {} ListRecommenderConfigurationsResponse
a -> GetRecommenderConfigurationsResponse
s {$sel:listRecommenderConfigurationsResponse:GetRecommenderConfigurationsResponse' :: ListRecommenderConfigurationsResponse
listRecommenderConfigurationsResponse = ListRecommenderConfigurationsResponse
a} :: GetRecommenderConfigurationsResponse)

instance
  Prelude.NFData
    GetRecommenderConfigurationsResponse