{-# 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.DescribePullRequestEvents
-- 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)
--
-- Returns information about one or more pull request events.
--
-- This operation returns paginated results.
module Amazonka.CodeCommit.DescribePullRequestEvents
  ( -- * Creating a Request
    DescribePullRequestEvents (..),
    newDescribePullRequestEvents,

    -- * Request Lenses
    describePullRequestEvents_pullRequestEventType,
    describePullRequestEvents_actorArn,
    describePullRequestEvents_nextToken,
    describePullRequestEvents_maxResults,
    describePullRequestEvents_pullRequestId,

    -- * Destructuring the Response
    DescribePullRequestEventsResponse (..),
    newDescribePullRequestEventsResponse,

    -- * Response Lenses
    describePullRequestEventsResponse_nextToken,
    describePullRequestEventsResponse_httpStatus,
    describePullRequestEventsResponse_pullRequestEvents,
  )
where

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

-- | /See:/ 'newDescribePullRequestEvents' smart constructor.
data DescribePullRequestEvents = DescribePullRequestEvents'
  { -- | Optional. The pull request event type about which you want to return
    -- information.
    DescribePullRequestEvents -> Maybe PullRequestEventType
pullRequestEventType :: Prelude.Maybe PullRequestEventType,
    -- | The Amazon Resource Name (ARN) of the user whose actions resulted in the
    -- event. Examples include updating the pull request with more commits or
    -- changing the status of a pull request.
    DescribePullRequestEvents -> Maybe Text
actorArn :: Prelude.Maybe Prelude.Text,
    -- | An enumeration token that, when provided in a request, returns the next
    -- batch of the results.
    DescribePullRequestEvents -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | A non-zero, non-negative integer used to limit the number of returned
    -- results. The default is 100 events, which is also the maximum number of
    -- events that can be returned in a result.
    DescribePullRequestEvents -> Maybe Int
maxResults :: Prelude.Maybe Prelude.Int,
    -- | The system-generated ID of the pull request. To get this ID, use
    -- ListPullRequests.
    DescribePullRequestEvents -> Text
pullRequestId :: Prelude.Text
  }
  deriving (DescribePullRequestEvents -> DescribePullRequestEvents -> Bool
(DescribePullRequestEvents -> DescribePullRequestEvents -> Bool)
-> (DescribePullRequestEvents -> DescribePullRequestEvents -> Bool)
-> Eq DescribePullRequestEvents
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePullRequestEvents -> DescribePullRequestEvents -> Bool
$c/= :: DescribePullRequestEvents -> DescribePullRequestEvents -> Bool
== :: DescribePullRequestEvents -> DescribePullRequestEvents -> Bool
$c== :: DescribePullRequestEvents -> DescribePullRequestEvents -> Bool
Prelude.Eq, ReadPrec [DescribePullRequestEvents]
ReadPrec DescribePullRequestEvents
Int -> ReadS DescribePullRequestEvents
ReadS [DescribePullRequestEvents]
(Int -> ReadS DescribePullRequestEvents)
-> ReadS [DescribePullRequestEvents]
-> ReadPrec DescribePullRequestEvents
-> ReadPrec [DescribePullRequestEvents]
-> Read DescribePullRequestEvents
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePullRequestEvents]
$creadListPrec :: ReadPrec [DescribePullRequestEvents]
readPrec :: ReadPrec DescribePullRequestEvents
$creadPrec :: ReadPrec DescribePullRequestEvents
readList :: ReadS [DescribePullRequestEvents]
$creadList :: ReadS [DescribePullRequestEvents]
readsPrec :: Int -> ReadS DescribePullRequestEvents
$creadsPrec :: Int -> ReadS DescribePullRequestEvents
Prelude.Read, Int -> DescribePullRequestEvents -> ShowS
[DescribePullRequestEvents] -> ShowS
DescribePullRequestEvents -> String
(Int -> DescribePullRequestEvents -> ShowS)
-> (DescribePullRequestEvents -> String)
-> ([DescribePullRequestEvents] -> ShowS)
-> Show DescribePullRequestEvents
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePullRequestEvents] -> ShowS
$cshowList :: [DescribePullRequestEvents] -> ShowS
show :: DescribePullRequestEvents -> String
$cshow :: DescribePullRequestEvents -> String
showsPrec :: Int -> DescribePullRequestEvents -> ShowS
$cshowsPrec :: Int -> DescribePullRequestEvents -> ShowS
Prelude.Show, (forall x.
 DescribePullRequestEvents -> Rep DescribePullRequestEvents x)
