{-# 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 #-}
module Amazonka.APIGateway.GetDocumentationVersions
(
GetDocumentationVersions (..),
newGetDocumentationVersions,
getDocumentationVersions_limit,
getDocumentationVersions_position,
getDocumentationVersions_restApiId,
GetDocumentationVersionsResponse (..),
newGetDocumentationVersionsResponse,
getDocumentationVersionsResponse_items,
getDocumentationVersionsResponse_position,
getDocumentationVersionsResponse_httpStatus,
)
where
import Amazonka.APIGateway.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetDocumentationVersions = GetDocumentationVersions'
{
GetDocumentationVersions -> Maybe Int
limit :: Prelude.Maybe Prelude.Int,
GetDocumentationVersions -> Maybe Text
position :: Prelude.Maybe Prelude.Text,
GetDocumentationVersions -> Text
restApiId :: Prelude.Text
}
deriving (GetDocumentationVersions -> GetDocumentationVersions -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDocumentationVersions -> GetDocumentationVersions -> Bool
$c/= :: GetDocumentationVersions -> GetDocumentationVersions -> Bool
== :: GetDocumentationVersions -> GetDocumentationVersions -> Bool
$c== :: GetDocumentationVersions -> GetDocumentationVersions -> Bool
Prelude.Eq, ReadPrec [GetDocumentationVersions]
ReadPrec GetDocumentationVersions
Int -> ReadS GetDocumentationVersions
ReadS [GetDocumentationVersions]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDocumentationVersions]
$creadListPrec :: ReadPrec [GetDocumentationVersions]
readPrec :: ReadPrec GetDocumentationVersions
$creadPrec :: ReadPrec GetDocumentationVersions
readList :: ReadS [GetDocumentationVersions]
$creadList :: ReadS [GetDocumentationVersions]
readsPrec :: Int -> ReadS GetDocumentationVersions
$creadsPrec :: Int -> ReadS GetDocumentationVersions
Prelude.Read, Int -> GetDocumentationVersions -> ShowS
[GetDocumentationVersions] -> ShowS
GetDocumentationVersions -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDocumentationVersions] -> ShowS
$cshowList :: [GetDocumentationVersions] -> ShowS
show :: GetDocumentationVersions -> String
$cshow :: GetDocumentationVersions -> String
showsPrec :: Int -> GetDocumentationVersions -> ShowS
$cshowsPrec :: Int -> GetDocumentationVersions -> ShowS
Prelude.Show, forall x.
Rep GetDocumentationVersions x -> GetDocumentationVersions
forall x.
GetDocumentationVersions -> Rep GetDocumentationVersions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDocumentationVersions x -> GetDocumentationVersions
$cfrom :: forall x.
GetDocumentationVersions -> Rep GetDocumentationVersions x
Prelude.Generic)
newGetDocumentationVersions ::
Prelude.Text ->
GetDocumentationVersions
newGetDocumentationVersions :: Text -> GetDocumentationVersions
newGetDocumentationVersions Text
pRestApiId_ =
GetDocumentationVersions'
{ $sel:limit:GetDocumentationVersions' :: Maybe Int
limit = forall a. Maybe a
Prelude.Nothing,
$sel:position:GetDocumentationVersions' :: Maybe Text
position = forall a. Maybe a
Prelude.Nothing,
$sel:restApiId:GetDocumentationVersions' :: Text
restApiId = Text
pRestApiId_
}
getDocumentationVersions_limit :: Lens.Lens' GetDocumentationVersions (Prelude.Maybe Prelude.Int)
getDocumentationVersions_limit :: Lens' GetDocumentationVersions (Maybe Int)
getDocumentationVersions_limit = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationVersions' {Maybe Int
limit :: Maybe Int
$sel:limit:GetDocumentationVersions' :: GetDocumentationVersions -> Maybe Int
limit} -> Maybe Int
limit) (\s :: GetDocumentationVersions
s@GetDocumentationVersions' {} Maybe Int
a -> GetDocumentationVersions
s {$sel:limit:GetDocumentationVersions' :: Maybe Int
limit = Maybe Int
a} :: GetDocumentationVersions)
getDocumentationVersions_position :: Lens.Lens' GetDocumentationVersions (Prelude.Maybe Prelude.Text)
getDocumentationVersions_position :: Lens' GetDocumentationVersions (Maybe Text)
getDocumentationVersions_position = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationVersions' {Maybe Text
position :: Maybe Text
$sel:position:GetDocumentationVersions' :: GetDocumentationVersions -> Maybe Text
position} -> Maybe Text
position) (\s :: GetDocumentationVersions
s@GetDocumentationVersions' {} Maybe Text
a -> GetDocumentationVersions
s {$sel:position:GetDocumentationVersions' :: Maybe Text
position = Maybe Text
a} :: GetDocumentationVersions)
getDocumentationVersions_restApiId :: Lens.Lens' GetDocumentationVersions Prelude.Text
getDocumentationVersions_restApiId :: Lens' GetDocumentationVersions Text
getDocumentationVersions_restApiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationVersions' {Text
restApiId :: Text
$sel:restApiId:GetDocumentationVersions' :: GetDocumentationVersions -> Text
restApiId} -> Text
restApiId) (\s :: GetDocumentationVersions
s@GetDocumentationVersions' {} Text
a -> GetDocumentationVersions
s {$sel:restApiId:GetDocumentationVersions' :: Text
restApiId = Text
a} :: GetDocumentationVersions)
instance Core.AWSPager GetDocumentationVersions where
page :: GetDocumentationVersions
-> AWSResponse GetDocumentationVersions
-> Maybe GetDocumentationVersions
page GetDocumentationVersions
rq AWSResponse GetDocumentationVersions
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetDocumentationVersions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetDocumentationVersionsResponse (Maybe Text)
getDocumentationVersionsResponse_position
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetDocumentationVersions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens'
GetDocumentationVersionsResponse (Maybe [DocumentationVersion])
getDocumentationVersionsResponse_items
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ GetDocumentationVersions
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetDocumentationVersions (Maybe Text)
getDocumentationVersions_position
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetDocumentationVersions
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetDocumentationVersionsResponse (Maybe Text)
getDocumentationVersionsResponse_position
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest GetDocumentationVersions where
type
AWSResponse GetDocumentationVersions =
GetDocumentationVersionsResponse
request :: (Service -> Service)
-> GetDocumentationVersions -> Request GetDocumentationVersions
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDocumentationVersions
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDocumentationVersions)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [DocumentationVersion]
-> Maybe Text -> Int -> GetDocumentationVersionsResponse
GetDocumentationVersionsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"item" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"position")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetDocumentationVersions where
hashWithSalt :: Int -> GetDocumentationVersions -> Int
hashWithSalt Int
_salt GetDocumentationVersions' {Maybe Int
Maybe Text
Text
restApiId :: Text
position :: Maybe Text
limit :: Maybe Int
$sel:restApiId:GetDocumentationVersions' :: GetDocumentationVersions -> Text
$sel:position:GetDocumentationVersions' :: GetDocumentationVersions -> Maybe Text
$sel:limit:GetDocumentationVersions' :: GetDocumentationVersions -> Maybe Int
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
limit
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
position
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
restApiId
instance Prelude.NFData GetDocumentationVersions where
rnf :: GetDocumentationVersions -> ()
rnf GetDocumentationVersions' {Maybe Int
Maybe Text
Text
restApiId :: Text
position :: Maybe Text
limit :: Maybe Int
$sel:restApiId:GetDocumentationVersions' :: GetDocumentationVersions -> Text
$sel:position:GetDocumentationVersions' :: GetDocumentationVersions -> Maybe Text
$sel:limit:GetDocumentationVersions' :: GetDocumentationVersions -> Maybe Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
limit
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
position
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
restApiId
instance Data.ToHeaders GetDocumentationVersions where
toHeaders :: GetDocumentationVersions -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Accept"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"application/json" :: Prelude.ByteString)
]
)
instance Data.ToPath GetDocumentationVersions where
toPath :: GetDocumentationVersions -> ByteString
toPath GetDocumentationVersions' {Maybe Int
Maybe Text
Text
restApiId :: Text
position :: Maybe Text
limit :: Maybe Int
$sel:restApiId:GetDocumentationVersions' :: GetDocumentationVersions -> Text
$sel:position:GetDocumentationVersions' :: GetDocumentationVersions -> Maybe Text
$sel:limit:GetDocumentationVersions' :: GetDocumentationVersions -> Maybe Int
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/restapis/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
restApiId,
ByteString
"/documentation/versions"
]
instance Data.ToQuery GetDocumentationVersions where
toQuery :: GetDocumentationVersions -> QueryString
toQuery GetDocumentationVersions' {Maybe Int
Maybe Text
Text
restApiId :: Text
position :: Maybe Text
limit :: Maybe Int
$sel:restApiId:GetDocumentationVersions' :: GetDocumentationVersions -> Text
$sel:position:GetDocumentationVersions' :: GetDocumentationVersions -> Maybe Text
$sel:limit:GetDocumentationVersions' :: GetDocumentationVersions -> Maybe Int
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"limit" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Int
limit, ByteString
"position" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
position]
data GetDocumentationVersionsResponse = GetDocumentationVersionsResponse'
{
GetDocumentationVersionsResponse -> Maybe [DocumentationVersion]
items :: Prelude.Maybe [DocumentationVersion],
GetDocumentationVersionsResponse -> Maybe Text
position :: Prelude.Maybe Prelude.Text,
GetDocumentationVersionsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDocumentationVersionsResponse
-> GetDocumentationVersionsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDocumentationVersionsResponse
-> GetDocumentationVersionsResponse -> Bool
$c/= :: GetDocumentationVersionsResponse
-> GetDocumentationVersionsResponse -> Bool
== :: GetDocumentationVersionsResponse
-> GetDocumentationVersionsResponse -> Bool
$c== :: GetDocumentationVersionsResponse
-> GetDocumentationVersionsResponse -> Bool
Prelude.Eq, ReadPrec [GetDocumentationVersionsResponse]
ReadPrec GetDocumentationVersionsResponse
Int -> ReadS GetDocumentationVersionsResponse
ReadS [GetDocumentationVersionsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDocumentationVersionsResponse]
$creadListPrec :: ReadPrec [GetDocumentationVersionsResponse]
readPrec :: ReadPrec GetDocumentationVersionsResponse
$creadPrec :: ReadPrec GetDocumentationVersionsResponse
readList :: ReadS [GetDocumentationVersionsResponse]
$creadList :: ReadS [GetDocumentationVersionsResponse]
readsPrec :: Int -> ReadS GetDocumentationVersionsResponse
$creadsPrec :: Int -> ReadS GetDocumentationVersionsResponse
Prelude.Read, Int -> GetDocumentationVersionsResponse -> ShowS
[GetDocumentationVersionsResponse] -> ShowS
GetDocumentationVersionsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDocumentationVersionsResponse] -> ShowS
$cshowList :: [GetDocumentationVersionsResponse] -> ShowS
show :: GetDocumentationVersionsResponse -> String
$cshow :: GetDocumentationVersionsResponse -> String
showsPrec :: Int -> GetDocumentationVersionsResponse -> ShowS
$cshowsPrec :: Int -> GetDocumentationVersionsResponse -> ShowS
Prelude.Show, forall x.
Rep GetDocumentationVersionsResponse x
-> GetDocumentationVersionsResponse
forall x.
GetDocumentationVersionsResponse
-> Rep GetDocumentationVersionsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDocumentationVersionsResponse x
-> GetDocumentationVersionsResponse
$cfrom :: forall x.
GetDocumentationVersionsResponse
-> Rep GetDocumentationVersionsResponse x
Prelude.Generic)
newGetDocumentationVersionsResponse ::
Prelude.Int ->
GetDocumentationVersionsResponse
newGetDocumentationVersionsResponse :: Int -> GetDocumentationVersionsResponse
newGetDocumentationVersionsResponse Int
pHttpStatus_ =
GetDocumentationVersionsResponse'
{ $sel:items:GetDocumentationVersionsResponse' :: Maybe [DocumentationVersion]
items =
forall a. Maybe a
Prelude.Nothing,
$sel:position:GetDocumentationVersionsResponse' :: Maybe Text
position = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDocumentationVersionsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDocumentationVersionsResponse_items :: Lens.Lens' GetDocumentationVersionsResponse (Prelude.Maybe [DocumentationVersion])
getDocumentationVersionsResponse_items :: Lens'
GetDocumentationVersionsResponse (Maybe [DocumentationVersion])
getDocumentationVersionsResponse_items = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationVersionsResponse' {Maybe [DocumentationVersion]
items :: Maybe [DocumentationVersion]
$sel:items:GetDocumentationVersionsResponse' :: GetDocumentationVersionsResponse -> Maybe [DocumentationVersion]
items} -> Maybe [DocumentationVersion]
items) (\s :: GetDocumentationVersionsResponse
s@GetDocumentationVersionsResponse' {} Maybe [DocumentationVersion]
a -> GetDocumentationVersionsResponse
s {$sel:items:GetDocumentationVersionsResponse' :: Maybe [DocumentationVersion]
items = Maybe [DocumentationVersion]
a} :: GetDocumentationVersionsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
getDocumentationVersionsResponse_position :: Lens.Lens' GetDocumentationVersionsResponse (Prelude.Maybe Prelude.Text)
getDocumentationVersionsResponse_position :: Lens' GetDocumentationVersionsResponse (Maybe Text)
getDocumentationVersionsResponse_position = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationVersionsResponse' {Maybe Text
position :: Maybe Text
$sel:position:GetDocumentationVersionsResponse' :: GetDocumentationVersionsResponse -> Maybe Text
position} -> Maybe Text
position) (\s :: GetDocumentationVersionsResponse
s@GetDocumentationVersionsResponse' {} Maybe Text
a -> GetDocumentationVersionsResponse
s {$sel:position:GetDocumentationVersionsResponse' :: Maybe Text
position = Maybe Text
a} :: GetDocumentationVersionsResponse)
getDocumentationVersionsResponse_httpStatus :: Lens.Lens' GetDocumentationVersionsResponse Prelude.Int
getDocumentationVersionsResponse_httpStatus :: Lens' GetDocumentationVersionsResponse Int
getDocumentationVersionsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationVersionsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDocumentationVersionsResponse' :: GetDocumentationVersionsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDocumentationVersionsResponse
s@GetDocumentationVersionsResponse' {} Int
a -> GetDocumentationVersionsResponse
s {$sel:httpStatus:GetDocumentationVersionsResponse' :: Int
httpStatus = Int
a} :: GetDocumentationVersionsResponse)
instance
Prelude.NFData
GetDocumentationVersionsResponse
where
rnf :: GetDocumentationVersionsResponse -> ()
rnf GetDocumentationVersionsResponse' {Int
Maybe [DocumentationVersion]
Maybe Text
httpStatus :: Int
position :: Maybe Text
items :: Maybe [DocumentationVersion]
$sel:httpStatus:GetDocumentationVersionsResponse' :: GetDocumentationVersionsResponse -> Int
$sel:position:GetDocumentationVersionsResponse' :: GetDocumentationVersionsResponse -> Maybe Text
$sel:items:GetDocumentationVersionsResponse' :: GetDocumentationVersionsResponse -> Maybe [DocumentationVersion]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [DocumentationVersion]
items
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
position
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus