{-# 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.Location.SearchPlaceIndexForPosition
-- 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)
--
-- Reverse geocodes a given coordinate and returns a legible address.
-- Allows you to search for Places or points of interest near a given
-- position.
module Amazonka.Location.SearchPlaceIndexForPosition
  ( -- * Creating a Request
    SearchPlaceIndexForPosition (..),
    newSearchPlaceIndexForPosition,

    -- * Request Lenses
    searchPlaceIndexForPosition_maxResults,
    searchPlaceIndexForPosition_indexName,
    searchPlaceIndexForPosition_position,

    -- * Destructuring the Response
    SearchPlaceIndexForPositionResponse (..),
    newSearchPlaceIndexForPositionResponse,

    -- * Response Lenses
    searchPlaceIndexForPositionResponse_httpStatus,
    searchPlaceIndexForPositionResponse_results,
    searchPlaceIndexForPositionResponse_summary,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Location.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newSearchPlaceIndexForPosition' smart constructor.
data SearchPlaceIndexForPosition = SearchPlaceIndexForPosition'
  { -- | An optional paramer. The maximum number of results returned per request.
    --
    -- Default value: @50@
    SearchPlaceIndexForPosition -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
    -- | The name of the place index resource you want to use for the search.
    SearchPlaceIndexForPosition -> Text
indexName :: Prelude.Text,
    -- | Specifies a coordinate for the query defined by a longitude, and
    -- latitude.
    --
    -- -   The first position is the X coordinate, or longitude.
    --
    -- -   The second position is the Y coordinate, or latitude.
    --
    -- For example, @position=xLongitude&position=yLatitude@ .
    SearchPlaceIndexForPosition -> Sensitive (NonEmpty Double)
position :: Core.Sensitive (Prelude.NonEmpty Prelude.Double)
  }
  deriving (SearchPlaceIndexForPosition -> SearchPlaceIndexForPosition -> Bool
(SearchPlaceIndexForPosition
 -> SearchPlaceIndexForPosition -> Bool)
-> (SearchPlaceIndexForPosition
    -> SearchPlaceIndexForPosition -> Bool)
-> Eq SearchPlaceIndexForPosition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchPlaceIndexForPosition -> SearchPlaceIndexForPosition -> Bool
$c/= :: SearchPlaceIndexForPosition -> SearchPlaceIndexForPosition -> Bool
== :: SearchPlaceIndexForPosition -> SearchPlaceIndexForPosition -> Bool
$c== :: SearchPlaceIndexForPosition -> SearchPlaceIndexForPosition -> Bool
Prelude.Eq, Int -> SearchPlaceIndexForPosition -> ShowS
[SearchPlaceIndexForPosition] -> ShowS
SearchPlaceIndexForPosition -> String
(Int -> SearchPlaceIndexForPosition -> ShowS)
-> (SearchPlaceIndexForPosition -> String)
-> ([SearchPlaceIndexForPosition] -> ShowS)
-> Show SearchPlaceIndexForPosition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchPlaceIndexForPosition] -> ShowS
$cshowList :: [SearchPlaceIndexForPosition] -> ShowS
show :: SearchPlaceIndexForPosition -> String
$cshow :: SearchPlaceIndexForPosition -> String
showsPrec :: Int -> SearchPlaceIndexForPosition -> ShowS
$cshowsPrec :: Int -> SearchPlaceIndexForPosition -> ShowS
Prelude.Show, (forall x.
 SearchPlaceIndexForPosition -> Rep SearchPlaceIndexForPosition x)
-> (forall x.
    Rep SearchPlaceIndexForPosition x -> SearchPlaceIndexForPosition)
-> Generic SearchPlaceIndexForPosition
forall x.
Rep SearchPlaceIndexForPosition x -> SearchPlaceIndexForPosition
forall x.
SearchPlaceIndexForPosition -> Rep SearchPlaceIndexForPosition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SearchPlaceIndexForPosition x -> SearchPlaceIndexForPosition
$cfrom :: forall x.
SearchPlaceIndexForPosition -> Rep SearchPlaceIndexForPosition x
Prelude.Generic)

