{-# 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.TemplateVersionsResponse
-- 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.TemplateVersionsResponse where

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

-- | Provides information about all the versions of a specific message
-- template.
--
-- /See:/ 'newTemplateVersionsResponse' smart constructor.
data TemplateVersionsResponse = TemplateVersionsResponse'
  { -- | The unique identifier for the request to retrieve information about all
    -- the versions of the message template.
    TemplateVersionsResponse -> Maybe Text
requestID :: Prelude.Maybe Prelude.Text,
    -- | 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.
    TemplateVersionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The message that\'s returned from the API for the request to retrieve
    -- information about all the versions of the message template.
    TemplateVersionsResponse -> Maybe Text
message :: Prelude.Maybe Prelude.Text,
    -- | An array of responses, one for each version of the message template.
    TemplateVersionsResponse -> [TemplateVersionResponse]
item :: [TemplateVersionResponse]
  }
  deriving (TemplateVersionsResponse -> TemplateVersionsResponse -> Bool
(TemplateVersionsResponse -> TemplateVersionsResponse -> Bool)
-> (TemplateVersionsResponse -> TemplateVersionsResponse -> Bool)
-> Eq TemplateVersionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TemplateVersionsResponse -> TemplateVersionsResponse -> Bool
$c/= :: TemplateVersionsResponse -> TemplateVersionsResponse -> Bool
== :: TemplateVersionsResponse -> TemplateVersionsResponse -> Bool
$c== :: TemplateVersionsResponse -> TemplateVersionsResponse -> Bool
Prelude.Eq, ReadPrec [TemplateVersionsResponse]
ReadPrec TemplateVersionsResponse
Int -> ReadS TemplateVersionsResponse
ReadS [TemplateVersionsResponse]
(Int -> ReadS TemplateVersionsResponse)
-> ReadS [TemplateVersionsResponse]
-> ReadPrec TemplateVersionsResponse
-> ReadPrec [TemplateVersionsResponse]
-> Read TemplateVersionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TemplateVersionsResponse]
$creadListPrec :: ReadPrec [TemplateVersionsResponse]
readPrec :: ReadPrec TemplateVersionsResponse
$creadPrec :: ReadPrec TemplateVersionsResponse
readList :: ReadS [TemplateVersionsResponse]
$creadList :: ReadS [TemplateVersionsResponse]
readsPrec :: Int -> ReadS TemplateVersionsResponse
$creadsPrec :: Int -> ReadS TemplateVersionsResponse
Prelude.Read, Int -> TemplateVersionsResponse -> ShowS
[TemplateVersionsResponse] -> ShowS
TemplateVersionsResponse -> String
(Int -> TemplateVersionsResponse -> ShowS)
-> (TemplateVersionsResponse -> String)
-> ([TemplateVersionsResponse] -> ShowS)
-> Show TemplateVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TemplateVersionsResponse] -> ShowS
$cshowList :: [TemplateVersionsResponse] -> ShowS
show :: TemplateVersionsResponse -> String
$cshow :: TemplateVersionsResponse -> String
showsPrec :: Int -> TemplateVersionsResponse -> ShowS
$cshowsPrec :: Int -> TemplateVersionsResponse -> ShowS
Prelude.Show, (forall x.
 TemplateVersionsResponse -> Rep TemplateVersionsResponse x)
-> (forall x.
    Rep TemplateVersionsResponse x -> TemplateVersionsResponse)
-> Generic TemplateVersionsResponse
forall x.
Rep TemplateVersionsResponse x -> TemplateVersionsResponse
forall x.
TemplateVersionsResponse -> Rep TemplateVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TemplateVersionsResponse x -> TemplateVersionsResponse
$cfrom :: forall x.
TemplateVersionsResponse -> Rep TemplateVersionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'TemplateVersionsResponse' 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:
--
-- 'requestID', 'templateVersionsResponse_requestID' - The unique identifier for the request to retrieve information about all
-- the versions of the message template.
--
-- 'nextToken', 'templateVersionsResponse_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.
--
-- 'message', 'templateVersionsResponse_message' - The message that\'s returned from the API for the request to retrieve
-- information about all the versions of the message template.
--
-- 'item', 'templateVersionsResponse_item' - An array of responses, one for each version of the message template.
newTemplateVersionsResponse ::
  TemplateVersionsResponse
newTemplateVersionsResponse :: TemplateVersionsResponse
newTemplateVersionsResponse =
  TemplateVersionsResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> [TemplateVersionResponse]
-> TemplateVersionsResponse
TemplateVersionsResponse'
    { $sel:requestID:TemplateVersionsResponse' :: Maybe Text
requestID =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:TemplateVersionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:message:TemplateVersionsResponse' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:item:TemplateVersionsResponse' :: [TemplateVersionResponse]
item = [TemplateVersionResponse]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The unique identifier for the request to retrieve information about all
-- the versions of the message template.
templateVersionsResponse_requestID :: Lens.Lens' TemplateVersionsResponse (Prelude.Maybe Prelude.Text)
templateVersionsResponse_requestID :: (Maybe Text -> f (Maybe Text))
-> TemplateVersionsResponse -> f TemplateVersionsResponse
templateVersionsResponse_requestID = (TemplateVersionsResponse -> Maybe Text)
-> (TemplateVersionsResponse
    -> Maybe Text -> TemplateVersionsResponse)
-> Lens
     TemplateVersionsResponse
     TemplateVersionsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionsResponse' {Maybe Text
requestID :: Maybe Text
$sel:requestID:TemplateVersionsResponse' :: TemplateVersionsResponse -> Maybe Text
requestID} -> Maybe Text
requestID) (\s :: TemplateVersionsResponse
s@TemplateVersionsResponse' {} Maybe Text
a -> TemplateVersionsResponse
s {$sel:requestID:TemplateVersionsResponse' :: Maybe Text
requestID = Maybe Text
a} :: TemplateVersionsResponse)

