{-# 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.Location.ListPlaceIndexes
(
ListPlaceIndexes (..),
newListPlaceIndexes,
listPlaceIndexes_maxResults,
listPlaceIndexes_nextToken,
ListPlaceIndexesResponse (..),
newListPlaceIndexesResponse,
listPlaceIndexesResponse_nextToken,
listPlaceIndexesResponse_httpStatus,
listPlaceIndexesResponse_entries,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Location.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListPlaceIndexes = ListPlaceIndexes'
{
ListPlaceIndexes -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListPlaceIndexes -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListPlaceIndexes -> ListPlaceIndexes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPlaceIndexes -> ListPlaceIndexes -> Bool
$c/= :: ListPlaceIndexes -> ListPlaceIndexes -> Bool
== :: ListPlaceIndexes -> ListPlaceIndexes -> Bool
$c== :: ListPlaceIndexes -> ListPlaceIndexes -> Bool
Prelude.Eq, ReadPrec [ListPlaceIndexes]
ReadPrec ListPlaceIndexes
Int -> ReadS ListPlaceIndexes
ReadS [ListPlaceIndexes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPlaceIndexes]
$creadListPrec :: ReadPrec [ListPlaceIndexes]
readPrec :: ReadPrec ListPlaceIndexes
$creadPrec :: ReadPrec ListPlaceIndexes
readList :: ReadS [ListPlaceIndexes]
$creadList :: ReadS [ListPlaceIndexes]
readsPrec :: Int -> ReadS ListPlaceIndexes
$creadsPrec :: Int -> ReadS ListPlaceIndexes
Prelude.Read, Int -> ListPlaceIndexes -> ShowS
[ListPlaceIndexes] -> ShowS
ListPlaceIndexes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPlaceIndexes] -> ShowS
$cshowList :: [ListPlaceIndexes] -> ShowS
show :: ListPlaceIndexes -> String
$cshow :: ListPlaceIndexes -> String
showsPrec :: Int -> ListPlaceIndexes -> ShowS
$cshowsPrec :: Int -> ListPlaceIndexes -> ShowS
Prelude.Show, forall x. Rep ListPlaceIndexes x -> ListPlaceIndexes
forall x. ListPlaceIndexes -> Rep ListPlaceIndexes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListPlaceIndexes x -> ListPlaceIndexes
$cfrom :: forall x. ListPlaceIndexes -> Rep ListPlaceIndexes x
Prelude.Generic)
newListPlaceIndexes ::
ListPlaceIndexes
newListPlaceIndexes :: ListPlaceIndexes
newListPlaceIndexes =
ListPlaceIndexes'
{ $sel:maxResults:ListPlaceIndexes' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListPlaceIndexes' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listPlaceIndexes_maxResults :: Lens.Lens' ListPlaceIndexes (Prelude.Maybe Prelude.Natural)
listPlaceIndexes_maxResults :: Lens' ListPlaceIndexes (Maybe Natural)
listPlaceIndexes_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPlaceIndexes' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListPlaceIndexes' :: ListPlaceIndexes -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListPlaceIndexes
s@ListPlaceIndexes' {} Maybe Natural
a -> ListPlaceIndexes
s {$sel:maxResults:ListPlaceIndexes' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListPlaceIndexes)
listPlaceIndexes_nextToken :: Lens.Lens' ListPlaceIndexes (Prelude.Maybe Prelude.Text)
listPlaceIndexes_nextToken :: Lens' ListPlaceIndexes (Maybe Text)
listPlaceIndexes_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPlaceIndexes' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPlaceIndexes' :: ListPlaceIndexes -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPlaceIndexes
s@ListPlaceIndexes' {} Maybe Text
a -> ListPlaceIndexes
s {$sel:nextToken:ListPlaceIndexes' :: Maybe Text
nextToken = Maybe Text
a} :: ListPlaceIndexes)
instance Core.AWSPager ListPlaceIndexes where
page :: ListPlaceIndexes
-> AWSResponse ListPlaceIndexes -> Maybe ListPlaceIndexes
page ListPlaceIndexes
rq AWSResponse ListPlaceIndexes
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListPlaceIndexes
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPlaceIndexesResponse (Maybe Text)
listPlaceIndexesResponse_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 ListPlaceIndexes
rs forall s a. s -> Getting a s a -> a
Lens.^. Lens' ListPlaceIndexesResponse [ListPlaceIndexesResponseEntry]
listPlaceIndexesResponse_entries) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListPlaceIndexes
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListPlaceIndexes (Maybe Text)
listPlaceIndexes_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListPlaceIndexes
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListPlaceIndexesResponse (Maybe Text)
listPlaceIndexesResponse_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 ListPlaceIndexes where
type
AWSResponse ListPlaceIndexes =
ListPlaceIndexesResponse
request :: (Service -> Service)
-> ListPlaceIndexes -> Request ListPlaceIndexes
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListPlaceIndexes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListPlaceIndexes)))
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
-> [ListPlaceIndexesResponseEntry]
-> ListPlaceIndexesResponse
ListPlaceIndexesResponse'
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
"Entries" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable ListPlaceIndexes where
hashWithSalt :: Int -> ListPlaceIndexes -> Int
hashWithSalt Int
_salt ListPlaceIndexes' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListPlaceIndexes' :: ListPlaceIndexes -> Maybe Text
$sel:maxResults:ListPlaceIndexes' :: ListPlaceIndexes -> 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 ListPlaceIndexes where
rnf :: ListPlaceIndexes -> ()
rnf ListPlaceIndexes' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListPlaceIndexes' :: ListPlaceIndexes -> Maybe Text
$sel:maxResults:ListPlaceIndexes' :: ListPlaceIndexes -> 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 ListPlaceIndexes where
toHeaders :: ListPlaceIndexes -> 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.ToJSON ListPlaceIndexes where
toJSON :: ListPlaceIndexes -> Value
toJSON ListPlaceIndexes' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListPlaceIndexes' :: ListPlaceIndexes -> Maybe Text
$sel:maxResults:ListPlaceIndexes' :: ListPlaceIndexes -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
]
)
instance Data.ToPath ListPlaceIndexes where
toPath :: ListPlaceIndexes -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/places/v0/list-indexes"
instance Data.ToQuery ListPlaceIndexes where
toQuery :: ListPlaceIndexes -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListPlaceIndexesResponse = ListPlaceIndexesResponse'
{
ListPlaceIndexesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListPlaceIndexesResponse -> Int
httpStatus :: Prelude.Int,
ListPlaceIndexesResponse -> [ListPlaceIndexesResponseEntry]
entries :: [ListPlaceIndexesResponseEntry]
}
deriving (ListPlaceIndexesResponse -> ListPlaceIndexesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListPlaceIndexesResponse -> ListPlaceIndexesResponse -> Bool
$c/= :: ListPlaceIndexesResponse -> ListPlaceIndexesResponse -> Bool
== :: ListPlaceIndexesResponse -> ListPlaceIndexesResponse -> Bool
$c== :: ListPlaceIndexesResponse -> ListPlaceIndexesResponse -> Bool
Prelude.Eq, ReadPrec [ListPlaceIndexesResponse]
ReadPrec ListPlaceIndexesResponse
Int -> ReadS ListPlaceIndexesResponse
ReadS [ListPlaceIndexesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListPlaceIndexesResponse]
$creadListPrec :: ReadPrec [ListPlaceIndexesResponse]
readPrec :: ReadPrec ListPlaceIndexesResponse
$creadPrec :: ReadPrec ListPlaceIndexesResponse
readList :: ReadS [ListPlaceIndexesResponse]
$creadList :: ReadS [ListPlaceIndexesResponse]
readsPrec :: Int -> ReadS ListPlaceIndexesResponse
$creadsPrec :: Int -> ReadS ListPlaceIndexesResponse
Prelude.Read, Int -> ListPlaceIndexesResponse -> ShowS
[ListPlaceIndexesResponse] -> ShowS
ListPlaceIndexesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListPlaceIndexesResponse] -> ShowS
$cshowList :: [ListPlaceIndexesResponse] -> ShowS
show :: ListPlaceIndexesResponse -> String
$cshow :: ListPlaceIndexesResponse -> String
showsPrec :: Int -> ListPlaceIndexesResponse -> ShowS
$cshowsPrec :: Int -> ListPlaceIndexesResponse -> ShowS
Prelude.Show, forall x.
Rep ListPlaceIndexesResponse x -> ListPlaceIndexesResponse
forall x.
ListPlaceIndexesResponse -> Rep ListPlaceIndexesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListPlaceIndexesResponse x -> ListPlaceIndexesResponse
$cfrom :: forall x.
ListPlaceIndexesResponse -> Rep ListPlaceIndexesResponse x
Prelude.Generic)
newListPlaceIndexesResponse ::
Prelude.Int ->
ListPlaceIndexesResponse
newListPlaceIndexesResponse :: Int -> ListPlaceIndexesResponse
newListPlaceIndexesResponse Int
pHttpStatus_ =
ListPlaceIndexesResponse'
{ $sel:nextToken:ListPlaceIndexesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListPlaceIndexesResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:entries:ListPlaceIndexesResponse' :: [ListPlaceIndexesResponseEntry]
entries = forall a. Monoid a => a
Prelude.mempty
}
listPlaceIndexesResponse_nextToken :: Lens.Lens' ListPlaceIndexesResponse (Prelude.Maybe Prelude.Text)
listPlaceIndexesResponse_nextToken :: Lens' ListPlaceIndexesResponse (Maybe Text)
listPlaceIndexesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPlaceIndexesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListPlaceIndexesResponse' :: ListPlaceIndexesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListPlaceIndexesResponse
s@ListPlaceIndexesResponse' {} Maybe Text
a -> ListPlaceIndexesResponse
s {$sel:nextToken:ListPlaceIndexesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListPlaceIndexesResponse)
listPlaceIndexesResponse_httpStatus :: Lens.Lens' ListPlaceIndexesResponse Prelude.Int
listPlaceIndexesResponse_httpStatus :: Lens' ListPlaceIndexesResponse Int
listPlaceIndexesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPlaceIndexesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListPlaceIndexesResponse' :: ListPlaceIndexesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListPlaceIndexesResponse
s@ListPlaceIndexesResponse' {} Int
a -> ListPlaceIndexesResponse
s {$sel:httpStatus:ListPlaceIndexesResponse' :: Int
httpStatus = Int
a} :: ListPlaceIndexesResponse)
listPlaceIndexesResponse_entries :: Lens.Lens' ListPlaceIndexesResponse [ListPlaceIndexesResponseEntry]
listPlaceIndexesResponse_entries :: Lens' ListPlaceIndexesResponse [ListPlaceIndexesResponseEntry]
listPlaceIndexesResponse_entries = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListPlaceIndexesResponse' {[ListPlaceIndexesResponseEntry]
entries :: [ListPlaceIndexesResponseEntry]
$sel:entries:ListPlaceIndexesResponse' :: ListPlaceIndexesResponse -> [ListPlaceIndexesResponseEntry]
entries} -> [ListPlaceIndexesResponseEntry]
entries) (\s :: ListPlaceIndexesResponse
s@ListPlaceIndexesResponse' {} [ListPlaceIndexesResponseEntry]
a -> ListPlaceIndexesResponse
s {$sel:entries:ListPlaceIndexesResponse' :: [ListPlaceIndexesResponseEntry]
entries = [ListPlaceIndexesResponseEntry]
a} :: ListPlaceIndexesResponse) 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 ListPlaceIndexesResponse where
rnf :: ListPlaceIndexesResponse -> ()
rnf ListPlaceIndexesResponse' {Int
[ListPlaceIndexesResponseEntry]
Maybe Text
entries :: [ListPlaceIndexesResponseEntry]
httpStatus :: Int
nextToken :: Maybe Text
$sel:entries:ListPlaceIndexesResponse' :: ListPlaceIndexesResponse -> [ListPlaceIndexesResponseEntry]
$sel:httpStatus:ListPlaceIndexesResponse' :: ListPlaceIndexesResponse -> Int
$sel:nextToken:ListPlaceIndexesResponse' :: ListPlaceIndexesResponse -> 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 [ListPlaceIndexesResponseEntry]
entries