-- |
-- Create a value of 'SearchPlaceIndexForPosition' 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:
--
-- 'maxResults', 'searchPlaceIndexForPosition_maxResults' - An optional paramer. The maximum number of results returned per request.
--
-- Default value: @50@
--
-- 'indexName', 'searchPlaceIndexForPosition_indexName' - The name of the place index resource you want to use for the search.
--
-- 'position', 'searchPlaceIndexForPosition_position' - Specifies a coordinate for the query defined by a longitude, and
-- latitude.
--
-- -   The first position is the X coordinate, or longitude.
--
-- -   The second position is the Y coordinate, or latitude.
--
-- For example, @position=xLongitude&position=yLatitude@ .
newSearchPlaceIndexForPosition ::
  -- | 'indexName'
  Prelude.Text ->
  -- | 'position'
  Prelude.NonEmpty Prelude.Double ->
  SearchPlaceIndexForPosition
newSearchPlaceIndexForPosition :: Text -> NonEmpty Double -> SearchPlaceIndexForPosition
newSearchPlaceIndexForPosition Text
pIndexName_ NonEmpty Double
pPosition_ =
  SearchPlaceIndexForPosition' :: Maybe Natural
-> Text
-> Sensitive (NonEmpty Double)
-> SearchPlaceIndexForPosition
SearchPlaceIndexForPosition'
    { $sel:maxResults:SearchPlaceIndexForPosition' :: Maybe Natural
maxResults =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:indexName:SearchPlaceIndexForPosition' :: Text
indexName = Text
pIndexName_,
      $sel:position:SearchPlaceIndexForPosition' :: Sensitive (NonEmpty Double)
position =
        Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
     (Sensitive (NonEmpty Double))
     (Identity (Sensitive (NonEmpty Double)))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
 -> Tagged
      (Sensitive (NonEmpty Double))
      (Identity (Sensitive (NonEmpty Double))))
-> (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
    -> Tagged (NonEmpty Double) (Identity (NonEmpty Double)))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged
     (Sensitive (NonEmpty Double))
     (Identity (Sensitive (NonEmpty Double)))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Tagged (NonEmpty Double) (Identity (NonEmpty Double))
-> Tagged (NonEmpty Double) (Identity (NonEmpty Double))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
          (Tagged (NonEmpty Double) (Identity (NonEmpty Double))
 -> Tagged
      (Sensitive (NonEmpty Double))
      (Identity (Sensitive (NonEmpty Double))))
-> NonEmpty Double -> Sensitive (NonEmpty Double)
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Double
pPosition_
    }

-- | An optional paramer. The maximum number of results returned per request.
--
-- Default value: @50@
searchPlaceIndexForPosition_maxResults :: Lens.Lens' SearchPlaceIndexForPosition (Prelude.Maybe Prelude.Natural)
searchPlaceIndexForPosition_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> SearchPlaceIndexForPosition -> f SearchPlaceIndexForPosition
searchPlaceIndexForPosition_maxResults = (SearchPlaceIndexForPosition -> Maybe Natural)
-> (SearchPlaceIndexForPosition
    -> Maybe Natural -> SearchPlaceIndexForPosition)
-> Lens
     SearchPlaceIndexForPosition
     SearchPlaceIndexForPosition
     (Maybe Natural)
     (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchPlaceIndexForPosition' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: SearchPlaceIndexForPosition
s@SearchPlaceIndexForPosition' {} Maybe Natural
a -> SearchPlaceIndexForPosition
s {$sel:maxResults:SearchPlaceIndexForPosition' :: Maybe Natural
maxResults = Maybe Natural
a} :: SearchPlaceIndexForPosition)

-- | The name of the place index resource you want to use for the search.
searchPlaceIndexForPosition_indexName :: Lens.Lens' SearchPlaceIndexForPosition Prelude.Text
searchPlaceIndexForPosition_indexName :: (Text -> f Text)
-> SearchPlaceIndexForPosition -> f SearchPlaceIndexForPosition
searchPlaceIndexForPosition_indexName = (SearchPlaceIndexForPosition -> Text)
-> (SearchPlaceIndexForPosition
    -> Text -> SearchPlaceIndexForPosition)
-> Lens
     SearchPlaceIndexForPosition SearchPlaceIndexForPosition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchPlaceIndexForPosition' {Text
indexName :: Text
$sel:indexName:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Text
indexName} -> Text
indexName) (\s :: SearchPlaceIndexForPosition
s@SearchPlaceIndexForPosition' {} Text
a -> SearchPlaceIndexForPosition
s {$sel:indexName:SearchPlaceIndexForPosition' :: Text
indexName = Text
a} :: SearchPlaceIndexForPosition)

-- | Specifies a coordinate for the query defined by a longitude, and
-- latitude.
--
-- -   The first position is the X coordinate, or longitude.
--
-- -   The second position is the Y coordinate, or latitude.
--
-- For example, @position=xLongitude&position=yLatitude@ .
searchPlaceIndexForPosition_position :: Lens.Lens' SearchPlaceIndexForPosition (Prelude.NonEmpty Prelude.Double)
searchPlaceIndexForPosition_position :: (NonEmpty Double -> f (NonEmpty Double))
-> SearchPlaceIndexForPosition -> f SearchPlaceIndexForPosition
searchPlaceIndexForPosition_position = (SearchPlaceIndexForPosition -> Sensitive (NonEmpty Double))
-> (SearchPlaceIndexForPosition
    -> Sensitive (NonEmpty Double) -> SearchPlaceIndexForPosition)
-> Lens
     SearchPlaceIndexForPosition
     SearchPlaceIndexForPosition
     (Sensitive (NonEmpty Double))
     (Sensitive (NonEmpty Double))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchPlaceIndexForPosition' {Sensitive (NonEmpty Double)
position :: Sensitive (NonEmpty Double)
$sel:position:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Sensitive (NonEmpty Double)
position} -> Sensitive (NonEmpty Double)
position) (\s :: SearchPlaceIndexForPosition
s@SearchPlaceIndexForPosition' {} Sensitive (NonEmpty Double)
a -> SearchPlaceIndexForPosition
s {$sel:position:SearchPlaceIndexForPosition' :: Sensitive (NonEmpty Double)
position = Sensitive (NonEmpty Double)
a} :: SearchPlaceIndexForPosition) ((Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
 -> SearchPlaceIndexForPosition -> f SearchPlaceIndexForPosition)
-> ((NonEmpty Double -> f (NonEmpty Double))
    -> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> (NonEmpty Double -> f (NonEmpty Double))
-> SearchPlaceIndexForPosition
-> f SearchPlaceIndexForPosition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double))
forall a. Iso' (Sensitive a) a
Core._Sensitive ((NonEmpty Double -> f (NonEmpty Double))
 -> Sensitive (NonEmpty Double) -> f (Sensitive (NonEmpty Double)))
-> ((NonEmpty Double -> f (NonEmpty Double))
    -> NonEmpty Double -> f (NonEmpty Double))
-> (NonEmpty Double -> f (NonEmpty Double))
-> Sensitive (NonEmpty Double)
-> f (Sensitive (NonEmpty Double))
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Double -> f (NonEmpty Double))
-> NonEmpty Double -> f (NonEmpty Double)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest SearchPlaceIndexForPosition where
  type
    AWSResponse SearchPlaceIndexForPosition =
      SearchPlaceIndexForPositionResponse
  request :: SearchPlaceIndexForPosition -> Request SearchPlaceIndexForPosition
request = Service
-> SearchPlaceIndexForPosition
-> Request SearchPlaceIndexForPosition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy SearchPlaceIndexForPosition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SearchPlaceIndexForPosition)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse SearchPlaceIndexForPosition))
-> Logger
-> Service
-> Proxy SearchPlaceIndexForPosition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SearchPlaceIndexForPosition)))
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 ->
          Int
-> [SearchForPositionResult]
-> SearchPlaceIndexForPositionSummary
-> SearchPlaceIndexForPositionResponse
SearchPlaceIndexForPositionResponse'
            (Int
 -> [SearchForPositionResult]
 -> SearchPlaceIndexForPositionSummary
 -> SearchPlaceIndexForPositionResponse)
-> Either String Int
-> Either
     String
     ([SearchForPositionResult]
      -> SearchPlaceIndexForPositionSummary
      -> SearchPlaceIndexForPositionResponse)
forall (f :: * -> *) a b. Functor 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))
            Either
  String
  ([SearchForPositionResult]
   -> SearchPlaceIndexForPositionSummary
   -> SearchPlaceIndexForPositionResponse)
-> Either String [SearchForPositionResult]
-> Either
     String
     (SearchPlaceIndexForPositionSummary
      -> SearchPlaceIndexForPositionResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [SearchForPositionResult])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Results" Either String (Maybe [SearchForPositionResult])
-> [SearchForPositionResult]
-> Either String [SearchForPositionResult]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [SearchForPositionResult]
forall a. Monoid a => a
Prelude.mempty)
            Either
  String
  (SearchPlaceIndexForPositionSummary
   -> SearchPlaceIndexForPositionResponse)
-> Either String SearchPlaceIndexForPositionSummary
-> Either String SearchPlaceIndexForPositionResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String SearchPlaceIndexForPositionSummary
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"Summary")
      )

instance Prelude.Hashable SearchPlaceIndexForPosition

instance Prelude.NFData SearchPlaceIndexForPosition

instance Core.ToHeaders SearchPlaceIndexForPosition where
  toHeaders :: SearchPlaceIndexForPosition -> ResponseHeaders
toHeaders =
    ResponseHeaders -> SearchPlaceIndexForPosition -> 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.ToJSON SearchPlaceIndexForPosition where
  toJSON :: SearchPlaceIndexForPosition -> Value
toJSON SearchPlaceIndexForPosition' {Maybe Natural
Text
Sensitive (NonEmpty Double)
position :: Sensitive (NonEmpty Double)
indexName :: Text
maxResults :: Maybe Natural
$sel:position:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Sensitive (NonEmpty Double)
$sel:indexName:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Text
$sel:maxResults:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Maybe Natural
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Position" Text -> Sensitive (NonEmpty Double) -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive (NonEmpty Double)
position)
          ]
      )

instance Core.ToPath SearchPlaceIndexForPosition where
  toPath :: SearchPlaceIndexForPosition -> ByteString
toPath SearchPlaceIndexForPosition' {Maybe Natural
Text
Sensitive (NonEmpty Double)
position :: Sensitive (NonEmpty Double)
indexName :: Text
maxResults :: Maybe Natural
$sel:position:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Sensitive (NonEmpty Double)
$sel:indexName:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Text
$sel:maxResults:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Maybe Natural
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/places/v0/indexes/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
indexName,
        ByteString
"/search/position"
      ]

instance Core.ToQuery SearchPlaceIndexForPosition where
  toQuery :: SearchPlaceIndexForPosition -> QueryString
toQuery = QueryString -> SearchPlaceIndexForPosition -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newSearchPlaceIndexForPositionResponse' smart constructor.
data SearchPlaceIndexForPositionResponse = SearchPlaceIndexForPositionResponse'
  { -- | The response's http status code.
    SearchPlaceIndexForPositionResponse -> Int
httpStatus :: Prelude.Int,
    -- | Returns a list of Places closest to the specified position. Each result
    -- contains additional information about the Places returned.
    SearchPlaceIndexForPositionResponse -> [SearchForPositionResult]
results :: [SearchForPositionResult],
    -- | Contains a summary of the request.
    SearchPlaceIndexForPositionResponse
-> SearchPlaceIndexForPositionSummary
summary :: SearchPlaceIndexForPositionSummary
  }
  deriving (SearchPlaceIndexForPositionResponse
-> SearchPlaceIndexForPositionResponse -> Bool
(SearchPlaceIndexForPositionResponse
 -> SearchPlaceIndexForPositionResponse -> Bool)
-> (SearchPlaceIndexForPositionResponse
    -> SearchPlaceIndexForPositionResponse -> Bool)
-> Eq SearchPlaceIndexForPositionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SearchPlaceIndexForPositionResponse
-> SearchPlaceIndexForPositionResponse -> Bool
$c/= :: SearchPlaceIndexForPositionResponse
-> SearchPlaceIndexForPositionResponse -> Bool
== :: SearchPlaceIndexForPositionResponse
-> SearchPlaceIndexForPositionResponse -> Bool
$c== :: SearchPlaceIndexForPositionResponse
-> SearchPlaceIndexForPositionResponse -> Bool
Prelude.Eq, Int -> SearchPlaceIndexForPositionResponse -> ShowS
[SearchPlaceIndexForPositionResponse] -> ShowS
SearchPlaceIndexForPositionResponse -> String
(Int -> SearchPlaceIndexForPositionResponse -> ShowS)
-> (SearchPlaceIndexForPositionResponse -> String)
-> ([SearchPlaceIndexForPositionResponse] -> ShowS)
-> Show SearchPlaceIndexForPositionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SearchPlaceIndexForPositionResponse] -> ShowS
$cshowList :: [SearchPlaceIndexForPositionResponse] -> ShowS
show :: SearchPlaceIndexForPositionResponse -> String
$cshow :: SearchPlaceIndexForPositionResponse -> String
showsPrec :: Int -> SearchPlaceIndexForPositionResponse -> ShowS
$cshowsPrec :: Int -> SearchPlaceIndexForPositionResponse -> ShowS
Prelude.Show, (forall x.
 SearchPlaceIndexForPositionResponse
 -> Rep SearchPlaceIndexForPositionResponse x)
-> (forall x.
    Rep SearchPlaceIndexForPositionResponse x
    -> SearchPlaceIndexForPositionResponse)
-> Generic SearchPlaceIndexForPositionResponse
forall x.
Rep SearchPlaceIndexForPositionResponse x
-> SearchPlaceIndexForPositionResponse
forall x.
SearchPlaceIndexForPositionResponse
-> Rep SearchPlaceIndexForPositionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep SearchPlaceIndexForPositionResponse x
-> SearchPlaceIndexForPositionResponse
$cfrom :: forall x.
SearchPlaceIndexForPositionResponse
-> Rep SearchPlaceIndexForPositionResponse x
Prelude.Generic)

-- |
-- Create a value of 'SearchPlaceIndexForPositionResponse' 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:
--
-- 'httpStatus', 'searchPlaceIndexForPositionResponse_httpStatus' - The response's http status code.
--
-- 'results', 'searchPlaceIndexForPositionResponse_results' - Returns a list of Places closest to the specified position. Each result
-- contains additional information about the Places returned.
--
-- 'summary', 'searchPlaceIndexForPositionResponse_summary' - Contains a summary of the request.
newSearchPlaceIndexForPositionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'summary'
  SearchPlaceIndexForPositionSummary ->
  SearchPlaceIndexForPositionResponse
newSearchPlaceIndexForPositionResponse :: Int
-> SearchPlaceIndexForPositionSummary
-> SearchPlaceIndexForPositionResponse
newSearchPlaceIndexForPositionResponse
  Int
pHttpStatus_
  SearchPlaceIndexForPositionSummary
pSummary_ =
    SearchPlaceIndexForPositionResponse' :: Int
-> [SearchForPositionResult]
-> SearchPlaceIndexForPositionSummary
-> SearchPlaceIndexForPositionResponse
SearchPlaceIndexForPositionResponse'
      { $sel:httpStatus:SearchPlaceIndexForPositionResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:results:SearchPlaceIndexForPositionResponse' :: [SearchForPositionResult]
results = [SearchForPositionResult]
forall a. Monoid a => a
Prelude.mempty,
        $sel:summary:SearchPlaceIndexForPositionResponse' :: SearchPlaceIndexForPositionSummary
summary = SearchPlaceIndexForPositionSummary
pSummary_
      }

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

