| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
type StreetViewPublishClient struct { |
| 295 |
|
| 296 |
internalClient internalStreetViewPublishClient |
| 297 |
|
| 298 |
|
| 299 |
CallOptions *StreetViewPublishCallOptions |
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
LROClient *lroauto.OperationsClient |
| 305 |
} |
| 306 |
|
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
func (c *StreetViewPublishClient) Close() error { |
| 312 |
return c.internalClient.Close() |
| 313 |
} |
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
func (c *StreetViewPublishClient) setGoogleClientInfo(keyval ...string) { |
| 319 |
c.internalClient.setGoogleClientInfo(keyval...) |
| 320 |
} |
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
func (c *StreetViewPublishClient) Connection() *grpc.ClientConn { |
| 327 |
return c.internalClient.Connection() |
| 328 |
} |
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
|
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
|
| 350 |
|
| 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 |
|
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
|
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
|
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 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 |
|
| 382 |
|
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
|
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 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 |
|
| 401 |
|
| 402 |
|
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 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 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
|
| 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 |
|
| 430 |
|
| 431 |
|
| 432 |
|
| 433 |
|
| 434 |
|
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
|
| 442 |
|
| 443 |
|
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
|
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 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 |
|
| 457 |
|
| 458 |
|
| 459 |
|
| 460 |
|
| 461 |
|
| 462 |
|
| 463 |
|
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
|
| 473 |
|
| 474 |
|
| 475 |
|
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
|
| 481 |
|
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
|
| 486 |
|
| 487 |
|
| 488 |
|
| 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 |
|
| 494 |
|
| 495 |
|
| 496 |
|
| 497 |
|
| 498 |
|
| 499 |
|
| 500 |
|
| 501 |
|
| 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 |
|
| 507 |
|
| 508 |
|
| 509 |
|
| 510 |
|
| 511 |
|
| 512 |
|
| 513 |
|
| 514 |
|
| 515 |
|
| 516 |
|
| 517 |
|
| 518 |
|
| 519 |
|
| 520 |
|
| 521 |
|
| 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 |
|
| 527 |
|
| 528 |
|
| 529 |
|
| 530 |
|
| 531 |
|
| 532 |
|
| 533 |
|
| 534 |
|
| 535 |
|
| 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 |
|
| 541 |
|
| 542 |
|
| 543 |
|
| 544 |
|
| 545 |
|
| 546 |
|
| 547 |
|
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
|
| 556 |
|
| 557 |
|
| 558 |
|
| 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 |
|
| 564 |
|
| 565 |
func (c *StreetViewPublishClient) CreatePhotoSequenceOperation(name string) *CreatePhotoSequenceOperation { |
| 566 |
return c.internalClient.CreatePhotoSequenceOperation(name) |
| 567 |
} |
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
|
| 576 |
|
| 577 |
|
| 578 |
|
| 579 |
|
| 580 |
|
| 581 |
|
| 582 |
|
| 583 |
|
| 584 |
|
| 585 |
|
| 586 |
|
| 587 |
|
| 588 |
|
| 589 |
|
| 590 |
|
| 591 |
|
| 592 |
|
| 593 |
|
| 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 |
|
| 599 |
|
| 600 |
func (c *StreetViewPublishClient) GetPhotoSequenceOperation(name string) *GetPhotoSequenceOperation { |
| 601 |
return c.internalClient.GetPhotoSequenceOperation(name) |
| 602 |
} |
| 603 |
|
| 604 |
|
| 605 |
|
| 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 |
|
| 611 |
|
| 612 |
|
| 613 |
|
| 614 |
|
| 615 |
|
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
|
| 622 |
|
| 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 |
|
| 628 |
|
| 629 |
|
| 630 |
type streetViewPublishGRPCClient struct { |
| 631 |
|
| 632 |
connPool gtransport.ConnPool |
| 633 |
|
| 634 |
|
| 635 |
CallOptions **StreetViewPublishCallOptions |
| 636 |
|
| 637 |
|
| 638 |
streetViewPublishClient publishpb.StreetViewPublishServiceClient |
| 639 |
|
| 640 |
|
| 641 |
|
| 642 |
|
| 643 |
LROClient **lroauto.OperationsClient |
| 644 |
|
| 645 |
|
| 646 |
xGoogHeaders []string |
| 647 |
|
| 648 |
logger *slog.Logger |
| 649 |
} |
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
|
| 654 |
|
| 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 |
|
| 684 |
|
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
return nil, err |
| 690 |
} |
| 691 |
c.LROClient = &client.LROClient |
| 692 |
return &client, nil |
| 693 |
} |
| 694 |
|
| 695 |
|
| 696 |
|
| 697 |
|
| 698 |
|
| 699 |
func (c *streetViewPublishGRPCClient) Connection() *grpc.ClientConn { |
| 700 |
return c.connPool.Conn() |
| 701 |
} |
| 702 |
|
| 703 |
|
| 704 |
|
| 705 |
|
| 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 |
|
| 715 |
|
| 716 |
func (c *streetViewPublishGRPCClient) Close() error { |
| 717 |
return c.connPool.Close() |
| 718 |
} |
| 719 |
|
| 720 |
|
| 721 |
type streetViewPublishRESTClient struct { |
| 722 |
|
| 723 |
endpoint string |
| 724 |
|
| 725 |
|
| 726 |
httpClient *http.Client |
| 727 |
|
| 728 |
|
| 729 |
|
| 730 |
|
| 731 |
LROClient **lroauto.OperationsClient |
| 732 |
|
| 733 |
|
| 734 |
xGoogHeaders []string |
| 735 |
|
| 736 |
|
| 737 |
CallOptions **StreetViewPublishCallOptions |
| 738 |
|
| 739 |
logger *slog.Logger |
| 740 |
} |
| 741 |
|
| 742 |
|
| 743 |
|
| 744 |
|
| 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 |
|
| 787 |
|
| 788 |
|
| 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 |
|
| 798 |
|
| 799 |
func (c *streetViewPublishRESTClient) Close() error { |
| 800 |
|
| 801 |
c.httpClient = nil |
| 802 |
return nil |
| 803 |
} |
| 804 |
|
| 805 |
|
| 806 |
|
| 807 |
|
| 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 |
|
| 1089 |
|
| 1090 |
|
| 1091 |
|
| 1092 |
|
| 1093 |
|
| 1094 |
|
| 1095 |
|
| 1096 |
|
| 1097 |
|
| 1098 |
|
| 1099 |
|
| 1100 |
|
| 1101 |
|
| 1102 |
|
| 1103 |
|
| 1104 |
|
| 1105 |
|
| 1106 |
|
| 1107 |
|
| 1108 |
|
| 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 |
|
| 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 |
|
| 1162 |
|
| 1163 |
|
| 1164 |
|
| 1165 |
|
| 1166 |
|
| 1167 |
|
| 1168 |
|
| 1169 |
|
| 1170 |
|
| 1171 |
|
| 1172 |
|
| 1173 |
|
| 1174 |
|
| 1175 |
|
| 1176 |
|
| 1177 |
|
| 1178 |
|
| 1179 |
|
| 1180 |
|
| 1181 |
|
| 1182 |
|
| 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 |
|
| 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 |
|
| 1237 |
|
| 1238 |
|
| 1239 |
|
| 1240 |
|
| 1241 |
|
| 1242 |
|
| 1243 |
|
| 1244 |
|
| 1245 |
|
| 1246 |
|
| 1247 |
|
| 1248 |
|
| 1249 |
|
| 1250 |
|
| 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 |
|
| 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 |
|
| 1305 |
|
| 1306 |
|
| 1307 |
|
| 1308 |
|
| 1309 |
|
| 1310 |
|
| 1311 |
|
| 1312 |
|
| 1313 |
|
| 1314 |
|
| 1315 |
|
| 1316 |
|
| 1317 |
|
| 1318 |
|
| 1319 |
|
| 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 |
|
| 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 |
|
| 1376 |
|
| 1377 |
|
| 1378 |
|
| 1379 |
|
| 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 |
|
| 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 |
|
| 1465 |
|
| 1466 |
|
| 1467 |
|
| 1468 |
|
| 1469 |
|
| 1470 |
|
| 1471 |
|
| 1472 |
|
| 1473 |
|
| 1474 |
|
| 1475 |
|
| 1476 |
|
| 1477 |
|
| 1478 |
|
| 1479 |
|
| 1480 |
|
| 1481 |
|
| 1482 |
|
| 1483 |
|
| 1484 |
|
| 1485 |
|
| 1486 |
|
| 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 |
|
| 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 |
|
| 1551 |
|
| 1552 |
|
| 1553 |
|
| 1554 |
|
| 1555 |
|
| 1556 |
|
| 1557 |
|
| 1558 |
|
| 1559 |
|
| 1560 |
|
| 1561 |
|
| 1562 |
|
| 1563 |
|
| 1564 |
|
| 1565 |
|
| 1566 |
|
| 1567 |
|
| 1568 |
|
| 1569 |
|
| 1570 |
|
| 1571 |
|
| 1572 |
|
| 1573 |
|
| 1574 |
|
| 1575 |
|
| 1576 |
|
| 1577 |
|
| 1578 |
|
| 1579 |
|
| 1580 |
|
| 1581 |
|
| 1582 |
|
| 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 |
|
| 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 |
|
| 1636 |
|
| 1637 |
|
| 1638 |
|
| 1639 |
|
| 1640 |
|
| 1641 |
|
| 1642 |
|
| 1643 |
|
| 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 |
|
| 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 |
|
| 1679 |
|
| 1680 |
|
| 1681 |
|
| 1682 |
|
| 1683 |
|
| 1684 |
|
| 1685 |
|
| 1686 |
|
| 1687 |
|
| 1688 |
|
| 1689 |
|
| 1690 |
|
| 1691 |
|
| 1692 |
|
| 1693 |
|
| 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 |
|
| 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 |
|
| 1747 |
|
| 1748 |
|
| 1749 |
|
| 1750 |
|
| 1751 |
|
| 1752 |
|
| 1753 |
|
| 1754 |
|
| 1755 |
|
| 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 |
|
| 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 |
|
| 1809 |
|
| 1810 |
|
| 1811 |
|
| 1812 |
|
| 1813 |
|
| 1814 |
|
| 1815 |
|
| 1816 |
|
| 1817 |
|
| 1818 |
|
| 1819 |
|
| 1820 |
|
| 1821 |
|
| 1822 |
|
| 1823 |
|
| 1824 |
|
| 1825 |
|
| 1826 |
|
| 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 |
|
| 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 |
|
| 1885 |
|
| 1886 |
|
| 1887 |
|
| 1888 |
|
| 1889 |
|
| 1890 |
|
| 1891 |
|
| 1892 |
|
| 1893 |
|
| 1894 |
|
| 1895 |
|
| 1896 |
|
| 1897 |
|
| 1898 |
|
| 1899 |
|
| 1900 |
|
| 1901 |
|
| 1902 |
|
| 1903 |
|
| 1904 |
|
| 1905 |
|
| 1906 |
|
| 1907 |
|
| 1908 |
|
| 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 |
|
| 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 |
|
| 1968 |
|
| 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 |
|
| 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 |
|
| 2050 |
|
| 2051 |
|
| 2052 |
|
| 2053 |
|
| 2054 |
|
| 2055 |
|
| 2056 |
|
| 2057 |
|
| 2058 |
|
| 2059 |
|
| 2060 |
|
| 2061 |
|
| 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 |
|
| 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 |
|
| 2097 |
|
| 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 |
|
| 2105 |
|
| 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 |
|
| 2115 |
|
| 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 |
|
| 2123 |
|
| 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 |
} |