{-# 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.MediaStoreData.ListItems
(
ListItems (..),
newListItems,
listItems_path,
listItems_nextToken,
listItems_maxResults,
ListItemsResponse (..),
newListItemsResponse,
listItemsResponse_items,
listItemsResponse_nextToken,
listItemsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaStoreData.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListItems = ListItems'
{
ListItems -> Maybe Text
path :: Prelude.Maybe Prelude.Text,
ListItems -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListItems -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListItems -> ListItems -> Bool
(ListItems -> ListItems -> Bool)
-> (ListItems -> ListItems -> Bool) -> Eq ListItems
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListItems -> ListItems -> Bool
$c/= :: ListItems -> ListItems -> Bool
== :: ListItems -> ListItems -> Bool
$c== :: ListItems -> ListItems -> Bool
Prelude.Eq, ReadPrec [ListItems]
ReadPrec ListItems
Int -> ReadS ListItems
ReadS [ListItems]
(Int -> ReadS ListItems)
-> ReadS [ListItems]
-> ReadPrec ListItems
-> ReadPrec [ListItems]
-> Read ListItems
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListItems]
$creadListPrec :: ReadPrec [ListItems]
readPrec :: ReadPrec ListItems
$creadPrec :: ReadPrec ListItems
readList :: ReadS [ListItems]
$creadList :: ReadS [ListItems]
readsPrec :: Int -> ReadS ListItems
$creadsPrec :: Int -> ReadS ListItems
Prelude.Read, Int -> ListItems -> ShowS
[ListItems] -> ShowS
ListItems -> String
(Int -> ListItems -> ShowS)
-> (ListItems -> String)
-> ([ListItems] -> ShowS)
-> Show ListItems
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListItems] -> ShowS
$cshowList :: [ListItems] -> ShowS
show :: ListItems -> String
$cshow :: ListItems -> String
showsPrec :: Int -> ListItems -> ShowS
$cshowsPrec :: Int -> ListItems -> ShowS
Prelude.Show, (forall x. ListItems -> Rep ListItems x)
-> (forall x. Rep ListItems x -> ListItems) -> Generic ListItems
forall x. Rep ListItems x -> ListItems
forall x. ListItems -> Rep ListItems x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListItems x -> ListItems
$cfrom :: forall x. ListItems -> Rep ListItems x
Prelude.Generic)
newListItems ::
ListItems
newListItems :: ListItems
newListItems =
ListItems' :: Maybe Text -> Maybe Text -> Maybe Natural -> ListItems
ListItems'
{ $sel:path:ListItems' :: Maybe Text
path = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListItems' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListItems' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listItems_path :: Lens.Lens' ListItems (Prelude.Maybe Prelude.Text)
listItems_path :: (Maybe Text -> f (Maybe Text)) -> ListItems -> f ListItems
listItems_path = (ListItems -> Maybe Text)
-> (ListItems -> Maybe Text -> ListItems)
-> Lens ListItems ListItems (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListItems' {Maybe Text
path :: Maybe Text
$sel:path:ListItems' :: ListItems -> Maybe Text
path} -> Maybe Text
path) (\s :: ListItems
s@ListItems' {} Maybe Text
a -> ListItems
s {$sel:path:ListItems' :: Maybe Text
path = Maybe Text
a} :: ListItems)
listItems_nextToken :: Lens.Lens' ListItems (Prelude.Maybe Prelude.Text)
listItems_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListItems -> f ListItems
listItems_nextToken = (ListItems -> Maybe Text)
-> (ListItems -> Maybe Text -> ListItems)
-> Lens ListItems ListItems (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListItems' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListItems' :: ListItems -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListItems
s@ListItems' {} Maybe Text
a -> ListItems
s {$sel:nextToken:ListItems' :: Maybe Text
nextToken = Maybe Text
a} :: ListItems)
listItems_maxResults :: Lens.Lens' ListItems (Prelude.Maybe Prelude.Natural)
listItems_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListItems -> f ListItems
listItems_maxResults = (ListItems -> Maybe Natural)
-> (ListItems -> Maybe Natural -> ListItems)
-> Lens ListItems ListItems (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListItems' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListItems' :: ListItems -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListItems
s@ListItems' {} Maybe Natural
a -> ListItems
s {$sel:maxResults:ListItems' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListItems)
instance Core.AWSPager ListItems where
page :: ListItems -> AWSResponse ListItems -> Maybe ListItems
page ListItems
rq AWSResponse ListItems
rs
| Maybe Text -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListItems
ListItemsResponse
rs
ListItemsResponse
-> Getting (First Text) ListItemsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListItemsResponse -> Const (First Text) ListItemsResponse
Lens' ListItemsResponse (Maybe Text)
listItemsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListItemsResponse -> Const (First Text) ListItemsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListItemsResponse 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 ListItems
forall a. Maybe a
Prelude.Nothing
| Maybe [Item] -> Bool
forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListItems
ListItemsResponse
rs
ListItemsResponse
-> Getting (First [Item]) ListItemsResponse [Item] -> Maybe [Item]
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe [Item] -> Const (First [Item]) (Maybe [Item]))
-> ListItemsResponse -> Const (First [Item]) ListItemsResponse
Lens' ListItemsResponse (Maybe [Item])
listItemsResponse_items ((Maybe [Item] -> Const (First [Item]) (Maybe [Item]))
-> ListItemsResponse -> Const (First [Item]) ListItemsResponse)
-> (([Item] -> Const (First [Item]) [Item])
-> Maybe [Item] -> Const (First [Item]) (Maybe [Item]))
-> Getting (First [Item]) ListItemsResponse [Item]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Item] -> Const (First [Item]) [Item])
-> Maybe [Item] -> Const (First [Item]) (Maybe [Item])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
Maybe ListItems
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
ListItems -> Maybe ListItems
forall a. a -> Maybe a
Prelude.Just (ListItems -> Maybe ListItems) -> ListItems -> Maybe ListItems
forall a b. (a -> b) -> a -> b
Prelude.$
ListItems
rq
ListItems -> (ListItems -> ListItems) -> ListItems
forall a b. a -> (a -> b) -> b
Prelude.& (Maybe Text -> Identity (Maybe Text))
-> ListItems -> Identity ListItems
Lens ListItems ListItems (Maybe Text) (Maybe Text)
listItems_nextToken
((Maybe Text -> Identity (Maybe Text))
-> ListItems -> Identity ListItems)
-> Maybe Text -> ListItems -> ListItems
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListItems
ListItemsResponse
rs
ListItemsResponse
-> Getting (First Text) ListItemsResponse Text -> Maybe Text
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? (Maybe Text -> Const (First Text) (Maybe Text))
-> ListItemsResponse -> Const (First Text) ListItemsResponse
Lens' ListItemsResponse (Maybe Text)
listItemsResponse_nextToken ((Maybe Text -> Const (First Text) (Maybe Text))
-> ListItemsResponse -> Const (First Text) ListItemsResponse)
-> ((Text -> Const (First Text) Text)
-> Maybe Text -> Const (First Text) (Maybe Text))
-> Getting (First Text) ListItemsResponse 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 ListItems where
type AWSResponse ListItems = ListItemsResponse
request :: ListItems -> Request ListItems
request = Service -> ListItems -> Request ListItems
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListItems
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListItems)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListItems))
-> Logger
-> Service
-> Proxy ListItems
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListItems)))
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 [Item] -> Maybe Text -> Int -> ListItemsResponse
ListItemsResponse'
(Maybe [Item] -> Maybe Text -> Int -> ListItemsResponse)
-> Either String (Maybe [Item])
-> Either String (Maybe Text -> Int -> ListItemsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Item]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Items" Either String (Maybe (Maybe [Item]))
-> Maybe [Item] -> Either String (Maybe [Item])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Item]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListItemsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListItemsResponse)
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 -> ListItemsResponse)
-> Either String Int -> Either String ListItemsResponse
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 ListItems
instance Prelude.NFData ListItems
instance Core.ToHeaders ListItems where
toHeaders :: ListItems -> ResponseHeaders
toHeaders = ResponseHeaders -> ListItems -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty
instance Core.ToPath ListItems where
toPath :: ListItems -> ByteString
toPath = ByteString -> ListItems -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListItems where
toQuery :: ListItems -> QueryString
toQuery ListItems' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
path :: Maybe Text
$sel:maxResults:ListItems' :: ListItems -> Maybe Natural
$sel:nextToken:ListItems' :: ListItems -> Maybe Text
$sel:path:ListItems' :: ListItems -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"Path" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
path,
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
]
data ListItemsResponse = ListItemsResponse'
{
ListItemsResponse -> Maybe [Item]
items :: Prelude.Maybe [Item],
ListItemsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListItemsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListItemsResponse -> ListItemsResponse -> Bool
(ListItemsResponse -> ListItemsResponse -> Bool)
-> (ListItemsResponse -> ListItemsResponse -> Bool)
-> Eq ListItemsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListItemsResponse -> ListItemsResponse -> Bool
$c/= :: ListItemsResponse -> ListItemsResponse -> Bool
== :: ListItemsResponse -> ListItemsResponse -> Bool
$c== :: ListItemsResponse -> ListItemsResponse -> Bool
Prelude.Eq, ReadPrec [ListItemsResponse]
ReadPrec ListItemsResponse
Int -> ReadS ListItemsResponse
ReadS [ListItemsResponse]
(Int -> ReadS ListItemsResponse)
-> ReadS [ListItemsResponse]
-> ReadPrec ListItemsResponse
-> ReadPrec [ListItemsResponse]
-> Read ListItemsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListItemsResponse]
$creadListPrec :: ReadPrec [ListItemsResponse]
readPrec :: ReadPrec ListItemsResponse
$creadPrec :: ReadPrec ListItemsResponse
readList :: ReadS [ListItemsResponse]
$creadList :: ReadS [ListItemsResponse]
readsPrec :: Int -> ReadS ListItemsResponse
$creadsPrec :: Int -> ReadS ListItemsResponse
Prelude.Read, Int -> ListItemsResponse -> ShowS
[ListItemsResponse] -> ShowS
ListItemsResponse -> String
(Int -> ListItemsResponse -> ShowS)
-> (ListItemsResponse -> String)
-> ([ListItemsResponse] -> ShowS)
-> Show ListItemsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListItemsResponse] -> ShowS
$cshowList :: [ListItemsResponse] -> ShowS
show :: ListItemsResponse -> String
$cshow :: ListItemsResponse -> String
showsPrec :: Int -> ListItemsResponse -> ShowS
$cshowsPrec :: Int -> ListItemsResponse -> ShowS
Prelude.Show, (forall x. ListItemsResponse -> Rep ListItemsResponse x)
-> (forall x. Rep ListItemsResponse x -> ListItemsResponse)
-> Generic ListItemsResponse
forall x. Rep ListItemsResponse x -> ListItemsResponse
forall x. ListItemsResponse -> Rep ListItemsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListItemsResponse x -> ListItemsResponse
$cfrom :: forall x. ListItemsResponse -> Rep ListItemsResponse x
Prelude.Generic)
newListItemsResponse ::
Prelude.Int ->
ListItemsResponse
newListItemsResponse :: Int -> ListItemsResponse
newListItemsResponse Int
pHttpStatus_ =
ListItemsResponse' :: Maybe [Item] -> Maybe Text -> Int -> ListItemsResponse
ListItemsResponse'
{ $sel:items:ListItemsResponse' :: Maybe [Item]
items = Maybe [Item]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListItemsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListItemsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listItemsResponse_items :: Lens.Lens' ListItemsResponse (Prelude.Maybe [Item])
listItemsResponse_items :: (Maybe [Item] -> f (Maybe [Item]))
-> ListItemsResponse -> f ListItemsResponse
listItemsResponse_items = (ListItemsResponse -> Maybe [Item])
-> (ListItemsResponse -> Maybe [Item] -> ListItemsResponse)
-> Lens' ListItemsResponse (Maybe [Item])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListItemsResponse' {Maybe [Item]
items :: Maybe [Item]
$sel:items:ListItemsResponse' :: ListItemsResponse -> Maybe [Item]
items} -> Maybe [Item]
items) (\s :: ListItemsResponse
s@ListItemsResponse' {} Maybe [Item]
a -> ListItemsResponse
s {$sel:items:ListItemsResponse' :: Maybe [Item]
items = Maybe [Item]
a} :: ListItemsResponse) ((Maybe [Item] -> f (Maybe [Item]))
-> ListItemsResponse -> f ListItemsResponse)
-> ((Maybe [Item] -> f (Maybe [Item]))
-> Maybe [Item] -> f (Maybe [Item]))
-> (Maybe [Item] -> f (Maybe [Item]))
-> ListItemsResponse
-> f ListItemsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Item] [Item] [Item] [Item]
-> Iso (Maybe [Item]) (Maybe [Item]) (Maybe [Item]) (Maybe [Item])
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 [Item] [Item] [Item] [Item]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listItemsResponse_nextToken :: Lens.Lens' ListItemsResponse (Prelude.Maybe Prelude.Text)
listItemsResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListItemsResponse -> f ListItemsResponse
listItemsResponse_nextToken = (ListItemsResponse -> Maybe Text)
-> (ListItemsResponse -> Maybe Text -> ListItemsResponse)
-> Lens' ListItemsResponse (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListItemsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListItemsResponse' :: ListItemsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListItemsResponse
s@ListItemsResponse' {} Maybe Text
a -> ListItemsResponse
s {$sel:nextToken:ListItemsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListItemsResponse)
listItemsResponse_httpStatus :: Lens.Lens' ListItemsResponse Prelude.Int
listItemsResponse_httpStatus :: (Int -> f Int) -> ListItemsResponse -> f ListItemsResponse
listItemsResponse_httpStatus = (ListItemsResponse -> Int)
-> (ListItemsResponse -> Int -> ListItemsResponse)
-> Lens ListItemsResponse ListItemsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListItemsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListItemsResponse' :: ListItemsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListItemsResponse
s@ListItemsResponse' {} Int
a -> ListItemsResponse
s {$sel:httpStatus:ListItemsResponse' :: Int
httpStatus = Int
a} :: ListItemsResponse)
instance Prelude.NFData ListItemsResponse