{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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_language,
    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.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

-- | /See:/ 'newSearchPlaceIndexForPosition' smart constructor.
data SearchPlaceIndexForPosition = SearchPlaceIndexForPosition'
  { -- | The preferred language used to return results. The value must be a valid
    -- <https://tools.ietf.org/search/bcp47 BCP 47> language tag, for example,
    -- @en@ for English.
    --
    -- This setting affects the languages used in the results, but not the
    -- results themselves. If no language is specified, or not supported for a
    -- particular result, the partner automatically chooses a language for the
    -- result.
    --
    -- For an example, we\'ll use the Greek language. You search for a location
    -- around Athens, Greece, with the @language@ parameter set to @en@. The
    -- @city@ in the results will most likely be returned as @Athens@.
    --
    -- If you set the @language@ parameter to @el@, for Greek, then the @city@
    -- in the results will more likely be returned as @Αθήνα@.
    --
    -- If the data provider does not have a value for Greek, the result will be
    -- in a language that the provider does support.
    SearchPlaceIndexForPosition -> Maybe Text
language :: Prelude.Maybe Prelude.Text,
    -- | An optional parameter. 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 the longitude and latitude of the position to query.
    --
    -- This parameter must contain a pair of numbers. The first number
    -- represents the X coordinate, or longitude; the second number represents
    -- the Y coordinate, or latitude.
    --
    -- For example, @[-123.1174, 49.2847]@ represents a position with longitude
    -- @-123.1174@ and latitude @49.2847@.
    SearchPlaceIndexForPosition -> Sensitive (NonEmpty Double)
position :: Data.Sensitive (Prelude.NonEmpty Prelude.Double)
  }
  deriving (SearchPlaceIndexForPosition -> SearchPlaceIndexForPosition -> Bool
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
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.
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:
--
-- 'language', 'searchPlaceIndexForPosition_language' - The preferred language used to return results. The value must be a valid
-- <https://tools.ietf.org/search/bcp47 BCP 47> language tag, for example,
-- @en@ for English.
--
-- This setting affects the languages used in the results, but not the
-- results themselves. If no language is specified, or not supported for a
-- particular result, the partner automatically chooses a language for the
-- result.
--
-- For an example, we\'ll use the Greek language. You search for a location
-- around Athens, Greece, with the @language@ parameter set to @en@. The
-- @city@ in the results will most likely be returned as @Athens@.
--
-- If you set the @language@ parameter to @el@, for Greek, then the @city@
-- in the results will more likely be returned as @Αθήνα@.
--
-- If the data provider does not have a value for Greek, the result will be
-- in a language that the provider does support.
--
-- 'maxResults', 'searchPlaceIndexForPosition_maxResults' - An optional parameter. 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 the longitude and latitude of the position to query.
--
-- This parameter must contain a pair of numbers. The first number
-- represents the X coordinate, or longitude; the second number represents
-- the Y coordinate, or latitude.
--
-- For example, @[-123.1174, 49.2847]@ represents a position with longitude
-- @-123.1174@ and latitude @49.2847@.
newSearchPlaceIndexForPosition ::
  -- | 'indexName'
  Prelude.Text ->
  -- | 'position'
  Prelude.NonEmpty Prelude.Double ->
  SearchPlaceIndexForPosition
newSearchPlaceIndexForPosition :: Text -> NonEmpty Double -> SearchPlaceIndexForPosition
newSearchPlaceIndexForPosition Text
pIndexName_ NonEmpty Double
pPosition_ =
  SearchPlaceIndexForPosition'
    { $sel:language:SearchPlaceIndexForPosition' :: Maybe Text
language =
        forall a. Maybe a
Prelude.Nothing,
      $sel:maxResults:SearchPlaceIndexForPosition' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
      $sel:indexName:SearchPlaceIndexForPosition' :: Text
indexName = Text
pIndexName_,
      $sel:position:SearchPlaceIndexForPosition' :: Sensitive (NonEmpty Double)
position =
        forall a. Iso' (Sensitive a) a
Data._Sensitive
          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
          forall t b. AReview t b -> b -> t
Lens.# NonEmpty Double
pPosition_
    }

-- | The preferred language used to return results. The value must be a valid
-- <https://tools.ietf.org/search/bcp47 BCP 47> language tag, for example,
-- @en@ for English.
--
-- This setting affects the languages used in the results, but not the
-- results themselves. If no language is specified, or not supported for a
-- particular result, the partner automatically chooses a language for the
-- result.
--
-- For an example, we\'ll use the Greek language. You search for a location
-- around Athens, Greece, with the @language@ parameter set to @en@. The
-- @city@ in the results will most likely be returned as @Athens@.
--
-- If you set the @language@ parameter to @el@, for Greek, then the @city@
-- in the results will more likely be returned as @Αθήνα@.
--
-- If the data provider does not have a value for Greek, the result will be
-- in a language that the provider does support.
searchPlaceIndexForPosition_language :: Lens.Lens' SearchPlaceIndexForPosition (Prelude.Maybe Prelude.Text)
searchPlaceIndexForPosition_language :: Lens' SearchPlaceIndexForPosition (Maybe Text)
searchPlaceIndexForPosition_language = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SearchPlaceIndexForPosition' {Maybe Text
language :: Maybe Text
$sel:language:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Maybe Text
language} -> Maybe Text
language) (\s :: SearchPlaceIndexForPosition
s@SearchPlaceIndexForPosition' {} Maybe Text
a -> SearchPlaceIndexForPosition
s {$sel:language:SearchPlaceIndexForPosition' :: Maybe Text
language = Maybe Text
a} :: SearchPlaceIndexForPosition)

-- | An optional parameter. The maximum number of results returned per
-- request.
--
-- Default value: @50@
searchPlaceIndexForPosition_maxResults :: Lens.Lens' SearchPlaceIndexForPosition (Prelude.Maybe Prelude.Natural)
searchPlaceIndexForPosition_maxResults :: Lens' SearchPlaceIndexForPosition (Maybe Natural)
searchPlaceIndexForPosition_maxResults = 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 :: Lens' SearchPlaceIndexForPosition Text
searchPlaceIndexForPosition_indexName = 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 the longitude and latitude of the position to query.
--
-- This parameter must contain a pair of numbers. The first number
-- represents the X coordinate, or longitude; the second number represents
-- the Y coordinate, or latitude.
--
-- For example, @[-123.1174, 49.2847]@ represents a position with longitude
-- @-123.1174@ and latitude @49.2847@.
searchPlaceIndexForPosition_position :: Lens.Lens' SearchPlaceIndexForPosition (Prelude.NonEmpty Prelude.Double)
searchPlaceIndexForPosition_position :: Lens' SearchPlaceIndexForPosition (NonEmpty Double)
searchPlaceIndexForPosition_position = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. Iso' (Sensitive a) a
Data._Sensitive 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 Core.AWSRequest SearchPlaceIndexForPosition where
  type
    AWSResponse SearchPlaceIndexForPosition =
      SearchPlaceIndexForPositionResponse
  request :: (Service -> Service)
-> SearchPlaceIndexForPosition
-> Request SearchPlaceIndexForPosition
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 SearchPlaceIndexForPosition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse SearchPlaceIndexForPosition)))
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 ->
          Int
-> [SearchForPositionResult]
-> SearchPlaceIndexForPositionSummary
-> SearchPlaceIndexForPositionResponse
SearchPlaceIndexForPositionResponse'
            forall (f :: * -> *) a b. Functor 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
"Results" 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 a
Data..:> Key
"Summary")
      )

instance Prelude.Hashable SearchPlaceIndexForPosition where
  hashWithSalt :: Int -> SearchPlaceIndexForPosition -> Int
hashWithSalt Int
_salt SearchPlaceIndexForPosition' {Maybe Natural
Maybe Text
Text
Sensitive (NonEmpty Double)
position :: Sensitive (NonEmpty Double)
indexName :: Text
maxResults :: Maybe Natural
language :: Maybe Text
$sel:position:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Sensitive (NonEmpty Double)
$sel:indexName:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Text
$sel:maxResults:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Maybe Natural
$sel:language:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
language
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
indexName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Sensitive (NonEmpty Double)
position

