{-# 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.CodeCommit.ListPullRequests
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Returns a list of pull requests for a specified repository. The return
-- list can be refined by pull request status or pull request author ARN.
--
-- This operation returns paginated results.
module Amazonka.CodeCommit.ListPullRequests
  ( -- * Creating a Request
    ListPullRequests (..),
    newListPullRequests,

    -- * Request Lenses
    listPullRequests_authorArn,
    listPullRequests_maxResults,
    listPullRequests_nextToken,
    listPullRequests_pullRequestStatus,
    listPullRequests_repositoryName,

    -- * Destructuring the Response
    ListPullRequestsResponse (..),
    newListPullRequestsResponse,

    -- * Response Lenses
    listPullRequestsResponse_nextToken,
    listPullRequestsResponse_httpStatus,
    listPullRequestsResponse_pullRequestIds,
  )
where

import Amazonka.CodeCommit.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

-- | /See:/ 'newListPullRequests' smart constructor.
data ListPullRequests = ListPullRequests'
  { -- | Optional. The Amazon Resource Name (ARN) of the user who created the
    -- pull request. If used, this filters the results to pull requests created
    -- by that user.
    ListPullRequests -> Maybe Text
authorArn :: Prelude.Maybe Prelude.Text,
    -- | A non-zero, non-negative integer used to limit the number of returned
    -- results.
    ListPullRequests -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | An enumeration token that, when provided in a request, returns the next
    -- batch of the results.
    ListPullRequests -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | Optional. The status of the pull request. If used, this refines the
    -- results to the pull requests that match the specified status.
    ListPullRequests -> Maybe PullRequestStatusEnum
pullRequestStatus :: Prelude.Maybe PullRequestStatusEnum,
    -- | The name of the repository for which you want to list pull requests.
    ListPullRequests -> Text
repositoryName :: Prelude.Text
  }
  deriving (ListPullRequests -> ListPullRequests -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPullRequests -> ListPullRequests -> Bool
$c/= :: ListPullRequests -> ListPullRequests -> Bool
== :: ListPullRequests -> ListPullRequests -> Bool
$c== :: ListPullRequests -> ListPullRequests -> Bool
Prelude.Eq, ReadPrec [ListPullRequests]
ReadPrec ListPullRequests
Int -> ReadS ListPullRequests
ReadS [ListPullRequests]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPullRequests]
$creadListPrec :: ReadPrec [ListPullRequests]
readPrec :: ReadPrec ListPullRequests
$creadPrec :: ReadPrec ListPullRequests
readList :: ReadS [ListPullRequests]
$creadList :: ReadS [ListPullRequests]
readsPrec :: Int -> ReadS ListPullRequests
$creadsPrec :: Int -> ReadS ListPullRequests
Prelude.Read, Int -> ListPullRequests -> ShowS
[ListPullRequests] -> ShowS
ListPullRequests -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPullRequests] -> ShowS
$cshowList :: [ListPullRequests] -> ShowS
show :: ListPullRequests -> String
$cshow :: ListPullRequests -> String
showsPrec :: Int -> ListPullRequests -> ShowS
$cshowsPrec :: Int -> ListPullRequests -> ShowS
Prelude.Show, forall x. Rep ListPullRequests x -> ListPullRequests
forall x. ListPullRequests -> Rep ListPullRequests x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPullRequests x -> ListPullRequests
$cfrom :: forall x. ListPullRequests -> Rep ListPullRequests x
Prelude.Generic)

-- |
-- Create a value of 'ListPullRequests' 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:
--
-- 'authorArn', 'listPullRequests_authorArn' - Optional. The Amazon Resource Name (ARN) of the user who created the
-- pull request. If used, this filters the results to pull requests created
-- by that user.
--
-- 'maxResults', 'listPullRequests_maxResults' - A non-zero, non-negative integer used to limit the number of returned
-- results.
--
-- 'nextToken', 'listPullRequests_nextToken' - An enumeration token that, when provided in a request, returns the next
-- batch of the results.
--
-- 'pullRequestStatus', 'listPullRequests_pullRequestStatus' - Optional. The status of the pull request. If used, this refines the
-- results to the pull requests that match the specified status.
--
-- 'repositoryName', 'listPullRequests_repositoryName' - The name of the repository for which you want to list pull requests.
newListPullRequests ::
  -- | 'repositoryName'
  Prelude.Text ->
  ListPullRequests
newListPullRequests :: Text -> ListPullRequests
newListPullRequests Text
pRepositoryName_ =
  ListPullRequests'
    { $sel:authorArn:ListPullRequests' :: Maybe Text
authorArn = forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListPullRequests' :: Maybe Int
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListPullRequests' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
      $sel:pullRequestStatus:ListPullRequests' :: Maybe PullRequestStatusEnum
pullRequestStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryName:ListPullRequests' :: Text
repositoryName = Text
pRepositoryName_
    }

-- | Optional. The Amazon Resource Name (ARN) of the user who created the
-- pull request. If used, this filters the results to pull requests created
-- by that user.
listPullRequests_authorArn :: Lens.Lens' ListPullRequests (Prelude.Maybe Prelude.Text)
listPullRequests_authorArn :: Lens' ListPullRequests (Maybe Text)
listPullRequests_authorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPullRequests' {Maybe Text
authorArn :: Maybe Text
$sel:authorArn:ListPullRequests' :: ListPullRequests -> Maybe Text
authorArn} -> Maybe Text
authorArn) (\s :: ListPullRequests
s@ListPullRequests' {} Maybe Text
a -> ListPullRequests
s {$sel:authorArn:ListPullRequests' :: Maybe Text
authorArn = Maybe Text
a} :: ListPullRequests)

-- | A non-zero, non-negative integer used to limit the number of returned
-- results.
listPullRequests_maxResults :: Lens.Lens' ListPullRequests (Prelude.Maybe Prelude.Int)
listPullRequests_maxResults :: Lens' ListPullRequests (Maybe Int)
listPullRequests_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPullRequests' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:ListPullRequests' :: ListPullRequests -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: ListPullRequests
s@ListPullRequests' {} Maybe Int
a -> ListPullRequests
s {$sel:maxResults:ListPullRequests' :: Maybe Int
maxResults = Maybe Int
a} :: ListPullRequests)

-- | An enumeration token that, when provided in a request, returns the next
-- batch of the results.
listPullRequests_nextToken :: Lens.Lens' ListPullRequests (Prelude.Maybe Prelude.Text)
listPullRequests_nextToken :: Lens' ListPullRequests (Maybe Text)
listPullRequests_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPullRequests' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPullRequests' :: ListPullRequests -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPullRequests
s@ListPullRequests' {} Maybe Text
a -> ListPullRequests
s {$sel:nextToken:ListPullRequests' :: Maybe Text
nextToken = Maybe Text
a} :: ListPullRequests)

-- | Optional. The status of the pull request. If used, this refines the
-- results to the pull requests that match the specified status.
listPullRequests_pullRequestStatus :: Lens.Lens' ListPullRequests (Prelude.Maybe PullRequestStatusEnum)
listPullRequests_pullRequestStatus :: Lens' ListPullRequests (Maybe PullRequestStatusEnum)
listPullRequests_pullRequestStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPullRequests' {Maybe PullRequestStatusEnum
pullRequestStatus :: Maybe PullRequestStatusEnum
$sel:pullRequestStatus:ListPullRequests' :: ListPullRequests -> Maybe PullRequestStatusEnum
pullRequestStatus} -> Maybe PullRequestStatusEnum
pullRequestStatus) (\s :: ListPullRequests
s@ListPullRequests' {} Maybe PullRequestStatusEnum
a -> ListPullRequests
s {$sel:pullRequestStatus:ListPullRequests' :: Maybe PullRequestStatusEnum
pullRequestStatus = Maybe PullRequestStatusEnum
a} :: ListPullRequests)

-- | The name of the repository for which you want to list pull requests.
listPullRequests_repositoryName :: Lens.Lens' ListPullRequests Prelude.Text
listPullRequests_repositoryName :: Lens' ListPullRequests Text
listPullRequests_repositoryName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPullRequests' {Text
repositoryName :: Text
$sel:repositoryName:ListPullRequests' :: ListPullRequests -> Text
repositoryName} -> Text
repositoryName) (\s :: ListPullRequests
s@ListPullRequests' {} Text
a -> ListPullRequests
s {$sel:repositoryName:ListPullRequests' :: Text
repositoryName = Text
a} :: ListPullRequests)

instance Core.AWSPager ListPullRequests where
  page :: ListPullRequests
-> AWSResponse ListPullRequests -> Maybe ListPullRequests
page ListPullRequests
rq AWSResponse ListPullRequests
rs
    | forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse ListPullRequests
rs
            forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPullRequestsResponse (Maybe Text)
listPullRequestsResponse_nextToken
            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 ListPullRequests
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListPullRequestsResponse [Text]
listPullRequestsResponse_pullRequestIds) =
        forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
        forall a. a -> Maybe a
Prelude.Just
          forall a b. (a -> b) -> a -> b
Prelude.$ ListPullRequests
rq
          forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListPullRequests (Maybe Text)
listPullRequests_nextToken
          forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPullRequests
rs
          forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPullRequestsResponse (Maybe Text)
listPullRequestsResponse_nextToken
          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 ListPullRequests where
  type
    AWSResponse ListPullRequests =
      ListPullRequestsResponse
  request :: (Service -> Service)
-> ListPullRequests -> Request ListPullRequests
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListPullRequests
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPullRequests)))
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 Text -> Int -> [Text] -> ListPullRequestsResponse
ListPullRequestsResponse'
            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
"nextToken")
            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))
            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
"pullRequestIds"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable ListPullRequests where
  hashWithSalt :: Int -> ListPullRequests -> Int
hashWithSalt Int
_salt ListPullRequests' {Maybe Int
Maybe Text
Maybe PullRequestStatusEnum
Text
repositoryName :: Text
pullRequestStatus :: Maybe PullRequestStatusEnum
nextToken :: Maybe Text
maxResults :: Maybe Int
authorArn :: Maybe Text
$sel:repositoryName:ListPullRequests' :: ListPullRequests -> Text
$sel:pullRequestStatus:ListPullRequests' :: ListPullRequests -> Maybe PullRequestStatusEnum
$sel:nextToken:ListPullRequests' :: ListPullRequests -> Maybe Text
$sel:maxResults:ListPullRequests' :: ListPullRequests -> Maybe Int
$sel:authorArn:ListPullRequests' :: ListPullRequests -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
authorArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PullRequestStatusEnum
pullRequestStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
repositoryName

instance Prelude.NFData ListPullRequests where
  rnf :: ListPullRequests -> ()
rnf ListPullRequests' {Maybe Int
Maybe Text
Maybe PullRequestStatusEnum
Text
repositoryName :: Text
pullRequestStatus :: Maybe PullRequestStatusEnum
nextToken :: Maybe Text
maxResults :: Maybe Int
authorArn :: Maybe Text
$sel:repositoryName:ListPullRequests' :: ListPullRequests -> Text
$sel:pullRequestStatus:ListPullRequests' :: ListPullRequests -> Maybe PullRequestStatusEnum
$sel:nextToken:ListPullRequests' :: ListPullRequests -> Maybe Text
$sel:maxResults:ListPullRequests' :: ListPullRequests -> Maybe Int
$sel:authorArn:ListPullRequests' :: ListPullRequests -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
authorArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
maxResults
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PullRequestStatusEnum
pullRequestStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
repositoryName

instance Data.ToHeaders ListPullRequests where
  toHeaders :: ListPullRequests -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"CodeCommit_20150413.ListPullRequests" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON ListPullRequests where
  toJSON :: ListPullRequests -> Value
toJSON ListPullRequests' {Maybe Int
Maybe Text
Maybe PullRequestStatusEnum
Text
repositoryName :: Text
pullRequestStatus :: Maybe PullRequestStatusEnum
nextToken :: Maybe Text
maxResults :: Maybe Int
authorArn :: Maybe Text
$sel:repositoryName:ListPullRequests' :: ListPullRequests -> Text
$sel:pullRequestStatus:ListPullRequests' :: ListPullRequests -> Maybe PullRequestStatusEnum
$sel:nextToken:ListPullRequests' :: ListPullRequests -> Maybe Text
$sel:maxResults:ListPullRequests' :: ListPullRequests -> Maybe Int
$sel:authorArn:ListPullRequests' :: ListPullRequests -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"authorArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
authorArn,
            (Key
"maxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
            (Key
"nextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Key
"pullRequestStatus" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PullRequestStatusEnum
pullRequestStatus,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"repositoryName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
repositoryName)
          ]
      )

instance Data.ToPath ListPullRequests where
  toPath :: ListPullRequests -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery ListPullRequests where
  toQuery :: ListPullRequests -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newListPullRequestsResponse' smart constructor.
data ListPullRequestsResponse = ListPullRequestsResponse'
  { -- | An enumeration token that allows the operation to batch the next results
    -- of the operation.
    ListPullRequestsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListPullRequestsResponse -> Int
httpStatus :: Prelude.Int,
    -- | The system-generated IDs of the pull requests.
    ListPullRequestsResponse -> [Text]
pullRequestIds :: [Prelude.Text]
  }
  deriving (ListPullRequestsResponse -> ListPullRequestsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPullRequestsResponse -> ListPullRequestsResponse -> Bool
$c/= :: ListPullRequestsResponse -> ListPullRequestsResponse -> Bool
== :: ListPullRequestsResponse -> ListPullRequestsResponse -> Bool
$c== :: ListPullRequestsResponse -> ListPullRequestsResponse -> Bool
Prelude.Eq, ReadPrec [ListPullRequestsResponse]
ReadPrec ListPullRequestsResponse
Int -> ReadS ListPullRequestsResponse
ReadS [ListPullRequestsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPullRequestsResponse]
$creadListPrec :: ReadPrec [ListPullRequestsResponse]
readPrec :: ReadPrec ListPullRequestsResponse
$creadPrec :: ReadPrec ListPullRequestsResponse
readList :: ReadS [ListPullRequestsResponse]
$creadList :: ReadS [ListPullRequestsResponse]
readsPrec :: Int -> ReadS ListPullRequestsResponse
$creadsPrec :: Int -> ReadS ListPullRequestsResponse
Prelude.Read, Int -> ListPullRequestsResponse -> ShowS
[ListPullRequestsResponse] -> ShowS
ListPullRequestsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPullRequestsResponse] -> ShowS
$cshowList :: [ListPullRequestsResponse] -> ShowS
show :: ListPullRequestsResponse -> String
$cshow :: ListPullRequestsResponse -> String
showsPrec :: Int -> ListPullRequestsResponse -> ShowS
$cshowsPrec :: Int -> ListPullRequestsResponse -> ShowS
Prelude.Show, forall x.
Rep ListPullRequestsResponse x -> ListPullRequestsResponse
forall x.
ListPullRequestsResponse -> Rep ListPullRequestsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPullRequestsResponse x -> ListPullRequestsResponse
$cfrom :: forall x.
ListPullRequestsResponse -> Rep ListPullRequestsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListPullRequestsResponse' 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', 'listPullRequestsResponse_nextToken' - An enumeration token that allows the operation to batch the next results
-- of the operation.
--
-- 'httpStatus', 'listPullRequestsResponse_httpStatus' - The response's http status code.
--
-- 'pullRequestIds', 'listPullRequestsResponse_pullRequestIds' - The system-generated IDs of the pull requests.
newListPullRequestsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListPullRequestsResponse
newListPullRequestsResponse :: Int -> ListPullRequestsResponse
newListPullRequestsResponse Int
pHttpStatus_ =
  ListPullRequestsResponse'
    { $sel:nextToken:ListPullRequestsResponse' :: Maybe Text
nextToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListPullRequestsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:pullRequestIds:ListPullRequestsResponse' :: [Text]
pullRequestIds = forall a. Monoid a => a
Prelude.mempty
    }

-- | An enumeration token that allows the operation to batch the next results
-- of the operation.
listPullRequestsResponse_nextToken :: Lens.Lens' ListPullRequestsResponse (Prelude.Maybe Prelude.Text)
listPullRequestsResponse_nextToken :: Lens' ListPullRequestsResponse (Maybe Text)
listPullRequestsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPullRequestsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPullRequestsResponse' :: ListPullRequestsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPullRequestsResponse
s@ListPullRequestsResponse' {} Maybe Text
a -> ListPullRequestsResponse
s {$sel:nextToken:ListPullRequestsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPullRequestsResponse)

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

-- | The system-generated IDs of the pull requests.
listPullRequestsResponse_pullRequestIds :: Lens.Lens' ListPullRequestsResponse [Prelude.Text]
listPullRequestsResponse_pullRequestIds :: Lens' ListPullRequestsResponse [Text]
listPullRequestsResponse_pullRequestIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPullRequestsResponse' {[Text]
pullRequestIds :: [Text]
$sel:pullRequestIds:ListPullRequestsResponse' :: ListPullRequestsResponse -> [Text]
pullRequestIds} -> [Text]
pullRequestIds) (\s :: ListPullRequestsResponse
s@ListPullRequestsResponse' {} [Text]
a -> ListPullRequestsResponse
s {$sel:pullRequestIds:ListPullRequestsResponse' :: [Text]
pullRequestIds = [Text]
a} :: ListPullRequestsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.NFData ListPullRequestsResponse where
  rnf :: ListPullRequestsResponse -> ()
rnf ListPullRequestsResponse' {Int
[Text]
Maybe Text
pullRequestIds :: [Text]
httpStatus :: Int
nextToken :: Maybe Text
$sel:pullRequestIds:ListPullRequestsResponse' :: ListPullRequestsResponse -> [Text]
$sel:httpStatus:ListPullRequestsResponse' :: ListPullRequestsResponse -> Int
$sel:nextToken:ListPullRequestsResponse' :: ListPullRequestsResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
pullRequestIds