Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gopkg.in/maxhawkins/google-places-api.v1

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gopkg.in/maxhawkins/google-places-api.v1

  • v1.0.0-20151117105910-79d63479bf6e
  • Go
  • Socket score

Version published
Created
Source

Google Places API Client for Go

Build Status GoDoc

A Go client for the Google Places API. A work in progress, contributions welcome.

To install this package, run:

go get gopkg.in/user/pkg.v1

Example

package main

import (
    "fmt"
    "net/http"
    "time"

    "github.com/maxhawkins/google-places-api/places"
)

func main() {
    service := places.NewService(http.DefaultClient, "<your api key>")

    call := service.Nearby(37.7833, -122.4167) // San Francisco
    call.Types = append(call.Types, places.Cafe)
    call.Radius = 500

    resp, err := call.Do()
    if places.IsZeroResults(err) {
        fmt.Println("no results")
        return
    }
    if err != nil {
        panic(err)
    }

    results := resp.Results
    token := resp.NextPageToken

    for token != "" {
        time.Sleep(2 * time.Second) // Rate limit

        call.PageToken = token
        resp, err := call.Do()
        if err != nil {
            panic(err)
        }

        token = resp.NextPageToken
        results = append(results, resp.Results...)
    }

    for _, result := range results {
        fmt.Println(result.Name)
    }
}

Status

This package is a work in progress. Not all API calls are implemented.

What's done
  • Place Details
  • Nearby Search
  • Radar Search
What's not done
  • Text Search
  • Place Add
  • Place Delete
  • Place Photos
  • Place Autocomplete
  • Query Autocomplete
  • More Examples

FAQs

Package last updated on 17 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc