{-# 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.CodeGuruReviewer.ListCodeReviews
-- 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)
--
-- Lists all the code reviews that the customer has created in the past 90
-- days.
module Amazonka.CodeGuruReviewer.ListCodeReviews
  ( -- * Creating a Request
    ListCodeReviews (..),
    newListCodeReviews,

    -- * Request Lenses
    listCodeReviews_states,
    listCodeReviews_providerTypes,
    listCodeReviews_repositoryNames,
    listCodeReviews_nextToken,
    listCodeReviews_maxResults,
    listCodeReviews_type,

    -- * Destructuring the Response
    ListCodeReviewsResponse (..),
    newListCodeReviewsResponse,

    -- * Response Lenses
    listCodeReviewsResponse_codeReviewSummaries,
    listCodeReviewsResponse_nextToken,
    listCodeReviewsResponse_httpStatus,
  )
where

import Amazonka.CodeGuruReviewer.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:/ 'newListCodeReviews' smart constructor.
data ListCodeReviews = ListCodeReviews'
  { -- | List of states for filtering that needs to be applied before displaying
    -- the result. For example, @states=[Pending]@ lists code reviews in the
    -- Pending state.
    --
    -- The valid code review states are:
    --
    -- -   @Completed@: The code review is complete.
    --
    -- -   @Pending@: The code review started and has not completed or failed.
    --
    -- -   @Failed@: The code review failed.
    --
    -- -   @Deleting@: The code review is being deleted.
    ListCodeReviews -> Maybe (NonEmpty JobState)
states :: Prelude.Maybe (Prelude.NonEmpty JobState),
    -- | List of provider types for filtering that needs to be applied before
    -- displaying the result. For example, @providerTypes=[GitHub]@ lists code
    -- reviews from GitHub.
    ListCodeReviews -> Maybe (NonEmpty ProviderType)
providerTypes :: Prelude.Maybe (Prelude.NonEmpty ProviderType),
    -- | List of repository names for filtering that needs to be applied before
    -- displaying the result.
    ListCodeReviews -> Maybe (NonEmpty Text)
repositoryNames :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | If nextToken is returned, there are more results available. The value of
    -- nextToken is a unique pagination token for each page. Make the call
    -- again using the returned token to retrieve the next page. Keep all other
    -- arguments unchanged.
    ListCodeReviews -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The maximum number of results that are returned per call. The default is
    -- 100.
    ListCodeReviews -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The type of code reviews to list in the response.
    ListCodeReviews -> Type
type' :: Type
  }
  deriving (ListCodeReviews -> ListCodeReviews -> Bool
(ListCodeReviews -> ListCodeReviews -> Bool)
-> (ListCodeReviews -> ListCodeReviews -> Bool)
-> Eq ListCodeReviews
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCodeReviews -> ListCodeReviews -> Bool
$c/= :: ListCodeReviews -> ListCodeReviews -> Bool
== :: ListCodeReviews -> ListCodeReviews -> Bool
$c== :: ListCodeReviews -> ListCodeReviews -> Bool
Prelude.Eq, ReadPrec [ListCodeReviews]
ReadPrec ListCodeReviews
Int -> ReadS ListCodeReviews
ReadS [ListCodeReviews]
(Int -> ReadS ListCodeReviews)
-> ReadS [ListCodeReviews]
-> ReadPrec ListCodeReviews
-> ReadPrec [ListCodeReviews]
-> Read ListCodeReviews
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCodeReviews]
$creadListPrec :: ReadPrec [ListCodeReviews]
readPrec :: ReadPrec ListCodeReviews
$creadPrec :: ReadPrec ListCodeReviews
readList :: ReadS [ListCodeReviews]
$creadList :: ReadS [ListCodeReviews]
readsPrec :: Int -> ReadS ListCodeReviews
$creadsPrec :: Int -> ReadS ListCodeReviews
Prelude.Read, Int -> ListCodeReviews -> ShowS
[ListCodeReviews] -> ShowS
ListCodeReviews -> String
(Int -> ListCodeReviews -> ShowS)
-> (ListCodeReviews -> String)
-> ([ListCodeReviews] -> ShowS)
-> Show ListCodeReviews
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCodeReviews] -> ShowS
$cshowList :: [ListCodeReviews] -> ShowS
show :: ListCodeReviews -> String
$cshow :: ListCodeReviews -> String
showsPrec :: Int -> ListCodeReviews -> ShowS
$cshowsPrec :: Int -> ListCodeReviews -> ShowS
Prelude.Show, (forall x. ListCodeReviews -> Rep ListCodeReviews x)
-> (forall x. Rep ListCodeReviews x -> ListCodeReviews)
-> Generic ListCodeReviews
forall x. Rep ListCodeReviews x -> ListCodeReviews
forall x. ListCodeReviews -> Rep ListCodeReviews x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListCodeReviews x -> ListCodeReviews
$cfrom :: forall x. ListCodeReviews -> Rep ListCodeReviews x
Prelude.Generic)

-- |
-- Create a value of 'ListCodeReviews' 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:
--
-- 'states', 'listCodeReviews_states' - List of states for filtering that needs to be applied before displaying
-- the result. For example, @states=[Pending]@ lists code reviews in the
-- Pending state.
--
-- The valid code review states are:
--
-- -   @Completed@: The code review is complete.
--
-- -   @Pending@: The code review started and has not completed or failed.
--
-- -   @Failed@: The code review failed.
--
-- -   @Deleting@: The code review is being deleted.
--
-- 'providerTypes', 'listCodeReviews_providerTypes' - List of provider types for filtering that needs to be applied before
-- displaying the result. For example, @providerTypes=[GitHub]@ lists code
-- reviews from GitHub.
--
-- 'repositoryNames', 'listCodeReviews_repositoryNames' - List of repository names for filtering that needs to be applied before
-- displaying the result.
--
-- 'nextToken', 'listCodeReviews_nextToken' - If nextToken is returned, there are more results available. The value of
-- nextToken is a unique pagination token for each page. Make the call
-- again using the returned token to retrieve the next page. Keep all other
-- arguments unchanged.
--
-- 'maxResults', 'listCodeReviews_maxResults' - The maximum number of results that are returned per call. The default is
-- 100.
--
-- 'type'', 'listCodeReviews_type' - The type of code reviews to list in the response.
newListCodeReviews ::
  -- | 'type''
  Type ->
  ListCodeReviews
newListCodeReviews :: Type -> ListCodeReviews
newListCodeReviews Type
pType_ =
  ListCodeReviews' :: Maybe (NonEmpty JobState)
-> Maybe (NonEmpty ProviderType)
-> Maybe (NonEmpty Text)
-> Maybe Text
-> Maybe Natural
-> Type
-> ListCodeReviews
ListCodeReviews'
    { $sel:states:ListCodeReviews' :: Maybe (NonEmpty JobState)
states = Maybe (NonEmpty JobState)
forall a. Maybe a
Prelude.Nothing,
      $sel:providerTypes:ListCodeReviews' :: Maybe (NonEmpty ProviderType)
providerTypes = Maybe (NonEmpty ProviderType)
forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryNames:ListCodeReviews' :: Maybe (NonEmpty Text)
repositoryNames = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListCodeReviews' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:ListCodeReviews' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:type':ListCodeReviews' :: Type
type' = Type
pType_
    }

-- | List of states for filtering that needs to be applied before displaying
-- the result. For example, @states=[Pending]@ lists code reviews in the
-- Pending state.
--
-- The valid code review states are:
--
-- -   @Completed@: The code review is complete.
--
-- -   @Pending@: The code review started and has not completed or failed.
--
-- -   @Failed@: The code review failed.
--
-- -   @Deleting@: The code review is being deleted.
listCodeReviews_states :: Lens.Lens' ListCodeReviews (Prelude.Maybe (Prelude.NonEmpty JobState))
listCodeReviews_states :: (Maybe (NonEmpty JobState) -> f (Maybe (NonEmpty JobState)))
-> ListCodeReviews -> f ListCodeReviews
listCodeReviews_states = (ListCodeReviews -> Maybe (NonEmpty JobState))
-> (ListCodeReviews
    -> Maybe (NonEmpty JobState) -> ListCodeReviews)
