{-# 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.LexModels.GetIntentVersions
-- 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)
--
-- Gets information about all of the versions of an intent.
--
-- The @GetIntentVersions@ operation returns an @IntentMetadata@ object for
-- each version of an intent. For example, if an intent has three numbered
-- versions, the @GetIntentVersions@ operation returns four
-- @IntentMetadata@ objects in the response, one for each numbered version
-- and one for the @$LATEST@ version.
--
-- The @GetIntentVersions@ operation always returns at least one version,
-- the @$LATEST@ version.
--
-- This operation requires permissions for the @lex:GetIntentVersions@
-- action.
--
-- This operation returns paginated results.
module Amazonka.LexModels.GetIntentVersions
  ( -- * Creating a Request
    GetIntentVersions (..),
    newGetIntentVersions,

    -- * Request Lenses
    getIntentVersions_nextToken,
    getIntentVersions_maxResults,
    getIntentVersions_name,

    -- * Destructuring the Response
    GetIntentVersionsResponse (..),
    newGetIntentVersionsResponse,

    -- * Response Lenses
    getIntentVersionsResponse_intents,
    getIntentVersionsResponse_nextToken,
    getIntentVersionsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newGetIntentVersions' smart constructor.
data GetIntentVersions = GetIntentVersions'
  { -- | A pagination token for fetching the next page of intent versions. If the
    -- response to this call is truncated, Amazon Lex returns a pagination
    -- token in the response. To fetch the next page of versions, specify the
    -- pagination token in the next request.
    GetIntentVersions -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of intent versions to return in the response. The
    -- default is 10.
    GetIntentVersions -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The name of the intent for which versions should be returned.
    GetIntentVersions -> Text
name :: Prelude.Text
  }
  deriving (GetIntentVersions -> GetIntentVersions -> Bool
(GetIntentVersions -> GetIntentVersions -> Bool)
-> (GetIntentVersions -> GetIntentVersions -> Bool)
-> Eq GetIntentVersions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIntentVersions -> GetIntentVersions -> Bool
$c/= :: GetIntentVersions -> GetIntentVersions -> Bool
== :: GetIntentVersions -> GetIntentVersions -> Bool
$c== :: GetIntentVersions -> GetIntentVersions -> Bool
Prelude.Eq, ReadPrec [GetIntentVersions]
ReadPrec GetIntentVersions
Int -> ReadS GetIntentVersions
ReadS [GetIntentVersions]
(Int -> ReadS GetIntentVersions)
-> ReadS [GetIntentVersions]
-> ReadPrec GetIntentVersions
-> ReadPrec [GetIntentVersions]
-> Read GetIntentVersions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetIntentVersions]
$creadListPrec :: ReadPrec [GetIntentVersions]
readPrec :: ReadPrec GetIntentVersions
$creadPrec :: ReadPrec GetIntentVersions
readList :: ReadS [GetIntentVersions]
$creadList :: ReadS [GetIntentVersions]
readsPrec :: Int -> ReadS GetIntentVersions
$creadsPrec :: Int -> ReadS GetIntentVersions
Prelude.Read, Int -> GetIntentVersions -> ShowS
[GetIntentVersions] -> ShowS
GetIntentVersions -> String
(Int -> GetIntentVersions -> ShowS)
-> (GetIntentVersions -> String)
-> ([GetIntentVersions] -> ShowS)
-> Show GetIntentVersions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIntentVersions] -> ShowS
$cshowList :: [GetIntentVersions] -> ShowS
show :: GetIntentVersions -> String
$cshow :: GetIntentVersions -> String
showsPrec :: Int -> GetIntentVersions -> ShowS
$cshowsPrec :: Int -> GetIntentVersions -> ShowS
Prelude.Show, (forall x. GetIntentVersions -> Rep GetIntentVersions x)
-> (forall x. Rep GetIntentVersions x -> GetIntentVersions)
-> Generic GetIntentVersions
forall x. Rep GetIntentVersions x -> GetIntentVersions
forall x. GetIntentVersions -> Rep GetIntentVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetIntentVersions x -> GetIntentVersions
$cfrom :: forall x. GetIntentVersions -> Rep GetIntentVersions x
Prelude.Generic)

