{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.Amplify.ListBranches
(
ListBranches (..),
newListBranches,
listBranches_maxResults,
listBranches_nextToken,
listBranches_appId,
ListBranchesResponse (..),
newListBranchesResponse,
listBranchesResponse_nextToken,
listBranchesResponse_httpStatus,
listBranchesResponse_branches,
)
where
import Amazonka.Amplify.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListBranches = ListBranches'
{
ListBranches -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListBranches -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListBranches -> Text
appId :: Prelude.Text
}
deriving (ListBranches -> ListBranches -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBranches -> ListBranches -> Bool
$c/= :: ListBranches -> ListBranches -> Bool
== :: ListBranches -> ListBranches -> Bool
$c== :: ListBranches -> ListBranches -> Bool
Prelude.Eq, ReadPrec [ListBranches]
ReadPrec ListBranches
Int -> ReadS ListBranches
ReadS [ListBranches]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListBranches]
$creadListPrec :: ReadPrec [ListBranches]
readPrec :: ReadPrec ListBranches
$creadPrec :: ReadPrec ListBranches
readList :: ReadS [ListBranches]
$creadList :: ReadS [ListBranches]
readsPrec :: Int -> ReadS ListBranches
$creadsPrec :: Int -> ReadS ListBranches
Prelude.Read, Int -> ListBranches -> ShowS
[ListBranches] -> ShowS
ListBranches -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBranches] -> ShowS
$cshowList :: [ListBranches] -> ShowS
show :: ListBranches -> String
$cshow :: ListBranches -> String
showsPrec :: Int -> ListBranches -> ShowS
$cshowsPrec :: Int -> ListBranches -> ShowS
Prelude.Show, forall x. Rep ListBranches x -> ListBranches
forall x. ListBranches -> Rep ListBranches x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBranches x -> ListBranches
$cfrom :: forall x. ListBranches -> Rep ListBranches x
Prelude.Generic)
newListBranches ::
Prelude.Text ->
ListBranches
newListBranches :: Text -> ListBranches
newListBranches Text
pAppId_ =
ListBranches'
{ $sel:maxResults:ListBranches' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListBranches' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:appId:ListBranches' :: Text
appId = Text
pAppId_
}
listBranches_maxResults :: Lens.Lens' ListBranches (Prelude.Maybe Prelude.Natural)
listBranches_maxResults :: Lens' ListBranches (Maybe Natural)
listBranches_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBranches' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListBranches' :: ListBranches -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListBranches
s@ListBranches' {} Maybe Natural
a -> ListBranches
s {$sel:maxResults:ListBranches' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListBranches)
listBranches_nextToken :: Lens.Lens' ListBranches (Prelude.Maybe Prelude.Text)
listBranches_nextToken :: Lens' ListBranches (Maybe Text)
listBranches_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBranches' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBranches' :: ListBranches -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBranches
s@ListBranches' {} Maybe Text
a -> ListBranches
s {$sel:nextToken:ListBranches' :: Maybe Text
nextToken = Maybe Text
a} :: ListBranches)
listBranches_appId :: Lens.Lens' ListBranches Prelude.Text
listBranches_appId :: Lens' ListBranches Text
listBranches_appId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBranches' {Text
appId :: Text
$sel:appId:ListBranches' :: ListBranches -> Text
appId} -> Text
appId) (\s :: ListBranches
s@ListBranches' {} Text
a -> ListBranches
s {$sel:appId:ListBranches' :: Text
appId = Text
a} :: ListBranches)
instance Core.AWSPager ListBranches where
page :: ListBranches -> AWSResponse ListBranches -> Maybe ListBranches
page ListBranches
rq AWSResponse ListBranches
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListBranches
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListBranchesResponse (Maybe Text)
listBranchesResponse_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 ListBranches
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListBranchesResponse [Branch]
listBranchesResponse_branches) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListBranches
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListBranches (Maybe Text)
listBranches_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListBranches
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListBranchesResponse (Maybe Text)
listBranchesResponse_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 ListBranches where
type AWSResponse ListBranches = ListBranchesResponse
request :: (Service -> Service) -> ListBranches -> Request ListBranches
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListBranches
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListBranches)))
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 -> [Branch] -> ListBranchesResponse
ListBranchesResponse'
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
"branches" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListBranches where
hashWithSalt :: Int -> ListBranches -> Int
hashWithSalt Int
_salt ListBranches' {Maybe Natural
Maybe Text
Text
appId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:appId:ListBranches' :: ListBranches -> Text
$sel:nextToken:ListBranches' :: ListBranches -> Maybe Text
$sel:maxResults:ListBranches' :: ListBranches -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
appId
instance Prelude.NFData ListBranches where
rnf :: ListBranches -> ()
rnf ListBranches' {Maybe Natural
Maybe Text
Text
appId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:appId:ListBranches' :: ListBranches -> Text
$sel:nextToken:ListBranches' :: ListBranches -> Maybe Text
$sel:maxResults:ListBranches' :: ListBranches -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
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 Text
appId
instance Data.ToHeaders ListBranches where
toHeaders :: ListBranches -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath ListBranches where
toPath :: ListBranches -> ByteString
toPath ListBranches' {Maybe Natural
Maybe Text
Text
appId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:appId:ListBranches' :: ListBranches -> Text
$sel:nextToken:ListBranches' :: ListBranches -> Maybe Text
$sel:maxResults:ListBranches' :: ListBranches -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/apps/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
appId, ByteString
"/branches"]
instance Data.ToQuery ListBranches where
toQuery :: ListBranches -> QueryString
toQuery ListBranches' {Maybe Natural
Maybe Text
Text
appId :: Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:appId:ListBranches' :: ListBranches -> Text
$sel:nextToken:ListBranches' :: ListBranches -> Maybe Text
$sel:maxResults:ListBranches' :: ListBranches -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken
]
data ListBranchesResponse = ListBranchesResponse'
{
ListBranchesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListBranchesResponse -> Int
httpStatus :: Prelude.Int,
ListBranchesResponse -> [Branch]
branches :: [Branch]
}
deriving (ListBranchesResponse -> ListBranchesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListBranchesResponse -> ListBranchesResponse -> Bool
$c/= :: ListBranchesResponse -> ListBranchesResponse -> Bool
== :: ListBranchesResponse -> ListBranchesResponse -> Bool
$c== :: ListBranchesResponse -> ListBranchesResponse -> Bool
Prelude.Eq, Int -> ListBranchesResponse -> ShowS
[ListBranchesResponse] -> ShowS
ListBranchesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListBranchesResponse] -> ShowS
$cshowList :: [ListBranchesResponse] -> ShowS
show :: ListBranchesResponse -> String
$cshow :: ListBranchesResponse -> String
showsPrec :: Int -> ListBranchesResponse -> ShowS
$cshowsPrec :: Int -> ListBranchesResponse -> ShowS
Prelude.Show, forall x. Rep ListBranchesResponse x -> ListBranchesResponse
forall x. ListBranchesResponse -> Rep ListBranchesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListBranchesResponse x -> ListBranchesResponse
$cfrom :: forall x. ListBranchesResponse -> Rep ListBranchesResponse x
Prelude.Generic)
newListBranchesResponse ::
Prelude.Int ->
ListBranchesResponse
newListBranchesResponse :: Int -> ListBranchesResponse
newListBranchesResponse Int
pHttpStatus_ =
ListBranchesResponse'
{ $sel:nextToken:ListBranchesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListBranchesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:branches:ListBranchesResponse' :: [Branch]
branches = forall a. Monoid a => a
Prelude.mempty
}
listBranchesResponse_nextToken :: Lens.Lens' ListBranchesResponse (Prelude.Maybe Prelude.Text)
listBranchesResponse_nextToken :: Lens' ListBranchesResponse (Maybe Text)
listBranchesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBranchesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListBranchesResponse' :: ListBranchesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListBranchesResponse
s@ListBranchesResponse' {} Maybe Text
a -> ListBranchesResponse
s {$sel:nextToken:ListBranchesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListBranchesResponse)
listBranchesResponse_httpStatus :: Lens.Lens' ListBranchesResponse Prelude.Int
listBranchesResponse_httpStatus :: Lens' ListBranchesResponse Int
listBranchesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBranchesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListBranchesResponse' :: ListBranchesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListBranchesResponse
s@ListBranchesResponse' {} Int
a -> ListBranchesResponse
s {$sel:httpStatus:ListBranchesResponse' :: Int
httpStatus = Int
a} :: ListBranchesResponse)
listBranchesResponse_branches :: Lens.Lens' ListBranchesResponse [Branch]
listBranchesResponse_branches :: Lens' ListBranchesResponse [Branch]
listBranchesResponse_branches = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListBranchesResponse' {[Branch]
branches :: [Branch]
$sel:branches:ListBranchesResponse' :: ListBranchesResponse -> [Branch]
branches} -> [Branch]
branches) (\s :: ListBranchesResponse
s@ListBranchesResponse' {} [Branch]
a -> ListBranchesResponse
s {$sel:branches:ListBranchesResponse' :: [Branch]
branches = [Branch]
a} :: ListBranchesResponse) 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 ListBranchesResponse where
rnf :: ListBranchesResponse -> ()
rnf ListBranchesResponse' {Int
[Branch]
Maybe Text
branches :: [Branch]
httpStatus :: Int
nextToken :: Maybe Text
$sel:branches:ListBranchesResponse' :: ListBranchesResponse -> [Branch]
$sel:httpStatus:ListBranchesResponse' :: ListBranchesResponse -> Int
$sel:nextToken:ListBranchesResponse' :: ListBranchesResponse -> 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 [Branch]
branches