-> Lens
     ListCodeReviews
     ListCodeReviews
     (Maybe (NonEmpty JobState))
     (Maybe (NonEmpty JobState))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCodeReviews' {Maybe (NonEmpty JobState)
states :: Maybe (NonEmpty JobState)
$sel:states:ListCodeReviews' :: ListCodeReviews -> Maybe (NonEmpty JobState)
states} -> Maybe (NonEmpty JobState)
states) (\s :: ListCodeReviews
s@ListCodeReviews' {} Maybe (NonEmpty JobState)
a -> ListCodeReviews
s {$sel:states:ListCodeReviews' :: Maybe (NonEmpty JobState)
states = Maybe (NonEmpty JobState)
a} :: ListCodeReviews) ((Maybe (NonEmpty JobState) -> f (Maybe (NonEmpty JobState)))
 -> ListCodeReviews -> f ListCodeReviews)
-> ((Maybe (NonEmpty JobState) -> f (Maybe (NonEmpty JobState)))
    -> Maybe (NonEmpty JobState) -> f (Maybe (NonEmpty JobState)))
-> (Maybe (NonEmpty JobState) -> f (Maybe (NonEmpty JobState)))
-> ListCodeReviews
-> f ListCodeReviews
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty JobState)
  (NonEmpty JobState)
  (NonEmpty JobState)
  (NonEmpty JobState)
-> Iso
     (Maybe (NonEmpty JobState))
     (Maybe (NonEmpty JobState))
     (Maybe (NonEmpty JobState))
     (Maybe (NonEmpty JobState))
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
  (NonEmpty JobState)
  (NonEmpty JobState)
  (NonEmpty JobState)
  (NonEmpty JobState)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | List of provider types for filtering that needs to be applied before
-- displaying the result. For example, @providerTypes=[GitHub]@ lists code
-- reviews from GitHub.
listCodeReviews_providerTypes :: Lens.Lens' ListCodeReviews (Prelude.Maybe (Prelude.NonEmpty ProviderType))
listCodeReviews_providerTypes :: (Maybe (NonEmpty ProviderType)
 -> f (Maybe (NonEmpty ProviderType)))
-> ListCodeReviews -> f ListCodeReviews
listCodeReviews_providerTypes = (ListCodeReviews -> Maybe (NonEmpty ProviderType))
-> (ListCodeReviews
    -> Maybe (NonEmpty ProviderType) -> ListCodeReviews)
-> Lens
     ListCodeReviews
     ListCodeReviews
     (Maybe (NonEmpty ProviderType))
     (Maybe (NonEmpty ProviderType))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCodeReviews' {Maybe (NonEmpty ProviderType)
providerTypes :: Maybe (NonEmpty ProviderType)
$sel:providerTypes:ListCodeReviews' :: ListCodeReviews -> Maybe (NonEmpty ProviderType)
providerTypes} -> Maybe (NonEmpty ProviderType)
providerTypes) (\s :: ListCodeReviews
s@ListCodeReviews' {} Maybe (NonEmpty ProviderType)
a -> ListCodeReviews
s {$sel:providerTypes:ListCodeReviews' :: Maybe (NonEmpty ProviderType)
providerTypes = Maybe (NonEmpty ProviderType)
a} :: ListCodeReviews) ((Maybe (NonEmpty ProviderType)
  -> f (Maybe (NonEmpty ProviderType)))
 -> ListCodeReviews -> f ListCodeReviews)
-> ((Maybe (NonEmpty ProviderType)
     -> f (Maybe (NonEmpty ProviderType)))
    -> Maybe (NonEmpty ProviderType)
    -> f (Maybe (NonEmpty ProviderType)))
-> (Maybe (NonEmpty ProviderType)
    -> f (Maybe (NonEmpty ProviderType)))
-> ListCodeReviews
-> f ListCodeReviews
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ProviderType)
  (NonEmpty ProviderType)
  (NonEmpty ProviderType)
  (NonEmpty ProviderType)
-> Iso
     (Maybe (NonEmpty ProviderType))
     (Maybe (NonEmpty ProviderType))
     (Maybe (NonEmpty ProviderType))
     (Maybe (NonEmpty ProviderType))
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
  (NonEmpty ProviderType)
  (NonEmpty ProviderType)
  (NonEmpty ProviderType)
  (NonEmpty ProviderType)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | List of repository names for filtering that needs to be applied before
-- displaying the result.
listCodeReviews_repositoryNames :: Lens.Lens' ListCodeReviews (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
listCodeReviews_repositoryNames :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListCodeReviews -> f ListCodeReviews
listCodeReviews_repositoryNames = (ListCodeReviews -> Maybe (NonEmpty Text))
-> (ListCodeReviews -> Maybe (NonEmpty Text) -> ListCodeReviews)
-> Lens
     ListCodeReviews
     ListCodeReviews
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCodeReviews' {Maybe (NonEmpty Text)
repositoryNames :: Maybe (NonEmpty Text)
$sel:repositoryNames:ListCodeReviews' :: ListCodeReviews -> Maybe (NonEmpty Text)
repositoryNames} -> Maybe (NonEmpty Text)
repositoryNames) (\s :: ListCodeReviews
s@ListCodeReviews' {} Maybe (NonEmpty Text)
a -> ListCodeReviews
s {$sel:repositoryNames:ListCodeReviews' :: Maybe (NonEmpty Text)
repositoryNames = Maybe (NonEmpty Text)
a} :: ListCodeReviews) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> ListCodeReviews -> f ListCodeReviews)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> ListCodeReviews
-> f ListCodeReviews
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If nextToken is returned, there are more results available. The value of
-- nextToken is a unique pagination token for each page. Make the call
-- again using the returned token to retrieve the next page. Keep all other
-- arguments unchanged.
listCodeReviews_nextToken :: Lens.Lens' ListCodeReviews (Prelude.Maybe Prelude.Text)
listCodeReviews_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListCodeReviews -> f ListCodeReviews
listCodeReviews_nextToken = (ListCodeReviews -> Maybe Text)
-> (ListCodeReviews -> Maybe Text -> ListCodeReviews)
-> Lens ListCodeReviews ListCodeReviews (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCodeReviews' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCodeReviews' :: ListCodeReviews -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCodeReviews
s@ListCodeReviews' {} Maybe Text
a -> ListCodeReviews
s {$sel:nextToken:ListCodeReviews' :: Maybe Text
nextToken = Maybe Text
a} :: ListCodeReviews)

-- | The maximum number of results that are returned per call. The default is
-- 100.
listCodeReviews_maxResults :: Lens.Lens' ListCodeReviews (Prelude.Maybe Prelude.Natural)
listCodeReviews_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListCodeReviews -> f ListCodeReviews
listCodeReviews_maxResults = (ListCodeReviews -> Maybe Natural)
-> (ListCodeReviews -> Maybe Natural -> ListCodeReviews)
-> Lens
     ListCodeReviews ListCodeReviews (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCodeReviews' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListCodeReviews' :: ListCodeReviews -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListCodeReviews
s@ListCodeReviews' {} Maybe Natural
a -> ListCodeReviews
s {$sel:maxResults:ListCodeReviews' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListCodeReviews)

-- | The type of code reviews to list in the response.
listCodeReviews_type :: Lens.Lens' ListCodeReviews Type
listCodeReviews_type :: (Type -> f Type) -> ListCodeReviews -> f ListCodeReviews
listCodeReviews_type = (ListCodeReviews -> Type)
-> (ListCodeReviews -> Type -> ListCodeReviews)
-> Lens ListCodeReviews ListCodeReviews Type Type
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCodeReviews' {Type
type' :: Type
$sel:type':ListCodeReviews' :: ListCodeReviews -> Type
type'} -> Type
type') (\s :: ListCodeReviews
s@ListCodeReviews' {} Type
a -> ListCodeReviews
s {$sel:type':ListCodeReviews' :: Type
type' = Type
a} :: ListCodeReviews)

instance Core.AWSRequest ListCodeReviews where
  type
    AWSResponse ListCodeReviews =
      ListCodeReviewsResponse
  request :: ListCodeReviews -> Request ListCodeReviews
request = Service -> ListCodeReviews -> Request ListCodeReviews
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy ListCodeReviews
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListCodeReviews)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse ListCodeReviews))
-> Logger
-> Service
-> Proxy ListCodeReviews
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListCodeReviews)))
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 [CodeReviewSummary]
-> Maybe Text -> Int -> ListCodeReviewsResponse
ListCodeReviewsResponse'
            (Maybe [CodeReviewSummary]
 -> Maybe Text -> Int -> ListCodeReviewsResponse)
