Elevate Your App's Experience with Google Places API on Hypi's Low-Code Platform
Explore Hypi's serverless functions
written by:
Courtney Robinson
If you're looking to supercharge your application with location-based insights and information, the Google Places API is your go-to solution. This robust function opens up a world of possibilities, allowing you to seamlessly integrate Google's wealth of location data into your Hypi GraphQL queries and mutations.
Usage Made Simple
Integrating the Google Places API is as straightforward as adding a function to your Hypi Query
or Mutation
types under the schema. Whether you're creating new types or modifying existing ones, the flexibility of this integration ensures a smooth implementation.
type Query {
findGooglePlaces(action: String, radius: Int!, lat: Float!, long: Float!): Json @fn(name: "google-places", version: "v1.1", src: hypi, env: ["GOOGLE_PLACES_KEY"])
}
Feel free to customize the function name (findGooglePlaces
in this example) to suit your preferences. The return type is Json
, but you have the option to create a custom type matching the structure returned by the function.
Environmental Essentials
To get started, you'll need to set up a crucial environment variable: GOOGLE_PLACES_KEY
. This key acts as your golden ticket to access the Google Places API. Ensure you create this environment variable in your Hypi app, providing the key's value for each instance utilizing the function.
Action-Packed Arguments
The power of the Google Places API lies in its versatility, thanks to a range of supported actions and their associated arguments. Let's dive into the key actions:
-
Details Action
placeid
: Google place IDfields
: List of fields needed for the requested place- Details Documentation
-
Photo Action
photoreference
: Reference obtained from thesearch-nearby
actionmaxheight
andmaxwidth
: Integer values between 1 and 1600- Photo Documentation
-
Search Nearby Next Page Action
nextpagetoken
: Pagination token returned by the Google Places API, used to fetch the next set of results- Search Nearby Next Page Documentation
-
Search Nearby Action
lat
: The latitudelong
: The longituderadius
: Meters from lat/long (max is 50K)keyword
: Search keywordopennow
: Only return places that are open nowrankby
: Supported values:PROMINENCE
orDISTANCE
minprice
andmaxprice
: Supported values:FREE
,INEXPENSIVE
,MODERATE
,EXPENSIVE
,VERY_EXPENSIVE
type
: Supported values (examples):RESTAURANT
GROCERY_OR_SUPERMARKET
PHARMACY
- and many more
- Search Nearby Documentation
Embrace the power of Google Places API, and elevate your application's location-based capabilities to new heights. Your users will thank you for the enriched experience!
Ready to transform your app with location-based magic? Dive into the Google Places API integration and unlock a new realm of possibilities. Get involved today and redefine user experiences like never before!
See more details on github/fn-google-places