-- | Returns a list of Places closest to the specified position. Each result
-- contains additional information about the Places returned.
searchPlaceIndexForPositionResponse_results :: Lens.Lens' SearchPlaceIndexForPositionResponse [SearchForPositionResult]
searchPlaceIndexForPositionResponse_results :: ([SearchForPositionResult] -> f [SearchForPositionResult])
-> SearchPlaceIndexForPositionResponse
-> f SearchPlaceIndexForPositionResponse
searchPlaceIndexForPositionResponse_results = (SearchPlaceIndexForPositionResponse -> [SearchForPositionResult])
-> (SearchPlaceIndexForPositionResponse
    -> [SearchForPositionResult]
    -> SearchPlaceIndexForPositionResponse)
-> Lens
     SearchPlaceIndexForPositionResponse
     SearchPlaceIndexForPositionResponse
     [SearchForPositionResult]
     [SearchForPositionResult]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchPlaceIndexForPositionResponse' {[SearchForPositionResult]
results :: [SearchForPositionResult]
$sel:results:SearchPlaceIndexForPositionResponse' :: SearchPlaceIndexForPositionResponse -> [SearchForPositionResult]
results} -> [SearchForPositionResult]
results) (\s :: SearchPlaceIndexForPositionResponse
s@SearchPlaceIndexForPositionResponse' {} [SearchForPositionResult]
a -> SearchPlaceIndexForPositionResponse
s {$sel:results:SearchPlaceIndexForPositionResponse' :: [SearchForPositionResult]
results = [SearchForPositionResult]
a} :: SearchPlaceIndexForPositionResponse) (([SearchForPositionResult] -> f [SearchForPositionResult])
 -> SearchPlaceIndexForPositionResponse
 -> f SearchPlaceIndexForPositionResponse)
-> (([SearchForPositionResult] -> f [SearchForPositionResult])
    -> [SearchForPositionResult] -> f [SearchForPositionResult])
-> ([SearchForPositionResult] -> f [SearchForPositionResult])
-> SearchPlaceIndexForPositionResponse
-> f SearchPlaceIndexForPositionResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([SearchForPositionResult] -> f [SearchForPositionResult])
-> [SearchForPositionResult] -> f [SearchForPositionResult]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Contains a summary of the request.
searchPlaceIndexForPositionResponse_summary :: Lens.Lens' SearchPlaceIndexForPositionResponse SearchPlaceIndexForPositionSummary
searchPlaceIndexForPositionResponse_summary :: (SearchPlaceIndexForPositionSummary
 -> f SearchPlaceIndexForPositionSummary)
-> SearchPlaceIndexForPositionResponse
-> f SearchPlaceIndexForPositionResponse
searchPlaceIndexForPositionResponse_summary = (SearchPlaceIndexForPositionResponse
 -> SearchPlaceIndexForPositionSummary)
-> (SearchPlaceIndexForPositionResponse
    -> SearchPlaceIndexForPositionSummary
    -> SearchPlaceIndexForPositionResponse)
-> Lens
     SearchPlaceIndexForPositionResponse
     SearchPlaceIndexForPositionResponse
     SearchPlaceIndexForPositionSummary
     SearchPlaceIndexForPositionSummary
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchPlaceIndexForPositionResponse' {SearchPlaceIndexForPositionSummary
summary :: SearchPlaceIndexForPositionSummary
$sel:summary:SearchPlaceIndexForPositionResponse' :: SearchPlaceIndexForPositionResponse
-> SearchPlaceIndexForPositionSummary
summary} -> SearchPlaceIndexForPositionSummary
summary) (\s :: SearchPlaceIndexForPositionResponse
s@SearchPlaceIndexForPositionResponse' {} SearchPlaceIndexForPositionSummary
a -> SearchPlaceIndexForPositionResponse
s {$sel:summary:SearchPlaceIndexForPositionResponse' :: SearchPlaceIndexForPositionSummary
summary = SearchPlaceIndexForPositionSummary
a} :: SearchPlaceIndexForPositionResponse)

instance
  Prelude.NFData
    SearchPlaceIndexForPositionResponse