-- |
-- Create a value of 'GetIntentVersions' 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', 'getIntentVersions_nextToken' - A pagination token for fetching the next page of intent versions. If the
-- response to this call is truncated, Amazon Lex returns a pagination
-- token in the response. To fetch the next page of versions, specify the
-- pagination token in the next request.
--
-- 'maxResults', 'getIntentVersions_maxResults' - The maximum number of intent versions to return in the response. The
-- default is 10.
--
-- 'name', 'getIntentVersions_name' - The name of the intent for which versions should be returned.
newGetIntentVersions ::
  -- | 'name'
  Prelude.Text ->
  GetIntentVersions
newGetIntentVersions :: Text -> GetIntentVersions
newGetIntentVersions Text
pName_ =
  GetIntentVersions' :: Maybe Text -> Maybe Natural -> Text -> GetIntentVersions
GetIntentVersions'
    { $sel:nextToken:GetIntentVersions' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:GetIntentVersions' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:name:GetIntentVersions' :: Text
name = Text
pName_
    }

-- | A pagination token for fetching the next page of intent versions. If the
-- response to this call is truncated, Amazon Lex returns a pagination
-- token in the response. To fetch the next page of versions, specify the
-- pagination token in the next request.
getIntentVersions_nextToken :: Lens.Lens' GetIntentVersions (Prelude.Maybe Prelude.Text)
getIntentVersions_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetIntentVersions -> f GetIntentVersions
getIntentVersions_nextToken = (GetIntentVersions -> Maybe Text)
-> (GetIntentVersions -> Maybe Text -> GetIntentVersions)
-> Lens
     GetIntentVersions GetIntentVersions (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIntentVersions' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetIntentVersions' :: GetIntentVersions -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetIntentVersions
s@GetIntentVersions' {} Maybe Text
a -> GetIntentVersions
s {$sel:nextToken:GetIntentVersions' :: Maybe Text
nextToken = Maybe Text
a} :: GetIntentVersions)

-- | The maximum number of intent versions to return in the response. The
-- default is 10.
getIntentVersions_maxResults :: Lens.Lens' GetIntentVersions (Prelude.Maybe Prelude.Natural)
getIntentVersions_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> GetIntentVersions -> f GetIntentVersions
getIntentVersions_maxResults = (GetIntentVersions -> Maybe Natural)
-> (GetIntentVersions -> Maybe Natural -> GetIntentVersions)
-> Lens
     GetIntentVersions GetIntentVersions (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIntentVersions' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetIntentVersions' :: GetIntentVersions -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetIntentVersions
s@GetIntentVersions' {} Maybe Natural
a -> GetIntentVersions
s {$sel:maxResults:GetIntentVersions' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetIntentVersions)

-- | The name of the intent for which versions should be returned.
getIntentVersions_name :: Lens.Lens' GetIntentVersions Prelude.Text
getIntentVersions_name :: (Text -> f Text) -> GetIntentVersions -> f GetIntentVersions
getIntentVersions_name = (GetIntentVersions -> Text)
-> (GetIntentVersions -> Text -> GetIntentVersions)
-> Lens GetIntentVersions GetIntentVersions Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIntentVersions' {Text
name :: Text
$sel:name:GetIntentVersions' :: GetIntentVersions -> Text
name} -> Text
name) (\s :: GetIntentVersions
s@GetIntentVersions' {} Text
a -> GetIntentVersions
s {$sel:name:GetIntentVersions' :: Text
name = Text
a} :: GetIntentVersions)

instance Core.AWSPager GetIntentVersions where
  page :: GetIntentVersions
-> AWSResponse GetIntentVersions -> Maybe GetIntentVersions
page GetIntentVersions
rq AWSResponse GetIntentVersions
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetIntentVersions
GetIntentVersionsResponse
rs
            GetIntentVersionsResponse
-> Getting (First Text) GetIntentVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetIntentVersionsResponse
-> Const (First Text) GetIntentVersionsResponse
Lens' GetIntentVersionsResponse (Maybe Text)
getIntentVersionsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetIntentVersionsResponse
 -> Const (First Text) GetIntentVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetIntentVersionsResponse 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 GetIntentVersions
forall a. Maybe a
Prelude.Nothing
    | Maybe [IntentMetadata] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse GetIntentVersions
GetIntentVersionsResponse
rs
            GetIntentVersionsResponse
-> Getting
     (First [IntentMetadata]) GetIntentVersionsResponse [IntentMetadata]
-> Maybe [IntentMetadata]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [IntentMetadata]
 -> Const (First [IntentMetadata]) (Maybe [IntentMetadata]))
-> GetIntentVersionsResponse
-> Const (First [IntentMetadata]) GetIntentVersionsResponse
Lens' GetIntentVersionsResponse (Maybe [IntentMetadata])
getIntentVersionsResponse_intents
              ((Maybe [IntentMetadata]
  -> Const (First [IntentMetadata]) (Maybe [IntentMetadata]))
 -> GetIntentVersionsResponse
 -> Const (First [IntentMetadata]) GetIntentVersionsResponse)
-> (([IntentMetadata]
     -> Const (First [IntentMetadata]) [IntentMetadata])
    -> Maybe [IntentMetadata]
    -> Const (First [IntentMetadata]) (Maybe [IntentMetadata]))
-> Getting
     (First [IntentMetadata]) GetIntentVersionsResponse [IntentMetadata]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([IntentMetadata]
 -> Const (First [IntentMetadata]) [IntentMetadata])
-> Maybe [IntentMetadata]
-> Const (First [IntentMetadata]) (Maybe [IntentMetadata])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
        ) =
      Maybe GetIntentVersions
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      GetIntentVersions -> Maybe GetIntentVersions
forall a. a -> Maybe a
Prelude.Just (GetIntentVersions -> Maybe GetIntentVersions)
-> GetIntentVersions -> Maybe GetIntentVersions
forall a b. (a -> b) -> a -> b
Prelude.$
        GetIntentVersions
rq
          GetIntentVersions
-> (GetIntentVersions -> GetIntentVersions) -> GetIntentVersions
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> GetIntentVersions -> Identity GetIntentVersions
Lens GetIntentVersions GetIntentVersions (Maybe Text) (Maybe Text)
getIntentVersions_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> GetIntentVersions -> Identity GetIntentVersions)
-> Maybe Text -> GetIntentVersions -> GetIntentVersions
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetIntentVersions
GetIntentVersionsResponse
rs
          GetIntentVersionsResponse
-> Getting (First Text) GetIntentVersionsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> GetIntentVersionsResponse
-> Const (First Text) GetIntentVersionsResponse
Lens' GetIntentVersionsResponse (Maybe Text)
getIntentVersionsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> GetIntentVersionsResponse
 -> Const (First Text) GetIntentVersionsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) GetIntentVersionsResponse 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 GetIntentVersions where
  type
    AWSResponse GetIntentVersions =
      GetIntentVersionsResponse
  request :: GetIntentVersions -> Request GetIntentVersions
request = Service -> GetIntentVersions -> Request GetIntentVersions
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetIntentVersions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetIntentVersions)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetIntentVersions))
-> Logger
-> Service
-> Proxy GetIntentVersions
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetIntentVersions)))
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 [IntentMetadata]
-> Maybe Text -> Int -> GetIntentVersionsResponse
GetIntentVersionsResponse'
            (Maybe [IntentMetadata]
 -> Maybe Text -> Int -> GetIntentVersionsResponse)
-> Either String (Maybe [IntentMetadata])
-> Either String (Maybe Text -> Int -> GetIntentVersionsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [IntentMetadata]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"intents" Either String (Maybe (Maybe [IntentMetadata]))
-> Maybe [IntentMetadata] -> Either String (Maybe [IntentMetadata])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [IntentMetadata]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Maybe Text -> Int -> GetIntentVersionsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> GetIntentVersionsResponse)
forall (f :: * -> *) a b. Applicative f => 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 (Int -> GetIntentVersionsResponse)
-> Either String Int -> Either String GetIntentVersionsResponse
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 GetIntentVersions

instance Prelude.NFData GetIntentVersions

instance Core.ToHeaders GetIntentVersions where
  toHeaders :: GetIntentVersions -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetIntentVersions -> 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 GetIntentVersions where
  toPath :: GetIntentVersions -> ByteString
toPath GetIntentVersions' {Maybe Natural
Maybe Text
Text
name :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:name:GetIntentVersions' :: GetIntentVersions -> Text
$sel:maxResults:GetIntentVersions' :: GetIntentVersions -> Maybe Natural
$sel:nextToken:GetIntentVersions' :: GetIntentVersions -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/intents/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
name, ByteString
"/versions/"]

