{-# 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.APIGateway.GetDocumentationParts
-- 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)
--
-- -- | Undocumented operation.
--
-- This operation returns paginated results.
module Amazonka.APIGateway.GetDocumentationParts
  ( -- * Creating a Request
    GetDocumentationParts (..),
    newGetDocumentationParts,

    -- * Request Lenses
    getDocumentationParts_path,
    getDocumentationParts_locationStatus,
    getDocumentationParts_nameQuery,
    getDocumentationParts_limit,
    getDocumentationParts_type,
    getDocumentationParts_position,
    getDocumentationParts_restApiId,

    -- * Destructuring the Response
    GetDocumentationPartsResponse (..),
    newGetDocumentationPartsResponse,

    -- * Response Lenses
    getDocumentationPartsResponse_items,
    getDocumentationPartsResponse_position,
    getDocumentationPartsResponse_httpStatus,
  )
where

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

-- | Gets the documentation parts of an API. The result may be filtered by
-- the type, name, or path of API entities (targets).
--
-- /See:/ 'newGetDocumentationParts' smart constructor.
data GetDocumentationParts = GetDocumentationParts'
  { -- | The path of API entities of the to-be-retrieved documentation parts.
    GetDocumentationParts -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
    -- | The status of the API documentation parts to retrieve. Valid values are
    -- @DOCUMENTED@ for retrieving DocumentationPart resources with content and
    -- @UNDOCUMENTED@ for DocumentationPart resources without content.
    GetDocumentationParts -> Maybe LocationStatusType
locationStatus :: Prelude.Maybe LocationStatusType,
    -- | The name of API entities of the to-be-retrieved documentation parts.
    GetDocumentationParts -> Maybe Text
nameQuery :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of returned results per page. The default value is 25
    -- and the maximum value is 500.
    GetDocumentationParts -> Maybe Int
limit :: Prelude.Maybe Prelude.Int,
    -- | The type of API entities of the to-be-retrieved documentation parts.
    GetDocumentationParts -> Maybe DocumentationPartType
type' :: Prelude.Maybe DocumentationPartType,
    -- | The current pagination position in the paged result set.
    GetDocumentationParts -> Maybe Text
position :: Prelude.Maybe Prelude.Text,
    -- | [Required] The string identifier of the associated RestApi.
    GetDocumentationParts -> Text
restApiId :: Prelude.Text
  }
  deriving (GetDocumentationParts -> GetDocumentationParts -> Bool
(GetDocumentationParts -> GetDocumentationParts -> Bool)
-> (GetDocumentationParts -> GetDocumentationParts -> Bool)
-> Eq GetDocumentationParts
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDocumentationParts -> GetDocumentationParts -> Bool
$c/= :: GetDocumentationParts -> GetDocumentationParts -> Bool
== :: GetDocumentationParts -> GetDocumentationParts -> Bool
$c== :: GetDocumentationParts -> GetDocumentationParts -> Bool
Prelude.Eq, ReadPrec [GetDocumentationParts]
ReadPrec GetDocumentationParts
Int -> ReadS GetDocumentationParts
ReadS [GetDocumentationParts]
(Int -> ReadS GetDocumentationParts)
-> ReadS [GetDocumentationParts]
-> ReadPrec GetDocumentationParts
-> ReadPrec [GetDocumentationParts]
-> Read GetDocumentationParts
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDocumentationParts]
$creadListPrec :: ReadPrec [GetDocumentationParts]
readPrec :: ReadPrec GetDocumentationParts
$creadPrec :: ReadPrec GetDocumentationParts
readList :: ReadS [GetDocumentationParts]
$creadList :: ReadS [GetDocumentationParts]
readsPrec :: Int -> ReadS GetDocumentationParts
$creadsPrec :: Int -> ReadS GetDocumentationParts
Prelude.Read, Int -> GetDocumentationParts -> ShowS
[GetDocumentationParts] -> ShowS
GetDocumentationParts -> String
(Int -> GetDocumentationParts -> ShowS)
-> (GetDocumentationParts -> String)
-> ([GetDocumentationParts] -> ShowS)
-> Show GetDocumentationParts
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDocumentationParts] -> ShowS
$cshowList :: [GetDocumentationParts] -> ShowS
show :: GetDocumentationParts -> String
$cshow :: GetDocumentationParts -> String
showsPrec :: Int -> GetDocumentationParts -> ShowS
$cshowsPrec :: Int -> GetDocumentationParts -> ShowS
Prelude.Show, (forall x. GetDocumentationParts -> Rep GetDocumentationParts x)
-> (forall x. Rep GetDocumentationParts x -> GetDocumentationParts)
-> Generic GetDocumentationParts
forall x. Rep GetDocumentationParts x -> GetDocumentationParts
forall x. GetDocumentationParts -> Rep GetDocumentationParts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDocumentationParts x -> GetDocumentationParts
$cfrom :: forall x. GetDocumentationParts -> Rep GetDocumentationParts x
Prelude.Generic)

-- |
-- Create a value of 'GetDocumentationParts' 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:
--
-- 'path', 'getDocumentationParts_path' - The path of API entities of the to-be-retrieved documentation parts.
--
-- 'locationStatus', 'getDocumentationParts_locationStatus' - The status of the API documentation parts to retrieve. Valid values are
-- @DOCUMENTED@ for retrieving DocumentationPart resources with content and
-- @UNDOCUMENTED@ for DocumentationPart resources without content.
--
-- 'nameQuery', 'getDocumentationParts_nameQuery' - The name of API entities of the to-be-retrieved documentation parts.
--
-- 'limit', 'getDocumentationParts_limit' - The maximum number of returned results per page. The default value is 25
-- and the maximum value is 500.
--
-- 'type'', 'getDocumentationParts_type' - The type of API entities of the to-be-retrieved documentation parts.
--
-- 'position', 'getDocumentationParts_position' - The current pagination position in the paged result set.
--
-- 'restApiId', 'getDocumentationParts_restApiId' - [Required] The string identifier of the associated RestApi.
newGetDocumentationParts ::
  -- | 'restApiId'
  Prelude.Text ->
  GetDocumentationParts
newGetDocumentationParts :: Text -> GetDocumentationParts
newGetDocumentationParts Text
pRestApiId_ =
  GetDocumentationParts' :: Maybe Text
-> Maybe LocationStatusType
-> Maybe Text
-> Maybe Int
-> Maybe DocumentationPartType
-> Maybe Text
-> Text
-> GetDocumentationParts
GetDocumentationParts'
    { $sel:path:GetDocumentationParts' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:locationStatus:GetDocumentationParts' :: Maybe LocationStatusType
locationStatus = Maybe LocationStatusType
forall a. Maybe a
Prelude.Nothing,
      $sel:nameQuery:GetDocumentationParts' :: Maybe Text
nameQuery = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:limit:GetDocumentationParts' :: Maybe Int
limit = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:type':GetDocumentationParts' :: Maybe DocumentationPartType
type' = Maybe DocumentationPartType
forall a. Maybe a
Prelude.Nothing,
      $sel:position:GetDocumentationParts' :: Maybe Text
position = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:restApiId:GetDocumentationParts' :: Text
restApiId = Text
pRestApiId_
    }

-- | The path of API entities of the to-be-retrieved documentation parts.
getDocumentationParts_path :: Lens.Lens' GetDocumentationParts (Prelude.Maybe Prelude.Text)
getDocumentationParts_path :: (Maybe Text -> f (Maybe Text))
-> GetDocumentationParts -> f GetDocumentationParts
getDocumentationParts_path = (GetDocumentationParts -> Maybe Text)
-> (GetDocumentationParts -> Maybe Text -> GetDocumentationParts)
-> Lens
     GetDocumentationParts
     GetDocumentationParts
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationParts' {Maybe Text
path :: Maybe Text
$sel:path:GetDocumentationParts' :: GetDocumentationParts -> Maybe Text
path} -> Maybe Text
path) (\s :: GetDocumentationParts
s@GetDocumentationParts' {} Maybe Text
a -> GetDocumentationParts
s {$sel:path:GetDocumentationParts' :: Maybe Text
path = Maybe Text
a} :: GetDocumentationParts)

-- | The status of the API documentation parts to retrieve. Valid values are
-- @DOCUMENTED@ for retrieving DocumentationPart resources with content and
-- @UNDOCUMENTED@ for DocumentationPart resources without content.
getDocumentationParts_locationStatus :: Lens.Lens' GetDocumentationParts (Prelude.Maybe LocationStatusType)
getDocumentationParts_locationStatus :: (Maybe LocationStatusType -> f (Maybe LocationStatusType))
-> GetDocumentationParts -> f GetDocumentationParts
getDocumentationParts_locationStatus = (GetDocumentationParts -> Maybe LocationStatusType)
-> (GetDocumentationParts
    -> Maybe LocationStatusType -> GetDocumentationParts)