-> Either String (Maybe [CodeReviewSummary])
-> Either String (Maybe Text -> Int -> ListCodeReviewsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( Object
x Object -> Text -> Either String (Maybe (Maybe [CodeReviewSummary]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"CodeReviewSummaries"
                            Either String (Maybe (Maybe [CodeReviewSummary]))
-> Maybe [CodeReviewSummary]
-> Either String (Maybe [CodeReviewSummary])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [CodeReviewSummary]
forall a. Monoid a => a
Prelude.mempty
                        )
            Either String (Maybe Text -> Int -> ListCodeReviewsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListCodeReviewsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
            Either String (Int -> ListCodeReviewsResponse)
-> Either String Int -> Either String ListCodeReviewsResponse
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 ListCodeReviews

instance Prelude.NFData ListCodeReviews

instance Core.ToHeaders ListCodeReviews where
  toHeaders :: ListCodeReviews -> ResponseHeaders
toHeaders =
    ResponseHeaders -> ListCodeReviews -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

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

instance Core.ToQuery ListCodeReviews where
  toQuery :: ListCodeReviews -> QueryString
toQuery ListCodeReviews' {Maybe Natural
Maybe (NonEmpty Text)
Maybe (NonEmpty JobState)
Maybe (NonEmpty ProviderType)
Maybe Text
Type
type' :: Type
maxResults :: Maybe Natural
nextToken :: Maybe Text
repositoryNames :: Maybe (NonEmpty Text)
providerTypes :: Maybe (NonEmpty ProviderType)
states :: Maybe (NonEmpty JobState)
$sel:type':ListCodeReviews' :: ListCodeReviews -> Type
$sel:maxResults:ListCodeReviews' :: ListCodeReviews -> Maybe Natural
$sel:nextToken:ListCodeReviews' :: ListCodeReviews -> Maybe Text
$sel:repositoryNames:ListCodeReviews' :: ListCodeReviews -> Maybe (NonEmpty Text)
$sel:providerTypes:ListCodeReviews' :: ListCodeReviews -> Maybe (NonEmpty ProviderType)
$sel:states:ListCodeReviews' :: ListCodeReviews -> Maybe (NonEmpty JobState)
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"States"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> NonEmpty JobState -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" (NonEmpty JobState -> QueryString)
-> Maybe (NonEmpty JobState) -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty JobState)
states),
        ByteString
"ProviderTypes"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> NonEmpty ProviderType -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                (NonEmpty ProviderType -> QueryString)
-> Maybe (NonEmpty ProviderType) -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ProviderType)
providerTypes
            ),
        ByteString
"RepositoryNames"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            ( ByteString -> NonEmpty Text -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member"
                (NonEmpty Text -> QueryString)
-> Maybe (NonEmpty Text) -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
repositoryNames
            ),
        ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
        ByteString
"MaxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults,
        ByteString
"Type" ByteString -> Type -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Type
type'
      ]

