{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.ApplicationsResponse
-- 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)
module Amazonka.Pinpoint.Types.ApplicationsResponse where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Pinpoint.Types.ApplicationResponse
import qualified Amazonka.Prelude as Prelude

-- | Provides information about all of your applications.
--
-- /See:/ 'newApplicationsResponse' smart constructor.
data ApplicationsResponse = ApplicationsResponse'
  { -- | The string to use in a subsequent request to get the next page of
    -- results in a paginated response. This value is null if there are no
    -- additional pages.
    ApplicationsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | An array of responses, one for each application that was returned.
    ApplicationsResponse -> Maybe [ApplicationResponse]
item :: Prelude.Maybe [ApplicationResponse]
  }
  deriving (ApplicationsResponse -> ApplicationsResponse -> Bool
(ApplicationsResponse -> ApplicationsResponse -> Bool)
-> (ApplicationsResponse -> ApplicationsResponse -> Bool)
-> Eq ApplicationsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplicationsResponse -> ApplicationsResponse -> Bool
$c/= :: ApplicationsResponse -> ApplicationsResponse -> Bool
== :: ApplicationsResponse -> ApplicationsResponse -> Bool
$c== :: ApplicationsResponse -> ApplicationsResponse -> Bool
Prelude.Eq, ReadPrec [ApplicationsResponse]
ReadPrec ApplicationsResponse
Int -> ReadS ApplicationsResponse
ReadS [ApplicationsResponse]
(Int -> ReadS ApplicationsResponse)
-> ReadS [ApplicationsResponse]
-> ReadPrec ApplicationsResponse
-> ReadPrec [ApplicationsResponse]
-> Read ApplicationsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApplicationsResponse]
$creadListPrec :: ReadPrec [ApplicationsResponse]
readPrec :: ReadPrec ApplicationsResponse
$creadPrec :: ReadPrec ApplicationsResponse
readList :: ReadS [ApplicationsResponse]
$creadList :: ReadS [ApplicationsResponse]
readsPrec :: Int -> ReadS ApplicationsResponse
$creadsPrec :: Int -> ReadS ApplicationsResponse
Prelude.Read, Int -> ApplicationsResponse -> ShowS
[ApplicationsResponse] -> ShowS
ApplicationsResponse -> String
(Int -> ApplicationsResponse -> ShowS)
-> (ApplicationsResponse -> String)
-> ([ApplicationsResponse] -> ShowS)
-> Show ApplicationsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApplicationsResponse] -> ShowS
$cshowList :: [ApplicationsResponse] -> ShowS
show :: ApplicationsResponse -> String
$cshow :: ApplicationsResponse -> String
showsPrec :: Int -> ApplicationsResponse -> ShowS
$cshowsPrec :: Int -> ApplicationsResponse -> ShowS
Prelude.Show, (forall x. ApplicationsResponse -> Rep ApplicationsResponse x)
-> (forall x. Rep ApplicationsResponse x -> ApplicationsResponse)
-> Generic ApplicationsResponse
forall x. Rep ApplicationsResponse x -> ApplicationsResponse
forall x. ApplicationsResponse -> Rep ApplicationsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApplicationsResponse x -> ApplicationsResponse
$cfrom :: forall x. ApplicationsResponse -> Rep ApplicationsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ApplicationsResponse' 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', 'applicationsResponse_nextToken' - The string to use in a subsequent request to get the next page of
-- results in a paginated response. This value is null if there are no
-- additional pages.
--
-- 'item', 'applicationsResponse_item' - An array of responses, one for each application that was returned.
newApplicationsResponse ::
  ApplicationsResponse
newApplicationsResponse :: ApplicationsResponse
newApplicationsResponse =
  ApplicationsResponse' :: Maybe Text -> Maybe [ApplicationResponse] -> ApplicationsResponse
ApplicationsResponse'
    { $sel:nextToken:ApplicationsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:item:ApplicationsResponse' :: Maybe [ApplicationResponse]
item = Maybe [ApplicationResponse]
forall a. Maybe a
Prelude.Nothing
    }