-> Lens
     GetDocumentationParts
     GetDocumentationParts
     (Maybe LocationStatusType)
     (Maybe LocationStatusType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationParts' {Maybe LocationStatusType
locationStatus :: Maybe LocationStatusType
$sel:locationStatus:GetDocumentationParts' :: GetDocumentationParts -> Maybe LocationStatusType
locationStatus} -> Maybe LocationStatusType
locationStatus) (\s :: GetDocumentationParts
s@GetDocumentationParts' {} Maybe LocationStatusType
a -> GetDocumentationParts
s {$sel:locationStatus:GetDocumentationParts' :: Maybe LocationStatusType
locationStatus = Maybe LocationStatusType
a} :: GetDocumentationParts)

-- | The name of API entities of the to-be-retrieved documentation parts.
getDocumentationParts_nameQuery :: Lens.Lens' GetDocumentationParts (Prelude.Maybe Prelude.Text)
getDocumentationParts_nameQuery :: (Maybe Text -> f (Maybe Text))
-> GetDocumentationParts -> f GetDocumentationParts
getDocumentationParts_nameQuery = (GetDocumentationParts -> Maybe Text)
-> (GetDocumentationParts -> Maybe Text -> GetDocumentationParts)
-> Lens
     GetDocumentationParts
     GetDocumentationParts
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationParts' {Maybe Text
nameQuery :: Maybe Text
$sel:nameQuery:GetDocumentationParts' :: GetDocumentationParts -> Maybe Text
nameQuery} -> Maybe Text
nameQuery) (\s :: GetDocumentationParts
s@GetDocumentationParts' {} Maybe Text
a -> GetDocumentationParts
s {$sel:nameQuery:GetDocumentationParts' :: Maybe Text
nameQuery = Maybe Text
a} :: GetDocumentationParts)

-- | The maximum number of returned results per page. The default value is 25
-- and the maximum value is 500.
getDocumentationParts_limit :: Lens.Lens' GetDocumentationParts (Prelude.Maybe Prelude.Int)
getDocumentationParts_limit :: (Maybe Int -> f (Maybe Int))
-> GetDocumentationParts -> f GetDocumentationParts
getDocumentationParts_limit = (GetDocumentationParts -> Maybe Int)
-> (GetDocumentationParts -> Maybe Int -> GetDocumentationParts)
-> Lens
     GetDocumentationParts GetDocumentationParts (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationParts' {Maybe Int
limit :: Maybe Int
$sel:limit:GetDocumentationParts' :: GetDocumentationParts -> Maybe Int
limit} -> Maybe Int
limit) (\s :: GetDocumentationParts
s@GetDocumentationParts' {} Maybe Int
a -> GetDocumentationParts
s {$sel:limit:GetDocumentationParts' :: Maybe Int
limit = Maybe Int
a} :: GetDocumentationParts)

-- | The type of API entities of the to-be-retrieved documentation parts.
getDocumentationParts_type :: Lens.Lens' GetDocumentationParts (Prelude.Maybe DocumentationPartType)
getDocumentationParts_type :: (Maybe DocumentationPartType -> f (Maybe DocumentationPartType))
-> GetDocumentationParts -> f GetDocumentationParts
getDocumentationParts_type = (GetDocumentationParts -> Maybe DocumentationPartType)
-> (GetDocumentationParts
    -> Maybe DocumentationPartType -> GetDocumentationParts)
-> Lens
     GetDocumentationParts
     GetDocumentationParts
     (Maybe DocumentationPartType)
     (Maybe DocumentationPartType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationParts' {Maybe DocumentationPartType
type' :: Maybe DocumentationPartType
$sel:type':GetDocumentationParts' :: GetDocumentationParts -> Maybe DocumentationPartType
type'} -> Maybe DocumentationPartType
type') (\s :: GetDocumentationParts
s@GetDocumentationParts' {} Maybe DocumentationPartType
a -> GetDocumentationParts
s {$sel:type':GetDocumentationParts' :: Maybe DocumentationPartType
type' = Maybe DocumentationPartType
a} :: GetDocumentationParts)