-> (forall x.
    Rep DescribePullRequestEvents x -> DescribePullRequestEvents)
-> Generic DescribePullRequestEvents
forall x.
Rep DescribePullRequestEvents x -> DescribePullRequestEvents
forall x.
DescribePullRequestEvents -> Rep DescribePullRequestEvents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribePullRequestEvents x -> DescribePullRequestEvents
$cfrom :: forall x.
DescribePullRequestEvents -> Rep DescribePullRequestEvents x
Prelude.Generic)

-- |
-- Create a value of 'DescribePullRequestEvents' 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:
--
-- 'pullRequestEventType', 'describePullRequestEvents_pullRequestEventType' - Optional. The pull request event type about which you want to return
-- information.
--
-- 'actorArn', 'describePullRequestEvents_actorArn' - The Amazon Resource Name (ARN) of the user whose actions resulted in the
-- event. Examples include updating the pull request with more commits or
-- changing the status of a pull request.
--
-- 'nextToken', 'describePullRequestEvents_nextToken' - An enumeration token that, when provided in a request, returns the next
-- batch of the results.
--
-- 'maxResults', 'describePullRequestEvents_maxResults' - A non-zero, non-negative integer used to limit the number of returned
-- results. The default is 100 events, which is also the maximum number of
-- events that can be returned in a result.
--
-- 'pullRequestId', 'describePullRequestEvents_pullRequestId' - The system-generated ID of the pull request. To get this ID, use
-- ListPullRequests.
newDescribePullRequestEvents ::
  -- | 'pullRequestId'
  Prelude.Text ->
  DescribePullRequestEvents
newDescribePullRequestEvents :: Text -> DescribePullRequestEvents
newDescribePullRequestEvents Text
pPullRequestId_ =
  DescribePullRequestEvents' :: Maybe PullRequestEventType
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Text
-> DescribePullRequestEvents
DescribePullRequestEvents'
    { $sel:pullRequestEventType:DescribePullRequestEvents' :: Maybe PullRequestEventType
pullRequestEventType =
        Maybe PullRequestEventType
forall a. Maybe a
Prelude.Nothing,
      $sel:actorArn:DescribePullRequestEvents' :: Maybe Text
actorArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:DescribePullRequestEvents' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:DescribePullRequestEvents' :: Maybe Int
maxResults = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:pullRequestId:DescribePullRequestEvents' :: Text
pullRequestId = Text
pPullRequestId_
    }

-- | Optional. The pull request event type about which you want to return
-- information.
describePullRequestEvents_pullRequestEventType :: Lens.Lens' DescribePullRequestEvents (Prelude.Maybe PullRequestEventType)
describePullRequestEvents_pullRequestEventType :: (Maybe PullRequestEventType -> f (Maybe PullRequestEventType))
-> DescribePullRequestEvents -> f DescribePullRequestEvents
describePullRequestEvents_pullRequestEventType = (DescribePullRequestEvents -> Maybe PullRequestEventType)
-> (DescribePullRequestEvents
    -> Maybe PullRequestEventType -> DescribePullRequestEvents)
-> Lens
     DescribePullRequestEvents
     DescribePullRequestEvents
     (Maybe PullRequestEventType)
     (Maybe PullRequestEventType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePullRequestEvents' {Maybe PullRequestEventType
pullRequestEventType :: Maybe PullRequestEventType
$sel:pullRequestEventType:DescribePullRequestEvents' :: DescribePullRequestEvents -> Maybe PullRequestEventType
pullRequestEventType} -> Maybe PullRequestEventType
pullRequestEventType) (\s :: DescribePullRequestEvents
s@DescribePullRequestEvents' {} Maybe PullRequestEventType
a -> DescribePullRequestEvents
s {$sel:pullRequestEventType:DescribePullRequestEvents' :: Maybe PullRequestEventType
pullRequestEventType = Maybe PullRequestEventType
a} :: DescribePullRequestEvents)

-- | The Amazon Resource Name (ARN) of the user whose actions resulted in the
-- event. Examples include updating the pull request with more commits or
-- changing the status of a pull request.
describePullRequestEvents_actorArn :: Lens.Lens' DescribePullRequestEvents (Prelude.Maybe Prelude.Text)
describePullRequestEvents_actorArn :: (Maybe Text -> f (Maybe Text))
-> DescribePullRequestEvents -> f DescribePullRequestEvents
describePullRequestEvents_actorArn = (DescribePullRequestEvents -> Maybe Text)
-> (DescribePullRequestEvents
    -> Maybe Text -> DescribePullRequestEvents)