-- | /See:/ 'newListCodeReviewsResponse' smart constructor.
data ListCodeReviewsResponse = ListCodeReviewsResponse'
  { -- | A list of code reviews that meet the criteria of the request.
    ListCodeReviewsResponse -> Maybe [CodeReviewSummary]
codeReviewSummaries :: Prelude.Maybe [CodeReviewSummary],
    -- | Pagination token.
    ListCodeReviewsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    ListCodeReviewsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (ListCodeReviewsResponse -> ListCodeReviewsResponse -> Bool
(ListCodeReviewsResponse -> ListCodeReviewsResponse -> Bool)
-> (ListCodeReviewsResponse -> ListCodeReviewsResponse -> Bool)
-> Eq ListCodeReviewsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListCodeReviewsResponse -> ListCodeReviewsResponse -> Bool
$c/= :: ListCodeReviewsResponse -> ListCodeReviewsResponse -> Bool
== :: ListCodeReviewsResponse -> ListCodeReviewsResponse -> Bool
$c== :: ListCodeReviewsResponse -> ListCodeReviewsResponse -> Bool
Prelude.Eq, ReadPrec [ListCodeReviewsResponse]
ReadPrec ListCodeReviewsResponse
Int -> ReadS ListCodeReviewsResponse
ReadS [ListCodeReviewsResponse]
(Int -> ReadS ListCodeReviewsResponse)
-> ReadS [ListCodeReviewsResponse]
-> ReadPrec ListCodeReviewsResponse
-> ReadPrec [ListCodeReviewsResponse]
-> Read ListCodeReviewsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListCodeReviewsResponse]
$creadListPrec :: ReadPrec [ListCodeReviewsResponse]
readPrec :: ReadPrec ListCodeReviewsResponse
$creadPrec :: ReadPrec ListCodeReviewsResponse
readList :: ReadS [ListCodeReviewsResponse]
$creadList :: ReadS [ListCodeReviewsResponse]
readsPrec :: Int -> ReadS ListCodeReviewsResponse
$creadsPrec :: Int -> ReadS ListCodeReviewsResponse
Prelude.Read, Int -> ListCodeReviewsResponse -> ShowS
[ListCodeReviewsResponse] -> ShowS
ListCodeReviewsResponse -> String
(Int -> ListCodeReviewsResponse -> ShowS)
-> (ListCodeReviewsResponse -> String)
-> ([ListCodeReviewsResponse] -> ShowS)
-> Show ListCodeReviewsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListCodeReviewsResponse] -> ShowS
$cshowList :: [ListCodeReviewsResponse] -> ShowS
show :: ListCodeReviewsResponse -> String
$cshow :: ListCodeReviewsResponse -> String
showsPrec :: Int -> ListCodeReviewsResponse -> ShowS
$cshowsPrec :: Int -> ListCodeReviewsResponse -> ShowS
Prelude.Show, (forall x.
 ListCodeReviewsResponse -> Rep ListCodeReviewsResponse x)
-> (forall x.
    Rep ListCodeReviewsResponse x -> ListCodeReviewsResponse)
-> Generic ListCodeReviewsResponse
forall x. Rep ListCodeReviewsResponse x -> ListCodeReviewsResponse
forall x. ListCodeReviewsResponse -> Rep ListCodeReviewsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListCodeReviewsResponse x -> ListCodeReviewsResponse
$cfrom :: forall x. ListCodeReviewsResponse -> Rep ListCodeReviewsResponse x
Prelude.Generic)

-- |
-- Create a value of 'ListCodeReviewsResponse' 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:
--
-- 'codeReviewSummaries', 'listCodeReviewsResponse_codeReviewSummaries' - A list of code reviews that meet the criteria of the request.
--
-- 'nextToken', 'listCodeReviewsResponse_nextToken' - Pagination token.
--
-- 'httpStatus', 'listCodeReviewsResponse_httpStatus' - The response's http status code.
newListCodeReviewsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ListCodeReviewsResponse
newListCodeReviewsResponse :: Int -> ListCodeReviewsResponse
newListCodeReviewsResponse Int
pHttpStatus_ =
  ListCodeReviewsResponse' :: Maybe [CodeReviewSummary]