-- | The current pagination position in the paged result set.
getDocumentationParts_position :: Lens.Lens' GetDocumentationParts (Prelude.Maybe Prelude.Text)
getDocumentationParts_position :: (Maybe Text -> f (Maybe Text))
-> GetDocumentationParts -> f GetDocumentationParts
getDocumentationParts_position = (GetDocumentationParts -> Maybe Text)
-> (GetDocumentationParts -> Maybe Text -> GetDocumentationParts)
-> Lens
     GetDocumentationParts
     GetDocumentationParts
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationParts' {Maybe Text
position :: Maybe Text
$sel:position:GetDocumentationParts' :: GetDocumentationParts -> Maybe Text
position} -> Maybe Text
position) (\s :: GetDocumentationParts
s@GetDocumentationParts' {} Maybe Text
a -> GetDocumentationParts
s {$sel:position:GetDocumentationParts' :: Maybe Text
position = Maybe Text
a} :: GetDocumentationParts)

-- | [Required] The string identifier of the associated RestApi.
getDocumentationParts_restApiId :: Lens.Lens' GetDocumentationParts Prelude.Text
getDocumentationParts_restApiId :: (Text -> f Text)
-> GetDocumentationParts -> f GetDocumentationParts
getDocumentationParts_restApiId = (GetDocumentationParts -> Text)
-> (GetDocumentationParts -> Text -> GetDocumentationParts)
-> Lens GetDocumentationParts GetDocumentationParts Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationParts' {Text
restApiId :: Text
$sel:restApiId:GetDocumentationParts' :: GetDocumentationParts -> Text
restApiId} -> Text
restApiId) (\s :: GetDocumentationParts
s@GetDocumentationParts' {} Text
a -> GetDocumentationParts
s {$sel:restApiId:GetDocumentationParts' :: Text
restApiId = Text
a} :: GetDocumentationParts)

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

instance Prelude.NFData GetDocumentationParts

instance Core.ToHeaders GetDocumentationParts where
  toHeaders :: GetDocumentationParts -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetDocumentationParts -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Accept"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/json" :: Prelude.ByteString)
          ]
      )

instance Core.ToPath GetDocumentationParts where
  toPath :: GetDocumentationParts -> ByteString
toPath GetDocumentationParts' {Maybe Int
Maybe Text
Maybe DocumentationPartType
Maybe LocationStatusType
Text
restApiId :: Text
position :: Maybe Text
type' :: Maybe DocumentationPartType
limit :: Maybe Int
nameQuery :: Maybe Text
locationStatus :: Maybe LocationStatusType
path :: Maybe Text
$sel:restApiId:GetDocumentationParts' :: GetDocumentationParts -> Text
$sel:position:GetDocumentationParts' :: GetDocumentationParts -> Maybe Text
$sel:type':GetDocumentationParts' :: GetDocumentationParts -> Maybe DocumentationPartType
$sel:limit:GetDocumentationParts' :: GetDocumentationParts -> Maybe Int
$sel:nameQuery:GetDocumentationParts' :: GetDocumentationParts -> Maybe Text
$sel:locationStatus:GetDocumentationParts' :: GetDocumentationParts -> Maybe LocationStatusType
$sel:path:GetDocumentationParts' :: GetDocumentationParts -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/restapis/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
restApiId,
        ByteString
"/documentation/parts"
      ]

instance Core.ToQuery GetDocumentationParts where
  toQuery :: GetDocumentationParts -> QueryString
toQuery GetDocumentationParts' {Maybe Int
Maybe Text
Maybe DocumentationPartType
Maybe LocationStatusType
Text
restApiId :: Text
position :: Maybe Text
type' :: Maybe DocumentationPartType
limit :: Maybe Int
nameQuery :: Maybe Text
locationStatus :: Maybe LocationStatusType
path :: Maybe Text
$sel:restApiId:GetDocumentationParts' :: GetDocumentationParts -> Text
$sel:position:GetDocumentationParts' :: GetDocumentationParts -> Maybe Text
$sel:type':GetDocumentationParts' :: GetDocumentationParts -> Maybe DocumentationPartType
$sel:limit:GetDocumentationParts' :: GetDocumentationParts -> Maybe Int
$sel:nameQuery:GetDocumentationParts' :: GetDocumentationParts -> Maybe Text
$sel:locationStatus:GetDocumentationParts' :: GetDocumentationParts -> Maybe LocationStatusType
$sel:path:GetDocumentationParts' :: GetDocumentationParts -> Maybe Text
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"path" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
path,
        ByteString
"locationStatus" ByteString -> Maybe LocationStatusType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe LocationStatusType
locationStatus,
        ByteString
"name" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nameQuery,
        ByteString
"limit" ByteString -> Maybe Int -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Int
limit,
        ByteString
"type" ByteString -> Maybe DocumentationPartType -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe DocumentationPartType
type',
        ByteString
"position" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
position
      ]

-- | The collection of documentation parts of an API.
--
-- <https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-documenting-api.html Documenting an API>,
-- DocumentationPart
--
-- /See:/ 'newGetDocumentationPartsResponse' smart constructor.
data GetDocumentationPartsResponse = GetDocumentationPartsResponse'
  { -- | The current page of elements from this collection.
    GetDocumentationPartsResponse -> Maybe [DocumentationPart]
items :: Prelude.Maybe [DocumentationPart],
    GetDocumentationPartsResponse -> Maybe Text
position :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetDocumentationPartsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetDocumentationPartsResponse
-> GetDocumentationPartsResponse -> Bool
(GetDocumentationPartsResponse
 -> GetDocumentationPartsResponse -> Bool)
-> (GetDocumentationPartsResponse
    -> GetDocumentationPartsResponse -> Bool)
-> Eq GetDocumentationPartsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDocumentationPartsResponse
-> GetDocumentationPartsResponse -> Bool
$c/= :: GetDocumentationPartsResponse
-> GetDocumentationPartsResponse -> Bool
== :: GetDocumentationPartsResponse
-> GetDocumentationPartsResponse -> Bool
$c== :: GetDocumentationPartsResponse
-> GetDocumentationPartsResponse -> Bool
Prelude.Eq, ReadPrec [GetDocumentationPartsResponse]
ReadPrec GetDocumentationPartsResponse
Int -> ReadS GetDocumentationPartsResponse
ReadS [GetDocumentationPartsResponse]
(Int -> ReadS GetDocumentationPartsResponse)
-> ReadS [GetDocumentationPartsResponse]
-> ReadPrec GetDocumentationPartsResponse
-> ReadPrec [GetDocumentationPartsResponse]
-> Read GetDocumentationPartsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDocumentationPartsResponse]
$creadListPrec :: ReadPrec [GetDocumentationPartsResponse]
readPrec :: ReadPrec GetDocumentationPartsResponse
$creadPrec :: ReadPrec GetDocumentationPartsResponse
readList :: ReadS [GetDocumentationPartsResponse]
$creadList :: ReadS [GetDocumentationPartsResponse]
readsPrec :: Int -> ReadS GetDocumentationPartsResponse
$creadsPrec :: Int -> ReadS GetDocumentationPartsResponse
Prelude.Read, Int -> GetDocumentationPartsResponse -> ShowS
[GetDocumentationPartsResponse] -> ShowS
GetDocumentationPartsResponse -> String
(Int -> GetDocumentationPartsResponse -> ShowS)
-> (GetDocumentationPartsResponse -> String)
-> ([GetDocumentationPartsResponse] -> ShowS)
-> Show GetDocumentationPartsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDocumentationPartsResponse] -> ShowS
$cshowList :: [GetDocumentationPartsResponse] -> ShowS
show :: GetDocumentationPartsResponse -> String
$cshow :: GetDocumentationPartsResponse -> String
showsPrec :: Int -> GetDocumentationPartsResponse -> ShowS
$cshowsPrec :: Int -> GetDocumentationPartsResponse -> ShowS
Prelude.Show, (forall x.
 GetDocumentationPartsResponse
 -> Rep GetDocumentationPartsResponse x)
-> (forall x.
    Rep GetDocumentationPartsResponse x
    -> GetDocumentationPartsResponse)
-> Generic GetDocumentationPartsResponse
forall x.
Rep GetDocumentationPartsResponse x
-> GetDocumentationPartsResponse
forall x.
GetDocumentationPartsResponse
-> Rep GetDocumentationPartsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDocumentationPartsResponse x
-> GetDocumentationPartsResponse
$cfrom :: forall x.
GetDocumentationPartsResponse
-> Rep GetDocumentationPartsResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetDocumentationPartsResponse' 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:
--
-- 'items', 'getDocumentationPartsResponse_items' - The current page of elements from this collection.
--
-- 'position', 'getDocumentationPartsResponse_position' - Undocumented member.
--
-- 'httpStatus', 'getDocumentationPartsResponse_httpStatus' - The response's http status code.
newGetDocumentationPartsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetDocumentationPartsResponse
newGetDocumentationPartsResponse :: Int -> GetDocumentationPartsResponse
newGetDocumentationPartsResponse Int
pHttpStatus_ =
  GetDocumentationPartsResponse' :: Maybe [DocumentationPart]
-> Maybe Text -> Int -> GetDocumentationPartsResponse
GetDocumentationPartsResponse'
    { $sel:items:GetDocumentationPartsResponse' :: Maybe [DocumentationPart]
items =
        Maybe [DocumentationPart]
forall a. Maybe a
Prelude.Nothing,
      $sel:position:GetDocumentationPartsResponse' :: Maybe Text
position = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetDocumentationPartsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The current page of elements from this collection.
getDocumentationPartsResponse_items :: Lens.Lens' GetDocumentationPartsResponse (Prelude.Maybe [DocumentationPart])
getDocumentationPartsResponse_items :: (Maybe [DocumentationPart] -> f (Maybe [DocumentationPart]))
-> GetDocumentationPartsResponse -> f GetDocumentationPartsResponse
getDocumentationPartsResponse_items = (GetDocumentationPartsResponse -> Maybe [DocumentationPart])
-> (GetDocumentationPartsResponse
    -> Maybe [DocumentationPart] -> GetDocumentationPartsResponse)
-> Lens' GetDocumentationPartsResponse (Maybe [DocumentationPart])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationPartsResponse' {Maybe [DocumentationPart]
items :: Maybe [DocumentationPart]
$sel:items:GetDocumentationPartsResponse' :: GetDocumentationPartsResponse -> Maybe [DocumentationPart]
items} -> Maybe [DocumentationPart]
items) (\s :: GetDocumentationPartsResponse
s@GetDocumentationPartsResponse' {} Maybe [DocumentationPart]
a -> GetDocumentationPartsResponse
s {$sel:items:GetDocumentationPartsResponse' :: Maybe [DocumentationPart]
items = Maybe [DocumentationPart]
a} :: GetDocumentationPartsResponse) ((Maybe [DocumentationPart] -> f (Maybe [DocumentationPart]))
 -> GetDocumentationPartsResponse
 -> f GetDocumentationPartsResponse)
-> ((Maybe [DocumentationPart] -> f (Maybe [DocumentationPart]))
    -> Maybe [DocumentationPart] -> f (Maybe [DocumentationPart]))
-> (Maybe [DocumentationPart] -> f (Maybe [DocumentationPart]))
-> GetDocumentationPartsResponse
-> f GetDocumentationPartsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DocumentationPart]
  [DocumentationPart]
  [DocumentationPart]
  [DocumentationPart]
-> Iso
     (Maybe [DocumentationPart])
     (Maybe [DocumentationPart])
     (Maybe [DocumentationPart])
     (Maybe [DocumentationPart])
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
  [DocumentationPart]
  [DocumentationPart]
  [DocumentationPart]
  [DocumentationPart]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Undocumented member.
getDocumentationPartsResponse_position :: Lens.Lens' GetDocumentationPartsResponse (Prelude.Maybe Prelude.Text)
getDocumentationPartsResponse_position :: (Maybe Text -> f (Maybe Text))
-> GetDocumentationPartsResponse -> f GetDocumentationPartsResponse
getDocumentationPartsResponse_position = (GetDocumentationPartsResponse -> Maybe Text)
-> (GetDocumentationPartsResponse
    -> Maybe Text -> GetDocumentationPartsResponse)
-> Lens' GetDocumentationPartsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDocumentationPartsResponse' {Maybe Text
position :: Maybe Text
$sel:position:GetDocumentationPartsResponse' :: GetDocumentationPartsResponse -> Maybe Text
position} -> Maybe Text
position) (\s :: GetDocumentationPartsResponse
s@GetDocumentationPartsResponse' {} Maybe Text
a -> GetDocumentationPartsResponse
s {$sel:position:GetDocumentationPartsResponse' :: Maybe Text
position = Maybe Text
a} :: GetDocumentationPartsResponse)

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

instance Prelude.NFData GetDocumentationPartsResponse