-> Lens
     DescribePullRequestEvents
     DescribePullRequestEvents
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePullRequestEvents' {Maybe Text
actorArn :: Maybe Text
$sel:actorArn:DescribePullRequestEvents' :: DescribePullRequestEvents -> Maybe Text
actorArn} -> Maybe Text
actorArn) (\s :: DescribePullRequestEvents
s@DescribePullRequestEvents' {} Maybe Text
a -> DescribePullRequestEvents
s {$sel:actorArn:DescribePullRequestEvents' :: Maybe Text
actorArn = Maybe Text
a} :: DescribePullRequestEvents)

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

-- | A non-zero, non-negative integer used to limit the number of returned
-- results. The default is 100 events, which is also the maximum number of
-- events that can be returned in a result.
describePullRequestEvents_maxResults :: Lens.Lens' DescribePullRequestEvents (Prelude.Maybe Prelude.Int)
describePullRequestEvents_maxResults :: (Maybe Int -> f (Maybe Int))
-> DescribePullRequestEvents -> f DescribePullRequestEvents
describePullRequestEvents_maxResults = (DescribePullRequestEvents -> Maybe Int)
-> (DescribePullRequestEvents
    -> Maybe Int -> DescribePullRequestEvents)
-> Lens
     DescribePullRequestEvents
     DescribePullRequestEvents
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePullRequestEvents' {Maybe Int
maxResults :: Maybe Int
$sel:maxResults:DescribePullRequestEvents' :: DescribePullRequestEvents -> Maybe Int
maxResults} -> Maybe Int
maxResults) (\s :: DescribePullRequestEvents
s@DescribePullRequestEvents' {} Maybe Int
a -> DescribePullRequestEvents
s {$sel:maxResults:DescribePullRequestEvents' :: Maybe Int
maxResults = Maybe Int
a} :: DescribePullRequestEvents)

-- | The system-generated ID of the pull request. To get this ID, use
-- ListPullRequests.
describePullRequestEvents_pullRequestId :: Lens.Lens' DescribePullRequestEvents Prelude.Text
describePullRequestEvents_pullRequestId :: (Text -> f Text)
-> DescribePullRequestEvents -> f DescribePullRequestEvents
describePullRequestEvents_pullRequestId = (DescribePullRequestEvents -> Text)
-> (DescribePullRequestEvents -> Text -> DescribePullRequestEvents)
-> Lens
     DescribePullRequestEvents DescribePullRequestEvents Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePullRequestEvents' {Text
pullRequestId :: Text
$sel:pullRequestId:DescribePullRequestEvents' :: DescribePullRequestEvents -> Text
pullRequestId} -> Text
pullRequestId) (\s :: DescribePullRequestEvents
s@DescribePullRequestEvents' {} Text
a -> DescribePullRequestEvents
s {$sel:pullRequestId:DescribePullRequestEvents' :: Text
pullRequestId = Text
a} :: DescribePullRequestEvents)

instance Core.AWSPager DescribePullRequestEvents where
  page :: DescribePullRequestEvents
-> AWSResponse DescribePullRequestEvents
-> Maybe DescribePullRequestEvents
page DescribePullRequestEvents
rq AWSResponse DescribePullRequestEvents
rs
    | Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribePullRequestEvents
DescribePullRequestEventsResponse
rs
            DescribePullRequestEventsResponse
-> Getting (First Text) DescribePullRequestEventsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribePullRequestEventsResponse
-> Const (First Text) DescribePullRequestEventsResponse
Lens' DescribePullRequestEventsResponse (Maybe Text)
describePullRequestEventsResponse_nextToken
              ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribePullRequestEventsResponse
 -> Const (First Text) DescribePullRequestEventsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribePullRequestEventsResponse 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 DescribePullRequestEvents
forall a. Maybe a
Prelude.Nothing
    | [PullRequestEvent] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
        ( AWSResponse DescribePullRequestEvents
DescribePullRequestEventsResponse
rs
            DescribePullRequestEventsResponse
-> Getting
     [PullRequestEvent]
     DescribePullRequestEventsResponse
     [PullRequestEvent]
-> [PullRequestEvent]
forall s a. s -> Getting a s a -> a
Lens.^. Getting
  [PullRequestEvent]
  DescribePullRequestEventsResponse
  [PullRequestEvent]
Lens' DescribePullRequestEventsResponse [PullRequestEvent]
describePullRequestEventsResponse_pullRequestEvents
        ) =
      Maybe DescribePullRequestEvents
forall a. Maybe a
Prelude.Nothing
    | Bool
Prelude.otherwise =
      DescribePullRequestEvents -> Maybe DescribePullRequestEvents
forall a. a -> Maybe a
Prelude.Just (DescribePullRequestEvents -> Maybe DescribePullRequestEvents)
-> DescribePullRequestEvents -> Maybe DescribePullRequestEvents
forall a b. (a -> b) -> a -> b
Prelude.$
        DescribePullRequestEvents
rq
          DescribePullRequestEvents
-> (DescribePullRequestEvents -> DescribePullRequestEvents)
-> DescribePullRequestEvents
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> DescribePullRequestEvents -> Identity DescribePullRequestEvents
Lens
  DescribePullRequestEvents
  DescribePullRequestEvents
  (Maybe Text)
  (Maybe Text)
describePullRequestEvents_nextToken
          ((Maybe Text -> Identity (Maybe Text))
 -> DescribePullRequestEvents -> Identity DescribePullRequestEvents)
-> Maybe Text
-> DescribePullRequestEvents
-> DescribePullRequestEvents
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse DescribePullRequestEvents
DescribePullRequestEventsResponse
rs
          DescribePullRequestEventsResponse
-> Getting (First Text) DescribePullRequestEventsResponse Text
-> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> DescribePullRequestEventsResponse
-> Const (First Text) DescribePullRequestEventsResponse
Lens' DescribePullRequestEventsResponse (Maybe Text)
describePullRequestEventsResponse_nextToken
            ((Maybe Text -> Const (First Text) (Maybe Text))
 -> DescribePullRequestEventsResponse
 -> Const (First Text) DescribePullRequestEventsResponse)
-> ((Text -> Const (First Text) Text)
    -> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) DescribePullRequestEventsResponse 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 DescribePullRequestEvents where
  type
    AWSResponse DescribePullRequestEvents =
      DescribePullRequestEventsResponse
  request :: DescribePullRequestEvents -> Request DescribePullRequestEvents
request = Service
-> DescribePullRequestEvents -> Request DescribePullRequestEvents
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribePullRequestEvents
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribePullRequestEvents)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribePullRequestEvents))
-> Logger
-> Service
-> Proxy DescribePullRequestEvents
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DescribePullRequestEvents)))
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 Text
-> Int -> [PullRequestEvent] -> DescribePullRequestEventsResponse
DescribePullRequestEventsResponse'
            (Maybe Text
 -> Int -> [PullRequestEvent] -> DescribePullRequestEventsResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Int -> [PullRequestEvent] -> DescribePullRequestEventsResponse)
forall (f :: * -> *) a b. Functor 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 -> [PullRequestEvent] -> DescribePullRequestEventsResponse)
-> Either String Int
-> Either
     String ([PullRequestEvent] -> DescribePullRequestEventsResponse)
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))
            Either
  String ([PullRequestEvent] -> DescribePullRequestEventsResponse)
-> Either String [PullRequestEvent]
-> Either String DescribePullRequestEventsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( Object
x Object -> Text -> Either String (Maybe [PullRequestEvent])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"pullRequestEvents"
                            Either String (Maybe [PullRequestEvent])
-> [PullRequestEvent] -> Either String [PullRequestEvent]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [PullRequestEvent]
forall a. Monoid a => a
Prelude.mempty
                        )
      )

instance Prelude.Hashable DescribePullRequestEvents

instance Prelude.NFData DescribePullRequestEvents

instance Core.ToHeaders DescribePullRequestEvents where
  toHeaders :: DescribePullRequestEvents -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DescribePullRequestEvents -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"CodeCommit_20150413.DescribePullRequestEvents" ::
                          Prelude.ByteString
                      ),
            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.ToJSON DescribePullRequestEvents where
  toJSON :: DescribePullRequestEvents -> Value
toJSON DescribePullRequestEvents' {Maybe Int
Maybe Text
Maybe PullRequestEventType
Text
pullRequestId :: Text
maxResults :: Maybe Int
nextToken :: Maybe Text
actorArn :: Maybe Text
pullRequestEventType :: Maybe PullRequestEventType
$sel:pullRequestId:DescribePullRequestEvents' :: DescribePullRequestEvents -> Text
$sel:maxResults:DescribePullRequestEvents' :: DescribePullRequestEvents -> Maybe Int
$sel:nextToken:DescribePullRequestEvents' :: DescribePullRequestEvents -> Maybe Text
$sel:actorArn:DescribePullRequestEvents' :: DescribePullRequestEvents -> Maybe Text
$sel:pullRequestEventType:DescribePullRequestEvents' :: DescribePullRequestEvents -> Maybe PullRequestEventType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"pullRequestEventType" Text -> PullRequestEventType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (PullRequestEventType -> Pair)
-> Maybe PullRequestEventType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PullRequestEventType
pullRequestEventType,
            (Text
"actorArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
actorArn,
            (Text
"nextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
            (Text
"maxResults" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"pullRequestId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
pullRequestId)
          ]
      )

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

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

-- | /See:/ 'newDescribePullRequestEventsResponse' smart constructor.
data DescribePullRequestEventsResponse = DescribePullRequestEventsResponse'
  { -- | An enumeration token that can be used in a request to return the next
    -- batch of the results.
    DescribePullRequestEventsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    DescribePullRequestEventsResponse -> Int
httpStatus :: Prelude.Int,
    -- | Information about the pull request events.
    DescribePullRequestEventsResponse -> [PullRequestEvent]
pullRequestEvents :: [PullRequestEvent]
  }
  deriving (DescribePullRequestEventsResponse
-> DescribePullRequestEventsResponse -> Bool
(DescribePullRequestEventsResponse
 -> DescribePullRequestEventsResponse -> Bool)
-> (DescribePullRequestEventsResponse
    -> DescribePullRequestEventsResponse -> Bool)
-> Eq DescribePullRequestEventsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribePullRequestEventsResponse
-> DescribePullRequestEventsResponse -> Bool
$c/= :: DescribePullRequestEventsResponse
-> DescribePullRequestEventsResponse -> Bool
== :: DescribePullRequestEventsResponse
-> DescribePullRequestEventsResponse -> Bool
$c== :: DescribePullRequestEventsResponse
-> DescribePullRequestEventsResponse -> Bool
Prelude.Eq, ReadPrec [DescribePullRequestEventsResponse]
ReadPrec DescribePullRequestEventsResponse
Int -> ReadS DescribePullRequestEventsResponse
ReadS [DescribePullRequestEventsResponse]
(Int -> ReadS DescribePullRequestEventsResponse)
-> ReadS [DescribePullRequestEventsResponse]
-> ReadPrec DescribePullRequestEventsResponse
-> ReadPrec [DescribePullRequestEventsResponse]
-> Read DescribePullRequestEventsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribePullRequestEventsResponse]
$creadListPrec :: ReadPrec [DescribePullRequestEventsResponse]
readPrec :: ReadPrec DescribePullRequestEventsResponse
$creadPrec :: ReadPrec DescribePullRequestEventsResponse
readList :: ReadS [DescribePullRequestEventsResponse]
$creadList :: ReadS [DescribePullRequestEventsResponse]
readsPrec :: Int -> ReadS DescribePullRequestEventsResponse
$creadsPrec :: Int -> ReadS DescribePullRequestEventsResponse
Prelude.Read, Int -> DescribePullRequestEventsResponse -> ShowS
[DescribePullRequestEventsResponse] -> ShowS
DescribePullRequestEventsResponse -> String
(Int -> DescribePullRequestEventsResponse -> ShowS)
-> (DescribePullRequestEventsResponse -> String)
-> ([DescribePullRequestEventsResponse] -> ShowS)
-> Show DescribePullRequestEventsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribePullRequestEventsResponse] -> ShowS
$cshowList :: [DescribePullRequestEventsResponse] -> ShowS
show :: DescribePullRequestEventsResponse -> String
$cshow :: DescribePullRequestEventsResponse -> String
showsPrec :: Int -> DescribePullRequestEventsResponse -> ShowS
$cshowsPrec :: Int -> DescribePullRequestEventsResponse -> ShowS
Prelude.Show, (forall x.
 DescribePullRequestEventsResponse
 -> Rep DescribePullRequestEventsResponse x)
-> (forall x.
    Rep DescribePullRequestEventsResponse x
    -> DescribePullRequestEventsResponse)
