| 1 |
// Copyright 2025 Google LLC |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// https://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
// Code generated by protoc-gen-go_gapic. DO NOT EDIT. |
| 16 |
|
| 17 |
package publish |
| 18 |
|
| 19 |
import ( |
| 20 |
"bytes" |
| 21 |
"context" |
| 22 |
"fmt" |
| 23 |
"log/slog" |
| 24 |
"math" |
| 25 |
"net/http" |
| 26 |
"net/url" |
| 27 |
"time" |
| 28 |
|
| 29 |
"cloud.google.com/go/longrunning" |
| 30 |
lroauto "cloud.google.com/go/longrunning/autogen" |
| 31 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 32 |
publishpb "cloud.google.com/go/streetview/publish/apiv1/publishpb" |
| 33 |
gax "github.com/googleapis/gax-go/v2" |
| 34 |
"google.golang.org/api/iterator" |
| 35 |
"google.golang.org/api/option" |
| 36 |
"google.golang.org/api/option/internaloption" |
| 37 |
gtransport "google.golang.org/api/transport/grpc" |
| 38 |
httptransport "google.golang.org/api/transport/http" |
| 39 |
"google.golang.org/grpc" |
| 40 |
"google.golang.org/grpc/codes" |
| 41 |
"google.golang.org/protobuf/encoding/protojson" |
| 42 |
"google.golang.org/protobuf/proto" |
| 43 |
emptypb "google.golang.org/protobuf/types/known/emptypb" |
| 44 |
) |
| 45 |
|
| 46 |
var newStreetViewPublishClientHook clientHook |
| 47 |
|
| 48 |
// StreetViewPublishCallOptions contains the retry settings for each method of StreetViewPublishClient. |
| 49 |
type StreetViewPublishCallOptions struct { |
| 50 |
StartUpload []gax.CallOption |
| 51 |
CreatePhoto []gax.CallOption |
| 52 |
GetPhoto []gax.CallOption |
| 53 |
BatchGetPhotos []gax.CallOption |
| 54 |
ListPhotos []gax.CallOption |
| 55 |
UpdatePhoto []gax.CallOption |
| 56 |
BatchUpdatePhotos []gax.CallOption |
| 57 |
DeletePhoto []gax.CallOption |
| 58 |
BatchDeletePhotos []gax.CallOption |
| 59 |
StartPhotoSequenceUpload []gax.CallOption |
| 60 |
CreatePhotoSequence []gax.CallOption |
| 61 |
GetPhotoSequence []gax.CallOption |
| 62 |
ListPhotoSequences []gax.CallOption |
| 63 |
DeletePhotoSequence []gax.CallOption |
| 64 |
} |
| 65 |
|
| 66 |
func defaultStreetViewPublishGRPCClientOptions() []option.ClientOption { |
| 67 |
return []option.ClientOption{ |
| 68 |
internaloption.WithDefaultEndpoint("streetviewpublish.googleapis.com:443"), |
| 69 |
internaloption.WithDefaultEndpointTemplate("streetviewpublish.UNIVERSE_DOMAIN:443"), |
| 70 |
internaloption.WithDefaultMTLSEndpoint("streetviewpublish.mtls.googleapis.com:443"), |
| 71 |
internaloption.WithDefaultUniverseDomain("googleapis.com"), |
| 72 |
internaloption.WithDefaultAudience("https://streetviewpublish.googleapis.com/"), |
| 73 |
internaloption.WithDefaultScopes(DefaultAuthScopes()...), |
| 74 |
internaloption.EnableJwtWithScope(), |
| 75 |
internaloption.EnableNewAuthLibrary(), |
| 76 |
option.WithGRPCDialOption(grpc.WithDefaultCallOptions( |
| 77 |
grpc.MaxCallRecvMsgSize(math.MaxInt32))), |
| 78 |
} |
| 79 |
} |
| 80 |
|
| 81 |
func defaultStreetViewPublishCallOptions() *StreetViewPublishCallOptions { |
| 82 |
return &StreetViewPublishCallOptions{ |
| 83 |
StartUpload: []gax.CallOption{ |
| 84 |
gax.WithTimeout(60000 * time.Millisecond), |
| 85 |
gax.WithRetry(func() gax.Retryer { |
| 86 |
return gax.OnCodes([]codes.Code{}, gax.Backoff{ |
| 87 |
Initial: 100 * time.Millisecond, |
| 88 |
Max: 60000 * time.Millisecond, |
| 89 |
Multiplier: 1.30, |
| 90 |
}) |
| 91 |
}), |
| 92 |
}, |
| 93 |
CreatePhoto: []gax.CallOption{ |
| 94 |
gax.WithTimeout(60000 * time.Millisecond), |
| 95 |
gax.WithRetry(func() gax.Retryer { |
| 96 |
return gax.OnCodes([]codes.Code{}, gax.Backoff{ |
| 97 |
Initial: 100 * time.Millisecond, |
| 98 |
Max: 60000 * time.Millisecond, |
| 99 |
Multiplier: 1.30, |
| 100 |
}) |
| 101 |
}), |
| 102 |
}, |
| 103 |
GetPhoto: []gax.CallOption{ |
| 104 |
gax.WithTimeout(60000 * time.Millisecond), |
| 105 |
gax.WithRetry(func() gax.Retryer { |
| 106 |
return gax.OnCodes([]codes.Code{ |
| 107 |
codes.Unavailable, |
| 108 |
codes.DeadlineExceeded, |
| 109 |
}, gax.Backoff{ |
| 110 |
Initial: 100 * time.Millisecond, |
| 111 |
Max: 60000 * time.Millisecond, |
| 112 |
Multiplier: 1.30, |
| 113 |
}) |
| 114 |
}), |
| 115 |
}, |
| 116 |
BatchGetPhotos: []gax.CallOption{ |
| 117 |
gax.WithTimeout(60000 * time.Millisecond), |
| 118 |
gax.WithRetry(func() gax.Retryer { |
| 119 |
return gax.OnCodes([]codes.Code{ |
| 120 |
codes.Unavailable, |
| 121 |
codes.DeadlineExceeded, |
| 122 |
}, gax.Backoff{ |
| 123 |
Initial: 100 * time.Millisecond, |
| 124 |
Max: 60000 * time.Millisecond, |
| 125 |
Multiplier: 1.30, |
| 126 |
}) |
| 127 |
}), |
| 128 |
}, |
| 129 |
ListPhotos: []gax.CallOption{ |
| 130 |
gax.WithTimeout(60000 * time.Millisecond), |
| 131 |
gax.WithRetry(func() gax.Retryer { |
| 132 |
return gax.OnCodes([]codes.Code{ |
| 133 |
codes.Unavailable, |
| 134 |
codes.DeadlineExceeded, |
| 135 |
}, gax.Backoff{ |
| 136 |
Initial: 100 * time.Millisecond, |
| 137 |
Max: 60000 * time.Millisecond, |
| 138 |
Multiplier: 1.30, |
| 139 |
}) |
| 140 |
}), |
| 141 |
}, |
| 142 |
UpdatePhoto: []gax.CallOption{ |
| 143 |
gax.WithTimeout(60000 * time.Millisecond), |
| 144 |
gax.WithRetry(func() gax.Retryer { |
| 145 |
return gax.OnCodes([]codes.Code{ |
| 146 |
codes.Unavailable, |
| 147 |
codes.DeadlineExceeded, |
| 148 |
}, gax.Backoff{ |
| 149 |
Initial: 100 * time.Millisecond, |
| 150 |
Max: 60000 * time.Millisecond, |
| 151 |
Multiplier: 1.30, |
| 152 |
}) |
| 153 |
}), |
| 154 |
}, |
| 155 |
BatchUpdatePhotos: []gax.CallOption{ |
| 156 |
gax.WithTimeout(60000 * time.Millisecond), |
| 157 |
gax.WithRetry(func() gax.Retryer { |
| 158 |
return gax.OnCodes([]codes.Code{}, gax.Backoff{ |
| 159 |
Initial: 100 * time.Millisecond, |
| 160 |
Max: 60000 * time.Millisecond, |
| 161 |
Multiplier: 1.30, |
| 162 |
}) |
| 163 |
}), |
| 164 |
}, |
| 165 |
DeletePhoto: []gax.CallOption{ |
| 166 |
gax.WithTimeout(60000 * time.Millisecond), |
| 167 |
gax.WithRetry(func() gax.Retryer { |
| 168 |
return gax.OnCodes([]codes.Code{ |
| 169 |
codes.Unavailable, |
| 170 |
codes.DeadlineExceeded, |
| 171 |
}, gax.Backoff{ |
| 172 |
Initial: 100 * time.Millisecond, |
| 173 |
Max: 60000 * time.Millisecond, |
| 174 |
Multiplier: 1.30, |
| 175 |
}) |
| 176 |
}), |
| 177 |
}, |
| 178 |
BatchDeletePhotos: []gax.CallOption{}, |
| 179 |
StartPhotoSequenceUpload: []gax.CallOption{}, |
| 180 |
CreatePhotoSequence: []gax.CallOption{}, |
| 181 |
GetPhotoSequence: []gax.CallOption{}, |
| 182 |
ListPhotoSequences: []gax.CallOption{}, |
| 183 |
DeletePhotoSequence: []gax.CallOption{}, |
| 184 |
} |
| 185 |
} |
| 186 |
|
| 187 |
func defaultStreetViewPublishRESTCallOptions() *StreetViewPublishCallOptions { |
| 188 |
return &StreetViewPublishCallOptions{ |
| 189 |
StartUpload: []gax.CallOption{ |
| 190 |
gax.WithTimeout(60000 * time.Millisecond), |
| 191 |
}, |
| 192 |
CreatePhoto: []gax.CallOption{ |
| 193 |
gax.WithTimeout(60000 * time.Millisecond), |
| 194 |
}, |
| 195 |
GetPhoto: []gax.CallOption{ |
| 196 |
gax.WithTimeout(60000 * time.Millisecond), |
| 197 |
gax.WithRetry(func() gax.Retryer { |
| 198 |
return gax.OnHTTPCodes(gax.Backoff{ |
| 199 |
Initial: 100 * time.Millisecond, |
| 200 |
Max: 60000 * time.Millisecond, |
| 201 |
Multiplier: 1.30, |
| 202 |
}, |
| 203 |
http.StatusServiceUnavailable, |
| 204 |
http.StatusGatewayTimeout) |
| 205 |
}), |
| 206 |
}, |
| 207 |
BatchGetPhotos: []gax.CallOption{ |
| 208 |
gax.WithTimeout(60000 * time.Millisecond), |
| 209 |
gax.WithRetry(func() gax.Retryer { |
| 210 |
return gax.OnHTTPCodes(gax.Backoff{ |
| 211 |
Initial: 100 * time.Millisecond, |
| 212 |
Max: 60000 * time.Millisecond, |
| 213 |
Multiplier: 1.30, |
| 214 |
}, |
| 215 |
http.StatusServiceUnavailable, |
| 216 |
http.StatusGatewayTimeout) |
| 217 |
}), |
| 218 |
}, |
| 219 |
ListPhotos: []gax.CallOption{ |
| 220 |
gax.WithTimeout(60000 * time.Millisecond), |
| 221 |
gax.WithRetry(func() gax.Retryer { |
| 222 |
return gax.OnHTTPCodes(gax.Backoff{ |
| 223 |
Initial: 100 * time.Millisecond, |
| 224 |
Max: 60000 * time.Millisecond, |
| 225 |
Multiplier: 1.30, |
| 226 |
}, |
| 227 |
http.StatusServiceUnavailable, |
| 228 |
http.StatusGatewayTimeout) |
| 229 |
}), |
| 230 |
}, |
| 231 |
UpdatePhoto: []gax.CallOption{ |
| 232 |
gax.WithTimeout(60000 * time.Millisecond), |
| 233 |
gax.WithRetry(func() gax.Retryer { |
| 234 |
return gax.OnHTTPCodes(gax.Backoff{ |
| 235 |
Initial: 100 * time.Millisecond, |
| 236 |
Max: 60000 * time.Millisecond, |
| 237 |
Multiplier: 1.30, |
| 238 |
}, |
| 239 |
http.StatusServiceUnavailable, |
| 240 |
http.StatusGatewayTimeout) |
| 241 |
}), |
| 242 |
}, |
| 243 |
BatchUpdatePhotos: []gax.CallOption{ |
| 244 |
gax.WithTimeout(60000 * time.Millisecond), |
| 245 |
}, |
| 246 |
DeletePhoto: []gax.CallOption{ |
| 247 |
gax.WithTimeout(60000 * time.Millisecond), |
| 248 |
gax.WithRetry(func() gax.Retryer { |
| 249 |
return gax.OnHTTPCodes(gax.Backoff{ |
| 250 |
Initial: 100 * time.Millisecond, |
| 251 |
Max: 60000 * time.Millisecond, |
| 252 |
Multiplier: 1.30, |
| 253 |
}, |
| 254 |
http.StatusServiceUnavailable, |
| 255 |
http.StatusGatewayTimeout) |
| 256 |
}), |
| 257 |
}, |
| 258 |
BatchDeletePhotos: []gax.CallOption{}, |
| 259 |
StartPhotoSequenceUpload: []gax.CallOption{}, |
| 260 |
CreatePhotoSequence: []gax.CallOption{}, |
| 261 |
GetPhotoSequence: []gax.CallOption{}, |
| 262 |
ListPhotoSequences: []gax.CallOption{}, |
| 263 |
DeletePhotoSequence: []gax.CallOption{}, |
| 264 |
} |
| 265 |
} |
| 266 |
|
| 267 |
// internalStreetViewPublishClient is an interface that defines the methods available from Street View Publish API. |
| 268 |
type internalStreetViewPublishClient interface { |
| 269 |
Close() error |
| 270 |
setGoogleClientInfo(...string) |
| 271 |
Connection() *grpc.ClientConn |
| 272 |
StartUpload(context.Context, *emptypb.Empty, ...gax.CallOption) (*publishpb.UploadRef, error) |
| 273 |
CreatePhoto(context.Context, *publishpb.CreatePhotoRequest, ...gax.CallOption) (*publishpb.Photo, error) |
| 274 |
GetPhoto(context.Context, *publishpb.GetPhotoRequest, ...gax.CallOption) (*publishpb.Photo, error) |
| 275 |
BatchGetPhotos(context.Context, *publishpb.BatchGetPhotosRequest, ...gax.CallOption) (*publishpb.BatchGetPhotosResponse, error) |
| 276 |
ListPhotos(context.Context, *publishpb.ListPhotosRequest, ...gax.CallOption) *PhotoIterator |
| 277 |
UpdatePhoto(context.Context, *publishpb.UpdatePhotoRequest, ...gax.CallOption) (*publishpb.Photo, error) |
| 278 |
BatchUpdatePhotos(context.Context, *publishpb.BatchUpdatePhotosRequest, ...gax.CallOption) (*publishpb.BatchUpdatePhotosResponse, error) |
| 279 |
DeletePhoto(context.Context, *publishpb.DeletePhotoRequest, ...gax.CallOption) error |
| 280 |
BatchDeletePhotos(context.Context, *publishpb.BatchDeletePhotosRequest, ...gax.CallOption) (*publishpb.BatchDeletePhotosResponse, error) |
| 281 |
StartPhotoSequenceUpload(context.Context, *emptypb.Empty, ...gax.CallOption) (*publishpb.UploadRef, error) |
| 282 |
CreatePhotoSequence(context.Context, *publishpb.CreatePhotoSequenceRequest, ...gax.CallOption) (*CreatePhotoSequenceOperation, error) |
| 283 |
CreatePhotoSequenceOperation(name string) *CreatePhotoSequenceOperation |
| 284 |
GetPhotoSequence(context.Context, *publishpb.GetPhotoSequenceRequest, ...gax.CallOption) (*GetPhotoSequenceOperation, error) |
| 285 |
GetPhotoSequenceOperation(name string) *GetPhotoSequenceOperation |
| 286 |
ListPhotoSequences(context.Context, *publishpb.ListPhotoSequencesRequest, ...gax.CallOption) *OperationIterator |
| 287 |
DeletePhotoSequence(context.Context, *publishpb.DeletePhotoSequenceRequest, ...gax.CallOption) error |
| 288 |
} |
| 289 |
|
| 290 |
// StreetViewPublishClient is a client for interacting with Street View Publish API. |
| 291 |
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. |
| 292 |
// |
| 293 |
// Publishes and connects user-contributed photos on Street View. |
| 294 |
type StreetViewPublishClient struct { |
| 295 |
// The internal transport-dependent client. |
| 296 |
internalClient internalStreetViewPublishClient |
| 297 |
|
| 298 |
// The call options for this service. |
| 299 |
CallOptions *StreetViewPublishCallOptions |
| 300 |
|
| 301 |
// LROClient is used internally to handle long-running operations. |
| 302 |
// It is exposed so that its CallOptions can be modified if required. |
| 303 |
// Users should not Close this client. |
| 304 |
LROClient *lroauto.OperationsClient |
| 305 |
} |
| 306 |
|
| 307 |
// Wrapper methods routed to the internal client. |
| 308 |
|
| 309 |
// Close closes the connection to the API service. The user should invoke this when |
| 310 |
// the client is no longer required. |
| 311 |
func (c *StreetViewPublishClient) Close() error { |
| 312 |
return c.internalClient.Close() |
| 313 |
} |
| 314 |
|
| 315 |
// setGoogleClientInfo sets the name and version of the application in |
| 316 |
// the `x-goog-api-client` header passed on each request. Intended for |
| 317 |
// use by Google-written clients. |
| 318 |
func (c *StreetViewPublishClient) setGoogleClientInfo(keyval ...string) { |
| 319 |
c.internalClient.setGoogleClientInfo(keyval...) |
| 320 |
} |
| 321 |
|
| 322 |
// Connection returns a connection to the API service. |
| 323 |
// |
| 324 |
// Deprecated: Connections are now pooled so this method does not always |
| 325 |
// return the same resource. |
| 326 |
func (c *StreetViewPublishClient) Connection() *grpc.ClientConn { |
| 327 |
return c.internalClient.Connection() |
| 328 |
} |
| 329 |
|
| 330 |
// StartUpload creates an upload session to start uploading photo bytes. The method uses |
| 331 |
// the upload URL of the returned |
| 332 |
// UploadRef to upload the bytes for |
| 333 |
// the [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)]. |
| 334 |
// |
| 335 |
// In addition to the photo requirements shown in |
| 336 |
// https://support.google.com/maps/answer/7012050?ref_topic=6275604 (at https://support.google.com/maps/answer/7012050?ref_topic=6275604), |
| 337 |
// the photo must meet the following requirements: |
| 338 |
// |
| 339 |
// Photo Sphere XMP metadata must be included in the photo metadata. See |
| 340 |
// https://developers.google.com/streetview/spherical-metadata (at https://developers.google.com/streetview/spherical-metadata) for the |
| 341 |
// required fields. |
| 342 |
// |
| 343 |
// The pixel size of the photo must meet the size requirements listed in |
| 344 |
// https://support.google.com/maps/answer/7012050?ref_topic=6275604 (at https://support.google.com/maps/answer/7012050?ref_topic=6275604), and |
| 345 |
// the photo must be a full 360 horizontally. |
| 346 |
// |
| 347 |
// After the upload completes, the method uses |
| 348 |
// UploadRef with |
| 349 |
// CreatePhoto |
| 350 |
// to create the [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] object entry. |
| 351 |
func (c *StreetViewPublishClient) StartUpload(ctx context.Context, req *emptypb.Empty, opts ...gax.CallOption) (*publishpb.UploadRef, error) { |
| 352 |
return c.internalClient.StartUpload(ctx, req, opts...) |
| 353 |
} |
| 354 |
|
| 355 |
// CreatePhoto after the client finishes uploading the photo with the returned |
| 356 |
// UploadRef, |
| 357 |
// CreatePhoto |
| 358 |
// publishes the uploaded [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] to |
| 359 |
// Street View on Google Maps. |
| 360 |
// |
| 361 |
// Currently, the only way to set heading, pitch, and roll in CreatePhoto is |
| 362 |
// through the Photo Sphere XMP |
| 363 |
// metadata (at https://developers.google.com/streetview/spherical-metadata) in |
| 364 |
// the photo bytes. CreatePhoto ignores the pose.heading, pose.pitch, |
| 365 |
// pose.roll, pose.altitude, and pose.level fields in Pose. |
| 366 |
// |
| 367 |
// This method returns the following error codes: |
| 368 |
// |
| 369 |
// google.rpc.Code.INVALID_ARGUMENT if |
| 370 |
// the request is malformed or if the uploaded photo is not a 360 photo. |
| 371 |
// |
| 372 |
// google.rpc.Code.NOT_FOUND if the upload |
| 373 |
// reference does not exist. |
| 374 |
// |
| 375 |
// google.rpc.Code.RESOURCE_EXHAUSTED |
| 376 |
// if the account has reached the storage limit. |
| 377 |
func (c *StreetViewPublishClient) CreatePhoto(ctx context.Context, req *publishpb.CreatePhotoRequest, opts ...gax.CallOption) (*publishpb.Photo, error) { |
| 378 |
return c.internalClient.CreatePhoto(ctx, req, opts...) |
| 379 |
} |
| 380 |
|
| 381 |
// GetPhoto gets the metadata of the specified |
| 382 |
// [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)]. |
| 383 |
// |
| 384 |
// This method returns the following error codes: |
| 385 |
// |
| 386 |
// google.rpc.Code.PERMISSION_DENIED if |
| 387 |
// the requesting user did not create the requested |
| 388 |
// [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)]. |
| 389 |
// |
| 390 |
// google.rpc.Code.NOT_FOUND if the requested |
| 391 |
// [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] does not exist. |
| 392 |
// |
| 393 |
// google.rpc.Code.UNAVAILABLE if the |
| 394 |
// requested [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] is still being |
| 395 |
// indexed. |
| 396 |
func (c *StreetViewPublishClient) GetPhoto(ctx context.Context, req *publishpb.GetPhotoRequest, opts ...gax.CallOption) (*publishpb.Photo, error) { |
| 397 |
return c.internalClient.GetPhoto(ctx, req, opts...) |
| 398 |
} |
| 399 |
|
| 400 |
// BatchGetPhotos gets the metadata of the specified |
| 401 |
// [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] batch. |
| 402 |
// |
| 403 |
// Note that if |
| 404 |
// BatchGetPhotos |
| 405 |
// fails, either critical fields are missing or there is an authentication |
| 406 |
// error. Even if |
| 407 |
// BatchGetPhotos |
| 408 |
// succeeds, individual photos in the batch may have failures. |
| 409 |
// These failures are specified in each |
| 410 |
// PhotoResponse.status |
| 411 |
// in |
| 412 |
// BatchGetPhotosResponse.results. |
| 413 |
// See |
| 414 |
// GetPhoto |
| 415 |
// for specific failures that can occur per photo. |
| 416 |
func (c *StreetViewPublishClient) BatchGetPhotos(ctx context.Context, req *publishpb.BatchGetPhotosRequest, opts ...gax.CallOption) (*publishpb.BatchGetPhotosResponse, error) { |
| 417 |
return c.internalClient.BatchGetPhotos(ctx, req, opts...) |
| 418 |
} |
| 419 |
|
| 420 |
// ListPhotos lists all the [Photos][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] that belong to |
| 421 |
// the user. |
| 422 |
// |
| 423 |
// Note: Recently created photos that are still |
| 424 |
// being indexed are not returned in the response. |
| 425 |
func (c *StreetViewPublishClient) ListPhotos(ctx context.Context, req *publishpb.ListPhotosRequest, opts ...gax.CallOption) *PhotoIterator { |
| 426 |
return c.internalClient.ListPhotos(ctx, req, opts...) |
| 427 |
} |
| 428 |
|
| 429 |
// UpdatePhoto updates the metadata of a [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)], such |
| 430 |
// as pose, place association, connections, etc. Changing the pixels of a |
| 431 |
// photo is not supported. |
| 432 |
// |
| 433 |
// Only the fields specified in the |
| 434 |
// updateMask |
| 435 |
// field are used. If updateMask is not present, the update applies to all |
| 436 |
// fields. |
| 437 |
// |
| 438 |
// This method returns the following error codes: |
| 439 |
// |
| 440 |
// google.rpc.Code.PERMISSION_DENIED if |
| 441 |
// the requesting user did not create the requested photo. |
| 442 |
// |
| 443 |
// google.rpc.Code.INVALID_ARGUMENT if |
| 444 |
// the request is malformed. |
| 445 |
// |
| 446 |
// google.rpc.Code.NOT_FOUND if the requested |
| 447 |
// photo does not exist. |
| 448 |
// |
| 449 |
// google.rpc.Code.UNAVAILABLE if the |
| 450 |
// requested [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] is still being |
| 451 |
// indexed. |
| 452 |
func (c *StreetViewPublishClient) UpdatePhoto(ctx context.Context, req *publishpb.UpdatePhotoRequest, opts ...gax.CallOption) (*publishpb.Photo, error) { |
| 453 |
return c.internalClient.UpdatePhoto(ctx, req, opts...) |
| 454 |
} |
| 455 |
|
| 456 |
// BatchUpdatePhotos updates the metadata of [Photos][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)], such |
| 457 |
// as pose, place association, connections, etc. Changing the pixels of photos |
| 458 |
// is not supported. |
| 459 |
// |
| 460 |
// Note that if |
| 461 |
// BatchUpdatePhotos |
| 462 |
// fails, either critical fields are missing or there is an authentication |
| 463 |
// error. Even if |
| 464 |
// BatchUpdatePhotos |
| 465 |
// succeeds, individual photos in the batch may have failures. |
| 466 |
// These failures are specified in each |
| 467 |
// PhotoResponse.status |
| 468 |
// in |
| 469 |
// BatchUpdatePhotosResponse.results. |
| 470 |
// See |
| 471 |
// UpdatePhoto |
| 472 |
// for specific failures that can occur per photo. |
| 473 |
// |
| 474 |
// Only the fields specified in |
| 475 |
// updateMask |
| 476 |
// field are used. If updateMask is not present, the update applies to all |
| 477 |
// fields. |
| 478 |
// |
| 479 |
// The number of |
| 480 |
// UpdatePhotoRequest |
| 481 |
// messages in a |
| 482 |
// BatchUpdatePhotosRequest |
| 483 |
// must not exceed 20. |
| 484 |
// |
| 485 |
// Note: To update |
| 486 |
// Pose.altitude, |
| 487 |
// Pose.latLngPair has to be |
| 488 |
// filled as well. Otherwise, the request will fail. |
| 489 |
func (c *StreetViewPublishClient) BatchUpdatePhotos(ctx context.Context, req *publishpb.BatchUpdatePhotosRequest, opts ...gax.CallOption) (*publishpb.BatchUpdatePhotosResponse, error) { |
| 490 |
return c.internalClient.BatchUpdatePhotos(ctx, req, opts...) |
| 491 |
} |
| 492 |
|
| 493 |
// DeletePhoto deletes a [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] and its metadata. |
| 494 |
// |
| 495 |
// This method returns the following error codes: |
| 496 |
// |
| 497 |
// google.rpc.Code.PERMISSION_DENIED if |
| 498 |
// the requesting user did not create the requested photo. |
| 499 |
// |
| 500 |
// google.rpc.Code.NOT_FOUND if the photo ID |
| 501 |
// does not exist. |
| 502 |
func (c *StreetViewPublishClient) DeletePhoto(ctx context.Context, req *publishpb.DeletePhotoRequest, opts ...gax.CallOption) error { |
| 503 |
return c.internalClient.DeletePhoto(ctx, req, opts...) |
| 504 |
} |
| 505 |
|
| 506 |
// BatchDeletePhotos deletes a list of [Photos][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] and their |
| 507 |
// metadata. |
| 508 |
// |
| 509 |
// Note that if |
| 510 |
// BatchDeletePhotos |
| 511 |
// fails, either critical fields are missing or there is an authentication |
| 512 |
// error. Even if |
| 513 |
// BatchDeletePhotos |
| 514 |
// succeeds, individual photos in the batch may have failures. |
| 515 |
// These failures are specified in each |
| 516 |
// PhotoResponse.status |
| 517 |
// in |
| 518 |
// BatchDeletePhotosResponse.results. |
| 519 |
// See |
| 520 |
// DeletePhoto |
| 521 |
// for specific failures that can occur per photo. |
| 522 |
func (c *StreetViewPublishClient) BatchDeletePhotos(ctx context.Context, req *publishpb.BatchDeletePhotosRequest, opts ...gax.CallOption) (*publishpb.BatchDeletePhotosResponse, error) { |
| 523 |
return c.internalClient.BatchDeletePhotos(ctx, req, opts...) |
| 524 |
} |
| 525 |
|
| 526 |
// StartPhotoSequenceUpload creates an upload session to start uploading photo sequence data. |
| 527 |
// The upload URL of the returned |
| 528 |
// UploadRef is used to upload the |
| 529 |
// data for the photoSequence. |
| 530 |
// |
| 531 |
// After the upload is complete, the |
| 532 |
// UploadRef is used with |
| 533 |
// CreatePhotoSequence |
| 534 |
// to create the PhotoSequence |
| 535 |
// object entry. |
| 536 |
func (c *StreetViewPublishClient) StartPhotoSequenceUpload(ctx context.Context, req *emptypb.Empty, opts ...gax.CallOption) (*publishpb.UploadRef, error) { |
| 537 |
return c.internalClient.StartPhotoSequenceUpload(ctx, req, opts...) |
| 538 |
} |
| 539 |
|
| 540 |
// CreatePhotoSequence after the client finishes uploading the |
| 541 |
// PhotoSequence with the |
| 542 |
// returned UploadRef, |
| 543 |
// CreatePhotoSequence |
| 544 |
// extracts a sequence of 360 photos from a video or Extensible Device |
| 545 |
// Metadata (XDM, http://www.xdm.org/ (at http://www.xdm.org/)) to be published to Street View on |
| 546 |
// Google Maps. |
| 547 |
// |
| 548 |
// CreatePhotoSequence returns an Operation, |
| 549 |
// with the PhotoSequence Id set |
| 550 |
// in the Operation.name field. |
| 551 |
// |
| 552 |
// This method returns the following error codes: |
| 553 |
// |
| 554 |
// google.rpc.Code.INVALID_ARGUMENT if |
| 555 |
// the request is malformed. |
| 556 |
// |
| 557 |
// google.rpc.Code.NOT_FOUND if the upload |
| 558 |
// reference does not exist. |
| 559 |
func (c *StreetViewPublishClient) CreatePhotoSequence(ctx context.Context, req *publishpb.CreatePhotoSequenceRequest, opts ...gax.CallOption) (*CreatePhotoSequenceOperation, error) { |
| 560 |
return c.internalClient.CreatePhotoSequence(ctx, req, opts...) |
| 561 |
} |
| 562 |
|
| 563 |
// CreatePhotoSequenceOperation returns a new CreatePhotoSequenceOperation from a given name. |
| 564 |
// The name must be that of a previously created CreatePhotoSequenceOperation, possibly from a different process. |
| 565 |
func (c *StreetViewPublishClient) CreatePhotoSequenceOperation(name string) *CreatePhotoSequenceOperation { |
| 566 |
return c.internalClient.CreatePhotoSequenceOperation(name) |
| 567 |
} |
| 568 |
|
| 569 |
// GetPhotoSequence gets the metadata of the specified |
| 570 |
// PhotoSequence via the |
| 571 |
// Operation interface. |
| 572 |
// |
| 573 |
// This method returns the following three types of responses: |
| 574 |
// |
| 575 |
// Operation.done = false, if the processing of |
| 576 |
// PhotoSequence is not |
| 577 |
// finished yet. |
| 578 |
// |
| 579 |
// Operation.done = true and Operation.error is populated, if there was |
| 580 |
// an error in processing. |
| 581 |
// |
| 582 |
// Operation.done = true and Operation.response is poulated, which |
| 583 |
// contains a PhotoSequence |
| 584 |
// message. |
| 585 |
// |
| 586 |
// This method returns the following error codes: |
| 587 |
// |
| 588 |
// google.rpc.Code.PERMISSION_DENIED if |
| 589 |
// the requesting user did not create the requested |
| 590 |
// PhotoSequence. |
| 591 |
// |
| 592 |
// google.rpc.Code.NOT_FOUND if the requested |
| 593 |
// PhotoSequence does not exist. |
| 594 |
func (c *StreetViewPublishClient) GetPhotoSequence(ctx context.Context, req *publishpb.GetPhotoSequenceRequest, opts ...gax.CallOption) (*GetPhotoSequenceOperation, error) { |
| 595 |
return c.internalClient.GetPhotoSequence(ctx, req, opts...) |
| 596 |
} |
| 597 |
|
| 598 |
// GetPhotoSequenceOperation returns a new GetPhotoSequenceOperation from a given name. |
| 599 |
// The name must be that of a previously created GetPhotoSequenceOperation, possibly from a different process. |
| 600 |
func (c *StreetViewPublishClient) GetPhotoSequenceOperation(name string) *GetPhotoSequenceOperation { |
| 601 |
return c.internalClient.GetPhotoSequenceOperation(name) |
| 602 |
} |
| 603 |
|
| 604 |
// ListPhotoSequences lists all the PhotoSequences |
| 605 |
// that belong to the user, in descending CreatePhotoSequence timestamp order. |
| 606 |
func (c *StreetViewPublishClient) ListPhotoSequences(ctx context.Context, req *publishpb.ListPhotoSequencesRequest, opts ...gax.CallOption) *OperationIterator { |
| 607 |
return c.internalClient.ListPhotoSequences(ctx, req, opts...) |
| 608 |
} |
| 609 |
|
| 610 |
// DeletePhotoSequence deletes a PhotoSequence and |
| 611 |
// its metadata. |
| 612 |
// |
| 613 |
// This method returns the following error codes: |
| 614 |
// |
| 615 |
// google.rpc.Code.PERMISSION_DENIED if |
| 616 |
// the requesting user did not create the requested photo sequence. |
| 617 |
// |
| 618 |
// google.rpc.Code.NOT_FOUND if the photo |
| 619 |
// sequence ID does not exist. |
| 620 |
// |
| 621 |
// google.rpc.Code.FAILED_PRECONDITION if the photo sequence ID is not |
| 622 |
// yet finished processing. |
| 623 |
func (c *StreetViewPublishClient) DeletePhotoSequence(ctx context.Context, req *publishpb.DeletePhotoSequenceRequest, opts ...gax.CallOption) error { |
| 624 |
return c.internalClient.DeletePhotoSequence(ctx, req, opts...) |
| 625 |
} |
| 626 |
|
| 627 |
// streetViewPublishGRPCClient is a client for interacting with Street View Publish API over gRPC transport. |
| 628 |
// |
| 629 |
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. |
| 630 |
type streetViewPublishGRPCClient struct { |
| 631 |
// Connection pool of gRPC connections to the service. |
| 632 |
connPool gtransport.ConnPool |
| 633 |
|
| 634 |
// Points back to the CallOptions field of the containing StreetViewPublishClient |
| 635 |
CallOptions **StreetViewPublishCallOptions |
| 636 |
|
| 637 |
// The gRPC API client. |
| 638 |
streetViewPublishClient publishpb.StreetViewPublishServiceClient |
| 639 |
|
| 640 |
// LROClient is used internally to handle long-running operations. |
| 641 |
// It is exposed so that its CallOptions can be modified if required. |
| 642 |
// Users should not Close this client. |
| 643 |
LROClient **lroauto.OperationsClient |
| 644 |
|
| 645 |
// The x-goog-* metadata to be sent with each request. |
| 646 |
xGoogHeaders []string |
| 647 |
|
| 648 |
logger *slog.Logger |
| 649 |
} |
| 650 |
|
| 651 |
// NewStreetViewPublishClient creates a new street view publish service client based on gRPC. |
| 652 |
// The returned client must be Closed when it is done being used to clean up its underlying connections. |
| 653 |
// |
| 654 |
// Publishes and connects user-contributed photos on Street View. |
| 655 |
func NewStreetViewPublishClient(ctx context.Context, opts ...option.ClientOption) (*StreetViewPublishClient, error) { |
| 656 |
clientOpts := defaultStreetViewPublishGRPCClientOptions() |
| 657 |
if newStreetViewPublishClientHook != nil { |
| 658 |
hookOpts, err := newStreetViewPublishClientHook(ctx, clientHookParams{}) |
| 659 |
if err != nil { |
| 660 |
return nil, err |
| 661 |
} |
| 662 |
clientOpts = append(clientOpts, hookOpts...) |
| 663 |
} |
| 664 |
|
| 665 |
connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) |
| 666 |
if err != nil { |
| 667 |
return nil, err |
| 668 |
} |
| 669 |
client := StreetViewPublishClient{CallOptions: defaultStreetViewPublishCallOptions()} |
| 670 |
|
| 671 |
c := &streetViewPublishGRPCClient{ |
| 672 |
connPool: connPool, |
| 673 |
streetViewPublishClient: publishpb.NewStreetViewPublishServiceClient(connPool), |
| 674 |
CallOptions: &client.CallOptions, |
| 675 |
logger: internaloption.GetLogger(opts), |
| 676 |
} |
| 677 |
c.setGoogleClientInfo() |
| 678 |
|
| 679 |
client.internalClient = c |
| 680 |
|
| 681 |
client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) |
| 682 |
if err != nil { |
| 683 |
// This error "should not happen", since we are just reusing old connection pool |
| 684 |
// and never actually need to dial. |
| 685 |
// If this does happen, we could leak connp. However, we cannot close conn: |
| 686 |
// If the user invoked the constructor with option.WithGRPCConn, |
| 687 |
// we would close a connection that's still in use. |
| 688 |
// TODO: investigate error conditions. |
| 689 |
return nil, err |
| 690 |
} |
| 691 |
c.LROClient = &client.LROClient |
| 692 |
return &client, nil |
| 693 |
} |
| 694 |
|
| 695 |
// Connection returns a connection to the API service. |
| 696 |
// |
| 697 |
// Deprecated: Connections are now pooled so this method does not always |
| 698 |
// return the same resource. |
| 699 |
func (c *streetViewPublishGRPCClient) Connection() *grpc.ClientConn { |
| 700 |
return c.connPool.Conn() |
| 701 |
} |
| 702 |
|
| 703 |
// setGoogleClientInfo sets the name and version of the application in |
| 704 |
// the `x-goog-api-client` header passed on each request. Intended for |
| 705 |
// use by Google-written clients. |
| 706 |
func (c *streetViewPublishGRPCClient) setGoogleClientInfo(keyval ...string) { |
| 707 |
kv := append([]string{"gl-go", gax.GoVersion}, keyval...) |
| 708 |
kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion) |
| 709 |
c.xGoogHeaders = []string{ |
| 710 |
"x-goog-api-client", gax.XGoogHeader(kv...), |
| 711 |
} |
| 712 |
} |
| 713 |
|
| 714 |
// Close closes the connection to the API service. The user should invoke this when |
| 715 |
// the client is no longer required. |
| 716 |
func (c *streetViewPublishGRPCClient) Close() error { |
| 717 |
return c.connPool.Close() |
| 718 |
} |
| 719 |
|
| 720 |
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. |
| 721 |
type streetViewPublishRESTClient struct { |
| 722 |
// The http endpoint to connect to. |
| 723 |
endpoint string |
| 724 |
|
| 725 |
// The http client. |
| 726 |
httpClient *http.Client |
| 727 |
|
| 728 |
// LROClient is used internally to handle long-running operations. |
| 729 |
// It is exposed so that its CallOptions can be modified if required. |
| 730 |
// Users should not Close this client. |
| 731 |
LROClient **lroauto.OperationsClient |
| 732 |
|
| 733 |
// The x-goog-* headers to be sent with each request. |
| 734 |
xGoogHeaders []string |
| 735 |
|
| 736 |
// Points back to the CallOptions field of the containing StreetViewPublishClient |
| 737 |
CallOptions **StreetViewPublishCallOptions |
| 738 |
|
| 739 |
logger *slog.Logger |
| 740 |
} |
| 741 |
|
| 742 |
// NewStreetViewPublishRESTClient creates a new street view publish service rest client. |
| 743 |
// |
| 744 |
// Publishes and connects user-contributed photos on Street View. |
| 745 |
func NewStreetViewPublishRESTClient(ctx context.Context, opts ...option.ClientOption) (*StreetViewPublishClient, error) { |
| 746 |
clientOpts := append(defaultStreetViewPublishRESTClientOptions(), opts...) |
| 747 |
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) |
| 748 |
if err != nil { |
| 749 |
return nil, err |
| 750 |
} |
| 751 |
|
| 752 |
callOpts := defaultStreetViewPublishRESTCallOptions() |
| 753 |
c := &streetViewPublishRESTClient{ |
| 754 |
endpoint: endpoint, |
| 755 |
httpClient: httpClient, |
| 756 |
CallOptions: &callOpts, |
| 757 |
logger: internaloption.GetLogger(opts), |
| 758 |
} |
| 759 |
c.setGoogleClientInfo() |
| 760 |
|
| 761 |
lroOpts := []option.ClientOption{ |
| 762 |
option.WithHTTPClient(httpClient), |
| 763 |
option.WithEndpoint(endpoint), |
| 764 |
} |
| 765 |
opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...) |
| 766 |
if err != nil { |
| 767 |
return nil, err |
| 768 |
} |
| 769 |
c.LROClient = &opClient |
| 770 |
|
| 771 |
return &StreetViewPublishClient{internalClient: c, CallOptions: callOpts}, nil |
| 772 |
} |
| 773 |
|
| 774 |
func defaultStreetViewPublishRESTClientOptions() []option.ClientOption { |
| 775 |
return []option.ClientOption{ |
| 776 |
internaloption.WithDefaultEndpoint("https://streetviewpublish.googleapis.com"), |
| 777 |
internaloption.WithDefaultEndpointTemplate("https://streetviewpublish.UNIVERSE_DOMAIN"), |
| 778 |
internaloption.WithDefaultMTLSEndpoint("https://streetviewpublish.mtls.googleapis.com"), |
| 779 |
internaloption.WithDefaultUniverseDomain("googleapis.com"), |
| 780 |
internaloption.WithDefaultAudience("https://streetviewpublish.googleapis.com/"), |
| 781 |
internaloption.WithDefaultScopes(DefaultAuthScopes()...), |
| 782 |
internaloption.EnableNewAuthLibrary(), |
| 783 |
} |
| 784 |
} |
| 785 |
|
| 786 |
// setGoogleClientInfo sets the name and version of the application in |
| 787 |
// the `x-goog-api-client` header passed on each request. Intended for |
| 788 |
// use by Google-written clients. |
| 789 |
func (c *streetViewPublishRESTClient) setGoogleClientInfo(keyval ...string) { |
| 790 |
kv := append([]string{"gl-go", gax.GoVersion}, keyval...) |
| 791 |
kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN", "pb", protoVersion) |
| 792 |
c.xGoogHeaders = []string{ |
| 793 |
"x-goog-api-client", gax.XGoogHeader(kv...), |
| 794 |
} |
| 795 |
} |
| 796 |
|
| 797 |
// Close closes the connection to the API service. The user should invoke this when |
| 798 |
// the client is no longer required. |
| 799 |
func (c *streetViewPublishRESTClient) Close() error { |
| 800 |
// Replace httpClient with nil to force cleanup. |
| 801 |
c.httpClient = nil |
| 802 |
return nil |
| 803 |
} |
| 804 |
|
| 805 |
// Connection returns a connection to the API service. |
| 806 |
// |
| 807 |
// Deprecated: This method always returns nil. |
| 808 |
func (c *streetViewPublishRESTClient) Connection() *grpc.ClientConn { |
| 809 |
return nil |
| 810 |
} |
| 811 |
func (c *streetViewPublishGRPCClient) StartUpload(ctx context.Context, req *emptypb.Empty, opts ...gax.CallOption) (*publishpb.UploadRef, error) { |
| 812 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, c.xGoogHeaders...) |
| 813 |
opts = append((*c.CallOptions).StartUpload[0:len((*c.CallOptions).StartUpload):len((*c.CallOptions).StartUpload)], opts...) |
| 814 |
var resp *publishpb.UploadRef |
| 815 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 816 |
var err error |
| 817 |
resp, err = executeRPC(ctx, c.streetViewPublishClient.StartUpload, req, settings.GRPC, c.logger, "StartUpload") |
| 818 |
return err |
| 819 |
}, opts...) |
| 820 |
if err != nil { |
| 821 |
return nil, err |
| 822 |
} |
| 823 |
return resp, nil |
| 824 |
} |
| 825 |
|
| 826 |
func (c *streetViewPublishGRPCClient) CreatePhoto(ctx context.Context, req *publishpb.CreatePhotoRequest, opts ...gax.CallOption) (*publishpb.Photo, error) { |
| 827 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, c.xGoogHeaders...) |
| 828 |
opts = append((*c.CallOptions).CreatePhoto[0:len((*c.CallOptions).CreatePhoto):len((*c.CallOptions).CreatePhoto)], opts...) |
| 829 |
var resp *publishpb.Photo |
| 830 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 831 |
var err error |
| 832 |
resp, err = executeRPC(ctx, c.streetViewPublishClient.CreatePhoto, req, settings.GRPC, c.logger, "CreatePhoto") |
| 833 |
return err |
| 834 |
}, opts...) |
| 835 |
if err != nil { |
| 836 |
return nil, err |
| 837 |
} |
| 838 |
return resp, nil |
| 839 |
} |
| 840 |
|
| 841 |
func (c *streetViewPublishGRPCClient) GetPhoto(ctx context.Context, req *publishpb.GetPhotoRequest, opts ...gax.CallOption) (*publishpb.Photo, error) { |
| 842 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "photo_id", url.QueryEscape(req.GetPhotoId()))} |
| 843 |
|
| 844 |
hds = append(c.xGoogHeaders, hds...) |
| 845 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 846 |
opts = append((*c.CallOptions).GetPhoto[0:len((*c.CallOptions).GetPhoto):len((*c.CallOptions).GetPhoto)], opts...) |
| 847 |
var resp *publishpb.Photo |
| 848 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 849 |
var err error |
| 850 |
resp, err = executeRPC(ctx, c.streetViewPublishClient.GetPhoto, req, settings.GRPC, c.logger, "GetPhoto") |
| 851 |
return err |
| 852 |
}, opts...) |
| 853 |
if err != nil { |
| 854 |
return nil, err |
| 855 |
} |
| 856 |
return resp, nil |
| 857 |
} |
| 858 |
|
| 859 |
func (c *streetViewPublishGRPCClient) BatchGetPhotos(ctx context.Context, req *publishpb.BatchGetPhotosRequest, opts ...gax.CallOption) (*publishpb.BatchGetPhotosResponse, error) { |
| 860 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, c.xGoogHeaders...) |
| 861 |
opts = append((*c.CallOptions).BatchGetPhotos[0:len((*c.CallOptions).BatchGetPhotos):len((*c.CallOptions).BatchGetPhotos)], opts...) |
| 862 |
var resp *publishpb.BatchGetPhotosResponse |
| 863 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 864 |
var err error |
| 865 |
resp, err = executeRPC(ctx, c.streetViewPublishClient.BatchGetPhotos, req, settings.GRPC, c.logger, "BatchGetPhotos") |
| 866 |
return err |
| 867 |
}, opts...) |
| 868 |
if err != nil { |
| 869 |
return nil, err |
| 870 |
} |
| 871 |
return resp, nil |
| 872 |
} |
| 873 |
|
| 874 |
func (c *streetViewPublishGRPCClient) ListPhotos(ctx context.Context, req *publishpb.ListPhotosRequest, opts ...gax.CallOption) *PhotoIterator { |
| 875 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, c.xGoogHeaders...) |
| 876 |
opts = append((*c.CallOptions).ListPhotos[0:len((*c.CallOptions).ListPhotos):len((*c.CallOptions).ListPhotos)], opts...) |
| 877 |
it := &PhotoIterator{} |
| 878 |
req = proto.Clone(req).(*publishpb.ListPhotosRequest) |
| 879 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*publishpb.Photo, string, error) { |
| 880 |
resp := &publishpb.ListPhotosResponse{} |
| 881 |
if pageToken != "" { |
| 882 |
req.PageToken = pageToken |
| 883 |
} |
| 884 |
if pageSize > math.MaxInt32 { |
| 885 |
req.PageSize = math.MaxInt32 |
| 886 |
} else if pageSize != 0 { |
| 887 |
req.PageSize = int32(pageSize) |
| 888 |
} |
| 889 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 890 |
var err error |
| 891 |
resp, err = executeRPC(ctx, c.streetViewPublishClient.ListPhotos, req, settings.GRPC, c.logger, "ListPhotos") |
| 892 |
return err |
| 893 |
}, opts...) |
| 894 |
if err != nil { |
| 895 |
return nil, "", err |
| 896 |
} |
| 897 |
|
| 898 |
it.Response = resp |
| 899 |
return resp.GetPhotos(), resp.GetNextPageToken(), nil |
| 900 |
} |
| 901 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 902 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 903 |
if err != nil { |
| 904 |
return "", err |
| 905 |
} |
| 906 |
it.items = append(it.items, items...) |
| 907 |
return nextPageToken, nil |
| 908 |
} |
| 909 |
|
| 910 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 911 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 912 |
it.pageInfo.Token = req.GetPageToken() |
| 913 |
|
| 914 |
return it |
| 915 |
} |
| 916 |
|
| 917 |
func (c *streetViewPublishGRPCClient) UpdatePhoto(ctx context.Context, req *publishpb.UpdatePhotoRequest, opts ...gax.CallOption) (*publishpb.Photo, error) { |
| 918 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "photo.photo_id.id", url.QueryEscape(req.GetPhoto().GetPhotoId().GetId()))} |
| 919 |
|
| 920 |
hds = append(c.xGoogHeaders, hds...) |
| 921 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 922 |
opts = append((*c.CallOptions).UpdatePhoto[0:len((*c.CallOptions).UpdatePhoto):len((*c.CallOptions).UpdatePhoto)], opts...) |
| 923 |
var resp *publishpb.Photo |
| 924 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 925 |
var err error |
| 926 |
resp, err = executeRPC(ctx, c.streetViewPublishClient.UpdatePhoto, req, settings.GRPC, c.logger, "UpdatePhoto") |
| 927 |
return err |
| 928 |
}, opts...) |
| 929 |
if err != nil { |
| 930 |
return nil, err |
| 931 |
} |
| 932 |
return resp, nil |
| 933 |
} |
| 934 |
|
| 935 |
func (c *streetViewPublishGRPCClient) BatchUpdatePhotos(ctx context.Context, req *publishpb.BatchUpdatePhotosRequest, opts ...gax.CallOption) (*publishpb.BatchUpdatePhotosResponse, error) { |
| 936 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, c.xGoogHeaders...) |
| 937 |
opts = append((*c.CallOptions).BatchUpdatePhotos[0:len((*c.CallOptions).BatchUpdatePhotos):len((*c.CallOptions).BatchUpdatePhotos)], opts...) |
| 938 |
var resp *publishpb.BatchUpdatePhotosResponse |
| 939 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 940 |
var err error |
| 941 |
resp, err = executeRPC(ctx, c.streetViewPublishClient.BatchUpdatePhotos, req, settings.GRPC, c.logger, "BatchUpdatePhotos") |
| 942 |
return err |
| 943 |
}, opts...) |
| 944 |
if err != nil { |
| 945 |
return nil, err |
| 946 |
} |
| 947 |
return resp, nil |
| 948 |
} |
| 949 |
|
| 950 |
func (c *streetViewPublishGRPCClient) DeletePhoto(ctx context.Context, req *publishpb.DeletePhotoRequest, opts ...gax.CallOption) error { |
| 951 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "photo_id", url.QueryEscape(req.GetPhotoId()))} |
| 952 |
|
| 953 |
hds = append(c.xGoogHeaders, hds...) |
| 954 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 955 |
opts = append((*c.CallOptions).DeletePhoto[0:len((*c.CallOptions).DeletePhoto):len((*c.CallOptions).DeletePhoto)], opts...) |
| 956 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 957 |
var err error |
| 958 |
_, err = executeRPC(ctx, c.streetViewPublishClient.DeletePhoto, req, settings.GRPC, c.logger, "DeletePhoto") |
| 959 |
return err |
| 960 |
}, opts...) |
| 961 |
return err |
| 962 |
} |
| 963 |
|
| 964 |
func (c *streetViewPublishGRPCClient) BatchDeletePhotos(ctx context.Context, req *publishpb.BatchDeletePhotosRequest, opts ...gax.CallOption) (*publishpb.BatchDeletePhotosResponse, error) { |
| 965 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, c.xGoogHeaders...) |
| 966 |
opts = append((*c.CallOptions).BatchDeletePhotos[0:len((*c.CallOptions).BatchDeletePhotos):len((*c.CallOptions).BatchDeletePhotos)], opts...) |
| 967 |
var resp *publishpb.BatchDeletePhotosResponse |
| 968 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 969 |
var err error |
| 970 |
resp, err = executeRPC(ctx, c.streetViewPublishClient.BatchDeletePhotos, req, settings.GRPC, c.logger, "BatchDeletePhotos") |
| 971 |
return err |
| 972 |
}, opts...) |
| 973 |
if err != nil { |
| 974 |
return nil, err |
| 975 |
} |
| 976 |
return resp, nil |
| 977 |
} |
| 978 |
|
| 979 |
func (c *streetViewPublishGRPCClient) StartPhotoSequenceUpload(ctx context.Context, req *emptypb.Empty, opts ...gax.CallOption) (*publishpb.UploadRef, error) { |
| 980 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, c.xGoogHeaders...) |
| 981 |
opts = append((*c.CallOptions).StartPhotoSequenceUpload[0:len((*c.CallOptions).StartPhotoSequenceUpload):len((*c.CallOptions).StartPhotoSequenceUpload)], opts...) |
| 982 |
var resp *publishpb.UploadRef |
| 983 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 984 |
var err error |
| 985 |
resp, err = executeRPC(ctx, c.streetViewPublishClient.StartPhotoSequenceUpload, req, settings.GRPC, c.logger, "StartPhotoSequenceUpload") |
| 986 |
return err |
| 987 |
}, opts...) |
| 988 |
if err != nil { |
| 989 |
return nil, err |
| 990 |
} |
| 991 |
return resp, nil |
| 992 |
} |
| 993 |
|
| 994 |
func (c *streetViewPublishGRPCClient) CreatePhotoSequence(ctx context.Context, req *publishpb.CreatePhotoSequenceRequest, opts ...gax.CallOption) (*CreatePhotoSequenceOperation, error) { |
| 995 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, c.xGoogHeaders...) |
| 996 |
opts = append((*c.CallOptions).CreatePhotoSequence[0:len((*c.CallOptions).CreatePhotoSequence):len((*c.CallOptions).CreatePhotoSequence)], opts...) |
| 997 |
var resp *longrunningpb.Operation |
| 998 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 999 |
var err error |
| 1000 |
resp, err = executeRPC(ctx, c.streetViewPublishClient.CreatePhotoSequence, req, settings.GRPC, c.logger, "CreatePhotoSequence") |
| 1001 |
return err |
| 1002 |
}, opts...) |
| 1003 |
if err != nil { |
| 1004 |
return nil, err |
| 1005 |
} |
| 1006 |
return &CreatePhotoSequenceOperation{ |
| 1007 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 1008 |
}, nil |
| 1009 |
} |
| 1010 |
|
| 1011 |
func (c *streetViewPublishGRPCClient) GetPhotoSequence(ctx context.Context, req *publishpb.GetPhotoSequenceRequest, opts ...gax.CallOption) (*GetPhotoSequenceOperation, error) { |
| 1012 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "sequence_id", url.QueryEscape(req.GetSequenceId()))} |
| 1013 |
|
| 1014 |
hds = append(c.xGoogHeaders, hds...) |
| 1015 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1016 |
opts = append((*c.CallOptions).GetPhotoSequence[0:len((*c.CallOptions).GetPhotoSequence):len((*c.CallOptions).GetPhotoSequence)], opts...) |
| 1017 |
var resp *longrunningpb.Operation |
| 1018 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1019 |
var err error |
| 1020 |
resp, err = executeRPC(ctx, c.streetViewPublishClient.GetPhotoSequence, req, settings.GRPC, c.logger, "GetPhotoSequence") |
| 1021 |
return err |
| 1022 |
}, opts...) |
| 1023 |
if err != nil { |
| 1024 |
return nil, err |
| 1025 |
} |
| 1026 |
return &GetPhotoSequenceOperation{ |
| 1027 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 1028 |
}, nil |
| 1029 |
} |
| 1030 |
|
| 1031 |
func (c *streetViewPublishGRPCClient) ListPhotoSequences(ctx context.Context, req *publishpb.ListPhotoSequencesRequest, opts ...gax.CallOption) *OperationIterator { |
| 1032 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, c.xGoogHeaders...) |
| 1033 |
opts = append((*c.CallOptions).ListPhotoSequences[0:len((*c.CallOptions).ListPhotoSequences):len((*c.CallOptions).ListPhotoSequences)], opts...) |
| 1034 |
it := &OperationIterator{} |
| 1035 |
req = proto.Clone(req).(*publishpb.ListPhotoSequencesRequest) |
| 1036 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { |
| 1037 |
resp := &publishpb.ListPhotoSequencesResponse{} |
| 1038 |
if pageToken != "" { |
| 1039 |
req.PageToken = pageToken |
| 1040 |
} |
| 1041 |
if pageSize > math.MaxInt32 { |
| 1042 |
req.PageSize = math.MaxInt32 |
| 1043 |
} else if pageSize != 0 { |
| 1044 |
req.PageSize = int32(pageSize) |
| 1045 |
} |
| 1046 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1047 |
var err error |
| 1048 |
resp, err = executeRPC(ctx, c.streetViewPublishClient.ListPhotoSequences, req, settings.GRPC, c.logger, "ListPhotoSequences") |
| 1049 |
return err |
| 1050 |
}, opts...) |
| 1051 |
if err != nil { |
| 1052 |
return nil, "", err |
| 1053 |
} |
| 1054 |
|
| 1055 |
it.Response = resp |
| 1056 |
return resp.GetPhotoSequences(), resp.GetNextPageToken(), nil |
| 1057 |
} |
| 1058 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1059 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1060 |
if err != nil { |
| 1061 |
return "", err |
| 1062 |
} |
| 1063 |
it.items = append(it.items, items...) |
| 1064 |
return nextPageToken, nil |
| 1065 |
} |
| 1066 |
|
| 1067 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1068 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1069 |
it.pageInfo.Token = req.GetPageToken() |
| 1070 |
|
| 1071 |
return it |
| 1072 |
} |
| 1073 |
|
| 1074 |
func (c *streetViewPublishGRPCClient) DeletePhotoSequence(ctx context.Context, req *publishpb.DeletePhotoSequenceRequest, opts ...gax.CallOption) error { |
| 1075 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "sequence_id", url.QueryEscape(req.GetSequenceId()))} |
| 1076 |
|
| 1077 |
hds = append(c.xGoogHeaders, hds...) |
| 1078 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1079 |
opts = append((*c.CallOptions).DeletePhotoSequence[0:len((*c.CallOptions).DeletePhotoSequence):len((*c.CallOptions).DeletePhotoSequence)], opts...) |
| 1080 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1081 |
var err error |
| 1082 |
_, err = executeRPC(ctx, c.streetViewPublishClient.DeletePhotoSequence, req, settings.GRPC, c.logger, "DeletePhotoSequence") |
| 1083 |
return err |
| 1084 |
}, opts...) |
| 1085 |
return err |
| 1086 |
} |
| 1087 |
|
| 1088 |
// StartUpload creates an upload session to start uploading photo bytes. The method uses |
| 1089 |
// the upload URL of the returned |
| 1090 |
// UploadRef to upload the bytes for |
| 1091 |
// the [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)]. |
| 1092 |
// |
| 1093 |
// In addition to the photo requirements shown in |
| 1094 |
// https://support.google.com/maps/answer/7012050?ref_topic=6275604 (at https://support.google.com/maps/answer/7012050?ref_topic=6275604), |
| 1095 |
// the photo must meet the following requirements: |
| 1096 |
// |
| 1097 |
// Photo Sphere XMP metadata must be included in the photo metadata. See |
| 1098 |
// https://developers.google.com/streetview/spherical-metadata (at https://developers.google.com/streetview/spherical-metadata) for the |
| 1099 |
// required fields. |
| 1100 |
// |
| 1101 |
// The pixel size of the photo must meet the size requirements listed in |
| 1102 |
// https://support.google.com/maps/answer/7012050?ref_topic=6275604 (at https://support.google.com/maps/answer/7012050?ref_topic=6275604), and |
| 1103 |
// the photo must be a full 360 horizontally. |
| 1104 |
// |
| 1105 |
// After the upload completes, the method uses |
| 1106 |
// UploadRef with |
| 1107 |
// CreatePhoto |
| 1108 |
// to create the [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] object entry. |
| 1109 |
func (c *streetViewPublishRESTClient) StartUpload(ctx context.Context, req *emptypb.Empty, opts ...gax.CallOption) (*publishpb.UploadRef, error) { |
| 1110 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 1111 |
jsonReq, err := m.Marshal(req) |
| 1112 |
if err != nil { |
| 1113 |
return nil, err |
| 1114 |
} |
| 1115 |
|
| 1116 |
baseUrl, err := url.Parse(c.endpoint) |
| 1117 |
if err != nil { |
| 1118 |
return nil, err |
| 1119 |
} |
| 1120 |
baseUrl.Path += fmt.Sprintf("/v1/photo:startUpload") |
| 1121 |
|
| 1122 |
params := url.Values{} |
| 1123 |
params.Add("$alt", "json;enum-encoding=int") |
| 1124 |
|
| 1125 |
baseUrl.RawQuery = params.Encode() |
| 1126 |
|
| 1127 |
// Build HTTP headers from client and context metadata. |
| 1128 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 1129 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1130 |
opts = append((*c.CallOptions).StartUpload[0:len((*c.CallOptions).StartUpload):len((*c.CallOptions).StartUpload)], opts...) |
| 1131 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1132 |
resp := &publishpb.UploadRef{} |
| 1133 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1134 |
if settings.Path != "" { |
| 1135 |
baseUrl.Path = settings.Path |
| 1136 |
} |
| 1137 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 1138 |
if err != nil { |
| 1139 |
return err |
| 1140 |
} |
| 1141 |
httpReq = httpReq.WithContext(ctx) |
| 1142 |
httpReq.Header = headers |
| 1143 |
|
| 1144 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "StartUpload") |
| 1145 |
if err != nil { |
| 1146 |
return err |
| 1147 |
} |
| 1148 |
|
| 1149 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 1150 |
return err |
| 1151 |
} |
| 1152 |
|
| 1153 |
return nil |
| 1154 |
}, opts...) |
| 1155 |
if e != nil { |
| 1156 |
return nil, e |
| 1157 |
} |
| 1158 |
return resp, nil |
| 1159 |
} |
| 1160 |
|
| 1161 |
// CreatePhoto after the client finishes uploading the photo with the returned |
| 1162 |
// UploadRef, |
| 1163 |
// CreatePhoto |
| 1164 |
// publishes the uploaded [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] to |
| 1165 |
// Street View on Google Maps. |
| 1166 |
// |
| 1167 |
// Currently, the only way to set heading, pitch, and roll in CreatePhoto is |
| 1168 |
// through the Photo Sphere XMP |
| 1169 |
// metadata (at https://developers.google.com/streetview/spherical-metadata) in |
| 1170 |
// the photo bytes. CreatePhoto ignores the pose.heading, pose.pitch, |
| 1171 |
// pose.roll, pose.altitude, and pose.level fields in Pose. |
| 1172 |
// |
| 1173 |
// This method returns the following error codes: |
| 1174 |
// |
| 1175 |
// google.rpc.Code.INVALID_ARGUMENT if |
| 1176 |
// the request is malformed or if the uploaded photo is not a 360 photo. |
| 1177 |
// |
| 1178 |
// google.rpc.Code.NOT_FOUND if the upload |
| 1179 |
// reference does not exist. |
| 1180 |
// |
| 1181 |
// google.rpc.Code.RESOURCE_EXHAUSTED |
| 1182 |
// if the account has reached the storage limit. |
| 1183 |
func (c *streetViewPublishRESTClient) CreatePhoto(ctx context.Context, req *publishpb.CreatePhotoRequest, opts ...gax.CallOption) (*publishpb.Photo, error) { |
| 1184 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 1185 |
body := req.GetPhoto() |
| 1186 |
jsonReq, err := m.Marshal(body) |
| 1187 |
if err != nil { |
| 1188 |
return nil, err |
| 1189 |
} |
| 1190 |
|
| 1191 |
baseUrl, err := url.Parse(c.endpoint) |
| 1192 |
if err != nil { |
| 1193 |
return nil, err |
| 1194 |
} |
| 1195 |
baseUrl.Path += fmt.Sprintf("/v1/photo") |
| 1196 |
|
| 1197 |
params := url.Values{} |
| 1198 |
params.Add("$alt", "json;enum-encoding=int") |
| 1199 |
|
| 1200 |
baseUrl.RawQuery = params.Encode() |
| 1201 |
|
| 1202 |
// Build HTTP headers from client and context metadata. |
| 1203 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 1204 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1205 |
opts = append((*c.CallOptions).CreatePhoto[0:len((*c.CallOptions).CreatePhoto):len((*c.CallOptions).CreatePhoto)], opts...) |
| 1206 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1207 |
resp := &publishpb.Photo{} |
| 1208 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1209 |
if settings.Path != "" { |
| 1210 |
baseUrl.Path = settings.Path |
| 1211 |
} |
| 1212 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 1213 |
if err != nil { |
| 1214 |
return err |
| 1215 |
} |
| 1216 |
httpReq = httpReq.WithContext(ctx) |
| 1217 |
httpReq.Header = headers |
| 1218 |
|
| 1219 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreatePhoto") |
| 1220 |
if err != nil { |
| 1221 |
return err |
| 1222 |
} |
| 1223 |
|
| 1224 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 1225 |
return err |
| 1226 |
} |
| 1227 |
|
| 1228 |
return nil |
| 1229 |
}, opts...) |
| 1230 |
if e != nil { |
| 1231 |
return nil, e |
| 1232 |
} |
| 1233 |
return resp, nil |
| 1234 |
} |
| 1235 |
|
| 1236 |
// GetPhoto gets the metadata of the specified |
| 1237 |
// [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)]. |
| 1238 |
// |
| 1239 |
// This method returns the following error codes: |
| 1240 |
// |
| 1241 |
// google.rpc.Code.PERMISSION_DENIED if |
| 1242 |
// the requesting user did not create the requested |
| 1243 |
// [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)]. |
| 1244 |
// |
| 1245 |
// google.rpc.Code.NOT_FOUND if the requested |
| 1246 |
// [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] does not exist. |
| 1247 |
// |
| 1248 |
// google.rpc.Code.UNAVAILABLE if the |
| 1249 |
// requested [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] is still being |
| 1250 |
// indexed. |
| 1251 |
func (c *streetViewPublishRESTClient) GetPhoto(ctx context.Context, req *publishpb.GetPhotoRequest, opts ...gax.CallOption) (*publishpb.Photo, error) { |
| 1252 |
baseUrl, err := url.Parse(c.endpoint) |
| 1253 |
if err != nil { |
| 1254 |
return nil, err |
| 1255 |
} |
| 1256 |
baseUrl.Path += fmt.Sprintf("/v1/photo/%v", req.GetPhotoId()) |
| 1257 |
|
| 1258 |
params := url.Values{} |
| 1259 |
params.Add("$alt", "json;enum-encoding=int") |
| 1260 |
if req.GetLanguageCode() != "" { |
| 1261 |
params.Add("languageCode", fmt.Sprintf("%v", req.GetLanguageCode())) |
| 1262 |
} |
| 1263 |
params.Add("view", fmt.Sprintf("%v", req.GetView())) |
| 1264 |
|
| 1265 |
baseUrl.RawQuery = params.Encode() |
| 1266 |
|
| 1267 |
// Build HTTP headers from client and context metadata. |
| 1268 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "photo_id", url.QueryEscape(req.GetPhotoId()))} |
| 1269 |
|
| 1270 |
hds = append(c.xGoogHeaders, hds...) |
| 1271 |
hds = append(hds, "Content-Type", "application/json") |
| 1272 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1273 |
opts = append((*c.CallOptions).GetPhoto[0:len((*c.CallOptions).GetPhoto):len((*c.CallOptions).GetPhoto)], opts...) |
| 1274 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1275 |
resp := &publishpb.Photo{} |
| 1276 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1277 |
if settings.Path != "" { |
| 1278 |
baseUrl.Path = settings.Path |
| 1279 |
} |
| 1280 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 1281 |
if err != nil { |
| 1282 |
return err |
| 1283 |
} |
| 1284 |
httpReq = httpReq.WithContext(ctx) |
| 1285 |
httpReq.Header = headers |
| 1286 |
|
| 1287 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetPhoto") |
| 1288 |
if err != nil { |
| 1289 |
return err |
| 1290 |
} |
| 1291 |
|
| 1292 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 1293 |
return err |
| 1294 |
} |
| 1295 |
|
| 1296 |
return nil |
| 1297 |
}, opts...) |
| 1298 |
if e != nil { |
| 1299 |
return nil, e |
| 1300 |
} |
| 1301 |
return resp, nil |
| 1302 |
} |
| 1303 |
|
| 1304 |
// BatchGetPhotos gets the metadata of the specified |
| 1305 |
// [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] batch. |
| 1306 |
// |
| 1307 |
// Note that if |
| 1308 |
// BatchGetPhotos |
| 1309 |
// fails, either critical fields are missing or there is an authentication |
| 1310 |
// error. Even if |
| 1311 |
// BatchGetPhotos |
| 1312 |
// succeeds, individual photos in the batch may have failures. |
| 1313 |
// These failures are specified in each |
| 1314 |
// PhotoResponse.status |
| 1315 |
// in |
| 1316 |
// BatchGetPhotosResponse.results. |
| 1317 |
// See |
| 1318 |
// GetPhoto |
| 1319 |
// for specific failures that can occur per photo. |
| 1320 |
func (c *streetViewPublishRESTClient) BatchGetPhotos(ctx context.Context, req *publishpb.BatchGetPhotosRequest, opts ...gax.CallOption) (*publishpb.BatchGetPhotosResponse, error) { |
| 1321 |
baseUrl, err := url.Parse(c.endpoint) |
| 1322 |
if err != nil { |
| 1323 |
return nil, err |
| 1324 |
} |
| 1325 |
baseUrl.Path += fmt.Sprintf("/v1/photos:batchGet") |
| 1326 |
|
| 1327 |
params := url.Values{} |
| 1328 |
params.Add("$alt", "json;enum-encoding=int") |
| 1329 |
if req.GetLanguageCode() != "" { |
| 1330 |
params.Add("languageCode", fmt.Sprintf("%v", req.GetLanguageCode())) |
| 1331 |
} |
| 1332 |
if items := req.GetPhotoIds(); len(items) > 0 { |
| 1333 |
for _, item := range items { |
| 1334 |
params.Add("photoIds", fmt.Sprintf("%v", item)) |
| 1335 |
} |
| 1336 |
} |
| 1337 |
params.Add("view", fmt.Sprintf("%v", req.GetView())) |
| 1338 |
|
| 1339 |
baseUrl.RawQuery = params.Encode() |
| 1340 |
|
| 1341 |
// Build HTTP headers from client and context metadata. |
| 1342 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 1343 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1344 |
opts = append((*c.CallOptions).BatchGetPhotos[0:len((*c.CallOptions).BatchGetPhotos):len((*c.CallOptions).BatchGetPhotos)], opts...) |
| 1345 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1346 |
resp := &publishpb.BatchGetPhotosResponse{} |
| 1347 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1348 |
if settings.Path != "" { |
| 1349 |
baseUrl.Path = settings.Path |
| 1350 |
} |
| 1351 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 1352 |
if err != nil { |
| 1353 |
return err |
| 1354 |
} |
| 1355 |
httpReq = httpReq.WithContext(ctx) |
| 1356 |
httpReq.Header = headers |
| 1357 |
|
| 1358 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "BatchGetPhotos") |
| 1359 |
if err != nil { |
| 1360 |
return err |
| 1361 |
} |
| 1362 |
|
| 1363 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 1364 |
return err |
| 1365 |
} |
| 1366 |
|
| 1367 |
return nil |
| 1368 |
}, opts...) |
| 1369 |
if e != nil { |
| 1370 |
return nil, e |
| 1371 |
} |
| 1372 |
return resp, nil |
| 1373 |
} |
| 1374 |
|
| 1375 |
// ListPhotos lists all the [Photos][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] that belong to |
| 1376 |
// the user. |
| 1377 |
// |
| 1378 |
// Note: Recently created photos that are still |
| 1379 |
// being indexed are not returned in the response. |
| 1380 |
func (c *streetViewPublishRESTClient) ListPhotos(ctx context.Context, req *publishpb.ListPhotosRequest, opts ...gax.CallOption) *PhotoIterator { |
| 1381 |
it := &PhotoIterator{} |
| 1382 |
req = proto.Clone(req).(*publishpb.ListPhotosRequest) |
| 1383 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1384 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*publishpb.Photo, string, error) { |
| 1385 |
resp := &publishpb.ListPhotosResponse{} |
| 1386 |
if pageToken != "" { |
| 1387 |
req.PageToken = pageToken |
| 1388 |
} |
| 1389 |
if pageSize > math.MaxInt32 { |
| 1390 |
req.PageSize = math.MaxInt32 |
| 1391 |
} else if pageSize != 0 { |
| 1392 |
req.PageSize = int32(pageSize) |
| 1393 |
} |
| 1394 |
baseUrl, err := url.Parse(c.endpoint) |
| 1395 |
if err != nil { |
| 1396 |
return nil, "", err |
| 1397 |
} |
| 1398 |
baseUrl.Path += fmt.Sprintf("/v1/photos") |
| 1399 |
|
| 1400 |
params := url.Values{} |
| 1401 |
params.Add("$alt", "json;enum-encoding=int") |
| 1402 |
if req.GetFilter() != "" { |
| 1403 |
params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) |
| 1404 |
} |
| 1405 |
if req.GetLanguageCode() != "" { |
| 1406 |
params.Add("languageCode", fmt.Sprintf("%v", req.GetLanguageCode())) |
| 1407 |
} |
| 1408 |
if req.GetPageSize() != 0 { |
| 1409 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 1410 |
} |
| 1411 |
if req.GetPageToken() != "" { |
| 1412 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 1413 |
} |
| 1414 |
params.Add("view", fmt.Sprintf("%v", req.GetView())) |
| 1415 |
|
| 1416 |
baseUrl.RawQuery = params.Encode() |
| 1417 |
|
| 1418 |
// Build HTTP headers from client and context metadata. |
| 1419 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 1420 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1421 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1422 |
if settings.Path != "" { |
| 1423 |
baseUrl.Path = settings.Path |
| 1424 |
} |
| 1425 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 1426 |
if err != nil { |
| 1427 |
return err |
| 1428 |
} |
| 1429 |
httpReq.Header = headers |
| 1430 |
|
| 1431 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListPhotos") |
| 1432 |
if err != nil { |
| 1433 |
return err |
| 1434 |
} |
| 1435 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 1436 |
return err |
| 1437 |
} |
| 1438 |
|
| 1439 |
return nil |
| 1440 |
}, opts...) |
| 1441 |
if e != nil { |
| 1442 |
return nil, "", e |
| 1443 |
} |
| 1444 |
it.Response = resp |
| 1445 |
return resp.GetPhotos(), resp.GetNextPageToken(), nil |
| 1446 |
} |
| 1447 |
|
| 1448 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1449 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1450 |
if err != nil { |
| 1451 |
return "", err |
| 1452 |
} |
| 1453 |
it.items = append(it.items, items...) |
| 1454 |
return nextPageToken, nil |
| 1455 |
} |
| 1456 |
|
| 1457 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1458 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1459 |
it.pageInfo.Token = req.GetPageToken() |
| 1460 |
|
| 1461 |
return it |
| 1462 |
} |
| 1463 |
|
| 1464 |
// UpdatePhoto updates the metadata of a [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)], such |
| 1465 |
// as pose, place association, connections, etc. Changing the pixels of a |
| 1466 |
// photo is not supported. |
| 1467 |
// |
| 1468 |
// Only the fields specified in the |
| 1469 |
// updateMask |
| 1470 |
// field are used. If updateMask is not present, the update applies to all |
| 1471 |
// fields. |
| 1472 |
// |
| 1473 |
// This method returns the following error codes: |
| 1474 |
// |
| 1475 |
// google.rpc.Code.PERMISSION_DENIED if |
| 1476 |
// the requesting user did not create the requested photo. |
| 1477 |
// |
| 1478 |
// google.rpc.Code.INVALID_ARGUMENT if |
| 1479 |
// the request is malformed. |
| 1480 |
// |
| 1481 |
// google.rpc.Code.NOT_FOUND if the requested |
| 1482 |
// photo does not exist. |
| 1483 |
// |
| 1484 |
// google.rpc.Code.UNAVAILABLE if the |
| 1485 |
// requested [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] is still being |
| 1486 |
// indexed. |
| 1487 |
func (c *streetViewPublishRESTClient) UpdatePhoto(ctx context.Context, req *publishpb.UpdatePhotoRequest, opts ...gax.CallOption) (*publishpb.Photo, error) { |
| 1488 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 1489 |
body := req.GetPhoto() |
| 1490 |
jsonReq, err := m.Marshal(body) |
| 1491 |
if err != nil { |
| 1492 |
return nil, err |
| 1493 |
} |
| 1494 |
|
| 1495 |
baseUrl, err := url.Parse(c.endpoint) |
| 1496 |
if err != nil { |
| 1497 |
return nil, err |
| 1498 |
} |
| 1499 |
baseUrl.Path += fmt.Sprintf("/v1/photo/%v", req.GetPhoto().GetPhotoId().GetId()) |
| 1500 |
|
| 1501 |
params := url.Values{} |
| 1502 |
params.Add("$alt", "json;enum-encoding=int") |
| 1503 |
if req.GetUpdateMask() != nil { |
| 1504 |
field, err := protojson.Marshal(req.GetUpdateMask()) |
| 1505 |
if err != nil { |
| 1506 |
return nil, err |
| 1507 |
} |
| 1508 |
params.Add("updateMask", string(field[1:len(field)-1])) |
| 1509 |
} |
| 1510 |
|
| 1511 |
baseUrl.RawQuery = params.Encode() |
| 1512 |
|
| 1513 |
// Build HTTP headers from client and context metadata. |
| 1514 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "photo.photo_id.id", url.QueryEscape(req.GetPhoto().GetPhotoId().GetId()))} |
| 1515 |
|
| 1516 |
hds = append(c.xGoogHeaders, hds...) |
| 1517 |
hds = append(hds, "Content-Type", "application/json") |
| 1518 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1519 |
opts = append((*c.CallOptions).UpdatePhoto[0:len((*c.CallOptions).UpdatePhoto):len((*c.CallOptions).UpdatePhoto)], opts...) |
| 1520 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1521 |
resp := &publishpb.Photo{} |
| 1522 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1523 |
if settings.Path != "" { |
| 1524 |
baseUrl.Path = settings.Path |
| 1525 |
} |
| 1526 |
httpReq, err := http.NewRequest("PUT", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 1527 |
if err != nil { |
| 1528 |
return err |
| 1529 |
} |
| 1530 |
httpReq = httpReq.WithContext(ctx) |
| 1531 |
httpReq.Header = headers |
| 1532 |
|
| 1533 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdatePhoto") |
| 1534 |
if err != nil { |
| 1535 |
return err |
| 1536 |
} |
| 1537 |
|
| 1538 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 1539 |
return err |
| 1540 |
} |
| 1541 |
|
| 1542 |
return nil |
| 1543 |
}, opts...) |
| 1544 |
if e != nil { |
| 1545 |
return nil, e |
| 1546 |
} |
| 1547 |
return resp, nil |
| 1548 |
} |
| 1549 |
|
| 1550 |
// BatchUpdatePhotos updates the metadata of [Photos][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)], such |
| 1551 |
// as pose, place association, connections, etc. Changing the pixels of photos |
| 1552 |
// is not supported. |
| 1553 |
// |
| 1554 |
// Note that if |
| 1555 |
// BatchUpdatePhotos |
| 1556 |
// fails, either critical fields are missing or there is an authentication |
| 1557 |
// error. Even if |
| 1558 |
// BatchUpdatePhotos |
| 1559 |
// succeeds, individual photos in the batch may have failures. |
| 1560 |
// These failures are specified in each |
| 1561 |
// PhotoResponse.status |
| 1562 |
// in |
| 1563 |
// BatchUpdatePhotosResponse.results. |
| 1564 |
// See |
| 1565 |
// UpdatePhoto |
| 1566 |
// for specific failures that can occur per photo. |
| 1567 |
// |
| 1568 |
// Only the fields specified in |
| 1569 |
// updateMask |
| 1570 |
// field are used. If updateMask is not present, the update applies to all |
| 1571 |
// fields. |
| 1572 |
// |
| 1573 |
// The number of |
| 1574 |
// UpdatePhotoRequest |
| 1575 |
// messages in a |
| 1576 |
// BatchUpdatePhotosRequest |
| 1577 |
// must not exceed 20. |
| 1578 |
// |
| 1579 |
// Note: To update |
| 1580 |
// Pose.altitude, |
| 1581 |
// Pose.latLngPair has to be |
| 1582 |
// filled as well. Otherwise, the request will fail. |
| 1583 |
func (c *streetViewPublishRESTClient) BatchUpdatePhotos(ctx context.Context, req *publishpb.BatchUpdatePhotosRequest, opts ...gax.CallOption) (*publishpb.BatchUpdatePhotosResponse, error) { |
| 1584 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 1585 |
jsonReq, err := m.Marshal(req) |
| 1586 |
if err != nil { |
| 1587 |
return nil, err |
| 1588 |
} |
| 1589 |
|
| 1590 |
baseUrl, err := url.Parse(c.endpoint) |
| 1591 |
if err != nil { |
| 1592 |
return nil, err |
| 1593 |
} |
| 1594 |
baseUrl.Path += fmt.Sprintf("/v1/photos:batchUpdate") |
| 1595 |
|
| 1596 |
params := url.Values{} |
| 1597 |
params.Add("$alt", "json;enum-encoding=int") |
| 1598 |
|
| 1599 |
baseUrl.RawQuery = params.Encode() |
| 1600 |
|
| 1601 |
// Build HTTP headers from client and context metadata. |
| 1602 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 1603 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1604 |
opts = append((*c.CallOptions).BatchUpdatePhotos[0:len((*c.CallOptions).BatchUpdatePhotos):len((*c.CallOptions).BatchUpdatePhotos)], opts...) |
| 1605 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1606 |
resp := &publishpb.BatchUpdatePhotosResponse{} |
| 1607 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1608 |
if settings.Path != "" { |
| 1609 |
baseUrl.Path = settings.Path |
| 1610 |
} |
| 1611 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 1612 |
if err != nil { |
| 1613 |
return err |
| 1614 |
} |
| 1615 |
httpReq = httpReq.WithContext(ctx) |
| 1616 |
httpReq.Header = headers |
| 1617 |
|
| 1618 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "BatchUpdatePhotos") |
| 1619 |
if err != nil { |
| 1620 |
return err |
| 1621 |
} |
| 1622 |
|
| 1623 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 1624 |
return err |
| 1625 |
} |
| 1626 |
|
| 1627 |
return nil |
| 1628 |
}, opts...) |
| 1629 |
if e != nil { |
| 1630 |
return nil, e |
| 1631 |
} |
| 1632 |
return resp, nil |
| 1633 |
} |
| 1634 |
|
| 1635 |
// DeletePhoto deletes a [Photo][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] and its metadata. |
| 1636 |
// |
| 1637 |
// This method returns the following error codes: |
| 1638 |
// |
| 1639 |
// google.rpc.Code.PERMISSION_DENIED if |
| 1640 |
// the requesting user did not create the requested photo. |
| 1641 |
// |
| 1642 |
// google.rpc.Code.NOT_FOUND if the photo ID |
| 1643 |
// does not exist. |
| 1644 |
func (c *streetViewPublishRESTClient) DeletePhoto(ctx context.Context, req *publishpb.DeletePhotoRequest, opts ...gax.CallOption) error { |
| 1645 |
baseUrl, err := url.Parse(c.endpoint) |
| 1646 |
if err != nil { |
| 1647 |
return err |
| 1648 |
} |
| 1649 |
baseUrl.Path += fmt.Sprintf("/v1/photo/%v", req.GetPhotoId()) |
| 1650 |
|
| 1651 |
params := url.Values{} |
| 1652 |
params.Add("$alt", "json;enum-encoding=int") |
| 1653 |
|
| 1654 |
baseUrl.RawQuery = params.Encode() |
| 1655 |
|
| 1656 |
// Build HTTP headers from client and context metadata. |
| 1657 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "photo_id", url.QueryEscape(req.GetPhotoId()))} |
| 1658 |
|
| 1659 |
hds = append(c.xGoogHeaders, hds...) |
| 1660 |
hds = append(hds, "Content-Type", "application/json") |
| 1661 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1662 |
return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1663 |
if settings.Path != "" { |
| 1664 |
baseUrl.Path = settings.Path |
| 1665 |
} |
| 1666 |
httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) |
| 1667 |
if err != nil { |
| 1668 |
return err |
| 1669 |
} |
| 1670 |
httpReq = httpReq.WithContext(ctx) |
| 1671 |
httpReq.Header = headers |
| 1672 |
|
| 1673 |
_, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeletePhoto") |
| 1674 |
return err |
| 1675 |
}, opts...) |
| 1676 |
} |
| 1677 |
|
| 1678 |
// BatchDeletePhotos deletes a list of [Photos][google.streetview.publish.v1.Photo (at http://google.streetview.publish.v1.Photo)] and their |
| 1679 |
// metadata. |
| 1680 |
// |
| 1681 |
// Note that if |
| 1682 |
// BatchDeletePhotos |
| 1683 |
// fails, either critical fields are missing or there is an authentication |
| 1684 |
// error. Even if |
| 1685 |
// BatchDeletePhotos |
| 1686 |
// succeeds, individual photos in the batch may have failures. |
| 1687 |
// These failures are specified in each |
| 1688 |
// PhotoResponse.status |
| 1689 |
// in |
| 1690 |
// BatchDeletePhotosResponse.results. |
| 1691 |
// See |
| 1692 |
// DeletePhoto |
| 1693 |
// for specific failures that can occur per photo. |
| 1694 |
func (c *streetViewPublishRESTClient) BatchDeletePhotos(ctx context.Context, req *publishpb.BatchDeletePhotosRequest, opts ...gax.CallOption) (*publishpb.BatchDeletePhotosResponse, error) { |
| 1695 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 1696 |
jsonReq, err := m.Marshal(req) |
| 1697 |
if err != nil { |
| 1698 |
return nil, err |
| 1699 |
} |
| 1700 |
|
| 1701 |
baseUrl, err := url.Parse(c.endpoint) |
| 1702 |
if err != nil { |
| 1703 |
return nil, err |
| 1704 |
} |
| 1705 |
baseUrl.Path += fmt.Sprintf("/v1/photos:batchDelete") |
| 1706 |
|
| 1707 |
params := url.Values{} |
| 1708 |
params.Add("$alt", "json;enum-encoding=int") |
| 1709 |
|
| 1710 |
baseUrl.RawQuery = params.Encode() |
| 1711 |
|
| 1712 |
// Build HTTP headers from client and context metadata. |
| 1713 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 1714 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1715 |
opts = append((*c.CallOptions).BatchDeletePhotos[0:len((*c.CallOptions).BatchDeletePhotos):len((*c.CallOptions).BatchDeletePhotos)], opts...) |
| 1716 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1717 |
resp := &publishpb.BatchDeletePhotosResponse{} |
| 1718 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1719 |
if settings.Path != "" { |
| 1720 |
baseUrl.Path = settings.Path |
| 1721 |
} |
| 1722 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 1723 |
if err != nil { |
| 1724 |
return err |
| 1725 |
} |
| 1726 |
httpReq = httpReq.WithContext(ctx) |
| 1727 |
httpReq.Header = headers |
| 1728 |
|
| 1729 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "BatchDeletePhotos") |
| 1730 |
if err != nil { |
| 1731 |
return err |
| 1732 |
} |
| 1733 |
|
| 1734 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 1735 |
return err |
| 1736 |
} |
| 1737 |
|
| 1738 |
return nil |
| 1739 |
}, opts...) |
| 1740 |
if e != nil { |
| 1741 |
return nil, e |
| 1742 |
} |
| 1743 |
return resp, nil |
| 1744 |
} |
| 1745 |
|
| 1746 |
// StartPhotoSequenceUpload creates an upload session to start uploading photo sequence data. |
| 1747 |
// The upload URL of the returned |
| 1748 |
// UploadRef is used to upload the |
| 1749 |
// data for the photoSequence. |
| 1750 |
// |
| 1751 |
// After the upload is complete, the |
| 1752 |
// UploadRef is used with |
| 1753 |
// CreatePhotoSequence |
| 1754 |
// to create the PhotoSequence |
| 1755 |
// object entry. |
| 1756 |
func (c *streetViewPublishRESTClient) StartPhotoSequenceUpload(ctx context.Context, req *emptypb.Empty, opts ...gax.CallOption) (*publishpb.UploadRef, error) { |
| 1757 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 1758 |
jsonReq, err := m.Marshal(req) |
| 1759 |
if err != nil { |
| 1760 |
return nil, err |
| 1761 |
} |
| 1762 |
|
| 1763 |
baseUrl, err := url.Parse(c.endpoint) |
| 1764 |
if err != nil { |
| 1765 |
return nil, err |
| 1766 |
} |
| 1767 |
baseUrl.Path += fmt.Sprintf("/v1/photoSequence:startUpload") |
| 1768 |
|
| 1769 |
params := url.Values{} |
| 1770 |
params.Add("$alt", "json;enum-encoding=int") |
| 1771 |
|
| 1772 |
baseUrl.RawQuery = params.Encode() |
| 1773 |
|
| 1774 |
// Build HTTP headers from client and context metadata. |
| 1775 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 1776 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1777 |
opts = append((*c.CallOptions).StartPhotoSequenceUpload[0:len((*c.CallOptions).StartPhotoSequenceUpload):len((*c.CallOptions).StartPhotoSequenceUpload)], opts...) |
| 1778 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1779 |
resp := &publishpb.UploadRef{} |
| 1780 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1781 |
if settings.Path != "" { |
| 1782 |
baseUrl.Path = settings.Path |
| 1783 |
} |
| 1784 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 1785 |
if err != nil { |
| 1786 |
return err |
| 1787 |
} |
| 1788 |
httpReq = httpReq.WithContext(ctx) |
| 1789 |
httpReq.Header = headers |
| 1790 |
|
| 1791 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "StartPhotoSequenceUpload") |
| 1792 |
if err != nil { |
| 1793 |
return err |
| 1794 |
} |
| 1795 |
|
| 1796 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 1797 |
return err |
| 1798 |
} |
| 1799 |
|
| 1800 |
return nil |
| 1801 |
}, opts...) |
| 1802 |
if e != nil { |
| 1803 |
return nil, e |
| 1804 |
} |
| 1805 |
return resp, nil |
| 1806 |
} |
| 1807 |
|
| 1808 |
// CreatePhotoSequence after the client finishes uploading the |
| 1809 |
// PhotoSequence with the |
| 1810 |
// returned UploadRef, |
| 1811 |
// CreatePhotoSequence |
| 1812 |
// extracts a sequence of 360 photos from a video or Extensible Device |
| 1813 |
// Metadata (XDM, http://www.xdm.org/ (at http://www.xdm.org/)) to be published to Street View on |
| 1814 |
// Google Maps. |
| 1815 |
// |
| 1816 |
// CreatePhotoSequence returns an Operation, |
| 1817 |
// with the PhotoSequence Id set |
| 1818 |
// in the Operation.name field. |
| 1819 |
// |
| 1820 |
// This method returns the following error codes: |
| 1821 |
// |
| 1822 |
// google.rpc.Code.INVALID_ARGUMENT if |
| 1823 |
// the request is malformed. |
| 1824 |
// |
| 1825 |
// google.rpc.Code.NOT_FOUND if the upload |
| 1826 |
// reference does not exist. |
| 1827 |
func (c *streetViewPublishRESTClient) CreatePhotoSequence(ctx context.Context, req *publishpb.CreatePhotoSequenceRequest, opts ...gax.CallOption) (*CreatePhotoSequenceOperation, error) { |
| 1828 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 1829 |
body := req.GetPhotoSequence() |
| 1830 |
jsonReq, err := m.Marshal(body) |
| 1831 |
if err != nil { |
| 1832 |
return nil, err |
| 1833 |
} |
| 1834 |
|
| 1835 |
baseUrl, err := url.Parse(c.endpoint) |
| 1836 |
if err != nil { |
| 1837 |
return nil, err |
| 1838 |
} |
| 1839 |
baseUrl.Path += fmt.Sprintf("/v1/photoSequence") |
| 1840 |
|
| 1841 |
params := url.Values{} |
| 1842 |
params.Add("$alt", "json;enum-encoding=int") |
| 1843 |
params.Add("inputType", fmt.Sprintf("%v", req.GetInputType())) |
| 1844 |
|
| 1845 |
baseUrl.RawQuery = params.Encode() |
| 1846 |
|
| 1847 |
// Build HTTP headers from client and context metadata. |
| 1848 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 1849 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1850 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1851 |
resp := &longrunningpb.Operation{} |
| 1852 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1853 |
if settings.Path != "" { |
| 1854 |
baseUrl.Path = settings.Path |
| 1855 |
} |
| 1856 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 1857 |
if err != nil { |
| 1858 |
return err |
| 1859 |
} |
| 1860 |
httpReq = httpReq.WithContext(ctx) |
| 1861 |
httpReq.Header = headers |
| 1862 |
|
| 1863 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreatePhotoSequence") |
| 1864 |
if err != nil { |
| 1865 |
return err |
| 1866 |
} |
| 1867 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 1868 |
return err |
| 1869 |
} |
| 1870 |
|
| 1871 |
return nil |
| 1872 |
}, opts...) |
| 1873 |
if e != nil { |
| 1874 |
return nil, e |
| 1875 |
} |
| 1876 |
|
| 1877 |
override := fmt.Sprintf("/v1/%s", resp.GetName()) |
| 1878 |
return &CreatePhotoSequenceOperation{ |
| 1879 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 1880 |
pollPath: override, |
| 1881 |
}, nil |
| 1882 |
} |
| 1883 |
|
| 1884 |
// GetPhotoSequence gets the metadata of the specified |
| 1885 |
// PhotoSequence via the |
| 1886 |
// Operation interface. |
| 1887 |
// |
| 1888 |
// This method returns the following three types of responses: |
| 1889 |
// |
| 1890 |
// Operation.done = false, if the processing of |
| 1891 |
// PhotoSequence is not |
| 1892 |
// finished yet. |
| 1893 |
// |
| 1894 |
// Operation.done = true and Operation.error is populated, if there was |
| 1895 |
// an error in processing. |
| 1896 |
// |
| 1897 |
// Operation.done = true and Operation.response is poulated, which |
| 1898 |
// contains a PhotoSequence |
| 1899 |
// message. |
| 1900 |
// |
| 1901 |
// This method returns the following error codes: |
| 1902 |
// |
| 1903 |
// google.rpc.Code.PERMISSION_DENIED if |
| 1904 |
// the requesting user did not create the requested |
| 1905 |
// PhotoSequence. |
| 1906 |
// |
| 1907 |
// google.rpc.Code.NOT_FOUND if the requested |
| 1908 |
// PhotoSequence does not exist. |
| 1909 |
func (c *streetViewPublishRESTClient) GetPhotoSequence(ctx context.Context, req *publishpb.GetPhotoSequenceRequest, opts ...gax.CallOption) (*GetPhotoSequenceOperation, error) { |
| 1910 |
baseUrl, err := url.Parse(c.endpoint) |
| 1911 |
if err != nil { |
| 1912 |
return nil, err |
| 1913 |
} |
| 1914 |
baseUrl.Path += fmt.Sprintf("/v1/photoSequence/%v", req.GetSequenceId()) |
| 1915 |
|
| 1916 |
params := url.Values{} |
| 1917 |
params.Add("$alt", "json;enum-encoding=int") |
| 1918 |
if req.GetFilter() != "" { |
| 1919 |
params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) |
| 1920 |
} |
| 1921 |
if req.GetView() != 0 { |
| 1922 |
params.Add("view", fmt.Sprintf("%v", req.GetView())) |
| 1923 |
} |
| 1924 |
|
| 1925 |
baseUrl.RawQuery = params.Encode() |
| 1926 |
|
| 1927 |
// Build HTTP headers from client and context metadata. |
| 1928 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "sequence_id", url.QueryEscape(req.GetSequenceId()))} |
| 1929 |
|
| 1930 |
hds = append(c.xGoogHeaders, hds...) |
| 1931 |
hds = append(hds, "Content-Type", "application/json") |
| 1932 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1933 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1934 |
resp := &longrunningpb.Operation{} |
| 1935 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1936 |
if settings.Path != "" { |
| 1937 |
baseUrl.Path = settings.Path |
| 1938 |
} |
| 1939 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 1940 |
if err != nil { |
| 1941 |
return err |
| 1942 |
} |
| 1943 |
httpReq = httpReq.WithContext(ctx) |
| 1944 |
httpReq.Header = headers |
| 1945 |
|
| 1946 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetPhotoSequence") |
| 1947 |
if err != nil { |
| 1948 |
return err |
| 1949 |
} |
| 1950 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 1951 |
return err |
| 1952 |
} |
| 1953 |
|
| 1954 |
return nil |
| 1955 |
}, opts...) |
| 1956 |
if e != nil { |
| 1957 |
return nil, e |
| 1958 |
} |
| 1959 |
|
| 1960 |
override := fmt.Sprintf("/v1/%s", resp.GetName()) |
| 1961 |
return &GetPhotoSequenceOperation{ |
| 1962 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 1963 |
pollPath: override, |
| 1964 |
}, nil |
| 1965 |
} |
| 1966 |
|
| 1967 |
// ListPhotoSequences lists all the PhotoSequences |
| 1968 |
// that belong to the user, in descending CreatePhotoSequence timestamp order. |
| 1969 |
func (c *streetViewPublishRESTClient) ListPhotoSequences(ctx context.Context, req *publishpb.ListPhotoSequencesRequest, opts ...gax.CallOption) *OperationIterator { |
| 1970 |
it := &OperationIterator{} |
| 1971 |
req = proto.Clone(req).(*publishpb.ListPhotoSequencesRequest) |
| 1972 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1973 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { |
| 1974 |
resp := &publishpb.ListPhotoSequencesResponse{} |
| 1975 |
if pageToken != "" { |
| 1976 |
req.PageToken = pageToken |
| 1977 |
} |
| 1978 |
if pageSize > math.MaxInt32 { |
| 1979 |
req.PageSize = math.MaxInt32 |
| 1980 |
} else if pageSize != 0 { |
| 1981 |
req.PageSize = int32(pageSize) |
| 1982 |
} |
| 1983 |
baseUrl, err := url.Parse(c.endpoint) |
| 1984 |
if err != nil { |
| 1985 |
return nil, "", err |
| 1986 |
} |
| 1987 |
baseUrl.Path += fmt.Sprintf("/v1/photoSequences") |
| 1988 |
|
| 1989 |
params := url.Values{} |
| 1990 |
params.Add("$alt", "json;enum-encoding=int") |
| 1991 |
if req.GetFilter() != "" { |
| 1992 |
params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) |
| 1993 |
} |
| 1994 |
if req.GetPageSize() != 0 { |
| 1995 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 1996 |
} |
| 1997 |
if req.GetPageToken() != "" { |
| 1998 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 1999 |
} |
| 2000 |
|
| 2001 |
baseUrl.RawQuery = params.Encode() |
| 2002 |
|
| 2003 |
// Build HTTP headers from client and context metadata. |
| 2004 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 2005 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2006 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2007 |
if settings.Path != "" { |
| 2008 |
baseUrl.Path = settings.Path |
| 2009 |
} |
| 2010 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 2011 |
if err != nil { |
| 2012 |
return err |
| 2013 |
} |
| 2014 |
httpReq.Header = headers |
| 2015 |
|
| 2016 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListPhotoSequences") |
| 2017 |
if err != nil { |
| 2018 |
return err |
| 2019 |
} |
| 2020 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2021 |
return err |
| 2022 |
} |
| 2023 |
|
| 2024 |
return nil |
| 2025 |
}, opts...) |
| 2026 |
if e != nil { |
| 2027 |
return nil, "", e |
| 2028 |
} |
| 2029 |
it.Response = resp |
| 2030 |
return resp.GetPhotoSequences(), resp.GetNextPageToken(), nil |
| 2031 |
} |
| 2032 |
|
| 2033 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 2034 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 2035 |
if err != nil { |
| 2036 |
return "", err |
| 2037 |
} |
| 2038 |
it.items = append(it.items, items...) |
| 2039 |
return nextPageToken, nil |
| 2040 |
} |
| 2041 |
|
| 2042 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 2043 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 2044 |
it.pageInfo.Token = req.GetPageToken() |
| 2045 |
|
| 2046 |
return it |
| 2047 |
} |
| 2048 |
|
| 2049 |
// DeletePhotoSequence deletes a PhotoSequence and |
| 2050 |
// its metadata. |
| 2051 |
// |
| 2052 |
// This method returns the following error codes: |
| 2053 |
// |
| 2054 |
// google.rpc.Code.PERMISSION_DENIED if |
| 2055 |
// the requesting user did not create the requested photo sequence. |
| 2056 |
// |
| 2057 |
// google.rpc.Code.NOT_FOUND if the photo |
| 2058 |
// sequence ID does not exist. |
| 2059 |
// |
| 2060 |
// google.rpc.Code.FAILED_PRECONDITION if the photo sequence ID is not |
| 2061 |
// yet finished processing. |
| 2062 |
func (c *streetViewPublishRESTClient) DeletePhotoSequence(ctx context.Context, req *publishpb.DeletePhotoSequenceRequest, opts ...gax.CallOption) error { |
| 2063 |
baseUrl, err := url.Parse(c.endpoint) |
| 2064 |
if err != nil { |
| 2065 |
return err |
| 2066 |
} |
| 2067 |
baseUrl.Path += fmt.Sprintf("/v1/photoSequence/%v", req.GetSequenceId()) |
| 2068 |
|
| 2069 |
params := url.Values{} |
| 2070 |
params.Add("$alt", "json;enum-encoding=int") |
| 2071 |
|
| 2072 |
baseUrl.RawQuery = params.Encode() |
| 2073 |
|
| 2074 |
// Build HTTP headers from client and context metadata. |
| 2075 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "sequence_id", url.QueryEscape(req.GetSequenceId()))} |
| 2076 |
|
| 2077 |
hds = append(c.xGoogHeaders, hds...) |
| 2078 |
hds = append(hds, "Content-Type", "application/json") |
| 2079 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2080 |
return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2081 |
if settings.Path != "" { |
| 2082 |
baseUrl.Path = settings.Path |
| 2083 |
} |
| 2084 |
httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) |
| 2085 |
if err != nil { |
| 2086 |
return err |
| 2087 |
} |
| 2088 |
httpReq = httpReq.WithContext(ctx) |
| 2089 |
httpReq.Header = headers |
| 2090 |
|
| 2091 |
_, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeletePhotoSequence") |
| 2092 |
return err |
| 2093 |
}, opts...) |
| 2094 |
} |
| 2095 |
|
| 2096 |
// CreatePhotoSequenceOperation returns a new CreatePhotoSequenceOperation from a given name. |
| 2097 |
// The name must be that of a previously created CreatePhotoSequenceOperation, possibly from a different process. |
| 2098 |
func (c *streetViewPublishGRPCClient) CreatePhotoSequenceOperation(name string) *CreatePhotoSequenceOperation { |
| 2099 |
return &CreatePhotoSequenceOperation{ |
| 2100 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 2101 |
} |
| 2102 |
} |
| 2103 |
|
| 2104 |
// CreatePhotoSequenceOperation returns a new CreatePhotoSequenceOperation from a given name. |
| 2105 |
// The name must be that of a previously created CreatePhotoSequenceOperation, possibly from a different process. |
| 2106 |
func (c *streetViewPublishRESTClient) CreatePhotoSequenceOperation(name string) *CreatePhotoSequenceOperation { |
| 2107 |
override := fmt.Sprintf("/v1/%s", name) |
| 2108 |
return &CreatePhotoSequenceOperation{ |
| 2109 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 2110 |
pollPath: override, |
| 2111 |
} |
| 2112 |
} |
| 2113 |
|
| 2114 |
// GetPhotoSequenceOperation returns a new GetPhotoSequenceOperation from a given name. |
| 2115 |
// The name must be that of a previously created GetPhotoSequenceOperation, possibly from a different process. |
| 2116 |
func (c *streetViewPublishGRPCClient) GetPhotoSequenceOperation(name string) *GetPhotoSequenceOperation { |
| 2117 |
return &GetPhotoSequenceOperation{ |
| 2118 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 2119 |
} |
| 2120 |
} |
| 2121 |
|
| 2122 |
// GetPhotoSequenceOperation returns a new GetPhotoSequenceOperation from a given name. |
| 2123 |
// The name must be that of a previously created GetPhotoSequenceOperation, possibly from a different process. |
| 2124 |
func (c *streetViewPublishRESTClient) GetPhotoSequenceOperation(name string) *GetPhotoSequenceOperation { |
| 2125 |
override := fmt.Sprintf("/v1/%s", name) |
| 2126 |
return &GetPhotoSequenceOperation{ |
| 2127 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 2128 |
pollPath: override, |
| 2129 |
} |
| 2130 |
} |