-> Maybe Text -> Int -> ListCodeReviewsResponse
ListCodeReviewsResponse'
    { $sel:codeReviewSummaries:ListCodeReviewsResponse' :: Maybe [CodeReviewSummary]
codeReviewSummaries =
        Maybe [CodeReviewSummary]
forall a. Maybe a
Prelude.Nothing,
      $sel:nextToken:ListCodeReviewsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ListCodeReviewsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of code reviews that meet the criteria of the request.
listCodeReviewsResponse_codeReviewSummaries :: Lens.Lens' ListCodeReviewsResponse (Prelude.Maybe [CodeReviewSummary])
listCodeReviewsResponse_codeReviewSummaries :: (Maybe [CodeReviewSummary] -> f (Maybe [CodeReviewSummary]))
-> ListCodeReviewsResponse -> f ListCodeReviewsResponse
listCodeReviewsResponse_codeReviewSummaries = (ListCodeReviewsResponse -> Maybe [CodeReviewSummary])
-> (ListCodeReviewsResponse
    -> Maybe [CodeReviewSummary] -> ListCodeReviewsResponse)
-> Lens
     ListCodeReviewsResponse
     ListCodeReviewsResponse
     (Maybe [CodeReviewSummary])
     (Maybe [CodeReviewSummary])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCodeReviewsResponse' {Maybe [CodeReviewSummary]
codeReviewSummaries :: Maybe [CodeReviewSummary]
$sel:codeReviewSummaries:ListCodeReviewsResponse' :: ListCodeReviewsResponse -> Maybe [CodeReviewSummary]
codeReviewSummaries} -> Maybe [CodeReviewSummary]
codeReviewSummaries) (\s :: ListCodeReviewsResponse
s@ListCodeReviewsResponse' {} Maybe [CodeReviewSummary]
a -> ListCodeReviewsResponse
s {$sel:codeReviewSummaries:ListCodeReviewsResponse' :: Maybe [CodeReviewSummary]
codeReviewSummaries = Maybe [CodeReviewSummary]
a} :: ListCodeReviewsResponse) ((Maybe [CodeReviewSummary] -> f (Maybe [CodeReviewSummary]))
 -> ListCodeReviewsResponse -> f ListCodeReviewsResponse)
-> ((Maybe [CodeReviewSummary] -> f (Maybe [CodeReviewSummary]))
    -> Maybe [CodeReviewSummary] -> f (Maybe [CodeReviewSummary]))
-> (Maybe [CodeReviewSummary] -> f (Maybe [CodeReviewSummary]))
-> ListCodeReviewsResponse
-> f ListCodeReviewsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CodeReviewSummary]
  [CodeReviewSummary]
  [CodeReviewSummary]
  [CodeReviewSummary]
-> Iso
     (Maybe [CodeReviewSummary])
     (Maybe [CodeReviewSummary])
     (Maybe [CodeReviewSummary])
     (Maybe [CodeReviewSummary])
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
  [CodeReviewSummary]
  [CodeReviewSummary]
  [CodeReviewSummary]
  [CodeReviewSummary]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Pagination token.
listCodeReviewsResponse_nextToken :: Lens.Lens' ListCodeReviewsResponse (Prelude.Maybe Prelude.Text)
listCodeReviewsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListCodeReviewsResponse -> f ListCodeReviewsResponse
listCodeReviewsResponse_nextToken = (ListCodeReviewsResponse -> Maybe Text)
-> (ListCodeReviewsResponse
    -> Maybe Text -> ListCodeReviewsResponse)
-> Lens
     ListCodeReviewsResponse
     ListCodeReviewsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListCodeReviewsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListCodeReviewsResponse' :: ListCodeReviewsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListCodeReviewsResponse
s@ListCodeReviewsResponse' {} Maybe Text
a -> ListCodeReviewsResponse
s {$sel:nextToken:ListCodeReviewsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListCodeReviewsResponse)

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

instance Prelude.NFData ListCodeReviewsResponse