instance Core.ToQuery GetIntentVersions where
  toQuery :: GetIntentVersions -> QueryString
toQuery GetIntentVersions' {Maybe Natural
Maybe Text
Text
name :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:name:GetIntentVersions' :: GetIntentVersions -> Text
$sel:maxResults:GetIntentVersions' :: GetIntentVersions -> Maybe Natural
$sel:nextToken:GetIntentVersions' :: GetIntentVersions -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"nextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"maxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
      ]

-- | /See:/ 'newGetIntentVersionsResponse' smart constructor.
data GetIntentVersionsResponse = GetIntentVersionsResponse'
  { -- | An array of @IntentMetadata@ objects, one for each numbered version of
    -- the intent plus one for the @$LATEST@ version.
    GetIntentVersionsResponse -> Maybe [IntentMetadata]
intents :: Prelude.Maybe [IntentMetadata],
    -- | A pagination token for fetching the next page of intent versions. If the
    -- response to this call is truncated, Amazon Lex returns a pagination
    -- token in the response. To fetch the next page of versions, specify the
    -- pagination token in the next request.
    GetIntentVersionsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetIntentVersionsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetIntentVersionsResponse -> GetIntentVersionsResponse -> Bool
(GetIntentVersionsResponse -> GetIntentVersionsResponse -> Bool)
-> (GetIntentVersionsResponse -> GetIntentVersionsResponse -> Bool)
-> Eq GetIntentVersionsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetIntentVersionsResponse -> GetIntentVersionsResponse -> Bool
$c/= :: GetIntentVersionsResponse -> GetIntentVersionsResponse -> Bool
== :: GetIntentVersionsResponse -> GetIntentVersionsResponse -> Bool
$c== :: GetIntentVersionsResponse -> GetIntentVersionsResponse -> Bool
Prelude.Eq, ReadPrec [GetIntentVersionsResponse]
ReadPrec GetIntentVersionsResponse
Int -> ReadS GetIntentVersionsResponse
ReadS [GetIntentVersionsResponse]
(Int -> ReadS GetIntentVersionsResponse)
-> ReadS [GetIntentVersionsResponse]
-> ReadPrec GetIntentVersionsResponse
-> ReadPrec [GetIntentVersionsResponse]
-> Read GetIntentVersionsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetIntentVersionsResponse]
$creadListPrec :: ReadPrec [GetIntentVersionsResponse]
readPrec :: ReadPrec GetIntentVersionsResponse
$creadPrec :: ReadPrec GetIntentVersionsResponse
readList :: ReadS [GetIntentVersionsResponse]
$creadList :: ReadS [GetIntentVersionsResponse]
readsPrec :: Int -> ReadS GetIntentVersionsResponse
$creadsPrec :: Int -> ReadS GetIntentVersionsResponse
Prelude.Read, Int -> GetIntentVersionsResponse -> ShowS
[GetIntentVersionsResponse] -> ShowS
GetIntentVersionsResponse -> String
(Int -> GetIntentVersionsResponse -> ShowS)
-> (GetIntentVersionsResponse -> String)
-> ([GetIntentVersionsResponse] -> ShowS)
-> Show GetIntentVersionsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetIntentVersionsResponse] -> ShowS
$cshowList :: [GetIntentVersionsResponse] -> ShowS
show :: GetIntentVersionsResponse -> String
$cshow :: GetIntentVersionsResponse -> String
showsPrec :: Int -> GetIntentVersionsResponse -> ShowS
$cshowsPrec :: Int -> GetIntentVersionsResponse -> ShowS
Prelude.Show, (forall x.
 GetIntentVersionsResponse -> Rep GetIntentVersionsResponse x)
-> (forall x.
    Rep GetIntentVersionsResponse x -> GetIntentVersionsResponse)