instance Prelude.NFData SearchPlaceIndexForPosition where
  rnf :: SearchPlaceIndexForPosition -> ()
rnf SearchPlaceIndexForPosition' {Maybe Natural
Maybe Text
Text
Sensitive (NonEmpty Double)
position :: Sensitive (NonEmpty Double)
indexName :: Text
maxResults :: Maybe Natural
language :: Maybe Text
$sel:position:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Sensitive (NonEmpty Double)
$sel:indexName:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Text
$sel:maxResults:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Maybe Natural
$sel:language:SearchPlaceIndexForPosition' :: SearchPlaceIndexForPosition -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
language
      seq :: forall a b. a -> b -> b
`Prelude.seq` 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 Text
indexName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Sensitive (NonEmpty Double)
position

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

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

instance Data.ToQuery SearchPlaceIndexForPosition where
  toQuery :: SearchPlaceIndexForPosition -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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. Echoes the input values for
    -- @Position@, @Language@, @MaxResults@, and the @DataSource@ of the place
    -- index.
    SearchPlaceIndexForPositionResponse
-> SearchPlaceIndexForPositionSummary
summary :: SearchPlaceIndexForPositionSummary
  }
  deriving (SearchPlaceIndexForPositionResponse
-> SearchPlaceIndexForPositionResponse -> Bool
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
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.
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. Echoes the input values for
-- @Position@, @Language@, @MaxResults@, and the @DataSource@ of the place
-- index.
newSearchPlaceIndexForPositionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'summary'
  SearchPlaceIndexForPositionSummary ->
  SearchPlaceIndexForPositionResponse
newSearchPlaceIndexForPositionResponse :: Int
-> SearchPlaceIndexForPositionSummary
-> SearchPlaceIndexForPositionResponse
newSearchPlaceIndexForPositionResponse
  Int
pHttpStatus_
  SearchPlaceIndexForPositionSummary
pSummary_ =
    SearchPlaceIndexForPositionResponse'
      { $sel:httpStatus:SearchPlaceIndexForPositionResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:results:SearchPlaceIndexForPositionResponse' :: [SearchForPositionResult]
results = 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 :: Lens' SearchPlaceIndexForPositionResponse Int
searchPlaceIndexForPositionResponse_httpStatus = 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 :: Lens' SearchPlaceIndexForPositionResponse [SearchForPositionResult]
searchPlaceIndexForPositionResponse_results = 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) 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

-- | Contains a summary of the request. Echoes the input values for
-- @Position@, @Language@, @MaxResults@, and the @DataSource@ of the place
-- index.
searchPlaceIndexForPositionResponse_summary :: Lens.Lens' SearchPlaceIndexForPositionResponse SearchPlaceIndexForPositionSummary
searchPlaceIndexForPositionResponse_summary :: Lens'
  SearchPlaceIndexForPositionResponse
  SearchPlaceIndexForPositionSummary
searchPlaceIndexForPositionResponse_summary = 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
  where
  rnf :: SearchPlaceIndexForPositionResponse -> ()
rnf SearchPlaceIndexForPositionResponse' {Int
[SearchForPositionResult]
SearchPlaceIndexForPositionSummary
summary :: SearchPlaceIndexForPositionSummary
results :: [SearchForPositionResult]
httpStatus :: Int
$sel:summary:SearchPlaceIndexForPositionResponse' :: SearchPlaceIndexForPositionResponse
-> SearchPlaceIndexForPositionSummary
$sel:results:SearchPlaceIndexForPositionResponse' :: SearchPlaceIndexForPositionResponse -> [SearchForPositionResult]
$sel:httpStatus:SearchPlaceIndexForPositionResponse' :: SearchPlaceIndexForPositionResponse -> Int
..} =
    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 [SearchForPositionResult]
results
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SearchPlaceIndexForPositionSummary
summary