{-# 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.GamesParks.ListGames
(
ListGames (..),
newListGames,
listGames_maxResults,
listGames_nextToken,
ListGamesResponse (..),
newListGamesResponse,
listGamesResponse_games,
listGamesResponse_nextToken,
listGamesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GamesParks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListGames = ListGames'
{
ListGames -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListGames -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListGames -> ListGames -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGames -> ListGames -> Bool
$c/= :: ListGames -> ListGames -> Bool
== :: ListGames -> ListGames -> Bool
$c== :: ListGames -> ListGames -> Bool
Prelude.Eq, ReadPrec [ListGames]
ReadPrec ListGames
Int -> ReadS ListGames
ReadS [ListGames]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGames]
$creadListPrec :: ReadPrec [ListGames]
readPrec :: ReadPrec ListGames
$creadPrec :: ReadPrec ListGames
readList :: ReadS [ListGames]
$creadList :: ReadS [ListGames]
readsPrec :: Int -> ReadS ListGames
$creadsPrec :: Int -> ReadS ListGames
Prelude.Read, Int -> ListGames -> ShowS
[ListGames] -> ShowS
ListGames -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGames] -> ShowS
$cshowList :: [ListGames] -> ShowS
show :: ListGames -> String
$cshow :: ListGames -> String
showsPrec :: Int -> ListGames -> ShowS
$cshowsPrec :: Int -> ListGames -> ShowS
Prelude.Show, forall x. Rep ListGames x -> ListGames
forall x. ListGames -> Rep ListGames x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGames x -> ListGames
$cfrom :: forall x. ListGames -> Rep ListGames x
Prelude.Generic)
newListGames ::
ListGames
newListGames :: ListGames
newListGames =
ListGames'
{ $sel:maxResults:ListGames' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListGames' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listGames_maxResults :: Lens.Lens' ListGames (Prelude.Maybe Prelude.Natural)
listGames_maxResults :: Lens' ListGames (Maybe Natural)
listGames_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGames' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListGames' :: ListGames -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListGames
s@ListGames' {} Maybe Natural
a -> ListGames
s {$sel:maxResults:ListGames' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListGames)
listGames_nextToken :: Lens.Lens' ListGames (Prelude.Maybe Prelude.Text)
listGames_nextToken :: Lens' ListGames (Maybe Text)
listGames_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGames' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListGames' :: ListGames -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListGames
s@ListGames' {} Maybe Text
a -> ListGames
s {$sel:nextToken:ListGames' :: Maybe Text
nextToken = Maybe Text
a} :: ListGames)
instance Core.AWSPager ListGames where
page :: ListGames -> AWSResponse ListGames -> Maybe ListGames
page ListGames
rq AWSResponse ListGames
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListGames
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListGamesResponse (Maybe Text)
listGamesResponse_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 ListGames
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListGamesResponse (Maybe [GameSummary])
listGamesResponse_games
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
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListGames
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListGames (Maybe Text)
listGames_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListGames
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListGamesResponse (Maybe Text)
listGamesResponse_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 ListGames where
type AWSResponse ListGames = ListGamesResponse
request :: (Service -> Service) -> ListGames -> Request ListGames
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 ListGames
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListGames)))
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 [GameSummary] -> Maybe Text -> Int -> ListGamesResponse
ListGamesResponse'
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
"Games" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
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
"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))
)
instance Prelude.Hashable ListGames where
hashWithSalt :: Int -> ListGames -> Int
hashWithSalt Int
_salt ListGames' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListGames' :: ListGames -> Maybe Text
$sel:maxResults:ListGames' :: ListGames -> 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
instance Prelude.NFData ListGames where
rnf :: ListGames -> ()
rnf ListGames' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListGames' :: ListGames -> Maybe Text
$sel:maxResults:ListGames' :: ListGames -> 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
instance Data.ToHeaders ListGames where
toHeaders :: ListGames -> 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 ListGames where
toPath :: ListGames -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/game"
instance Data.ToQuery ListGames where
toQuery :: ListGames -> QueryString
toQuery ListGames' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListGames' :: ListGames -> Maybe Text
$sel:maxResults:ListGames' :: ListGames -> 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 ListGamesResponse = ListGamesResponse'
{
ListGamesResponse -> Maybe [GameSummary]
games :: Prelude.Maybe [GameSummary],
ListGamesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListGamesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListGamesResponse -> ListGamesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListGamesResponse -> ListGamesResponse -> Bool
$c/= :: ListGamesResponse -> ListGamesResponse -> Bool
== :: ListGamesResponse -> ListGamesResponse -> Bool
$c== :: ListGamesResponse -> ListGamesResponse -> Bool
Prelude.Eq, ReadPrec [ListGamesResponse]
ReadPrec ListGamesResponse
Int -> ReadS ListGamesResponse
ReadS [ListGamesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListGamesResponse]
$creadListPrec :: ReadPrec [ListGamesResponse]
readPrec :: ReadPrec ListGamesResponse
$creadPrec :: ReadPrec ListGamesResponse
readList :: ReadS [ListGamesResponse]
$creadList :: ReadS [ListGamesResponse]
readsPrec :: Int -> ReadS ListGamesResponse
$creadsPrec :: Int -> ReadS ListGamesResponse
Prelude.Read, Int -> ListGamesResponse -> ShowS
[ListGamesResponse] -> ShowS
ListGamesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListGamesResponse] -> ShowS
$cshowList :: [ListGamesResponse] -> ShowS
show :: ListGamesResponse -> String
$cshow :: ListGamesResponse -> String
showsPrec :: Int -> ListGamesResponse -> ShowS
$cshowsPrec :: Int -> ListGamesResponse -> ShowS
Prelude.Show, forall x. Rep ListGamesResponse x -> ListGamesResponse
forall x. ListGamesResponse -> Rep ListGamesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListGamesResponse x -> ListGamesResponse
$cfrom :: forall x. ListGamesResponse -> Rep ListGamesResponse x
Prelude.Generic)
newListGamesResponse ::
Prelude.Int ->
ListGamesResponse
newListGamesResponse :: Int -> ListGamesResponse
newListGamesResponse Int
pHttpStatus_ =
ListGamesResponse'
{ $sel:games:ListGamesResponse' :: Maybe [GameSummary]
games = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListGamesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListGamesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listGamesResponse_games :: Lens.Lens' ListGamesResponse (Prelude.Maybe [GameSummary])
listGamesResponse_games :: Lens' ListGamesResponse (Maybe [GameSummary])
listGamesResponse_games = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGamesResponse' {Maybe [GameSummary]
games :: Maybe [GameSummary]
$sel:games:ListGamesResponse' :: ListGamesResponse -> Maybe [GameSummary]
games} -> Maybe [GameSummary]
games) (\s :: ListGamesResponse
s@ListGamesResponse' {} Maybe [GameSummary]
a -> ListGamesResponse
s {$sel:games:ListGamesResponse' :: Maybe [GameSummary]
games = Maybe [GameSummary]
a} :: ListGamesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listGamesResponse_nextToken :: Lens.Lens' ListGamesResponse (Prelude.Maybe Prelude.Text)
listGamesResponse_nextToken :: Lens' ListGamesResponse (Maybe Text)
listGamesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGamesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListGamesResponse' :: ListGamesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListGamesResponse
s@ListGamesResponse' {} Maybe Text
a -> ListGamesResponse
s {$sel:nextToken:ListGamesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListGamesResponse)
listGamesResponse_httpStatus :: Lens.Lens' ListGamesResponse Prelude.Int
listGamesResponse_httpStatus :: Lens' ListGamesResponse Int
listGamesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListGamesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListGamesResponse' :: ListGamesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListGamesResponse
s@ListGamesResponse' {} Int
a -> ListGamesResponse
s {$sel:httpStatus:ListGamesResponse' :: Int
httpStatus = Int
a} :: ListGamesResponse)
instance Prelude.NFData ListGamesResponse where
rnf :: ListGamesResponse -> ()
rnf ListGamesResponse' {Int
Maybe [GameSummary]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
games :: Maybe [GameSummary]
$sel:httpStatus:ListGamesResponse' :: ListGamesResponse -> Int
$sel:nextToken:ListGamesResponse' :: ListGamesResponse -> Maybe Text
$sel:games:ListGamesResponse' :: ListGamesResponse -> Maybe [GameSummary]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [GameSummary]
games
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 Int
httpStatus