-> Generic GetIntentVersionsResponse
forall x.
Rep GetIntentVersionsResponse x -> GetIntentVersionsResponse
forall x.
GetIntentVersionsResponse -> Rep GetIntentVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetIntentVersionsResponse x -> GetIntentVersionsResponse
$cfrom :: forall x.
GetIntentVersionsResponse -> Rep GetIntentVersionsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetIntentVersionsResponse' 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:
--
-- 'intents', 'getIntentVersionsResponse_intents' - An array of @IntentMetadata@ objects, one for each numbered version of
-- the intent plus one for the @$LATEST@ version.
--
-- 'nextToken', 'getIntentVersionsResponse_nextToken' - A pagination token for fetching the next page of intent versions. If the
-- response to this call is truncated, Amazon Lex returns a pagination
-- token in the response. To fetch the next page of versions, specify the
-- pagination token in the next request.
--
-- 'httpStatus', 'getIntentVersionsResponse_httpStatus' - The response's http status code.
newGetIntentVersionsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetIntentVersionsResponse
newGetIntentVersionsResponse :: Int -> GetIntentVersionsResponse
newGetIntentVersionsResponse Int
pHttpStatus_ =
  GetIntentVersionsResponse' :: Maybe [IntentMetadata]
-> Maybe Text -> Int -> GetIntentVersionsResponse
GetIntentVersionsResponse'
    { $sel:intents:GetIntentVersionsResponse' :: Maybe [IntentMetadata]
intents =
        Maybe [IntentMetadata]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:GetIntentVersionsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetIntentVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of @IntentMetadata@ objects, one for each numbered version of
-- the intent plus one for the @$LATEST@ version.
getIntentVersionsResponse_intents :: Lens.Lens' GetIntentVersionsResponse (Prelude.Maybe [IntentMetadata])
getIntentVersionsResponse_intents :: (Maybe [IntentMetadata] -> f (Maybe [IntentMetadata]))
-> GetIntentVersionsResponse -> f GetIntentVersionsResponse
getIntentVersionsResponse_intents = (GetIntentVersionsResponse -> Maybe [IntentMetadata])
-> (GetIntentVersionsResponse
    -> Maybe [IntentMetadata] -> GetIntentVersionsResponse)
-> Lens' GetIntentVersionsResponse (Maybe [IntentMetadata])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIntentVersionsResponse' {Maybe [IntentMetadata]
intents :: Maybe [IntentMetadata]
$sel:intents:GetIntentVersionsResponse' :: GetIntentVersionsResponse -> Maybe [IntentMetadata]
intents} -> Maybe [IntentMetadata]
intents) (\s :: GetIntentVersionsResponse
s@GetIntentVersionsResponse' {} Maybe [IntentMetadata]
a -> GetIntentVersionsResponse
s {$sel:intents:GetIntentVersionsResponse' :: Maybe [IntentMetadata]
intents = Maybe [IntentMetadata]
a} :: GetIntentVersionsResponse) ((Maybe [IntentMetadata] -> f (Maybe [IntentMetadata]))
 -> GetIntentVersionsResponse -> f GetIntentVersionsResponse)
-> ((Maybe [IntentMetadata] -> f (Maybe [IntentMetadata]))
    -> Maybe [IntentMetadata] -> f (Maybe [IntentMetadata]))
-> (Maybe [IntentMetadata] -> f (Maybe [IntentMetadata]))
-> GetIntentVersionsResponse
-> f GetIntentVersionsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [IntentMetadata] [IntentMetadata] [IntentMetadata] [IntentMetadata]
-> Iso
     (Maybe [IntentMetadata])
     (Maybe [IntentMetadata])
     (Maybe [IntentMetadata])
     (Maybe [IntentMetadata])
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
  [IntentMetadata] [IntentMetadata] [IntentMetadata] [IntentMetadata]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A pagination token for fetching the next page of intent versions. If the
-- response to this call is truncated, Amazon Lex returns a pagination
-- token in the response. To fetch the next page of versions, specify the
-- pagination token in the next request.
getIntentVersionsResponse_nextToken :: Lens.Lens' GetIntentVersionsResponse (Prelude.Maybe Prelude.Text)
getIntentVersionsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> GetIntentVersionsResponse -> f GetIntentVersionsResponse
getIntentVersionsResponse_nextToken = (GetIntentVersionsResponse -> Maybe Text)
-> (GetIntentVersionsResponse
    -> Maybe Text -> GetIntentVersionsResponse)
-> Lens' GetIntentVersionsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetIntentVersionsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetIntentVersionsResponse' :: GetIntentVersionsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetIntentVersionsResponse
s@GetIntentVersionsResponse' {} Maybe Text
a -> GetIntentVersionsResponse
s {$sel:nextToken:GetIntentVersionsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetIntentVersionsResponse)

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

instance Prelude.NFData GetIntentVersionsResponse