Documentation
¶
Overview ¶
Package isochrones is an auto-generated package for the Isochrones API.
isochrones.googleapis.com (at http://isochrones.googleapis.com) API.
General documentation ¶
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage ¶
To get started with this package, create a client.
// go get cloud.google.com/go/maps/isochrones/apiv1@latest
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := isochrones.NewIsochroneClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.
Using the Client ¶
The following is an example of making an API call with the newly created client, mentioned above.
req := &isochronespb.GenerateIsochroneRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/maps/isochrones/apiv1/isochronespb#GenerateIsochroneRequest.
}
resp, err := c.GenerateIsochrone(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
Use of Context ¶
The ctx passed to NewIsochroneClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type IsochroneCallOptions ¶
type IsochroneCallOptions struct {
GenerateIsochrone []gax.CallOption
}
IsochroneCallOptions contains the retry settings for each method of IsochroneClient.
type IsochroneClient ¶
type IsochroneClient struct {
// The call options for this service.
CallOptions *IsochroneCallOptions
// contains filtered or unexported fields
}
IsochroneClient is a client for interacting with Isochrones API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service for calculating isochrones. An isochrone is an area of reachability from a given origin point within a specified travel time.
func NewIsochroneClient ¶
func NewIsochroneClient(ctx context.Context, opts ...option.ClientOption) (*IsochroneClient, error)
NewIsochroneClient creates a new isochrone service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service for calculating isochrones. An isochrone is an area of reachability from a given origin point within a specified travel time.
Example ¶
package main
import (
"context"
isochrones "cloud.google.com/go/maps/isochrones/apiv1"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := isochrones.NewIsochroneClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func NewIsochroneRESTClient ¶
func NewIsochroneRESTClient(ctx context.Context, opts ...option.ClientOption) (*IsochroneClient, error)
NewIsochroneRESTClient creates a new isochrone service rest client.
Service for calculating isochrones. An isochrone is an area of reachability from a given origin point within a specified travel time.
Example ¶
package main
import (
"context"
isochrones "cloud.google.com/go/maps/isochrones/apiv1"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := isochrones.NewIsochroneRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
Output:
func (*IsochroneClient) Close ¶
func (c *IsochroneClient) Close() error
Close closes the connection to the API service. **Always** call Close() when the client is no longer required.
func (*IsochroneClient) Connection
deprecated
func (c *IsochroneClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*IsochroneClient) GenerateIsochrone ¶
func (c *IsochroneClient) GenerateIsochrone(ctx context.Context, req *isochronespb.GenerateIsochroneRequest, opts ...gax.CallOption) (*isochronespb.GenerateIsochroneResponse, error)
GenerateIsochrone calculates and returns a single isochrone for a given set of parameters.
Example ¶
package main
import (
"context"
isochrones "cloud.google.com/go/maps/isochrones/apiv1"
isochronespb "cloud.google.com/go/maps/isochrones/apiv1/isochronespb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := isochrones.NewIsochroneClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &isochronespb.GenerateIsochroneRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/maps/isochrones/apiv1/isochronespb#GenerateIsochroneRequest.
}
resp, err := c.GenerateIsochrone(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Output: