{-# 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.Personalize.ListRecipes
-- 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)
--
-- Returns a list of available recipes. The response provides the
-- properties for each recipe, including the recipe\'s Amazon Resource Name
-- (ARN).
--
-- This operation returns paginated results.
module Amazonka.Personalize.ListRecipes
  ( -- * Creating a Request
    ListRecipes (..),
    newListRecipes,

    -- * Request Lenses
    listRecipes_nextToken,
    listRecipes_maxResults,
    listRecipes_recipeProvider,

    -- * Destructuring the Response
    ListRecipesResponse (..),
    newListRecipesResponse,

    -- * Response Lenses
    listRecipesResponse_nextToken,
    listRecipesResponse_recipes,
    listRecipesResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Personalize.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newListRecipes' smart constructor.
data ListRecipes = ListRecipes'
  { -- | A token returned from the previous call to @ListRecipes@ for getting the
    -- next set of recipes (if they exist).
    ListRecipes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of recipes to return.
    ListRecipes -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The default is @SERVICE@.
    ListRecipes -> Maybe RecipeProvider
recipeProvider :: Prelude.Maybe RecipeProvider
  }
  deriving (ListRecipes -> ListRecipes -> Bool
(ListRecipes -> ListRecipes -> Bool)
-> (ListRecipes -> ListRecipes -> Bool) -> Eq ListRecipes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRecipes -> ListRecipes -> Bool
$c/= :: ListRecipes -> ListRecipes -> Bool
== :: ListRecipes -> ListRecipes -> Bool
$c== :: ListRecipes -> ListRecipes -> Bool
Prelude.Eq, ReadPrec [ListRecipes]
ReadPrec ListRecipes
Int -> ReadS ListRecipes
ReadS [ListRecipes]
(Int -> ReadS ListRecipes)
-> ReadS [ListRecipes]
-> ReadPrec ListRecipes
-> ReadPrec [ListRecipes]
-> Read ListRecipes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRecipes]
$creadListPrec :: ReadPrec [ListRecipes]
readPrec :: ReadPrec ListRecipes
$creadPrec :: ReadPrec ListRecipes
readList :: ReadS [ListRecipes]
$creadList :: ReadS [ListRecipes]
readsPrec :: Int -> ReadS ListRecipes
$creadsPrec :: Int -> ReadS ListRecipes
Prelude.Read, Int -> ListRecipes -> ShowS
[ListRecipes] -> ShowS
ListRecipes -> String
(Int -> ListRecipes -> ShowS)
-> (ListRecipes -> String)
-> ([ListRecipes] -> ShowS)
-> Show ListRecipes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRecipes] -> ShowS
$cshowList :: [ListRecipes] -> ShowS
show :: ListRecipes -> String
$cshow :: ListRecipes -> String
showsPrec :: Int -> ListRecipes -> ShowS
$cshowsPrec :: Int -> ListRecipes -> ShowS
Prelude.Show, (forall x. ListRecipes -> Rep ListRecipes x)
-> (forall x. Rep ListRecipes x -> ListRecipes)
-> Generic ListRecipes
forall x. Rep ListRecipes x -> ListRecipes
forall x. ListRecipes -> Rep ListRecipes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRecipes x -> ListRecipes
$cfrom :: forall x. ListRecipes -> Rep ListRecipes x
Prelude.Generic)

-- |
-- Create a value of 'ListRecipes' 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:
--
-- 'nextToken', 'listRecipes_nextToken' - A token returned from the previous call to @ListRecipes@ for getting the
-- next set of recipes (if they exist).
--
-- 'maxResults', 'listRecipes_maxResults' - The maximum number of recipes to return.
--
-- 'recipeProvider', 'listRecipes_recipeProvider' - The default is @SERVICE@.
newListRecipes ::
  ListRecipes
newListRecipes :: ListRecipes
newListRecipes =
  ListRecipes' :: Maybe Text -> Maybe Natural -> Maybe RecipeProvider -> ListRecipes
ListRecipes'
    { $sel:nextToken:ListRecipes' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListRecipes' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:recipeProvider:ListRecipes' :: Maybe RecipeProvider
recipeProvider = Maybe RecipeProvider
forall a. Maybe a
Prelude.Nothing
    }

-- | A token returned from the previous call to @ListRecipes@ for getting the
-- next set of recipes (if they exist).
listRecipes_nextToken :: Lens.Lens' ListRecipes (Prelude.Maybe Prelude.Text)
listRecipes_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListRecipes -> f ListRecipes
listRecipes_nextToken = (ListRecipes -> Maybe Text)
-> (ListRecipes -> Maybe Text -> ListRecipes)
-> Lens ListRecipes ListRecipes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecipes' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRecipes' :: ListRecipes -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRecipes
s@ListRecipes' {} Maybe Text
a -> ListRecipes
s {$sel:nextToken:ListRecipes' :: Maybe Text
nextToken = Maybe Text
a} :: ListRecipes)

-- | The maximum number of recipes to return.
listRecipes_maxResults :: Lens.Lens' ListRecipes (Prelude.Maybe Prelude.Natural)
listRecipes_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListRecipes -> f ListRecipes
listRecipes_maxResults = (ListRecipes -> Maybe Natural)
-> (ListRecipes -> Maybe Natural -> ListRecipes)
-> Lens ListRecipes ListRecipes (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecipes' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListRecipes' :: ListRecipes -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListRecipes
s@ListRecipes' {} Maybe Natural
a -> ListRecipes
s {$sel:maxResults:ListRecipes' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListRecipes)

-- | The default is @SERVICE@.
listRecipes_recipeProvider :: Lens.Lens' ListRecipes (Prelude.Maybe RecipeProvider)
listRecipes_recipeProvider :: (Maybe RecipeProvider -> f (Maybe RecipeProvider))
-> ListRecipes -> f ListRecipes
listRecipes_recipeProvider = (ListRecipes -> Maybe RecipeProvider)
-> (ListRecipes -> Maybe RecipeProvider -> ListRecipes)
-> Lens
     ListRecipes
     ListRecipes
     (Maybe RecipeProvider)
     (Maybe RecipeProvider)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecipes' {Maybe RecipeProvider
recipeProvider :: Maybe RecipeProvider
$sel:recipeProvider:ListRecipes' :: ListRecipes -> Maybe RecipeProvider
recipeProvider} -> Maybe RecipeProvider
recipeProvider) (\s :: ListRecipes
s@ListRecipes' {} Maybe RecipeProvider
a -> ListRecipes
s {$sel:recipeProvider:ListRecipes' :: Maybe RecipeProvider
recipeProvider = Maybe RecipeProvider
a} :: ListRecipes)

instance Core.AWSPager ListRecipes where
  page :: ListRecipes -> AWSResponse ListRecipes -> Maybe ListRecipes
page ListRecipes
rq AWSResponse ListRecipes
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRecipes
ListRecipesResponse
rs
            ListRecipesResponse
-> Getting (First Text) ListRecipesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRecipesResponse -> Const (First Text) ListRecipesResponse
Lens' ListRecipesResponse (Maybe Text)
listRecipesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRecipesResponse -> Const (First Text) ListRecipesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRecipesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListRecipes
forall a. Maybe a
Prelude.Nothing
    | Maybe [RecipeSummary] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListRecipes
ListRecipesResponse
rs
            ListRecipesResponse
-> Getting
     (First [RecipeSummary]) ListRecipesResponse [RecipeSummary]
-> Maybe [RecipeSummary]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [RecipeSummary]
 -> Const (First [RecipeSummary]) (Maybe [RecipeSummary]))
-> ListRecipesResponse
-> Const (First [RecipeSummary]) ListRecipesResponse
Lens' ListRecipesResponse (Maybe [RecipeSummary])
listRecipesResponse_recipes ((Maybe [RecipeSummary]
  -> Const (First [RecipeSummary]) (Maybe [RecipeSummary]))
 -> ListRecipesResponse
 -> Const (First [RecipeSummary]) ListRecipesResponse)
-> (([RecipeSummary]
     -> Const (First [RecipeSummary]) [RecipeSummary])
    -> Maybe [RecipeSummary]
    -> Const (First [RecipeSummary]) (Maybe [RecipeSummary]))
-> Getting
     (First [RecipeSummary]) ListRecipesResponse [RecipeSummary]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([RecipeSummary] -> Const (First [RecipeSummary]) [RecipeSummary])
-> Maybe [RecipeSummary]
-> Const (First [RecipeSummary]) (Maybe [RecipeSummary])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe ListRecipes
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      ListRecipes -> Maybe ListRecipes
forall a. a -> Maybe a
Prelude.Just (ListRecipes -> Maybe ListRecipes)
-> ListRecipes -> Maybe ListRecipes
forall a b. (a -> b) -> a -> b
Prelude.$
        ListRecipes
