Go idiomatic client for Google Maps Platform Routes PreferredAPI.
NOTE: The libraries in this repository should be considered experimental at this time and breaking changes should be expected.
NOTE: The libraries in this repository are autogenerated from the interface definitions in the googleapis/googleapis repository using Bazel.
Installation
go get developers.google.com/maps/go/routespreferred
Requirements
Create a Project
You will need a Google Cloud Platform project. Follow these instructions to get your project set up.
Enable the Routes Preferred API
You will need to enable the Google Maps Platform Routes PreferredAPI.
Enable billing
You will need to enable billing to use the Google Maps Platform Routes API.
Local development environment
You will need to set up the local development environment.
Get started quickly by installing the Google Cloud SDK and running the following commands in command line:
gcloud auth login
and gcloud config set project [YOUR PROJECT ID]
.
Authentication
Routes Preferred supports authentication by OAuth token, self-signed JWT, and API Key. This library only supports OAuth and JWT from service account credentials. You can specify OAuth with option.WithScopes("https://www.googleapis.com/auth/maps-platform.routespreferred")
or JWT with option.WithAudiences("https://routespreferred.googleapis.com/")
, though these are both set by default.
To run outside of App Engine/Compute Engine environments, download service account credentials following these instructions and point to it with option.WithCredentialsFile(...)
or the GOOGLE_APPLICATION_CREDENTIALS
environment variable. See the compute routes sample for a complete example.
App Engine/Compute Engine instances are associated with a default service account, which this library will use by default to authenticate. However, since Routes Preferred isn't a Cloud API, the cloud-platform
scope will not grant access to it. Follow these instructions to set the https://www.googleapis.com/auth/maps-platform.routespreferred
scope for your instance. Note that the scope doesn't appear on the Cloud Console, so you should use the gcloud
command line interface.
Transport
Google Maps Platform Routes Preferred API uses gRPC for the transport layer.
Versioning
This library follows Semantic Versioning.
Contributing
Contributions to this library are always welcome and highly encouraged.
See CONTRIBUTING for more information how to get started.
License
Apache 2.0 - See LICENSE for more information.