-- | The string to use in a subsequent request to get the next page of
-- results in a paginated response. This value is null if there are no
-- additional pages.
applicationsResponse_nextToken :: Lens.Lens' ApplicationsResponse (Prelude.Maybe Prelude.Text)
applicationsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ApplicationsResponse -> f ApplicationsResponse
applicationsResponse_nextToken = (ApplicationsResponse -> Maybe Text)
-> (ApplicationsResponse -> Maybe Text -> ApplicationsResponse)
-> Lens
     ApplicationsResponse ApplicationsResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ApplicationsResponse' :: ApplicationsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ApplicationsResponse
s@ApplicationsResponse' {} Maybe Text
a -> ApplicationsResponse
s {$sel:nextToken:ApplicationsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ApplicationsResponse)

-- | An array of responses, one for each application that was returned.
applicationsResponse_item :: Lens.Lens' ApplicationsResponse (Prelude.Maybe [ApplicationResponse])
applicationsResponse_item :: (Maybe [ApplicationResponse] -> f (Maybe [ApplicationResponse]))
-> ApplicationsResponse -> f ApplicationsResponse
applicationsResponse_item = (ApplicationsResponse -> Maybe [ApplicationResponse])
-> (ApplicationsResponse
    -> Maybe [ApplicationResponse] -> ApplicationsResponse)
-> Lens
     ApplicationsResponse
     ApplicationsResponse
     (Maybe [ApplicationResponse])
     (Maybe [ApplicationResponse])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApplicationsResponse' {Maybe [ApplicationResponse]
item :: Maybe [ApplicationResponse]
$sel:item:ApplicationsResponse' :: ApplicationsResponse -> Maybe [ApplicationResponse]
item} -> Maybe [ApplicationResponse]
item) (\s :: ApplicationsResponse
s@ApplicationsResponse' {} Maybe [ApplicationResponse]
a -> ApplicationsResponse
s {$sel:item:ApplicationsResponse' :: Maybe [ApplicationResponse]
item = Maybe [ApplicationResponse]
a} :: ApplicationsResponse) ((Maybe [ApplicationResponse] -> f (Maybe [ApplicationResponse]))
 -> ApplicationsResponse -> f ApplicationsResponse)
-> ((Maybe [ApplicationResponse]
     -> f (Maybe [ApplicationResponse]))
    -> Maybe [ApplicationResponse] -> f (Maybe [ApplicationResponse]))
-> (Maybe [ApplicationResponse] -> f (Maybe [ApplicationResponse]))
-> ApplicationsResponse
-> f ApplicationsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [ApplicationResponse]
  [ApplicationResponse]
  [ApplicationResponse]
  [ApplicationResponse]
-> Iso
     (Maybe [ApplicationResponse])
     (Maybe [ApplicationResponse])
     (Maybe [ApplicationResponse])
     (Maybe [ApplicationResponse])
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
  [ApplicationResponse]
  [ApplicationResponse]
  [ApplicationResponse]
  [ApplicationResponse]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON ApplicationsResponse where
  parseJSON :: Value -> Parser ApplicationsResponse
parseJSON =
    String
-> (Object -> Parser ApplicationsResponse)
-> Value
-> Parser ApplicationsResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ApplicationsResponse"
      ( \Object
x ->
          Maybe Text -> Maybe [ApplicationResponse] -> ApplicationsResponse
ApplicationsResponse'
            (Maybe Text -> Maybe [ApplicationResponse] -> ApplicationsResponse)
-> Parser (Maybe Text)
-> Parser (Maybe [ApplicationResponse] -> ApplicationsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"NextToken")
            Parser (Maybe [ApplicationResponse] -> ApplicationsResponse)
-> Parser (Maybe [ApplicationResponse])
-> Parser ApplicationsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [ApplicationResponse]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Item" Parser (Maybe (Maybe [ApplicationResponse]))
-> Maybe [ApplicationResponse]
-> Parser (Maybe [ApplicationResponse])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [ApplicationResponse]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable ApplicationsResponse

instance Prelude.NFData ApplicationsResponse