diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 648f2e6..96227f1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ # limitations under the License. name: Test -on: [push, pull_request] +on: [push, pull_request, workflow_call] jobs: build: runs-on: ubuntu-latest diff --git a/README.md b/README.md index c360fc5..98cced0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ Go Client for Google Maps Services ================================== -[![Build Status](https://travis-ci.org/googlemaps/google-maps-services-go.svg?branch=master)](https://travis-ci.org/googlemaps/google-maps-services-go) [![GoDoc](https://godoc.org/googlemaps.github.io/maps?status.svg)](https://godoc.org/googlemaps.github.io/maps) [![Go Report Card](https://goreportcard.com/badge/github.com/googlemaps/google-maps-services-go)](https://goreportcard.com/report/github.com/googlemaps/google-maps-services-go) ![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/googlemaps/google-maps-services-go) @@ -9,11 +8,9 @@ Go Client for Google Maps Services ## Description -Use Go? Want to [geocode][Geocoding API] something? Looking for [directions][Directions API]? -Maybe [matrices of directions][Distance Matrix API]? This library brings the [Google Maps API Web -Services] to your Go application. +Use Go? This library brings many [Google Maps Platform Web Services APIs] to your Go application. -The Go Client for Google Maps Services is a Go Client library for the following Google Maps +The Go Client for Google Maps Services is a Go Client library for the following Google Maps Platform APIs: - [Directions API] @@ -25,56 +22,17 @@ APIs: - [Time Zone API] - [Maps Static API] -Keep in mind that the same [terms and conditions](https://developers.google.com/maps/terms) apply -to usage of the APIs when they're accessed through this library. - -## Support - -This library is community supported. We're comfortable enough with the stability and features of -the library that we want you to build real production applications on it. We will try to support, -through Stack Overflow, the public and protected surface of the library and maintain backwards -compatibility in the future; however, while the library is in version 0.x, we reserve the right -to make backwards-incompatible changes. If we do remove some functionality (typically because -better functionality exists or if the feature proved infeasible), our intention is to deprecate -and give developers a year to update their code. - -If you find a bug, or have a feature suggestion, please [log an issue][issues]. If you'd like to -contribute, please read [How to Contribute][contrib]. +> [!TIP] +> See the [Google Maps Platform Cloud Client Library for Go](https://github.com/googleapis/google-cloud-go/tree/main/maps) for our newer APIs +> including Address Validation API, Datasets API, Fleet Engine, new Places API, and Routes API. ## Requirements - Go 1.7 or later. -- A Google Maps API key. - -### API keys - -Each Google Maps Web Service request requires an API key or client ID. API keys -are freely available with a Google Account at -[Google APIs Console][API Console]. The type of API key you need is a **Server key**. - -To get an API key: - - 1. Visit [Google APIs Console][API Console] and log in with - a Google Account. - 1. Select one of your existing projects, or create a new project. - 1. Enable the API(s) you want to use. The Go Client for Google Maps Services - accesses the following APIs: - - Directions API - - Distance Matrix API - - Elevation API - - Geocoding API - - Places API - - Roads API - - Time Zone API - - Maps Static API - 1. Create a new **Server key**. - 1. If you'd like to restrict requests to a specific IP address, do so now. - -For guided help, follow the instructions for the [Directions API][directions-key]. -You only need one API key, but remember to enable all the APIs you need. -For even more information, see the guide to [API keys][apikey]. - -**Important:** This key should be kept secret on your server. +- A Google Maps Platform [API key] from a project with the APIs below enabled. + +> [!IMPORTANT] +> This key should be kept secret on your server. ## Installation @@ -84,13 +42,11 @@ To install the Go Client for Google Maps Services, please execute the following go get googlemaps.github.io/maps ``` -## Developer Documentation +## Documentation -View the [reference documentation](https://godoc.org/googlemaps.github.io/maps) +View the [reference documentation](https://godoc.org/googlemaps.github.io/maps). -Additional documentation for the included web services is available at -[developers.google.com/maps][Maps documentation] and -[developers.google.com/places][Places documentation]. +Additional documentation about the APIs is available at: - [Directions API] - [Distance Matrix API] @@ -134,43 +90,6 @@ func main() { } ``` -Below is the same example, using client ID and client secret (digital signature) -for authentication. This code assumes you have previously loaded the `clientID` -and `clientSecret` variables with appropriate values. - -For a guide on how to generate the `clientSecret` (digital signature), see the -documentation for the API you're using. For example, see the guide for the -[Directions API][directions-client-id]. - -```go -package main - -import ( - "context" - "log" - - "github.com/kr/pretty" - "googlemaps.github.io/maps" -) - -func main() { - c, err := maps.NewClient(maps.WithClientIDAndSignature("Client ID", "Client Secret")) - if err != nil { - log.Fatalf("fatal error: %s", err) - } - r := &maps.DirectionsRequest{ - Origin: "Sydney", - Destination: "Perth", - } - route, _, err := c.Directions(context.Background(), r) - if err != nil { - log.Fatalf("fatal error: %s", err) - } - - pretty.Println(route) -} -``` - ## Features ### Rate limiting @@ -179,11 +98,6 @@ Never sleep between requests again! By default, requests are sent at the expecte each web service, typically 50 queries per second for free users. If you want to speed up or slow down requests, you can do that too, using `maps.NewClient(maps.WithAPIKey(apiKey), maps.WithRateLimit(qps))`. -### Client IDs - -Google Maps APIs Premium Plan customers can use their [client ID and secret][clientid] to authenticate, -instead of an API key. - ### Native types Native objects for each of the API responses. @@ -196,17 +110,26 @@ and `metrics.RegisterViews()` to make the metrics available to be exported. OpenCensus can export these metrics to a [variety of monitoring services](https://opencensus.io/exporters/). You can also implement your own metric reporter instead of using the provided one. -[apikey]: https://developers.google.com/maps/faq#keysystem -[clientid]: https://developers.google.com/maps/documentation/business/webservices/auth +## Terms of Service + +This library uses Google Maps Platform services, and any use of Google Maps Platform is subject to the [Terms of Service](https://cloud.google.com/maps-platform/terms). + +For clarity, this library, and each underlying component, is not a Google Maps Platform Core Service. + +## Support + +This library is offered via an open source license. It is not governed by the Google Maps Platform Support [Technical Support Services Guidelines](https://cloud.google.com/maps-platform/terms/tssg), the [SLA](https://cloud.google.com/maps-platform/terms/sla), or the [Deprecation Policy](https://cloud.google.com/maps-platform/terms) (however, any Google Maps Platform services used by the library remain subject to the Google Maps Platform Terms of Service). + +This library adheres to [semantic versioning](https://semver.org/) to indicate when backwards-incompatible changes are introduced. + +If you find a bug, or have a feature request, please [file an issue][issues] on GitHub. If you would like to get answers to technical questions from other Google Maps Platform developers, ask through one of our [developer community channels](https://developers.google.com/maps/developer-community). If you'd like to contribute, please check the [Contributing guide][contrib]. + +You can also discuss this library on our [Discord server](https://discord.gg/hYsWbmk). -[API Console]: https://developers.google.com/console -[Maps documentation]: https://developers.google.com/maps/ -[Places documentation]: https://developers.google.com/places/ +[API key]: https://developers.google.com/maps/documentation/places/web-service/get-api-key -[Google Maps API Web Services]: https://developers.google.com/maps/apis-by-platform#web_service_apis +[Google Maps Platform Web Services APIs]: https://developers.google.com/maps/apis-by-platform#web_service_apis [Directions API]: https://developers.google.com/maps/documentation/directions/ -[directions-client-id]: https://developers.google.com/maps/documentation/directions/get-api-key#client-id -[directions-key]: https://developers.google.com/maps/documentation/directions/get-api-key#key [Distance Matrix API]: https://developers.google.com/maps/documentation/distancematrix/ [Elevation API]: https://developers.google.com/maps/documentation/elevation/ [Geocoding API]: https://developers.google.com/maps/documentation/geocoding/