rq
          ListRecipes -> (ListRecipes -> ListRecipes) -> ListRecipes
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListRecipes -> Identity ListRecipes
Lens ListRecipes ListRecipes (Maybe Text) (Maybe Text)
listRecipes_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> ListRecipes -> Identity ListRecipes)
-> Maybe Text -> ListRecipes -> ListRecipes
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListRecipes
ListRecipesResponse
rs
          ListRecipesResponse
-> Getting (First Text) ListRecipesResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListRecipesResponse -> Const (First Text) ListRecipesResponse
Lens' ListRecipesResponse (Maybe Text)
listRecipesResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
 -> ListRecipesResponse -> Const (First Text) ListRecipesResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListRecipesResponse Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just

instance Core.AWSRequest ListRecipes where
  type AWSResponse ListRecipes = ListRecipesResponse
  request :: ListRecipes -> Request ListRecipes
request = Service -> ListRecipes -> Request ListRecipes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy ListRecipes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListRecipes)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListRecipes))
-> Logger
-> Service
-> Proxy ListRecipes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListRecipes)))
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 Text -> Maybe [RecipeSummary] -> Int -> ListRecipesResponse
ListRecipesResponse'
            (Maybe Text -> Maybe [RecipeSummary] -> Int -> ListRecipesResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe [RecipeSummary] -> Int -> ListRecipesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"nextToken")
            Either String (Maybe [RecipeSummary] -> Int -> ListRecipesResponse)
-> Either String (Maybe [RecipeSummary])
-> Either String (Int -> ListRecipesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [RecipeSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"recipes" Either String (Maybe (Maybe [RecipeSummary]))
-> Maybe [RecipeSummary] -> Either String (Maybe [RecipeSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [RecipeSummary]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> ListRecipesResponse)
-> Either String Int -> Either String ListRecipesResponse
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 ListRecipes

instance Prelude.NFData ListRecipes

instance Core.ToHeaders ListRecipes where
  toHeaders :: ListRecipes -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListRecipes -> 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
"AmazonPersonalize.ListRecipes" ::
                          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 ListRecipes where
  toJSON :: ListRecipes -> Value
toJSON ListRecipes' {Maybe Natural
Maybe Text
Maybe RecipeProvider
recipeProvider :: Maybe RecipeProvider
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:recipeProvider:ListRecipes' :: ListRecipes -> Maybe RecipeProvider
$sel:maxResults:ListRecipes' :: ListRecipes -> Maybe Natural
$sel:nextToken:ListRecipes' :: ListRecipes -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"maxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            (Text
"recipeProvider" Text -> RecipeProvider -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (RecipeProvider -> Pair) -> Maybe RecipeProvider -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe RecipeProvider
recipeProvider
          ]
      )

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

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

-- | /See:/ 'newListRecipesResponse' smart constructor.
data ListRecipesResponse = ListRecipesResponse'
  { -- | A token for getting the next set of recipes.
    ListRecipesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The list of available recipes.
    ListRecipesResponse -> Maybe [RecipeSummary]
recipes :: Prelude.Maybe [RecipeSummary],
    -- | The response's http status code.
    ListRecipesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListRecipesResponse -> ListRecipesResponse -> Bool
(ListRecipesResponse -> ListRecipesResponse -> Bool)
-> (ListRecipesResponse -> ListRecipesResponse -> Bool)
-> Eq ListRecipesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListRecipesResponse -> ListRecipesResponse -> Bool
$c/= :: ListRecipesResponse -> ListRecipesResponse -> Bool
== :: ListRecipesResponse -> ListRecipesResponse -> Bool
$c== :: ListRecipesResponse -> ListRecipesResponse -> Bool
Prelude.Eq, ReadPrec [ListRecipesResponse]
ReadPrec ListRecipesResponse
Int -> ReadS ListRecipesResponse
ReadS [ListRecipesResponse]
(Int -> ReadS ListRecipesResponse)
-> ReadS [ListRecipesResponse]
-> ReadPrec ListRecipesResponse
-> ReadPrec [ListRecipesResponse]
-> Read ListRecipesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListRecipesResponse]
$creadListPrec :: ReadPrec [ListRecipesResponse]
readPrec :: ReadPrec ListRecipesResponse
$creadPrec :: ReadPrec ListRecipesResponse
readList :: ReadS [ListRecipesResponse]
$creadList :: ReadS [ListRecipesResponse]
readsPrec :: Int -> ReadS ListRecipesResponse
$creadsPrec :: Int -> ReadS ListRecipesResponse
Prelude.Read, Int -> ListRecipesResponse -> ShowS
[ListRecipesResponse] -> ShowS
ListRecipesResponse -> String
(Int -> ListRecipesResponse -> ShowS)
-> (ListRecipesResponse -> String)
-> ([ListRecipesResponse] -> ShowS)
-> Show ListRecipesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListRecipesResponse] -> ShowS
$cshowList :: [ListRecipesResponse] -> ShowS
show :: ListRecipesResponse -> String
$cshow :: ListRecipesResponse -> String
showsPrec :: Int -> ListRecipesResponse -> ShowS
$cshowsPrec :: Int -> ListRecipesResponse -> ShowS
Prelude.Show, (forall x. ListRecipesResponse -> Rep ListRecipesResponse x)
-> (forall x. Rep ListRecipesResponse x -> ListRecipesResponse)
-> Generic ListRecipesResponse
forall x. Rep ListRecipesResponse x -> ListRecipesResponse
forall x. ListRecipesResponse -> Rep ListRecipesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListRecipesResponse x -> ListRecipesResponse
$cfrom :: forall x. ListRecipesResponse -> Rep ListRecipesResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListRecipesResponse' 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:
--
-- 'nextToken', 'listRecipesResponse_nextToken' - A token for getting the next set of recipes.
--
-- 'recipes', 'listRecipesResponse_recipes' - The list of available recipes.
--
-- 'httpStatus', 'listRecipesResponse_httpStatus' - The response's http status code.
newListRecipesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListRecipesResponse
newListRecipesResponse :: Int -> ListRecipesResponse
newListRecipesResponse Int
pHttpStatus_ =
  ListRecipesResponse' :: Maybe Text -> Maybe [RecipeSummary] -> Int -> ListRecipesResponse
