npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ga1az/google-places-client

v0.0.1

Published

Google places client (new) interface

Downloads

2

Readme

google-places-client

a simple client for the google places api (NEW) written in typescript fully typed.

The methods are documented in the API Reference section.

Installation

To install dependencies:

bun install

Usage

First, import the PlacesClient and create an instance:

import { PlacesClient } from "google-places-client";

const client = new PlacesClient({ apiKey: TOKEN });

API Reference

Nearby Search

A Nearby Search (New) request takes one or more place types, and returns a list of matching places within the specified area. A field mask specifying one or more data types is required. Nearby Search (New) only supports POST requests.

await client.nearbySearch.execute(
  {
    locationRestriction: {
      circle: {
        center: {
          latitude: 37.7937,
          longitude: -122.3965,
        },
        radius: 500,
      },
    },
  },
  ["places.displayName"]
);

Text Search

A Text Search (New) returns information about a set of places based on a string — for example "pizza in New York" or "shoe stores near Ottawa" or "123 Main Street". The service responds with a list of places matching the text string and any location bias that has been set.

await client.textSearch.execute(
  {
    textQuery: "pizza in New York",
    pageSize: 5,
    locationBias: {
      circle: {
        center: { latitude: 37.7937, longitude: -122.3965 },
        radius: 500.0,
      },
    },
  },
  ["places.displayName", "places.allowsDogs"]
);

Place Details

Once you have a place ID, you can request more details about a particular establishment or point of interest by initiating a Place Details (New) request. A Place Details (New) request returns more comprehensive information about the indicated place such as its complete address, phone number, user rating and reviews.

await client.placeDetails.execute("ChIJj61dQgK6j4AR4GeTYWZsKWw", ["id"]);

Autocomplete

The Autocomplete (New) service is a web service that returns place predictions and query predictions in response to an HTTP request. In the request, specify a text search string and geographic bounds that controls the search area.

await client.autocomplete.execute({
  input: "pizza",
  languageCode: ["hi"],
});