-> Generic DescribePullRequestEventsResponse
forall x.
Rep DescribePullRequestEventsResponse x
-> DescribePullRequestEventsResponse
forall x.
DescribePullRequestEventsResponse
-> Rep DescribePullRequestEventsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribePullRequestEventsResponse x
-> DescribePullRequestEventsResponse
$cfrom :: forall x.
DescribePullRequestEventsResponse
-> Rep DescribePullRequestEventsResponse x
Prelude.Generic)

-- |
-- Create a value of 'DescribePullRequestEventsResponse' 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', 'describePullRequestEventsResponse_nextToken' - An enumeration token that can be used in a request to return the next
-- batch of the results.
--
-- 'httpStatus', 'describePullRequestEventsResponse_httpStatus' - The response's http status code.
--
-- 'pullRequestEvents', 'describePullRequestEventsResponse_pullRequestEvents' - Information about the pull request events.
newDescribePullRequestEventsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DescribePullRequestEventsResponse
newDescribePullRequestEventsResponse :: Int -> DescribePullRequestEventsResponse
newDescribePullRequestEventsResponse Int
pHttpStatus_ =
  DescribePullRequestEventsResponse' :: Maybe Text
-> Int -> [PullRequestEvent] -> DescribePullRequestEventsResponse
DescribePullRequestEventsResponse'
    { $sel:nextToken:DescribePullRequestEventsResponse' :: Maybe Text
nextToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DescribePullRequestEventsResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:pullRequestEvents:DescribePullRequestEventsResponse' :: [PullRequestEvent]
pullRequestEvents = [PullRequestEvent]
forall a. Monoid a => a
Prelude.mempty
    }

-- | An enumeration token that can be used in a request to return the next
-- batch of the results.
describePullRequestEventsResponse_nextToken :: Lens.Lens' DescribePullRequestEventsResponse (Prelude.Maybe Prelude.Text)
describePullRequestEventsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> DescribePullRequestEventsResponse
-> f DescribePullRequestEventsResponse
describePullRequestEventsResponse_nextToken = (DescribePullRequestEventsResponse -> Maybe Text)
-> (DescribePullRequestEventsResponse
    -> Maybe Text -> DescribePullRequestEventsResponse)
-> Lens' DescribePullRequestEventsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePullRequestEventsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:DescribePullRequestEventsResponse' :: DescribePullRequestEventsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: DescribePullRequestEventsResponse
s@DescribePullRequestEventsResponse' {} Maybe Text
a -> DescribePullRequestEventsResponse
s {$sel:nextToken:DescribePullRequestEventsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: DescribePullRequestEventsResponse)

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

-- | Information about the pull request events.
describePullRequestEventsResponse_pullRequestEvents :: Lens.Lens' DescribePullRequestEventsResponse [PullRequestEvent]
describePullRequestEventsResponse_pullRequestEvents :: ([PullRequestEvent] -> f [PullRequestEvent])
-> DescribePullRequestEventsResponse
-> f DescribePullRequestEventsResponse
describePullRequestEventsResponse_pullRequestEvents = (DescribePullRequestEventsResponse -> [PullRequestEvent])
-> (DescribePullRequestEventsResponse
    -> [PullRequestEvent] -> DescribePullRequestEventsResponse)
-> Lens' DescribePullRequestEventsResponse [PullRequestEvent]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribePullRequestEventsResponse' {[PullRequestEvent]
pullRequestEvents :: [PullRequestEvent]
$sel:pullRequestEvents:DescribePullRequestEventsResponse' :: DescribePullRequestEventsResponse -> [PullRequestEvent]
pullRequestEvents} -> [PullRequestEvent]
pullRequestEvents) (\s :: DescribePullRequestEventsResponse
s@DescribePullRequestEventsResponse' {} [PullRequestEvent]
a -> DescribePullRequestEventsResponse
s {$sel:pullRequestEvents:DescribePullRequestEventsResponse' :: [PullRequestEvent]
pullRequestEvents = [PullRequestEvent]
a} :: DescribePullRequestEventsResponse) (([PullRequestEvent] -> f [PullRequestEvent])
 -> DescribePullRequestEventsResponse
 -> f DescribePullRequestEventsResponse)
-> (([PullRequestEvent] -> f [PullRequestEvent])
    -> [PullRequestEvent] -> f [PullRequestEvent])
-> ([PullRequestEvent] -> f [PullRequestEvent])
-> DescribePullRequestEventsResponse
-> f DescribePullRequestEventsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([PullRequestEvent] -> f [PullRequestEvent])
-> [PullRequestEvent] -> f [PullRequestEvent]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance
  Prelude.NFData
    DescribePullRequestEventsResponse