ListRecipesResponse'
    { $sel:nextToken:ListRecipesResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:recipes:ListRecipesResponse' :: Maybe [RecipeSummary]
recipes = Maybe [RecipeSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListRecipesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A token for getting the next set of recipes.
listRecipesResponse_nextToken :: Lens.Lens' ListRecipesResponse (Prelude.Maybe Prelude.Text)
listRecipesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListRecipesResponse -> f ListRecipesResponse
listRecipesResponse_nextToken = (ListRecipesResponse -> Maybe Text)
-> (ListRecipesResponse -> Maybe Text -> ListRecipesResponse)
-> Lens' ListRecipesResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecipesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListRecipesResponse' :: ListRecipesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListRecipesResponse
s@ListRecipesResponse' {} Maybe Text
a -> ListRecipesResponse
s {$sel:nextToken:ListRecipesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListRecipesResponse)

-- | The list of available recipes.
listRecipesResponse_recipes :: Lens.Lens' ListRecipesResponse (Prelude.Maybe [RecipeSummary])
listRecipesResponse_recipes :: (Maybe [RecipeSummary] -> f (Maybe [RecipeSummary]))
-> ListRecipesResponse -> f ListRecipesResponse
listRecipesResponse_recipes = (ListRecipesResponse -> Maybe [RecipeSummary])
-> (ListRecipesResponse
    -> Maybe [RecipeSummary] -> ListRecipesResponse)
-> Lens' ListRecipesResponse (Maybe [RecipeSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListRecipesResponse' {Maybe [RecipeSummary]
recipes :: Maybe [RecipeSummary]
$sel:recipes:ListRecipesResponse' :: ListRecipesResponse -> Maybe [RecipeSummary]
recipes} -> Maybe [RecipeSummary]
recipes) (\s :: ListRecipesResponse
s@ListRecipesResponse' {} Maybe [RecipeSummary]
a -> ListRecipesResponse
s {$sel:recipes:ListRecipesResponse' :: Maybe [RecipeSummary]
recipes = Maybe [RecipeSummary]
a} :: ListRecipesResponse) ((Maybe [RecipeSummary] -> f (Maybe [RecipeSummary]))
 -> ListRecipesResponse -> f ListRecipesResponse)
-> ((Maybe [RecipeSummary] -> f (Maybe [RecipeSummary]))
    -> Maybe [RecipeSummary] -> f (Maybe [RecipeSummary]))
-> (Maybe [RecipeSummary] -> f (Maybe [RecipeSummary]))
-> ListRecipesResponse
-> f ListRecipesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [RecipeSummary] [RecipeSummary] [RecipeSummary] [RecipeSummary]
-> Iso
     (Maybe [RecipeSummary])
     (Maybe [RecipeSummary])
     (Maybe [RecipeSummary])
     (Maybe [RecipeSummary])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  [RecipeSummary] [RecipeSummary] [RecipeSummary] [RecipeSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData ListRecipesResponse