-- | 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.
templateVersionsResponse_nextToken :: Lens.Lens' TemplateVersionsResponse (Prelude.Maybe Prelude.Text)
templateVersionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> TemplateVersionsResponse -> f TemplateVersionsResponse
templateVersionsResponse_nextToken = (TemplateVersionsResponse -> Maybe Text)
-> (TemplateVersionsResponse
    -> Maybe Text -> TemplateVersionsResponse)
-> Lens
     TemplateVersionsResponse
     TemplateVersionsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:TemplateVersionsResponse' :: TemplateVersionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: TemplateVersionsResponse
s@TemplateVersionsResponse' {} Maybe Text
a -> TemplateVersionsResponse
s {$sel:nextToken:TemplateVersionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: TemplateVersionsResponse)

-- | The message that\'s returned from the API for the request to retrieve
-- information about all the versions of the message template.
templateVersionsResponse_message :: Lens.Lens' TemplateVersionsResponse (Prelude.Maybe Prelude.Text)
templateVersionsResponse_message :: (Maybe Text -> f (Maybe Text))
-> TemplateVersionsResponse -> f TemplateVersionsResponse
templateVersionsResponse_message = (TemplateVersionsResponse -> Maybe Text)
-> (TemplateVersionsResponse
    -> Maybe Text -> TemplateVersionsResponse)
-> Lens
     TemplateVersionsResponse
     TemplateVersionsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionsResponse' {Maybe Text
message :: Maybe Text
$sel:message:TemplateVersionsResponse' :: TemplateVersionsResponse -> Maybe Text
message} -> Maybe Text
message) (\s :: TemplateVersionsResponse
s@TemplateVersionsResponse' {} Maybe Text
a -> TemplateVersionsResponse
s {$sel:message:TemplateVersionsResponse' :: Maybe Text
message = Maybe Text
a} :: TemplateVersionsResponse)

-- | An array of responses, one for each version of the message template.
templateVersionsResponse_item :: Lens.Lens' TemplateVersionsResponse [TemplateVersionResponse]
templateVersionsResponse_item :: ([TemplateVersionResponse] -> f [TemplateVersionResponse])
-> TemplateVersionsResponse -> f TemplateVersionsResponse
templateVersionsResponse_item = (TemplateVersionsResponse -> [TemplateVersionResponse])
-> (TemplateVersionsResponse
    -> [TemplateVersionResponse] -> TemplateVersionsResponse)
-> Lens
     TemplateVersionsResponse
     TemplateVersionsResponse
     [TemplateVersionResponse]
     [TemplateVersionResponse]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TemplateVersionsResponse' {[TemplateVersionResponse]
item :: [TemplateVersionResponse]
$sel:item:TemplateVersionsResponse' :: TemplateVersionsResponse -> [TemplateVersionResponse]
item} -> [TemplateVersionResponse]
item) (\s :: TemplateVersionsResponse
s@TemplateVersionsResponse' {} [TemplateVersionResponse]
a -> TemplateVersionsResponse
s {$sel:item:TemplateVersionsResponse' :: [TemplateVersionResponse]
item = [TemplateVersionResponse]
a} :: TemplateVersionsResponse) (([TemplateVersionResponse] -> f [TemplateVersionResponse])
 -> TemplateVersionsResponse -> f TemplateVersionsResponse)
-> (([TemplateVersionResponse] -> f [TemplateVersionResponse])
    -> [TemplateVersionResponse] -> f [TemplateVersionResponse])
-> ([TemplateVersionResponse] -> f [TemplateVersionResponse])
-> TemplateVersionsResponse
-> f TemplateVersionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TemplateVersionResponse] -> f [TemplateVersionResponse])
-> [TemplateVersionResponse] -> f [TemplateVersionResponse]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON TemplateVersionsResponse where
  parseJSON :: Value -> Parser TemplateVersionsResponse
parseJSON =
    String
-> (Object -> Parser TemplateVersionsResponse)
-> Value
-> Parser TemplateVersionsResponse
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"TemplateVersionsResponse"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe Text
-> [TemplateVersionResponse]
-> TemplateVersionsResponse
TemplateVersionsResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> [TemplateVersionResponse]
 -> TemplateVersionsResponse)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> [TemplateVersionResponse]
      -> TemplateVersionsResponse)
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
"RequestID")
            Parser
  (Maybe Text
   -> Maybe Text
   -> [TemplateVersionResponse]
   -> TemplateVersionsResponse)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> [TemplateVersionResponse] -> TemplateVersionsResponse)
forall (f :: * -> *) a b. Applicative f => 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 Text
   -> [TemplateVersionResponse] -> TemplateVersionsResponse)
-> Parser (Maybe Text)
-> Parser ([TemplateVersionResponse] -> TemplateVersionsResponse)
forall (f :: * -> *) a b. Applicative f => 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
"Message")
            Parser ([TemplateVersionResponse] -> TemplateVersionsResponse)
-> Parser [TemplateVersionResponse]
-> Parser TemplateVersionsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe [TemplateVersionResponse])
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Item" Parser (Maybe [TemplateVersionResponse])
-> [TemplateVersionResponse] -> Parser [TemplateVersionResponse]
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= [TemplateVersionResponse]
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable TemplateVersionsResponse

instance Prelude.NFData TemplateVersionsResponse