| 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 translate |
| 18 |
|
| 19 |
import ( |
| 20 |
"context" |
| 21 |
"time" |
| 22 |
|
| 23 |
"cloud.google.com/go/longrunning" |
| 24 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 25 |
translatepb "cloud.google.com/go/translate/apiv3/translatepb" |
| 26 |
gax "github.com/googleapis/gax-go/v2" |
| 27 |
"google.golang.org/api/iterator" |
| 28 |
locationpb "google.golang.org/genproto/googleapis/cloud/location" |
| 29 |
) |
| 30 |
|
| 31 |
// BatchTranslateDocumentOperation manages a long-running operation from BatchTranslateDocument. |
| 32 |
type BatchTranslateDocumentOperation struct { |
| 33 |
lro *longrunning.Operation |
| 34 |
pollPath string |
| 35 |
} |
| 36 |
|
| 37 |
// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. |
| 38 |
// |
| 39 |
// See documentation of Poll for error-handling information. |
| 40 |
func (op *BatchTranslateDocumentOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.BatchTranslateDocumentResponse, error) { |
| 41 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 42 |
var resp translatepb.BatchTranslateDocumentResponse |
| 43 |
if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { |
| 44 |
return nil, err |
| 45 |
} |
| 46 |
return &resp, nil |
| 47 |
} |
| 48 |
|
| 49 |
// Poll fetches the latest state of the long-running operation. |
| 50 |
// |
| 51 |
// Poll also fetches the latest metadata, which can be retrieved by Metadata. |
| 52 |
// |
| 53 |
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and |
| 54 |
// the operation has completed with failure, the error is returned and op.Done will return true. |
| 55 |
// If Poll succeeds and the operation has completed successfully, |
| 56 |
// op.Done will return true, and the response of the operation is returned. |
| 57 |
// If Poll succeeds and the operation has not completed, the returned response and error are both nil. |
| 58 |
func (op *BatchTranslateDocumentOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.BatchTranslateDocumentResponse, error) { |
| 59 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 60 |
var resp translatepb.BatchTranslateDocumentResponse |
| 61 |
if err := op.lro.Poll(ctx, &resp, opts...); err != nil { |
| 62 |
return nil, err |
| 63 |
} |
| 64 |
if !op.Done() { |
| 65 |
return nil, nil |
| 66 |
} |
| 67 |
return &resp, nil |
| 68 |
} |
| 69 |
|
| 70 |
// Metadata returns metadata associated with the long-running operation. |
| 71 |
// Metadata itself does not contact the server, but Poll does. |
| 72 |
// To get the latest metadata, call this method after a successful call to Poll. |
| 73 |
// If the metadata is not available, the returned metadata and error are both nil. |
| 74 |
func (op *BatchTranslateDocumentOperation) Metadata() (*translatepb.BatchTranslateDocumentMetadata, error) { |
| 75 |
var meta translatepb.BatchTranslateDocumentMetadata |
| 76 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 77 |
return nil, nil |
| 78 |
} else if err != nil { |
| 79 |
return nil, err |
| 80 |
} |
| 81 |
return &meta, nil |
| 82 |
} |
| 83 |
|
| 84 |
// Done reports whether the long-running operation has completed. |
| 85 |
func (op *BatchTranslateDocumentOperation) Done() bool { |
| 86 |
return op.lro.Done() |
| 87 |
} |
| 88 |
|
| 89 |
// Name returns the name of the long-running operation. |
| 90 |
// The name is assigned by the server and is unique within the service from which the operation is created. |
| 91 |
func (op *BatchTranslateDocumentOperation) Name() string { |
| 92 |
return op.lro.Name() |
| 93 |
} |
| 94 |
|
| 95 |
// BatchTranslateTextOperation manages a long-running operation from BatchTranslateText. |
| 96 |
type BatchTranslateTextOperation struct { |
| 97 |
lro *longrunning.Operation |
| 98 |
pollPath string |
| 99 |
} |
| 100 |
|
| 101 |
// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. |
| 102 |
// |
| 103 |
// See documentation of Poll for error-handling information. |
| 104 |
func (op *BatchTranslateTextOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.BatchTranslateResponse, error) { |
| 105 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 106 |
var resp translatepb.BatchTranslateResponse |
| 107 |
if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { |
| 108 |
return nil, err |
| 109 |
} |
| 110 |
return &resp, nil |
| 111 |
} |
| 112 |
|
| 113 |
// Poll fetches the latest state of the long-running operation. |
| 114 |
// |
| 115 |
// Poll also fetches the latest metadata, which can be retrieved by Metadata. |
| 116 |
// |
| 117 |
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and |
| 118 |
// the operation has completed with failure, the error is returned and op.Done will return true. |
| 119 |
// If Poll succeeds and the operation has completed successfully, |
| 120 |
// op.Done will return true, and the response of the operation is returned. |
| 121 |
// If Poll succeeds and the operation has not completed, the returned response and error are both nil. |
| 122 |
func (op *BatchTranslateTextOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.BatchTranslateResponse, error) { |
| 123 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 124 |
var resp translatepb.BatchTranslateResponse |
| 125 |
if err := op.lro.Poll(ctx, &resp, opts...); err != nil { |
| 126 |
return nil, err |
| 127 |
} |
| 128 |
if !op.Done() { |
| 129 |
return nil, nil |
| 130 |
} |
| 131 |
return &resp, nil |
| 132 |
} |
| 133 |
|
| 134 |
// Metadata returns metadata associated with the long-running operation. |
| 135 |
// Metadata itself does not contact the server, but Poll does. |
| 136 |
// To get the latest metadata, call this method after a successful call to Poll. |
| 137 |
// If the metadata is not available, the returned metadata and error are both nil. |
| 138 |
func (op *BatchTranslateTextOperation) Metadata() (*translatepb.BatchTranslateMetadata, error) { |
| 139 |
var meta translatepb.BatchTranslateMetadata |
| 140 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 141 |
return nil, nil |
| 142 |
} else if err != nil { |
| 143 |
return nil, err |
| 144 |
} |
| 145 |
return &meta, nil |
| 146 |
} |
| 147 |
|
| 148 |
// Done reports whether the long-running operation has completed. |
| 149 |
func (op *BatchTranslateTextOperation) Done() bool { |
| 150 |
return op.lro.Done() |
| 151 |
} |
| 152 |
|
| 153 |
// Name returns the name of the long-running operation. |
| 154 |
// The name is assigned by the server and is unique within the service from which the operation is created. |
| 155 |
func (op *BatchTranslateTextOperation) Name() string { |
| 156 |
return op.lro.Name() |
| 157 |
} |
| 158 |
|
| 159 |
// CreateDatasetOperation manages a long-running operation from CreateDataset. |
| 160 |
type CreateDatasetOperation struct { |
| 161 |
lro *longrunning.Operation |
| 162 |
pollPath string |
| 163 |
} |
| 164 |
|
| 165 |
// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. |
| 166 |
// |
| 167 |
// See documentation of Poll for error-handling information. |
| 168 |
func (op *CreateDatasetOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.Dataset, error) { |
| 169 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 170 |
var resp translatepb.Dataset |
| 171 |
if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { |
| 172 |
return nil, err |
| 173 |
} |
| 174 |
return &resp, nil |
| 175 |
} |
| 176 |
|
| 177 |
// Poll fetches the latest state of the long-running operation. |
| 178 |
// |
| 179 |
// Poll also fetches the latest metadata, which can be retrieved by Metadata. |
| 180 |
// |
| 181 |
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and |
| 182 |
// the operation has completed with failure, the error is returned and op.Done will return true. |
| 183 |
// If Poll succeeds and the operation has completed successfully, |
| 184 |
// op.Done will return true, and the response of the operation is returned. |
| 185 |
// If Poll succeeds and the operation has not completed, the returned response and error are both nil. |
| 186 |
func (op *CreateDatasetOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.Dataset, error) { |
| 187 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 188 |
var resp translatepb.Dataset |
| 189 |
if err := op.lro.Poll(ctx, &resp, opts...); err != nil { |
| 190 |
return nil, err |
| 191 |
} |
| 192 |
if !op.Done() { |
| 193 |
return nil, nil |
| 194 |
} |
| 195 |
return &resp, nil |
| 196 |
} |
| 197 |
|
| 198 |
// Metadata returns metadata associated with the long-running operation. |
| 199 |
// Metadata itself does not contact the server, but Poll does. |
| 200 |
// To get the latest metadata, call this method after a successful call to Poll. |
| 201 |
// If the metadata is not available, the returned metadata and error are both nil. |
| 202 |
func (op *CreateDatasetOperation) Metadata() (*translatepb.CreateDatasetMetadata, error) { |
| 203 |
var meta translatepb.CreateDatasetMetadata |
| 204 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 205 |
return nil, nil |
| 206 |
} else if err != nil { |
| 207 |
return nil, err |
| 208 |
} |
| 209 |
return &meta, nil |
| 210 |
} |
| 211 |
|
| 212 |
// Done reports whether the long-running operation has completed. |
| 213 |
func (op *CreateDatasetOperation) Done() bool { |
| 214 |
return op.lro.Done() |
| 215 |
} |
| 216 |
|
| 217 |
// Name returns the name of the long-running operation. |
| 218 |
// The name is assigned by the server and is unique within the service from which the operation is created. |
| 219 |
func (op *CreateDatasetOperation) Name() string { |
| 220 |
return op.lro.Name() |
| 221 |
} |
| 222 |
|
| 223 |
// CreateGlossaryOperation manages a long-running operation from CreateGlossary. |
| 224 |
type CreateGlossaryOperation struct { |
| 225 |
lro *longrunning.Operation |
| 226 |
pollPath string |
| 227 |
} |
| 228 |
|
| 229 |
// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. |
| 230 |
// |
| 231 |
// See documentation of Poll for error-handling information. |
| 232 |
func (op *CreateGlossaryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.Glossary, error) { |
| 233 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 234 |
var resp translatepb.Glossary |
| 235 |
if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { |
| 236 |
return nil, err |
| 237 |
} |
| 238 |
return &resp, nil |
| 239 |
} |
| 240 |
|
| 241 |
// Poll fetches the latest state of the long-running operation. |
| 242 |
// |
| 243 |
// Poll also fetches the latest metadata, which can be retrieved by Metadata. |
| 244 |
// |
| 245 |
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and |
| 246 |
// the operation has completed with failure, the error is returned and op.Done will return true. |
| 247 |
// If Poll succeeds and the operation has completed successfully, |
| 248 |
// op.Done will return true, and the response of the operation is returned. |
| 249 |
// If Poll succeeds and the operation has not completed, the returned response and error are both nil. |
| 250 |
func (op *CreateGlossaryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.Glossary, error) { |
| 251 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 252 |
var resp translatepb.Glossary |
| 253 |
if err := op.lro.Poll(ctx, &resp, opts...); err != nil { |
| 254 |
return nil, err |
| 255 |
} |
| 256 |
if !op.Done() { |
| 257 |
return nil, nil |
| 258 |
} |
| 259 |
return &resp, nil |
| 260 |
} |
| 261 |
|
| 262 |
// Metadata returns metadata associated with the long-running operation. |
| 263 |
// Metadata itself does not contact the server, but Poll does. |
| 264 |
// To get the latest metadata, call this method after a successful call to Poll. |
| 265 |
// If the metadata is not available, the returned metadata and error are both nil. |
| 266 |
func (op *CreateGlossaryOperation) Metadata() (*translatepb.CreateGlossaryMetadata, error) { |
| 267 |
var meta translatepb.CreateGlossaryMetadata |
| 268 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 269 |
return nil, nil |
| 270 |
} else if err != nil { |
| 271 |
return nil, err |
| 272 |
} |
| 273 |
return &meta, nil |
| 274 |
} |
| 275 |
|
| 276 |
// Done reports whether the long-running operation has completed. |
| 277 |
func (op *CreateGlossaryOperation) Done() bool { |
| 278 |
return op.lro.Done() |
| 279 |
} |
| 280 |
|
| 281 |
// Name returns the name of the long-running operation. |
| 282 |
// The name is assigned by the server and is unique within the service from which the operation is created. |
| 283 |
func (op *CreateGlossaryOperation) Name() string { |
| 284 |
return op.lro.Name() |
| 285 |
} |
| 286 |
|
| 287 |
// CreateModelOperation manages a long-running operation from CreateModel. |
| 288 |
type CreateModelOperation struct { |
| 289 |
lro *longrunning.Operation |
| 290 |
pollPath string |
| 291 |
} |
| 292 |
|
| 293 |
// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. |
| 294 |
// |
| 295 |
// See documentation of Poll for error-handling information. |
| 296 |
func (op *CreateModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.Model, error) { |
| 297 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 298 |
var resp translatepb.Model |
| 299 |
if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { |
| 300 |
return nil, err |
| 301 |
} |
| 302 |
return &resp, nil |
| 303 |
} |
| 304 |
|
| 305 |
// Poll fetches the latest state of the long-running operation. |
| 306 |
// |
| 307 |
// Poll also fetches the latest metadata, which can be retrieved by Metadata. |
| 308 |
// |
| 309 |
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and |
| 310 |
// the operation has completed with failure, the error is returned and op.Done will return true. |
| 311 |
// If Poll succeeds and the operation has completed successfully, |
| 312 |
// op.Done will return true, and the response of the operation is returned. |
| 313 |
// If Poll succeeds and the operation has not completed, the returned response and error are both nil. |
| 314 |
func (op *CreateModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.Model, error) { |
| 315 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 316 |
var resp translatepb.Model |
| 317 |
if err := op.lro.Poll(ctx, &resp, opts...); err != nil { |
| 318 |
return nil, err |
| 319 |
} |
| 320 |
if !op.Done() { |
| 321 |
return nil, nil |
| 322 |
} |
| 323 |
return &resp, nil |
| 324 |
} |
| 325 |
|
| 326 |
// Metadata returns metadata associated with the long-running operation. |
| 327 |
// Metadata itself does not contact the server, but Poll does. |
| 328 |
// To get the latest metadata, call this method after a successful call to Poll. |
| 329 |
// If the metadata is not available, the returned metadata and error are both nil. |
| 330 |
func (op *CreateModelOperation) Metadata() (*translatepb.CreateModelMetadata, error) { |
| 331 |
var meta translatepb.CreateModelMetadata |
| 332 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 333 |
return nil, nil |
| 334 |
} else if err != nil { |
| 335 |
return nil, err |
| 336 |
} |
| 337 |
return &meta, nil |
| 338 |
} |
| 339 |
|
| 340 |
// Done reports whether the long-running operation has completed. |
| 341 |
func (op *CreateModelOperation) Done() bool { |
| 342 |
return op.lro.Done() |
| 343 |
} |
| 344 |
|
| 345 |
// Name returns the name of the long-running operation. |
| 346 |
// The name is assigned by the server and is unique within the service from which the operation is created. |
| 347 |
func (op *CreateModelOperation) Name() string { |
| 348 |
return op.lro.Name() |
| 349 |
} |
| 350 |
|
| 351 |
// DeleteDatasetOperation manages a long-running operation from DeleteDataset. |
| 352 |
type DeleteDatasetOperation struct { |
| 353 |
lro *longrunning.Operation |
| 354 |
pollPath string |
| 355 |
} |
| 356 |
|
| 357 |
// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. |
| 358 |
// |
| 359 |
// See documentation of Poll for error-handling information. |
| 360 |
func (op *DeleteDatasetOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { |
| 361 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 362 |
return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) |
| 363 |
} |
| 364 |
|
| 365 |
// Poll fetches the latest state of the long-running operation. |
| 366 |
// |
| 367 |
// Poll also fetches the latest metadata, which can be retrieved by Metadata. |
| 368 |
// |
| 369 |
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and |
| 370 |
// the operation has completed with failure, the error is returned and op.Done will return true. |
| 371 |
// If Poll succeeds and the operation has completed successfully, |
| 372 |
// op.Done will return true, and the response of the operation is returned. |
| 373 |
// If Poll succeeds and the operation has not completed, the returned response and error are both nil. |
| 374 |
func (op *DeleteDatasetOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { |
| 375 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 376 |
return op.lro.Poll(ctx, nil, opts...) |
| 377 |
} |
| 378 |
|
| 379 |
// Metadata returns metadata associated with the long-running operation. |
| 380 |
// Metadata itself does not contact the server, but Poll does. |
| 381 |
// To get the latest metadata, call this method after a successful call to Poll. |
| 382 |
// If the metadata is not available, the returned metadata and error are both nil. |
| 383 |
func (op *DeleteDatasetOperation) Metadata() (*translatepb.DeleteDatasetMetadata, error) { |
| 384 |
var meta translatepb.DeleteDatasetMetadata |
| 385 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 386 |
return nil, nil |
| 387 |
} else if err != nil { |
| 388 |
return nil, err |
| 389 |
} |
| 390 |
return &meta, nil |
| 391 |
} |
| 392 |
|
| 393 |
// Done reports whether the long-running operation has completed. |
| 394 |
func (op *DeleteDatasetOperation) Done() bool { |
| 395 |
return op.lro.Done() |
| 396 |
} |
| 397 |
|
| 398 |
// Name returns the name of the long-running operation. |
| 399 |
// The name is assigned by the server and is unique within the service from which the operation is created. |
| 400 |
func (op *DeleteDatasetOperation) Name() string { |
| 401 |
return op.lro.Name() |
| 402 |
} |
| 403 |
|
| 404 |
// DeleteGlossaryOperation manages a long-running operation from DeleteGlossary. |
| 405 |
type DeleteGlossaryOperation struct { |
| 406 |
lro *longrunning.Operation |
| 407 |
pollPath string |
| 408 |
} |
| 409 |
|
| 410 |
// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. |
| 411 |
// |
| 412 |
// See documentation of Poll for error-handling information. |
| 413 |
func (op *DeleteGlossaryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.DeleteGlossaryResponse, error) { |
| 414 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 415 |
var resp translatepb.DeleteGlossaryResponse |
| 416 |
if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { |
| 417 |
return nil, err |
| 418 |
} |
| 419 |
return &resp, nil |
| 420 |
} |
| 421 |
|
| 422 |
// Poll fetches the latest state of the long-running operation. |
| 423 |
// |
| 424 |
// Poll also fetches the latest metadata, which can be retrieved by Metadata. |
| 425 |
// |
| 426 |
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and |
| 427 |
// the operation has completed with failure, the error is returned and op.Done will return true. |
| 428 |
// If Poll succeeds and the operation has completed successfully, |
| 429 |
// op.Done will return true, and the response of the operation is returned. |
| 430 |
// If Poll succeeds and the operation has not completed, the returned response and error are both nil. |
| 431 |
func (op *DeleteGlossaryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.DeleteGlossaryResponse, error) { |
| 432 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 433 |
var resp translatepb.DeleteGlossaryResponse |
| 434 |
if err := op.lro.Poll(ctx, &resp, opts...); err != nil { |
| 435 |
return nil, err |
| 436 |
} |
| 437 |
if !op.Done() { |
| 438 |
return nil, nil |
| 439 |
} |
| 440 |
return &resp, nil |
| 441 |
} |
| 442 |
|
| 443 |
// Metadata returns metadata associated with the long-running operation. |
| 444 |
// Metadata itself does not contact the server, but Poll does. |
| 445 |
// To get the latest metadata, call this method after a successful call to Poll. |
| 446 |
// If the metadata is not available, the returned metadata and error are both nil. |
| 447 |
func (op *DeleteGlossaryOperation) Metadata() (*translatepb.DeleteGlossaryMetadata, error) { |
| 448 |
var meta translatepb.DeleteGlossaryMetadata |
| 449 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 450 |
return nil, nil |
| 451 |
} else if err != nil { |
| 452 |
return nil, err |
| 453 |
} |
| 454 |
return &meta, nil |
| 455 |
} |
| 456 |
|
| 457 |
// Done reports whether the long-running operation has completed. |
| 458 |
func (op *DeleteGlossaryOperation) Done() bool { |
| 459 |
return op.lro.Done() |
| 460 |
} |
| 461 |
|
| 462 |
// Name returns the name of the long-running operation. |
| 463 |
// The name is assigned by the server and is unique within the service from which the operation is created. |
| 464 |
func (op *DeleteGlossaryOperation) Name() string { |
| 465 |
return op.lro.Name() |
| 466 |
} |
| 467 |
|
| 468 |
// DeleteModelOperation manages a long-running operation from DeleteModel. |
| 469 |
type DeleteModelOperation struct { |
| 470 |
lro *longrunning.Operation |
| 471 |
pollPath string |
| 472 |
} |
| 473 |
|
| 474 |
// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. |
| 475 |
// |
| 476 |
// See documentation of Poll for error-handling information. |
| 477 |
func (op *DeleteModelOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { |
| 478 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 479 |
return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) |
| 480 |
} |
| 481 |
|
| 482 |
// Poll fetches the latest state of the long-running operation. |
| 483 |
// |
| 484 |
// Poll also fetches the latest metadata, which can be retrieved by Metadata. |
| 485 |
// |
| 486 |
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and |
| 487 |
// the operation has completed with failure, the error is returned and op.Done will return true. |
| 488 |
// If Poll succeeds and the operation has completed successfully, |
| 489 |
// op.Done will return true, and the response of the operation is returned. |
| 490 |
// If Poll succeeds and the operation has not completed, the returned response and error are both nil. |
| 491 |
func (op *DeleteModelOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { |
| 492 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 493 |
return op.lro.Poll(ctx, nil, opts...) |
| 494 |
} |
| 495 |
|
| 496 |
// Metadata returns metadata associated with the long-running operation. |
| 497 |
// Metadata itself does not contact the server, but Poll does. |
| 498 |
// To get the latest metadata, call this method after a successful call to Poll. |
| 499 |
// If the metadata is not available, the returned metadata and error are both nil. |
| 500 |
func (op *DeleteModelOperation) Metadata() (*translatepb.DeleteModelMetadata, error) { |
| 501 |
var meta translatepb.DeleteModelMetadata |
| 502 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 503 |
return nil, nil |
| 504 |
} else if err != nil { |
| 505 |
return nil, err |
| 506 |
} |
| 507 |
return &meta, nil |
| 508 |
} |
| 509 |
|
| 510 |
// Done reports whether the long-running operation has completed. |
| 511 |
func (op *DeleteModelOperation) Done() bool { |
| 512 |
return op.lro.Done() |
| 513 |
} |
| 514 |
|
| 515 |
// Name returns the name of the long-running operation. |
| 516 |
// The name is assigned by the server and is unique within the service from which the operation is created. |
| 517 |
func (op *DeleteModelOperation) Name() string { |
| 518 |
return op.lro.Name() |
| 519 |
} |
| 520 |
|
| 521 |
// ExportDataOperation manages a long-running operation from ExportData. |
| 522 |
type ExportDataOperation struct { |
| 523 |
lro *longrunning.Operation |
| 524 |
pollPath string |
| 525 |
} |
| 526 |
|
| 527 |
// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. |
| 528 |
// |
| 529 |
// See documentation of Poll for error-handling information. |
| 530 |
func (op *ExportDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { |
| 531 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 532 |
return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) |
| 533 |
} |
| 534 |
|
| 535 |
// Poll fetches the latest state of the long-running operation. |
| 536 |
// |
| 537 |
// Poll also fetches the latest metadata, which can be retrieved by Metadata. |
| 538 |
// |
| 539 |
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and |
| 540 |
// the operation has completed with failure, the error is returned and op.Done will return true. |
| 541 |
// If Poll succeeds and the operation has completed successfully, |
| 542 |
// op.Done will return true, and the response of the operation is returned. |
| 543 |
// If Poll succeeds and the operation has not completed, the returned response and error are both nil. |
| 544 |
func (op *ExportDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { |
| 545 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 546 |
return op.lro.Poll(ctx, nil, opts...) |
| 547 |
} |
| 548 |
|
| 549 |
// Metadata returns metadata associated with the long-running operation. |
| 550 |
// Metadata itself does not contact the server, but Poll does. |
| 551 |
// To get the latest metadata, call this method after a successful call to Poll. |
| 552 |
// If the metadata is not available, the returned metadata and error are both nil. |
| 553 |
func (op *ExportDataOperation) Metadata() (*translatepb.ExportDataMetadata, error) { |
| 554 |
var meta translatepb.ExportDataMetadata |
| 555 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 556 |
return nil, nil |
| 557 |
} else if err != nil { |
| 558 |
return nil, err |
| 559 |
} |
| 560 |
return &meta, nil |
| 561 |
} |
| 562 |
|
| 563 |
// Done reports whether the long-running operation has completed. |
| 564 |
func (op *ExportDataOperation) Done() bool { |
| 565 |
return op.lro.Done() |
| 566 |
} |
| 567 |
|
| 568 |
// Name returns the name of the long-running operation. |
| 569 |
// The name is assigned by the server and is unique within the service from which the operation is created. |
| 570 |
func (op *ExportDataOperation) Name() string { |
| 571 |
return op.lro.Name() |
| 572 |
} |
| 573 |
|
| 574 |
// ImportDataOperation manages a long-running operation from ImportData. |
| 575 |
type ImportDataOperation struct { |
| 576 |
lro *longrunning.Operation |
| 577 |
pollPath string |
| 578 |
} |
| 579 |
|
| 580 |
// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. |
| 581 |
// |
| 582 |
// See documentation of Poll for error-handling information. |
| 583 |
func (op *ImportDataOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { |
| 584 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 585 |
return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) |
| 586 |
} |
| 587 |
|
| 588 |
// Poll fetches the latest state of the long-running operation. |
| 589 |
// |
| 590 |
// Poll also fetches the latest metadata, which can be retrieved by Metadata. |
| 591 |
// |
| 592 |
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and |
| 593 |
// the operation has completed with failure, the error is returned and op.Done will return true. |
| 594 |
// If Poll succeeds and the operation has completed successfully, |
| 595 |
// op.Done will return true, and the response of the operation is returned. |
| 596 |
// If Poll succeeds and the operation has not completed, the returned response and error are both nil. |
| 597 |
func (op *ImportDataOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { |
| 598 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 599 |
return op.lro.Poll(ctx, nil, opts...) |
| 600 |
} |
| 601 |
|
| 602 |
// Metadata returns metadata associated with the long-running operation. |
| 603 |
// Metadata itself does not contact the server, but Poll does. |
| 604 |
// To get the latest metadata, call this method after a successful call to Poll. |
| 605 |
// If the metadata is not available, the returned metadata and error are both nil. |
| 606 |
func (op *ImportDataOperation) Metadata() (*translatepb.ImportDataMetadata, error) { |
| 607 |
var meta translatepb.ImportDataMetadata |
| 608 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 609 |
return nil, nil |
| 610 |
} else if err != nil { |
| 611 |
return nil, err |
| 612 |
} |
| 613 |
return &meta, nil |
| 614 |
} |
| 615 |
|
| 616 |
// Done reports whether the long-running operation has completed. |
| 617 |
func (op *ImportDataOperation) Done() bool { |
| 618 |
return op.lro.Done() |
| 619 |
} |
| 620 |
|
| 621 |
// Name returns the name of the long-running operation. |
| 622 |
// The name is assigned by the server and is unique within the service from which the operation is created. |
| 623 |
func (op *ImportDataOperation) Name() string { |
| 624 |
return op.lro.Name() |
| 625 |
} |
| 626 |
|
| 627 |
// UpdateGlossaryOperation manages a long-running operation from UpdateGlossary. |
| 628 |
type UpdateGlossaryOperation struct { |
| 629 |
lro *longrunning.Operation |
| 630 |
pollPath string |
| 631 |
} |
| 632 |
|
| 633 |
// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. |
| 634 |
// |
| 635 |
// See documentation of Poll for error-handling information. |
| 636 |
func (op *UpdateGlossaryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*translatepb.Glossary, error) { |
| 637 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 638 |
var resp translatepb.Glossary |
| 639 |
if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { |
| 640 |
return nil, err |
| 641 |
} |
| 642 |
return &resp, nil |
| 643 |
} |
| 644 |
|
| 645 |
// Poll fetches the latest state of the long-running operation. |
| 646 |
// |
| 647 |
// Poll also fetches the latest metadata, which can be retrieved by Metadata. |
| 648 |
// |
| 649 |
// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and |
| 650 |
// the operation has completed with failure, the error is returned and op.Done will return true. |
| 651 |
// If Poll succeeds and the operation has completed successfully, |
| 652 |
// op.Done will return true, and the response of the operation is returned. |
| 653 |
// If Poll succeeds and the operation has not completed, the returned response and error are both nil. |
| 654 |
func (op *UpdateGlossaryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*translatepb.Glossary, error) { |
| 655 |
opts = append([]gax.CallOption{gax.WithPath(op.pollPath)}, opts...) |
| 656 |
var resp translatepb.Glossary |
| 657 |
if err := op.lro.Poll(ctx, &resp, opts...); err != nil { |
| 658 |
return nil, err |
| 659 |
} |
| 660 |
if !op.Done() { |
| 661 |
return nil, nil |
| 662 |
} |
| 663 |
return &resp, nil |
| 664 |
} |
| 665 |
|
| 666 |
// Metadata returns metadata associated with the long-running operation. |
| 667 |
// Metadata itself does not contact the server, but Poll does. |
| 668 |
// To get the latest metadata, call this method after a successful call to Poll. |
| 669 |
// If the metadata is not available, the returned metadata and error are both nil. |
| 670 |
func (op *UpdateGlossaryOperation) Metadata() (*translatepb.UpdateGlossaryMetadata, error) { |
| 671 |
var meta translatepb.UpdateGlossaryMetadata |
| 672 |
if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { |
| 673 |
return nil, nil |
| 674 |
} else if err != nil { |
| 675 |
return nil, err |
| 676 |
} |
| 677 |
return &meta, nil |
| 678 |
} |
| 679 |
|
| 680 |
// Done reports whether the long-running operation has completed. |
| 681 |
func (op *UpdateGlossaryOperation) Done() bool { |
| 682 |
return op.lro.Done() |
| 683 |
} |
| 684 |
|
| 685 |
// Name returns the name of the long-running operation. |
| 686 |
// The name is assigned by the server and is unique within the service from which the operation is created. |
| 687 |
func (op *UpdateGlossaryOperation) Name() string { |
| 688 |
return op.lro.Name() |
| 689 |
} |
| 690 |
|
| 691 |
// AdaptiveMtDatasetIterator manages a stream of *translatepb.AdaptiveMtDataset. |
| 692 |
type AdaptiveMtDatasetIterator struct { |
| 693 |
items []*translatepb.AdaptiveMtDataset |
| 694 |
pageInfo *iterator.PageInfo |
| 695 |
nextFunc func() error |
| 696 |
|
| 697 |
// Response is the raw response for the current page. |
| 698 |
// It must be cast to the RPC response type. |
| 699 |
// Calling Next() or InternalFetch() updates this value. |
| 700 |
Response interface{} |
| 701 |
|
| 702 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 703 |
// It is not part of the stable interface of this package. |
| 704 |
// |
| 705 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 706 |
// The number of results is no greater than pageSize. |
| 707 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 708 |
InternalFetch func(pageSize int, pageToken string) (results []*translatepb.AdaptiveMtDataset, nextPageToken string, err error) |
| 709 |
} |
| 710 |
|
| 711 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 712 |
func (it *AdaptiveMtDatasetIterator) PageInfo() *iterator.PageInfo { |
| 713 |
return it.pageInfo |
| 714 |
} |
| 715 |
|
| 716 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 717 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 718 |
func (it *AdaptiveMtDatasetIterator) Next() (*translatepb.AdaptiveMtDataset, error) { |
| 719 |
var item *translatepb.AdaptiveMtDataset |
| 720 |
if err := it.nextFunc(); err != nil { |
| 721 |
return item, err |
| 722 |
} |
| 723 |
item = it.items[0] |
| 724 |
it.items = it.items[1:] |
| 725 |
return item, nil |
| 726 |
} |
| 727 |
|
| 728 |
func (it *AdaptiveMtDatasetIterator) bufLen() int { |
| 729 |
return len(it.items) |
| 730 |
} |
| 731 |
|
| 732 |
func (it *AdaptiveMtDatasetIterator) takeBuf() interface{} { |
| 733 |
b := it.items |
| 734 |
it.items = nil |
| 735 |
return b |
| 736 |
} |
| 737 |
|
| 738 |
// AdaptiveMtFileIterator manages a stream of *translatepb.AdaptiveMtFile. |
| 739 |
type AdaptiveMtFileIterator struct { |
| 740 |
items []*translatepb.AdaptiveMtFile |
| 741 |
pageInfo *iterator.PageInfo |
| 742 |
nextFunc func() error |
| 743 |
|
| 744 |
// Response is the raw response for the current page. |
| 745 |
// It must be cast to the RPC response type. |
| 746 |
// Calling Next() or InternalFetch() updates this value. |
| 747 |
Response interface{} |
| 748 |
|
| 749 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 750 |
// It is not part of the stable interface of this package. |
| 751 |
// |
| 752 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 753 |
// The number of results is no greater than pageSize. |
| 754 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 755 |
InternalFetch func(pageSize int, pageToken string) (results []*translatepb.AdaptiveMtFile, nextPageToken string, err error) |
| 756 |
} |
| 757 |
|
| 758 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 759 |
func (it *AdaptiveMtFileIterator) PageInfo() *iterator.PageInfo { |
| 760 |
return it.pageInfo |
| 761 |
} |
| 762 |
|
| 763 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 764 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 765 |
func (it *AdaptiveMtFileIterator) Next() (*translatepb.AdaptiveMtFile, error) { |
| 766 |
var item *translatepb.AdaptiveMtFile |
| 767 |
if err := it.nextFunc(); err != nil { |
| 768 |
return item, err |
| 769 |
} |
| 770 |
item = it.items[0] |
| 771 |
it.items = it.items[1:] |
| 772 |
return item, nil |
| 773 |
} |
| 774 |
|
| 775 |
func (it *AdaptiveMtFileIterator) bufLen() int { |
| 776 |
return len(it.items) |
| 777 |
} |
| 778 |
|
| 779 |
func (it *AdaptiveMtFileIterator) takeBuf() interface{} { |
| 780 |
b := it.items |
| 781 |
it.items = nil |
| 782 |
return b |
| 783 |
} |
| 784 |
|
| 785 |
// AdaptiveMtSentenceIterator manages a stream of *translatepb.AdaptiveMtSentence. |
| 786 |
type AdaptiveMtSentenceIterator struct { |
| 787 |
items []*translatepb.AdaptiveMtSentence |
| 788 |
pageInfo *iterator.PageInfo |
| 789 |
nextFunc func() error |
| 790 |
|
| 791 |
// Response is the raw response for the current page. |
| 792 |
// It must be cast to the RPC response type. |
| 793 |
// Calling Next() or InternalFetch() updates this value. |
| 794 |
Response interface{} |
| 795 |
|
| 796 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 797 |
// It is not part of the stable interface of this package. |
| 798 |
// |
| 799 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 800 |
// The number of results is no greater than pageSize. |
| 801 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 802 |
InternalFetch func(pageSize int, pageToken string) (results []*translatepb.AdaptiveMtSentence, nextPageToken string, err error) |
| 803 |
} |
| 804 |
|
| 805 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 806 |
func (it *AdaptiveMtSentenceIterator) PageInfo() *iterator.PageInfo { |
| 807 |
return it.pageInfo |
| 808 |
} |
| 809 |
|
| 810 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 811 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 812 |
func (it *AdaptiveMtSentenceIterator) Next() (*translatepb.AdaptiveMtSentence, error) { |
| 813 |
var item *translatepb.AdaptiveMtSentence |
| 814 |
if err := it.nextFunc(); err != nil { |
| 815 |
return item, err |
| 816 |
} |
| 817 |
item = it.items[0] |
| 818 |
it.items = it.items[1:] |
| 819 |
return item, nil |
| 820 |
} |
| 821 |
|
| 822 |
func (it *AdaptiveMtSentenceIterator) bufLen() int { |
| 823 |
return len(it.items) |
| 824 |
} |
| 825 |
|
| 826 |
func (it *AdaptiveMtSentenceIterator) takeBuf() interface{} { |
| 827 |
b := it.items |
| 828 |
it.items = nil |
| 829 |
return b |
| 830 |
} |
| 831 |
|
| 832 |
// DatasetIterator manages a stream of *translatepb.Dataset. |
| 833 |
type DatasetIterator struct { |
| 834 |
items []*translatepb.Dataset |
| 835 |
pageInfo *iterator.PageInfo |
| 836 |
nextFunc func() error |
| 837 |
|
| 838 |
// Response is the raw response for the current page. |
| 839 |
// It must be cast to the RPC response type. |
| 840 |
// Calling Next() or InternalFetch() updates this value. |
| 841 |
Response interface{} |
| 842 |
|
| 843 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 844 |
// It is not part of the stable interface of this package. |
| 845 |
// |
| 846 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 847 |
// The number of results is no greater than pageSize. |
| 848 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 849 |
InternalFetch func(pageSize int, pageToken string) (results []*translatepb.Dataset, nextPageToken string, err error) |
| 850 |
} |
| 851 |
|
| 852 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 853 |
func (it *DatasetIterator) PageInfo() *iterator.PageInfo { |
| 854 |
return it.pageInfo |
| 855 |
} |
| 856 |
|
| 857 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 858 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 859 |
func (it *DatasetIterator) Next() (*translatepb.Dataset, error) { |
| 860 |
var item *translatepb.Dataset |
| 861 |
if err := it.nextFunc(); err != nil { |
| 862 |
return item, err |
| 863 |
} |
| 864 |
item = it.items[0] |
| 865 |
it.items = it.items[1:] |
| 866 |
return item, nil |
| 867 |
} |
| 868 |
|
| 869 |
func (it *DatasetIterator) bufLen() int { |
| 870 |
return len(it.items) |
| 871 |
} |
| 872 |
|
| 873 |
func (it *DatasetIterator) takeBuf() interface{} { |
| 874 |
b := it.items |
| 875 |
it.items = nil |
| 876 |
return b |
| 877 |
} |
| 878 |
|
| 879 |
// ExampleIterator manages a stream of *translatepb.Example. |
| 880 |
type ExampleIterator struct { |
| 881 |
items []*translatepb.Example |
| 882 |
pageInfo *iterator.PageInfo |
| 883 |
nextFunc func() error |
| 884 |
|
| 885 |
// Response is the raw response for the current page. |
| 886 |
// It must be cast to the RPC response type. |
| 887 |
// Calling Next() or InternalFetch() updates this value. |
| 888 |
Response interface{} |
| 889 |
|
| 890 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 891 |
// It is not part of the stable interface of this package. |
| 892 |
// |
| 893 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 894 |
// The number of results is no greater than pageSize. |
| 895 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 896 |
InternalFetch func(pageSize int, pageToken string) (results []*translatepb.Example, nextPageToken string, err error) |
| 897 |
} |
| 898 |
|
| 899 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 900 |
func (it *ExampleIterator) PageInfo() *iterator.PageInfo { |
| 901 |
return it.pageInfo |
| 902 |
} |
| 903 |
|
| 904 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 905 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 906 |
func (it *ExampleIterator) Next() (*translatepb.Example, error) { |
| 907 |
var item *translatepb.Example |
| 908 |
if err := it.nextFunc(); err != nil { |
| 909 |
return item, err |
| 910 |
} |
| 911 |
item = it.items[0] |
| 912 |
it.items = it.items[1:] |
| 913 |
return item, nil |
| 914 |
} |
| 915 |
|
| 916 |
func (it *ExampleIterator) bufLen() int { |
| 917 |
return len(it.items) |
| 918 |
} |
| 919 |
|
| 920 |
func (it *ExampleIterator) takeBuf() interface{} { |
| 921 |
b := it.items |
| 922 |
it.items = nil |
| 923 |
return b |
| 924 |
} |
| 925 |
|
| 926 |
// GlossaryEntryIterator manages a stream of *translatepb.GlossaryEntry. |
| 927 |
type GlossaryEntryIterator struct { |
| 928 |
items []*translatepb.GlossaryEntry |
| 929 |
pageInfo *iterator.PageInfo |
| 930 |
nextFunc func() error |
| 931 |
|
| 932 |
// Response is the raw response for the current page. |
| 933 |
// It must be cast to the RPC response type. |
| 934 |
// Calling Next() or InternalFetch() updates this value. |
| 935 |
Response interface{} |
| 936 |
|
| 937 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 938 |
// It is not part of the stable interface of this package. |
| 939 |
// |
| 940 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 941 |
// The number of results is no greater than pageSize. |
| 942 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 943 |
InternalFetch func(pageSize int, pageToken string) (results []*translatepb.GlossaryEntry, nextPageToken string, err error) |
| 944 |
} |
| 945 |
|
| 946 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 947 |
func (it *GlossaryEntryIterator) PageInfo() *iterator.PageInfo { |
| 948 |
return it.pageInfo |
| 949 |
} |
| 950 |
|
| 951 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 952 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 953 |
func (it *GlossaryEntryIterator) Next() (*translatepb.GlossaryEntry, error) { |
| 954 |
var item *translatepb.GlossaryEntry |
| 955 |
if err := it.nextFunc(); err != nil { |
| 956 |
return item, err |
| 957 |
} |
| 958 |
item = it.items[0] |
| 959 |
it.items = it.items[1:] |
| 960 |
return item, nil |
| 961 |
} |
| 962 |
|
| 963 |
func (it *GlossaryEntryIterator) bufLen() int { |
| 964 |
return len(it.items) |
| 965 |
} |
| 966 |
|
| 967 |
func (it *GlossaryEntryIterator) takeBuf() interface{} { |
| 968 |
b := it.items |
| 969 |
it.items = nil |
| 970 |
return b |
| 971 |
} |
| 972 |
|
| 973 |
// GlossaryIterator manages a stream of *translatepb.Glossary. |
| 974 |
type GlossaryIterator struct { |
| 975 |
items []*translatepb.Glossary |
| 976 |
pageInfo *iterator.PageInfo |
| 977 |
nextFunc func() error |
| 978 |
|
| 979 |
// Response is the raw response for the current page. |
| 980 |
// It must be cast to the RPC response type. |
| 981 |
// Calling Next() or InternalFetch() updates this value. |
| 982 |
Response interface{} |
| 983 |
|
| 984 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 985 |
// It is not part of the stable interface of this package. |
| 986 |
// |
| 987 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 988 |
// The number of results is no greater than pageSize. |
| 989 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 990 |
InternalFetch func(pageSize int, pageToken string) (results []*translatepb.Glossary, nextPageToken string, err error) |
| 991 |
} |
| 992 |
|
| 993 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 994 |
func (it *GlossaryIterator) PageInfo() *iterator.PageInfo { |
| 995 |
return it.pageInfo |
| 996 |
} |
| 997 |
|
| 998 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 999 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 1000 |
func (it *GlossaryIterator) Next() (*translatepb.Glossary, error) { |
| 1001 |
var item *translatepb.Glossary |
| 1002 |
if err := it.nextFunc(); err != nil { |
| 1003 |
return item, err |
| 1004 |
} |
| 1005 |
item = it.items[0] |
| 1006 |
it.items = it.items[1:] |
| 1007 |
return item, nil |
| 1008 |
} |
| 1009 |
|
| 1010 |
func (it *GlossaryIterator) bufLen() int { |
| 1011 |
return len(it.items) |
| 1012 |
} |
| 1013 |
|
| 1014 |
func (it *GlossaryIterator) takeBuf() interface{} { |
| 1015 |
b := it.items |
| 1016 |
it.items = nil |
| 1017 |
return b |
| 1018 |
} |
| 1019 |
|
| 1020 |
// LocationIterator manages a stream of *locationpb.Location. |
| 1021 |
type LocationIterator struct { |
| 1022 |
items []*locationpb.Location |
| 1023 |
pageInfo *iterator.PageInfo |
| 1024 |
nextFunc func() error |
| 1025 |
|
| 1026 |
// Response is the raw response for the current page. |
| 1027 |
// It must be cast to the RPC response type. |
| 1028 |
// Calling Next() or InternalFetch() updates this value. |
| 1029 |
Response interface{} |
| 1030 |
|
| 1031 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 1032 |
// It is not part of the stable interface of this package. |
| 1033 |
// |
| 1034 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 1035 |
// The number of results is no greater than pageSize. |
| 1036 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 1037 |
InternalFetch func(pageSize int, pageToken string) (results []*locationpb.Location, nextPageToken string, err error) |
| 1038 |
} |
| 1039 |
|
| 1040 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 1041 |
func (it *LocationIterator) PageInfo() *iterator.PageInfo { |
| 1042 |
return it.pageInfo |
| 1043 |
} |
| 1044 |
|
| 1045 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 1046 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 1047 |
func (it *LocationIterator) Next() (*locationpb.Location, error) { |
| 1048 |
var item *locationpb.Location |
| 1049 |
if err := it.nextFunc(); err != nil { |
| 1050 |
return item, err |
| 1051 |
} |
| 1052 |
item = it.items[0] |
| 1053 |
it.items = it.items[1:] |
| 1054 |
return item, nil |
| 1055 |
} |
| 1056 |
|
| 1057 |
func (it *LocationIterator) bufLen() int { |
| 1058 |
return len(it.items) |
| 1059 |
} |
| 1060 |
|
| 1061 |
func (it *LocationIterator) takeBuf() interface{} { |
| 1062 |
b := it.items |
| 1063 |
it.items = nil |
| 1064 |
return b |
| 1065 |
} |
| 1066 |
|
| 1067 |
// ModelIterator manages a stream of *translatepb.Model. |
| 1068 |
type ModelIterator struct { |
| 1069 |
items []*translatepb.Model |
| 1070 |
pageInfo *iterator.PageInfo |
| 1071 |
nextFunc func() error |
| 1072 |
|
| 1073 |
// Response is the raw response for the current page. |
| 1074 |
// It must be cast to the RPC response type. |
| 1075 |
// Calling Next() or InternalFetch() updates this value. |
| 1076 |
Response interface{} |
| 1077 |
|
| 1078 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 1079 |
// It is not part of the stable interface of this package. |
| 1080 |
// |
| 1081 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 1082 |
// The number of results is no greater than pageSize. |
| 1083 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 1084 |
InternalFetch func(pageSize int, pageToken string) (results []*translatepb.Model, nextPageToken string, err error) |
| 1085 |
} |
| 1086 |
|
| 1087 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 1088 |
func (it *ModelIterator) PageInfo() *iterator.PageInfo { |
| 1089 |
return it.pageInfo |
| 1090 |
} |
| 1091 |
|
| 1092 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 1093 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 1094 |
func (it *ModelIterator) Next() (*translatepb.Model, error) { |
| 1095 |
var item *translatepb.Model |
| 1096 |
if err := it.nextFunc(); err != nil { |
| 1097 |
return item, err |
| 1098 |
} |
| 1099 |
item = it.items[0] |
| 1100 |
it.items = it.items[1:] |
| 1101 |
return item, nil |
| 1102 |
} |
| 1103 |
|
| 1104 |
func (it *ModelIterator) bufLen() int { |
| 1105 |
return len(it.items) |
| 1106 |
} |
| 1107 |
|
| 1108 |
func (it *ModelIterator) takeBuf() interface{} { |
| 1109 |
b := it.items |
| 1110 |
it.items = nil |
| 1111 |
return b |
| 1112 |
} |
| 1113 |
|
| 1114 |
// OperationIterator manages a stream of *longrunningpb.Operation. |
| 1115 |
type OperationIterator struct { |
| 1116 |
items []*longrunningpb.Operation |
| 1117 |
pageInfo *iterator.PageInfo |
| 1118 |
nextFunc func() error |
| 1119 |
|
| 1120 |
// Response is the raw response for the current page. |
| 1121 |
// It must be cast to the RPC response type. |
| 1122 |
// Calling Next() or InternalFetch() updates this value. |
| 1123 |
Response interface{} |
| 1124 |
|
| 1125 |
// InternalFetch is for use by the Google Cloud Libraries only. |
| 1126 |
// It is not part of the stable interface of this package. |
| 1127 |
// |
| 1128 |
// InternalFetch returns results from a single call to the underlying RPC. |
| 1129 |
// The number of results is no greater than pageSize. |
| 1130 |
// If there are no more results, nextPageToken is empty and err is nil. |
| 1131 |
InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error) |
| 1132 |
} |
| 1133 |
|
| 1134 |
// PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details. |
| 1135 |
func (it *OperationIterator) PageInfo() *iterator.PageInfo { |
| 1136 |
return it.pageInfo |
| 1137 |
} |
| 1138 |
|
| 1139 |
// Next returns the next result. Its second return value is iterator.Done if there are no more |
| 1140 |
// results. Once Next returns Done, all subsequent calls will return Done. |
| 1141 |
func (it *OperationIterator) Next() (*longrunningpb.Operation, error) { |
| 1142 |
var item *longrunningpb.Operation |
| 1143 |
if err := it.nextFunc(); err != nil { |
| 1144 |
return item, err |
| 1145 |
} |
| 1146 |
item = it.items[0] |
| 1147 |
it.items = it.items[1:] |
| 1148 |
return item, nil |
| 1149 |
} |
| 1150 |
|
| 1151 |
func (it *OperationIterator) bufLen() int { |
| 1152 |
return len(it.items) |
| 1153 |
} |
| 1154 |
|
| 1155 |
func (it *OperationIterator) takeBuf() interface{} { |
| 1156 |
b := it.items |
| 1157 |
it.items = nil |
| 1158 |
return b |
| 1159 |
} |