Package publish is an auto-generated package for the Street View Publish API.
Publishes 360 photos to Google Maps, along with position, orientation, and connectivity metadata. Apps can offer an interface for positioning, connecting, and uploading user-generated Street View images.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
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.
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 := publish.NewStreetViewPublishClient(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.
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 := publish.NewStreetViewPublishClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &publishpb.BatchDeletePhotosRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#BatchDeletePhotosRequest. } resp, err := c.BatchDeletePhotos(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewStreetViewPublishClient 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.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
CreatePhotoSequenceOperation
type CreatePhotoSequenceOperation struct {
// contains filtered or unexported fields
}
CreatePhotoSequenceOperation manages a long-running operation from CreatePhotoSequence.
func (*CreatePhotoSequenceOperation) Done
func (op *CreatePhotoSequenceOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreatePhotoSequenceOperation) Metadata
func (op *CreatePhotoSequenceOperation) Metadata() (*emptypb.Empty, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreatePhotoSequenceOperation) Name
func (op *CreatePhotoSequenceOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*CreatePhotoSequenceOperation) Poll
func (op *CreatePhotoSequenceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*publishpb.PhotoSequence, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*CreatePhotoSequenceOperation) Wait
func (op *CreatePhotoSequenceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*publishpb.PhotoSequence, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
GetPhotoSequenceOperation
type GetPhotoSequenceOperation struct {
// contains filtered or unexported fields
}
GetPhotoSequenceOperation manages a long-running operation from GetPhotoSequence.
func (*GetPhotoSequenceOperation) Done
func (op *GetPhotoSequenceOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*GetPhotoSequenceOperation) Metadata
func (op *GetPhotoSequenceOperation) Metadata() (*emptypb.Empty, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*GetPhotoSequenceOperation) Name
func (op *GetPhotoSequenceOperation) Name() string
Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.
func (*GetPhotoSequenceOperation) Poll
func (op *GetPhotoSequenceOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*publishpb.PhotoSequence, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.
func (*GetPhotoSequenceOperation) Wait
func (op *GetPhotoSequenceOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*publishpb.PhotoSequence, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
OperationIterator
type OperationIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error)
// contains filtered or unexported fields
}
OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All
func (it *OperationIterator) All() iter.Seq2[*longrunningpb.Operation, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*OperationIterator) Next
func (it *OperationIterator) Next() (*longrunningpb.Operation, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*OperationIterator) PageInfo
func (it *OperationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
PhotoIterator
type PhotoIterator struct {
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*publishpb.Photo, nextPageToken string, err error)
// contains filtered or unexported fields
}
PhotoIterator manages a stream of *publishpb.Photo.
func (*PhotoIterator) All
func (it *PhotoIterator) All() iter.Seq2[*publishpb.Photo, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*PhotoIterator) Next
func (it *PhotoIterator) Next() (*publishpb.Photo, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*PhotoIterator) PageInfo
func (it *PhotoIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
StreetViewPublishCallOptions
type StreetViewPublishCallOptions struct {
StartUpload []gax.CallOption
CreatePhoto []gax.CallOption
GetPhoto []gax.CallOption
BatchGetPhotos []gax.CallOption
ListPhotos []gax.CallOption
UpdatePhoto []gax.CallOption
BatchUpdatePhotos []gax.CallOption
DeletePhoto []gax.CallOption
BatchDeletePhotos []gax.CallOption
StartPhotoSequenceUpload []gax.CallOption
CreatePhotoSequence []gax.CallOption
GetPhotoSequence []gax.CallOption
ListPhotoSequences []gax.CallOption
DeletePhotoSequence []gax.CallOption
}
StreetViewPublishCallOptions contains the retry settings for each method of StreetViewPublishClient.
StreetViewPublishClient
type StreetViewPublishClient struct {
// The call options for this service.
CallOptions *StreetViewPublishCallOptions
// LROClient is used internally to handle long-running operations.
// It is exposed so that its CallOptions can be modified if required.
// Users should not Close this client.
LROClient *lroauto.OperationsClient
// contains filtered or unexported fields
}
StreetViewPublishClient is a client for interacting with Street View Publish API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Publishes and connects user-contributed photos on Street View.
func NewStreetViewPublishClient
func NewStreetViewPublishClient(ctx context.Context, opts ...option.ClientOption) (*StreetViewPublishClient, error)
NewStreetViewPublishClient creates a new street view publish service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Publishes and connects user-contributed photos on Street View.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewStreetViewPublishRESTClient
func NewStreetViewPublishRESTClient(ctx context.Context, opts ...option.ClientOption) (*StreetViewPublishClient, error)
NewStreetViewPublishRESTClient creates a new street view publish service rest client.
Publishes and connects user-contributed photos on Street View.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/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 := publish.NewStreetViewPublishRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*StreetViewPublishClient) BatchDeletePhotos
func (c *StreetViewPublishClient) BatchDeletePhotos(ctx context.Context, req *publishpb.BatchDeletePhotosRequest, opts ...gax.CallOption) (*publishpb.BatchDeletePhotosResponse, error)
BatchDeletePhotos deletes a list of [Photos][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] and their metadata.
Note that if BatchDeletePhotos fails, either critical fields are missing or there is an authentication error. Even if BatchDeletePhotos succeeds, individual photos in the batch may have failures. These failures are specified in each PhotoResponse.status in BatchDeletePhotosResponse.results. See DeletePhoto for specific failures that can occur per photo.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.BatchDeletePhotosRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#BatchDeletePhotosRequest.
}
resp, err := c.BatchDeletePhotos(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*StreetViewPublishClient) BatchGetPhotos
func (c *StreetViewPublishClient) BatchGetPhotos(ctx context.Context, req *publishpb.BatchGetPhotosRequest, opts ...gax.CallOption) (*publishpb.BatchGetPhotosResponse, error)
BatchGetPhotos gets the metadata of the specified [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] batch.
Note that if BatchGetPhotos fails, either critical fields are missing or there is an authentication error. Even if BatchGetPhotos succeeds, individual photos in the batch may have failures. These failures are specified in each PhotoResponse.status in BatchGetPhotosResponse.results. See GetPhoto for specific failures that can occur per photo.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.BatchGetPhotosRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#BatchGetPhotosRequest.
}
resp, err := c.BatchGetPhotos(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*StreetViewPublishClient) BatchUpdatePhotos
func (c *StreetViewPublishClient) BatchUpdatePhotos(ctx context.Context, req *publishpb.BatchUpdatePhotosRequest, opts ...gax.CallOption) (*publishpb.BatchUpdatePhotosResponse, error)
BatchUpdatePhotos updates the metadata of [Photos][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)], such as pose, place association, connections, etc. Changing the pixels of photos is not supported.
Note that if BatchUpdatePhotos fails, either critical fields are missing or there is an authentication error. Even if BatchUpdatePhotos succeeds, individual photos in the batch may have failures. These failures are specified in each PhotoResponse.status in BatchUpdatePhotosResponse.results. See UpdatePhoto for specific failures that can occur per photo.
Only the fields specified in updateMask field are used. If updateMask is not present, the update applies to all fields.
The number of UpdatePhotoRequest messages in a BatchUpdatePhotosRequest must not exceed 20.
Note: To update Pose.altitude, Pose.latLngPair has to be filled as well. Otherwise, the request will fail.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.BatchUpdatePhotosRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#BatchUpdatePhotosRequest.
}
resp, err := c.BatchUpdatePhotos(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*StreetViewPublishClient) Close
func (c *StreetViewPublishClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*StreetViewPublishClient) Connection (deprecated)
func (c *StreetViewPublishClient) 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 (*StreetViewPublishClient) CreatePhoto
func (c *StreetViewPublishClient) CreatePhoto(ctx context.Context, req *publishpb.CreatePhotoRequest, opts ...gax.CallOption) (*publishpb.Photo, error)
CreatePhoto after the client finishes uploading the photo with the returned UploadRef, CreatePhoto publishes the uploaded [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] to Street View on Google Maps.
Currently, the only way to set heading, pitch, and roll in CreatePhoto is through the Photo Sphere XMP metadata (at https://developers.google.com/streetview/spherical-metadata) in the photo bytes. CreatePhoto ignores the pose.heading, pose.pitch, pose.roll, pose.altitude, and pose.level fields in Pose.
This method returns the following error codes:
google.rpc.Code.INVALID_ARGUMENT if
the request is malformed or if the uploaded photo is not a 360 photo.
google.rpc.Code.NOT_FOUND if the upload
reference does not exist.
google.rpc.Code.RESOURCE_EXHAUSTED
if the account has reached the storage limit.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.CreatePhotoRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#CreatePhotoRequest.
}
resp, err := c.CreatePhoto(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*StreetViewPublishClient) CreatePhotoSequence
func (c *StreetViewPublishClient) CreatePhotoSequence(ctx context.Context, req *publishpb.CreatePhotoSequenceRequest, opts ...gax.CallOption) (*CreatePhotoSequenceOperation, error)
CreatePhotoSequence after the client finishes uploading the PhotoSequence with the returned UploadRef, CreatePhotoSequence extracts a sequence of 360 photos from a video or Extensible Device Metadata (XDM, http://www.xdm.org/ (at http://www.xdm.org/)) to be published to Street View on Google Maps.
CreatePhotoSequence returns an Operation, with the PhotoSequence Id set in the Operation.name field.
This method returns the following error codes:
google.rpc.Code.INVALID_ARGUMENT if
the request is malformed.
google.rpc.Code.NOT_FOUND if the upload
reference does not exist.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.CreatePhotoSequenceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#CreatePhotoSequenceRequest.
}
op, err := c.CreatePhotoSequence(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*StreetViewPublishClient) CreatePhotoSequenceOperation
func (c *StreetViewPublishClient) CreatePhotoSequenceOperation(name string) *CreatePhotoSequenceOperation
CreatePhotoSequenceOperation returns a new CreatePhotoSequenceOperation from a given name. The name must be that of a previously created CreatePhotoSequenceOperation, possibly from a different process.
func (*StreetViewPublishClient) DeletePhoto
func (c *StreetViewPublishClient) DeletePhoto(ctx context.Context, req *publishpb.DeletePhotoRequest, opts ...gax.CallOption) error
DeletePhoto deletes a [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] and its metadata.
This method returns the following error codes:
google.rpc.Code.PERMISSION_DENIED if
the requesting user did not create the requested photo.
google.rpc.Code.NOT_FOUND if the photo ID
does not exist.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.DeletePhotoRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#DeletePhotoRequest.
}
err = c.DeletePhoto(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*StreetViewPublishClient) DeletePhotoSequence
func (c *StreetViewPublishClient) DeletePhotoSequence(ctx context.Context, req *publishpb.DeletePhotoSequenceRequest, opts ...gax.CallOption) error
DeletePhotoSequence deletes a PhotoSequence and its metadata.
This method returns the following error codes:
google.rpc.Code.PERMISSION_DENIED if
the requesting user did not create the requested photo sequence.
google.rpc.Code.NOT_FOUND if the photo
sequence ID does not exist.
google.rpc.Code.FAILED_PRECONDITION if the photo sequence ID is not
yet finished processing.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.DeletePhotoSequenceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#DeletePhotoSequenceRequest.
}
err = c.DeletePhotoSequence(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*StreetViewPublishClient) GetPhoto
func (c *StreetViewPublishClient) GetPhoto(ctx context.Context, req *publishpb.GetPhotoRequest, opts ...gax.CallOption) (*publishpb.Photo, error)
GetPhoto gets the metadata of the specified [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)].
This method returns the following error codes:
google.rpc.Code.PERMISSION_DENIED if
the requesting user did not create the requested
[Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)].
google.rpc.Code.NOT_FOUND if the requested
[Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] does not exist.
google.rpc.Code.UNAVAILABLE if the
requested [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] is still being
indexed.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.GetPhotoRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#GetPhotoRequest.
}
resp, err := c.GetPhoto(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*StreetViewPublishClient) GetPhotoSequence
func (c *StreetViewPublishClient) GetPhotoSequence(ctx context.Context, req *publishpb.GetPhotoSequenceRequest, opts ...gax.CallOption) (*GetPhotoSequenceOperation, error)
GetPhotoSequence gets the metadata of the specified PhotoSequence via the Operation interface.
This method returns the following three types of responses:
Operation.done = false, if the processing of
PhotoSequence is not
finished yet.
Operation.done = true and Operation.error is populated, if there was
an error in processing.
Operation.done = true and Operation.response is poulated, which
contains a PhotoSequence
message.
This method returns the following error codes:
google.rpc.Code.PERMISSION_DENIED if
the requesting user did not create the requested
PhotoSequence.
google.rpc.Code.NOT_FOUND if the requested
PhotoSequence does not exist.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.GetPhotoSequenceRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#GetPhotoSequenceRequest.
}
op, err := c.GetPhotoSequence(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*StreetViewPublishClient) GetPhotoSequenceOperation
func (c *StreetViewPublishClient) GetPhotoSequenceOperation(name string) *GetPhotoSequenceOperation
GetPhotoSequenceOperation returns a new GetPhotoSequenceOperation from a given name. The name must be that of a previously created GetPhotoSequenceOperation, possibly from a different process.
func (*StreetViewPublishClient) ListPhotoSequences
func (c *StreetViewPublishClient) ListPhotoSequences(ctx context.Context, req *publishpb.ListPhotoSequencesRequest, opts ...gax.CallOption) *OperationIterator
ListPhotoSequences lists all the PhotoSequences that belong to the user, in descending CreatePhotoSequence timestamp order.
Examples
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
"google.golang.org/api/iterator"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.ListPhotoSequencesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#ListPhotoSequencesRequest.
}
it := c.ListPhotoSequences(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*publishpb.ListPhotoSequencesResponse)
}
}
all
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.ListPhotoSequencesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#ListPhotoSequencesRequest.
}
for resp, err := range c.ListPhotoSequences(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*StreetViewPublishClient) ListPhotos
func (c *StreetViewPublishClient) ListPhotos(ctx context.Context, req *publishpb.ListPhotosRequest, opts ...gax.CallOption) *PhotoIterator
ListPhotos lists all the [Photos][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] that belong to the user.
Note: Recently created photos that are still being indexed are not returned in the response.
Examples
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
"google.golang.org/api/iterator"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.ListPhotosRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#ListPhotosRequest.
}
it := c.ListPhotos(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*publishpb.ListPhotosResponse)
}
}
all
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.ListPhotosRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#ListPhotosRequest.
}
for resp, err := range c.ListPhotos(ctx, req).All() {
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*StreetViewPublishClient) StartPhotoSequenceUpload
func (c *StreetViewPublishClient) StartPhotoSequenceUpload(ctx context.Context, req *emptypb.Empty, opts ...gax.CallOption) (*publishpb.UploadRef, error)
StartPhotoSequenceUpload creates an upload session to start uploading photo sequence data. The upload URL of the returned UploadRef is used to upload the data for the photoSequence.
After the upload is complete, the UploadRef is used with CreatePhotoSequence to create the PhotoSequence object entry.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &emptypb.Empty{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/protobuf/types/known/emptypb#Empty.
}
resp, err := c.StartPhotoSequenceUpload(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*StreetViewPublishClient) StartUpload
func (c *StreetViewPublishClient) StartUpload(ctx context.Context, req *emptypb.Empty, opts ...gax.CallOption) (*publishpb.UploadRef, error)
StartUpload creates an upload session to start uploading photo bytes. The method uses the upload URL of the returned UploadRef to upload the bytes for the [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)].
In addition to the photo requirements shown in https://support.google.com/maps/answer/7012050?ref_topic=6275604 (at https://support.google.com/maps/answer/7012050?ref_topic=6275604), the photo must meet the following requirements:
Photo Sphere XMP metadata must be included in the photo metadata. See
https://developers.google.com/streetview/spherical-metadata (at https://developers.google.com/streetview/spherical-metadata) for the
required fields.
The pixel size of the photo must meet the size requirements listed in
https://support.google.com/maps/answer/7012050?ref_topic=6275604 (at https://support.google.com/maps/answer/7012050?ref_topic=6275604), and
the photo must be a full 360 horizontally.
After the upload completes, the method uses UploadRef with CreatePhoto to create the [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] object entry.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
emptypb "google.golang.org/protobuf/types/known/emptypb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &emptypb.Empty{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/protobuf/types/known/emptypb#Empty.
}
resp, err := c.StartUpload(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*StreetViewPublishClient) UpdatePhoto
func (c *StreetViewPublishClient) UpdatePhoto(ctx context.Context, req *publishpb.UpdatePhotoRequest, opts ...gax.CallOption) (*publishpb.Photo, error)
UpdatePhoto updates the metadata of a [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)], such as pose, place association, connections, etc. Changing the pixels of a photo is not supported.
Only the fields specified in the updateMask field are used. If updateMask is not present, the update applies to all fields.
This method returns the following error codes:
google.rpc.Code.PERMISSION_DENIED if
the requesting user did not create the requested photo.
google.rpc.Code.INVALID_ARGUMENT if
the request is malformed.
google.rpc.Code.NOT_FOUND if the requested
photo does not exist.
google.rpc.Code.UNAVAILABLE if the
requested [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] is still being
indexed.
Example
package main
import (
"context"
publish "cloud.google.com/go/streetview/publish/apiv1"
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb"
)
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 := publish.NewStreetViewPublishClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &publishpb.UpdatePhotoRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/streetview/publish/apiv1/publishpb#UpdatePhotoRequest.
}
resp, err := c.UpdatePhoto(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}