Debian Codegraph @

translate/v3/translate-gen.go

raw symbols SCIP
1 // Copyright 2026 Google LLC.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // Code generated file. DO NOT EDIT.
6
7 // Package translate provides access to the Cloud Translation API.
8 //
9 // This package is DEPRECATED. Use package cloud.google.com/go/translate instead.
10 //
11 // For product documentation, see: https://cloud.google.com/translate/docs/quickstarts
12 //
13 // # Library status
14 //
15 // These client libraries are officially supported by Google. However, this
16 // library is considered complete and is in maintenance mode. This means
17 // that we will address critical bugs and security issues but will not add
18 // any new features.
19 //
20 // When possible, we recommend using our newer
21 // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
22 // that are still actively being worked and iterated on.
23 //
24 // # Creating a client
25 //
26 // Usage example:
27 //
28 // import "google.golang.org/api/translate/v3"
29 // ...
30 // ctx := context.Background()
31 // translateService, err := translate.NewService(ctx)
32 //
33 // In this example, Google Application Default Credentials are used for
34 // authentication. For information on how to create and obtain Application
35 // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
36 //
37 // # Other authentication options
38 //
39 // By default, all available scopes (see "Constants") are used to authenticate.
40 // To restrict scopes, use [google.golang.org/api/option.WithScopes]:
41 //
42 // translateService, err := translate.NewService(ctx, option.WithScopes(translate.CloudTranslationScope))
43 //
44 // To use an API key for authentication (note: some APIs do not support API
45 // keys), use [google.golang.org/api/option.WithAPIKey]:
46 //
47 // translateService, err := translate.NewService(ctx, option.WithAPIKey("AIza..."))
48 //
49 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
50 // flow, use [google.golang.org/api/option.WithTokenSource]:
51 //
52 // config := &oauth2.Config{...}
53 // // ...
54 // token, err := config.Exchange(ctx, ...)
55 // translateService, err := translate.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
56 //
57 // See [google.golang.org/api/option.ClientOption] for details on options.
58 package translate // import "google.golang.org/api/translate/v3"
59
60 import (
61 "bytes"
62 "context"
63 "encoding/json"
64 "errors"
65 "fmt"
66 "io"
67 "log/slog"
68 "net/http"
69 "net/url"
70 "strconv"
71 "strings"
72
73 "github.com/googleapis/gax-go/v2/internallog"
74 googleapi "google.golang.org/api/googleapi"
75 internal "google.golang.org/api/internal"
76 gensupport "google.golang.org/api/internal/gensupport"
77 option "google.golang.org/api/option"
78 internaloption "google.golang.org/api/option/internaloption"
79 htransport "google.golang.org/api/transport/http"
80 )
81
82 // Always reference these packages, just in case the auto-generated code
83 // below doesn't.
84 var _ = bytes.NewBuffer
85 var _ = strconv.Itoa
86 var _ = fmt.Sprintf
87 var _ = json.NewDecoder
88 var _ = io.Copy
89 var _ = url.Parse
90 var _ = gensupport.MarshalJSON
91 var _ = googleapi.Version
92 var _ = errors.New
93 var _ = strings.Replace
94 var _ = context.Canceled
95 var _ = internaloption.WithDefaultEndpoint
96 var _ = internal.Version
97 var _ = internallog.New
98
99 const apiId = "translate:v3"
100 const apiName = "translate"
101 const apiVersion = "v3"
102 const basePath = "https://translation.googleapis.com/"
103 const basePathTemplate = "https://translation.UNIVERSE_DOMAIN/"
104 const mtlsBasePath = "https://translation.mtls.googleapis.com/"
105
106 // OAuth2 scopes used by this API.
107 const (
108 // See, edit, configure, and delete your Google Cloud data and see the email
109 // address for your Google Account.
110 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
111
112 // Translate text from one language to another using Google Translate
113 CloudTranslationScope = "https://www.googleapis.com/auth/cloud-translation"
114 )
115
116 // NewService creates a new Service.
117 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
118 scopesOption := internaloption.WithDefaultScopes(
119 "https://www.googleapis.com/auth/cloud-platform",
120 "https://www.googleapis.com/auth/cloud-translation",
121 )
122 // NOTE: prepend, so we don't override user-specified scopes.
123 opts = append([]option.ClientOption{scopesOption}, opts...)
124 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
125 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
126 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
127 opts = append(opts, internaloption.EnableNewAuthLibrary())
128 client, endpoint, err := htransport.NewClient(ctx, opts...)
129 if err != nil {
130 return nil, err
131 }
132 s := &Service{client: client, BasePath: basePath, logger: internaloption.GetLogger(opts)}
133 s.Projects = NewProjectsService(s)
134 if endpoint != "" {
135 s.BasePath = endpoint
136 }
137 return s, nil
138 }
139
140 // New creates a new Service. It uses the provided http.Client for requests.
141 //
142 // Deprecated: please use NewService instead.
143 // To provide a custom HTTP client, use option.WithHTTPClient.
144 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
145 func New(client *http.Client) (*Service, error) {
146 if client == nil {
147 return nil, errors.New("client is nil")
148 }
149 return NewService(context.TODO(), option.WithHTTPClient(client))
150 }
151
152 type Service struct {
153 client *http.Client
154 logger *slog.Logger
155 BasePath string // API endpoint base URL
156 UserAgent string // optional additional User-Agent fragment
157
158 Projects *ProjectsService
159 }
160
161 func (s *Service) userAgent() string {
162 if s.UserAgent == "" {
163 return googleapi.UserAgent
164 }
165 return googleapi.UserAgent + " " + s.UserAgent
166 }
167
168 func NewProjectsService(s *Service) *ProjectsService {
169 rs := &ProjectsService{s: s}
170 rs.Locations = NewProjectsLocationsService(s)
171 return rs
172 }
173
174 type ProjectsService struct {
175 s *Service
176
177 Locations *ProjectsLocationsService
178 }
179
180 func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
181 rs := &ProjectsLocationsService{s: s}
182 rs.AdaptiveMtDatasets = NewProjectsLocationsAdaptiveMtDatasetsService(s)
183 rs.Datasets = NewProjectsLocationsDatasetsService(s)
184 rs.Glossaries = NewProjectsLocationsGlossariesService(s)
185 rs.Models = NewProjectsLocationsModelsService(s)
186 rs.Operations = NewProjectsLocationsOperationsService(s)
187 return rs
188 }
189
190 type ProjectsLocationsService struct {
191 s *Service
192
193 AdaptiveMtDatasets *ProjectsLocationsAdaptiveMtDatasetsService
194
195 Datasets *ProjectsLocationsDatasetsService
196
197 Glossaries *ProjectsLocationsGlossariesService
198
199 Models *ProjectsLocationsModelsService
200
201 Operations *ProjectsLocationsOperationsService
202 }
203
204 func NewProjectsLocationsAdaptiveMtDatasetsService(s *Service) *ProjectsLocationsAdaptiveMtDatasetsService {
205 rs := &ProjectsLocationsAdaptiveMtDatasetsService{s: s}
206 rs.AdaptiveMtFiles = NewProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesService(s)
207 rs.AdaptiveMtSentences = NewProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesService(s)
208 return rs
209 }
210
211 type ProjectsLocationsAdaptiveMtDatasetsService struct {
212 s *Service
213
214 AdaptiveMtFiles *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesService
215
216 AdaptiveMtSentences *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesService
217 }
218
219 func NewProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesService(s *Service) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesService {
220 rs := &ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesService{s: s}
221 rs.AdaptiveMtSentences = NewProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesService(s)
222 return rs
223 }
224
225 type ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesService struct {
226 s *Service
227
228 AdaptiveMtSentences *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesService
229 }
230
231 func NewProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesService(s *Service) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesService {
232 rs := &ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesService{s: s}
233 return rs
234 }
235
236 type ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesService struct {
237 s *Service
238 }
239
240 func NewProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesService(s *Service) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesService {
241 rs := &ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesService{s: s}
242 return rs
243 }
244
245 type ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesService struct {
246 s *Service
247 }
248
249 func NewProjectsLocationsDatasetsService(s *Service) *ProjectsLocationsDatasetsService {
250 rs := &ProjectsLocationsDatasetsService{s: s}
251 rs.Examples = NewProjectsLocationsDatasetsExamplesService(s)
252 return rs
253 }
254
255 type ProjectsLocationsDatasetsService struct {
256 s *Service
257
258 Examples *ProjectsLocationsDatasetsExamplesService
259 }
260
261 func NewProjectsLocationsDatasetsExamplesService(s *Service) *ProjectsLocationsDatasetsExamplesService {
262 rs := &ProjectsLocationsDatasetsExamplesService{s: s}
263 return rs
264 }
265
266 type ProjectsLocationsDatasetsExamplesService struct {
267 s *Service
268 }
269
270 func NewProjectsLocationsGlossariesService(s *Service) *ProjectsLocationsGlossariesService {
271 rs := &ProjectsLocationsGlossariesService{s: s}
272 rs.GlossaryEntries = NewProjectsLocationsGlossariesGlossaryEntriesService(s)
273 return rs
274 }
275
276 type ProjectsLocationsGlossariesService struct {
277 s *Service
278
279 GlossaryEntries *ProjectsLocationsGlossariesGlossaryEntriesService
280 }
281
282 func NewProjectsLocationsGlossariesGlossaryEntriesService(s *Service) *ProjectsLocationsGlossariesGlossaryEntriesService {
283 rs := &ProjectsLocationsGlossariesGlossaryEntriesService{s: s}
284 return rs
285 }
286
287 type ProjectsLocationsGlossariesGlossaryEntriesService struct {
288 s *Service
289 }
290
291 func NewProjectsLocationsModelsService(s *Service) *ProjectsLocationsModelsService {
292 rs := &ProjectsLocationsModelsService{s: s}
293 return rs
294 }
295
296 type ProjectsLocationsModelsService struct {
297 s *Service
298 }
299
300 func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService {
301 rs := &ProjectsLocationsOperationsService{s: s}
302 return rs
303 }
304
305 type ProjectsLocationsOperationsService struct {
306 s *Service
307 }
308
309 // AdaptiveMtDataset: An Adaptive MT Dataset.
310 type AdaptiveMtDataset struct {
311 // CreateTime: Output only. Timestamp when this dataset was created.
312 CreateTime string `json:"createTime,omitempty"`
313 // DisplayName: The name of the dataset to show in the interface. The name can
314 // be up to 32 characters long and can consist only of ASCII Latin letters A-Z
315 // and a-z, underscores (_), and ASCII digits 0-9.
316 DisplayName string `json:"displayName,omitempty"`
317 // ExampleCount: The number of examples in the dataset.
318 ExampleCount int64 `json:"exampleCount,omitempty"`
319 // Name: Identifier. The resource name of the dataset, in form of
320 // `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{
321 // dataset_id}`
322 Name string `json:"name,omitempty"`
323 // SourceLanguageCode: The BCP-47 language code of the source language.
324 SourceLanguageCode string `json:"sourceLanguageCode,omitempty"`
325 // TargetLanguageCode: The BCP-47 language code of the target language.
326 TargetLanguageCode string `json:"targetLanguageCode,omitempty"`
327 // UpdateTime: Output only. Timestamp when this dataset was last updated.
328 UpdateTime string `json:"updateTime,omitempty"`
329
330 // ServerResponse contains the HTTP response code and headers from the server.
331 googleapi.ServerResponse `json:"-"`
332 // ForceSendFields is a list of field names (e.g. "CreateTime") to
333 // unconditionally include in API requests. By default, fields with empty or
334 // default values are omitted from API requests. See
335 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
336 // details.
337 ForceSendFields []string `json:"-"`
338 // NullFields is a list of field names (e.g. "CreateTime") to include in API
339 // requests with the JSON null value. By default, fields with empty values are
340 // omitted from API requests. See
341 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
342 NullFields []string `json:"-"`
343 }
344
345 func (s AdaptiveMtDataset) MarshalJSON() ([]byte, error) {
346 type NoMethod AdaptiveMtDataset
347 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
348 }
349
350 // AdaptiveMtFile: An AdaptiveMtFile.
351 type AdaptiveMtFile struct {
352 // CreateTime: Output only. Timestamp when this file was created.
353 CreateTime string `json:"createTime,omitempty"`
354 // DisplayName: The file's display name.
355 DisplayName string `json:"displayName,omitempty"`
356 // EntryCount: The number of entries that the file contains.
357 EntryCount int64 `json:"entryCount,omitempty"`
358 // Name: Identifier. The resource name of the file, in form of
359 // `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{
360 // dataset}/adaptiveMtFiles/{file}`
361 Name string `json:"name,omitempty"`
362 // UpdateTime: Output only. Timestamp when this file was last updated.
363 UpdateTime string `json:"updateTime,omitempty"`
364
365 // ServerResponse contains the HTTP response code and headers from the server.
366 googleapi.ServerResponse `json:"-"`
367 // ForceSendFields is a list of field names (e.g. "CreateTime") to
368 // unconditionally include in API requests. By default, fields with empty or
369 // default values are omitted from API requests. See
370 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
371 // details.
372 ForceSendFields []string `json:"-"`
373 // NullFields is a list of field names (e.g. "CreateTime") to include in API
374 // requests with the JSON null value. By default, fields with empty values are
375 // omitted from API requests. See
376 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
377 NullFields []string `json:"-"`
378 }
379
380 func (s AdaptiveMtFile) MarshalJSON() ([]byte, error) {
381 type NoMethod AdaptiveMtFile
382 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
383 }
384
385 // AdaptiveMtSentence: An AdaptiveMt sentence entry.
386 type AdaptiveMtSentence struct {
387 // CreateTime: Output only. Timestamp when this sentence was created.
388 CreateTime string `json:"createTime,omitempty"`
389 // Name: Identifier. The resource name of the file, in form of
390 // `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{
391 // dataset}/adaptiveMtFiles/{file}/adaptiveMtSentences/{sentence}`
392 Name string `json:"name,omitempty"`
393 // SourceSentence: Required. The source sentence.
394 SourceSentence string `json:"sourceSentence,omitempty"`
395 // TargetSentence: Required. The target sentence.
396 TargetSentence string `json:"targetSentence,omitempty"`
397 // UpdateTime: Output only. Timestamp when this sentence was last updated.
398 UpdateTime string `json:"updateTime,omitempty"`
399 // ForceSendFields is a list of field names (e.g. "CreateTime") to
400 // unconditionally include in API requests. By default, fields with empty or
401 // default values are omitted from API requests. See
402 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
403 // details.
404 ForceSendFields []string `json:"-"`
405 // NullFields is a list of field names (e.g. "CreateTime") to include in API
406 // requests with the JSON null value. By default, fields with empty values are
407 // omitted from API requests. See
408 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
409 NullFields []string `json:"-"`
410 }
411
412 func (s AdaptiveMtSentence) MarshalJSON() ([]byte, error) {
413 type NoMethod AdaptiveMtSentence
414 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
415 }
416
417 // AdaptiveMtTranslateRequest: The request for sending an AdaptiveMt
418 // translation query.
419 type AdaptiveMtTranslateRequest struct {
420 // Content: Required. The content of the input in string format.
421 Content []string `json:"content,omitempty"`
422 // Dataset: Required. The resource name for the dataset to use for adaptive MT
423 // translation.
424 // `projects/{project}/locations/{location-id}/adaptiveMtDatasets/{dataset}`
425 Dataset string `json:"dataset,omitempty"`
426 // GlossaryConfig: Optional. Glossary to be applied. The glossary must be
427 // within the same region (have the same location-id) as the model, otherwise
428 // an INVALID_ARGUMENT (400) error is returned.
429 GlossaryConfig *GlossaryConfig `json:"glossaryConfig,omitempty"`
430 // ReferenceSentenceConfig: Configuration for caller provided reference
431 // sentences.
432 ReferenceSentenceConfig *ReferenceSentenceConfig `json:"referenceSentenceConfig,omitempty"`
433 // ForceSendFields is a list of field names (e.g. "Content") to unconditionally
434 // include in API requests. By default, fields with empty or default values are
435 // omitted from API requests. See
436 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
437 // details.
438 ForceSendFields []string `json:"-"`
439 // NullFields is a list of field names (e.g. "Content") to include in API
440 // requests with the JSON null value. By default, fields with empty values are
441 // omitted from API requests. See
442 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
443 NullFields []string `json:"-"`
444 }
445
446 func (s AdaptiveMtTranslateRequest) MarshalJSON() ([]byte, error) {
447 type NoMethod AdaptiveMtTranslateRequest
448 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
449 }
450
451 // AdaptiveMtTranslateResponse: An AdaptiveMtTranslate response.
452 type AdaptiveMtTranslateResponse struct {
453 // GlossaryTranslations: Text translation response if a glossary is provided in
454 // the request. This could be the same as 'translation' above if no terms
455 // apply.
456 GlossaryTranslations []*AdaptiveMtTranslation `json:"glossaryTranslations,omitempty"`
457 // LanguageCode: Output only. The translation's language code.
458 LanguageCode string `json:"languageCode,omitempty"`
459 // Translations: Output only. The translation.
460 Translations []*AdaptiveMtTranslation `json:"translations,omitempty"`
461
462 // ServerResponse contains the HTTP response code and headers from the server.
463 googleapi.ServerResponse `json:"-"`
464 // ForceSendFields is a list of field names (e.g. "GlossaryTranslations") to
465 // unconditionally include in API requests. By default, fields with empty or
466 // default values are omitted from API requests. See
467 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
468 // details.
469 ForceSendFields []string `json:"-"`
470 // NullFields is a list of field names (e.g. "GlossaryTranslations") to include
471 // in API requests with the JSON null value. By default, fields with empty
472 // values are omitted from API requests. See
473 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
474 NullFields []string `json:"-"`
475 }
476
477 func (s AdaptiveMtTranslateResponse) MarshalJSON() ([]byte, error) {
478 type NoMethod AdaptiveMtTranslateResponse
479 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
480 }
481
482 // AdaptiveMtTranslation: An AdaptiveMt translation.
483 type AdaptiveMtTranslation struct {
484 // TranslatedText: Output only. The translated text.
485 TranslatedText string `json:"translatedText,omitempty"`
486 // ForceSendFields is a list of field names (e.g. "TranslatedText") to
487 // unconditionally include in API requests. By default, fields with empty or
488 // default values are omitted from API requests. See
489 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
490 // details.
491 ForceSendFields []string `json:"-"`
492 // NullFields is a list of field names (e.g. "TranslatedText") to include in
493 // API requests with the JSON null value. By default, fields with empty values
494 // are omitted from API requests. See
495 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
496 NullFields []string `json:"-"`
497 }
498
499 func (s AdaptiveMtTranslation) MarshalJSON() ([]byte, error) {
500 type NoMethod AdaptiveMtTranslation
501 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
502 }
503
504 // BatchDocumentInputConfig: Input configuration for BatchTranslateDocument
505 // request.
506 type BatchDocumentInputConfig struct {
507 // GcsSource: Google Cloud Storage location for the source input. This can be a
508 // single file (for example, `gs://translation-test/input.docx`) or a wildcard
509 // (for example, `gs://translation-test/*`). File mime type is determined based
510 // on extension. Supported mime type includes: - `pdf`, application/pdf -
511 // `docx`,
512 // application/vnd.openxmlformats-officedocument.wordprocessingml.document -
513 // `pptx`,
514 // application/vnd.openxmlformats-officedocument.presentationml.presentation -
515 // `xlsx`, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
516 // The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. The
517 // max file size to support for `.pdf` is 1GB and the max page limit is 1000
518 // pages. The max file size to support for all input documents is 1GB.
519 GcsSource *GcsSource `json:"gcsSource,omitempty"`
520 // ForceSendFields is a list of field names (e.g. "GcsSource") to
521 // unconditionally include in API requests. By default, fields with empty or
522 // default values are omitted from API requests. See
523 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
524 // details.
525 ForceSendFields []string `json:"-"`
526 // NullFields is a list of field names (e.g. "GcsSource") to include in API
527 // requests with the JSON null value. By default, fields with empty values are
528 // omitted from API requests. See
529 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
530 NullFields []string `json:"-"`
531 }
532
533 func (s BatchDocumentInputConfig) MarshalJSON() ([]byte, error) {
534 type NoMethod BatchDocumentInputConfig
535 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
536 }
537
538 // BatchDocumentOutputConfig: Output configuration for BatchTranslateDocument
539 // request.
540 type BatchDocumentOutputConfig struct {
541 // GcsDestination: Google Cloud Storage destination for output content. For
542 // every single input document (for example, gs://a/b/c.[extension]), we
543 // generate at most 2 * n output files. (n is the # of target_language_codes in
544 // the BatchTranslateDocumentRequest). While the input documents are being
545 // processed, we write/update an index file `index.csv` under
546 // `gcs_destination.output_uri_prefix` (for example,
547 // gs://translation_output/index.csv) The index file is generated/updated as
548 // new files are being translated. The format is:
549 // input_document,target_language_code,translation_output,error_output,
550 // glossary_translation_output,glossary_error_output `input_document` is one
551 // file we matched using gcs_source.input_uri. `target_language_code` is
552 // provided in the request. `translation_output` contains the translations.
553 // (details provided below) `error_output` contains the error message during
554 // processing of the file. Both translations_file and errors_file could be
555 // empty strings if we have no content to output. `glossary_translation_output`
556 // and `glossary_error_output` are the translated output/error when we apply
557 // glossaries. They could also be empty if we have no content to output. Once a
558 // row is present in index.csv, the input/output matching never changes.
559 // Callers should also expect all the content in input_file are processed and
560 // ready to be consumed (that is, no partial output file is written). Since
561 // index.csv will be keeping updated during the process, please make sure there
562 // is no custom retention policy applied on the output bucket that may avoid
563 // file updating.
564 // (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) The
565 // naming format of translation output files follows (for target language code
566 // [trg]): `translation_output`:
567 // `gs://translation_output/a_b_c_[trg]_translation.[extension]`
568 // `glossary_translation_output`:
569 // `gs://translation_test/a_b_c_[trg]_glossary_translation.[extension]`. The
570 // output document will maintain the same file format as the input document.
571 // The naming format of error output files follows (for target language code
572 // [trg]): `error_output`: `gs://translation_test/a_b_c_[trg]_errors.txt`
573 // `glossary_error_output`:
574 // `gs://translation_test/a_b_c_[trg]_glossary_translation.txt`. The error
575 // output is a txt file containing error details.
576 GcsDestination *GcsDestination `json:"gcsDestination,omitempty"`
577 // ForceSendFields is a list of field names (e.g. "GcsDestination") to
578 // unconditionally include in API requests. By default, fields with empty or
579 // default values are omitted from API requests. See
580 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
581 // details.
582 ForceSendFields []string `json:"-"`
583 // NullFields is a list of field names (e.g. "GcsDestination") to include in
584 // API requests with the JSON null value. By default, fields with empty values
585 // are omitted from API requests. See
586 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
587 NullFields []string `json:"-"`
588 }
589
590 func (s BatchDocumentOutputConfig) MarshalJSON() ([]byte, error) {
591 type NoMethod BatchDocumentOutputConfig
592 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
593 }
594
595 // BatchTranslateDocumentRequest: The BatchTranslateDocument request.
596 type BatchTranslateDocumentRequest struct {
597 // CustomizedAttribution: Optional. This flag is to support user customized
598 // attribution. If not provided, the default is `Machine Translated by Google`.
599 // Customized attribution should follow rules in
600 // https://cloud.google.com/translate/attribution#attribution_and_logos
601 CustomizedAttribution string `json:"customizedAttribution,omitempty"`
602 // EnableRotationCorrection: Optional. If true, enable auto rotation correction
603 // in DVS.
604 EnableRotationCorrection bool `json:"enableRotationCorrection,omitempty"`
605 // EnableShadowRemovalNativePdf: Optional. If true, use the text removal server
606 // to remove the shadow text on background image for native pdf translation.
607 // Shadow removal feature can only be enabled when
608 // is_translate_native_pdf_only: false && pdf_native_only: false
609 EnableShadowRemovalNativePdf bool `json:"enableShadowRemovalNativePdf,omitempty"`
610 // FormatConversions: Optional. The file format conversion map that is applied
611 // to all input files. The map key is the original mime_type. The map value is
612 // the target mime_type of translated documents. Supported file format
613 // conversion includes: - `application/pdf` to
614 // `application/vnd.openxmlformats-officedocument.wordprocessingml.document` If
615 // nothing specified, output files will be in the same format as the original
616 // file.
617 FormatConversions map[string]string `json:"formatConversions,omitempty"`
618 // Glossaries: Optional. Glossaries to be applied. It's keyed by target
619 // language code.
620 Glossaries map[string]TranslateTextGlossaryConfig `json:"glossaries,omitempty"`
621 // InputConfigs: Required. Input configurations. The total number of files
622 // matched should be <= 100. The total content size to translate should be <=
623 // 100M Unicode codepoints. The files must use UTF-8 encoding.
624 InputConfigs []*BatchDocumentInputConfig `json:"inputConfigs,omitempty"`
625 // Models: Optional. The models to use for translation. Map's key is target
626 // language code. Map's value is the model name. Value can be a built-in
627 // general model, or an AutoML Translation model. The value format depends on
628 // model type: - AutoML Translation models:
629 // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
630 // - General (built-in) models:
631 // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
632 // If the map is empty or a specific model is not requested for a language
633 // pair, then default google model (nmt) is used.
634 Models map[string]string `json:"models,omitempty"`
635 // OutputConfig: Required. Output configuration. If 2 input configs match to
636 // the same file (that is, same input path), we don't generate output for
637 // duplicate inputs.
638 OutputConfig *BatchDocumentOutputConfig `json:"outputConfig,omitempty"`
639 // PdfNativeOnly: Optional. If true, only native pdf pages will be translated.
640 PdfNativeOnly bool `json:"pdfNativeOnly,omitempty"`
641 // SourceLanguageCode: Required. The ISO-639 language code of the input
642 // document if known, for example, "en-US" or "sr-Latn". Supported language
643 // codes are listed in Language Support
644 // (https://cloud.google.com/translate/docs/languages).
645 SourceLanguageCode string `json:"sourceLanguageCode,omitempty"`
646 // TargetLanguageCodes: Required. The ISO-639 language code to use for
647 // translation of the input document. Specify up to 10 language codes here.
648 // Supported language codes are listed in Language Support
649 // (https://cloud.google.com/translate/docs/languages).
650 TargetLanguageCodes []string `json:"targetLanguageCodes,omitempty"`
651 // ForceSendFields is a list of field names (e.g. "CustomizedAttribution") to
652 // unconditionally include in API requests. By default, fields with empty or
653 // default values are omitted from API requests. See
654 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
655 // details.
656 ForceSendFields []string `json:"-"`
657 // NullFields is a list of field names (e.g. "CustomizedAttribution") to
658 // include in API requests with the JSON null value. By default, fields with
659 // empty values are omitted from API requests. See
660 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
661 NullFields []string `json:"-"`
662 }
663
664 func (s BatchTranslateDocumentRequest) MarshalJSON() ([]byte, error) {
665 type NoMethod BatchTranslateDocumentRequest
666 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
667 }
668
669 // BatchTranslateTextRequest: The batch translation request.
670 type BatchTranslateTextRequest struct {
671 // Glossaries: Optional. Glossaries to be applied for translation. It's keyed
672 // by target language code.
673 Glossaries map[string]TranslateTextGlossaryConfig `json:"glossaries,omitempty"`
674 // InputConfigs: Required. Input configurations. The total number of files
675 // matched should be <= 100. The total content size should be <= 100M Unicode
676 // codepoints. The files must use UTF-8 encoding.
677 InputConfigs []*InputConfig `json:"inputConfigs,omitempty"`
678 // Labels: Optional. The labels with user-defined metadata for the request.
679 // Label keys and values can be no longer than 63 characters (Unicode
680 // codepoints), can only contain lowercase letters, numeric characters,
681 // underscores and dashes. International characters are allowed. Label values
682 // are optional. Label keys must start with a letter. See
683 // https://cloud.google.com/translate/docs/advanced/labels for more
684 // information.
685 Labels map[string]string `json:"labels,omitempty"`
686 // Models: Optional. The models to use for translation. Map's key is target
687 // language code. Map's value is model name. Value can be a built-in general
688 // model, or an AutoML Translation model. The value format depends on model
689 // type: - AutoML Translation models:
690 // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
691 // - General (built-in) models:
692 // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
693 // If the map is empty or a specific model is not requested for a language
694 // pair, then default google model (nmt) is used.
695 Models map[string]string `json:"models,omitempty"`
696 // OutputConfig: Required. Output configuration. If 2 input configs match to
697 // the same file (that is, same input path), we don't generate output for
698 // duplicate inputs.
699 OutputConfig *OutputConfig `json:"outputConfig,omitempty"`
700 // SourceLanguageCode: Required. Source language code. Supported language codes
701 // are listed in Language Support
702 // (https://cloud.google.com/translate/docs/languages).
703 SourceLanguageCode string `json:"sourceLanguageCode,omitempty"`
704 // TargetLanguageCodes: Required. Specify up to 10 language codes here.
705 // Supported language codes are listed in Language Support
706 // (https://cloud.google.com/translate/docs/languages).
707 TargetLanguageCodes []string `json:"targetLanguageCodes,omitempty"`
708 // ForceSendFields is a list of field names (e.g. "Glossaries") to
709 // unconditionally include in API requests. By default, fields with empty or
710 // default values are omitted from API requests. See
711 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
712 // details.
713 ForceSendFields []string `json:"-"`
714 // NullFields is a list of field names (e.g. "Glossaries") to include in API
715 // requests with the JSON null value. By default, fields with empty values are
716 // omitted from API requests. See
717 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
718 NullFields []string `json:"-"`
719 }
720
721 func (s BatchTranslateTextRequest) MarshalJSON() ([]byte, error) {
722 type NoMethod BatchTranslateTextRequest
723 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
724 }
725
726 // CancelOperationRequest: The request message for Operations.CancelOperation.
727 type CancelOperationRequest struct {
728 }
729
730 // Dataset: A dataset that hosts the examples (sentence pairs) used for
731 // translation models.
732 type Dataset struct {
733 // CreateTime: Output only. Timestamp when this dataset was created.
734 CreateTime string `json:"createTime,omitempty"`
735 // DisplayName: The name of the dataset to show in the interface. The name can
736 // be up to 32 characters long and can consist only of ASCII Latin letters A-Z
737 // and a-z, underscores (_), and ASCII digits 0-9.
738 DisplayName string `json:"displayName,omitempty"`
739 // ExampleCount: Output only. The number of examples in the dataset.
740 ExampleCount int64 `json:"exampleCount,omitempty"`
741 // Name: The resource name of the dataset, in form of
742 // `projects/{project-number-or-id}/locations/{location_id}/datasets/{dataset_id
743 // }`
744 Name string `json:"name,omitempty"`
745 // SourceLanguageCode: The BCP-47 language code of the source language.
746 SourceLanguageCode string `json:"sourceLanguageCode,omitempty"`
747 // TargetLanguageCode: The BCP-47 language code of the target language.
748 TargetLanguageCode string `json:"targetLanguageCode,omitempty"`
749 // TestExampleCount: Output only. Number of test examples (sentence pairs).
750 TestExampleCount int64 `json:"testExampleCount,omitempty"`
751 // TrainExampleCount: Output only. Number of training examples (sentence
752 // pairs).
753 TrainExampleCount int64 `json:"trainExampleCount,omitempty"`
754 // UpdateTime: Output only. Timestamp when this dataset was last updated.
755 UpdateTime string `json:"updateTime,omitempty"`
756 // ValidateExampleCount: Output only. Number of validation examples (sentence
757 // pairs).
758 ValidateExampleCount int64 `json:"validateExampleCount,omitempty"`
759
760 // ServerResponse contains the HTTP response code and headers from the server.
761 googleapi.ServerResponse `json:"-"`
762 // ForceSendFields is a list of field names (e.g. "CreateTime") to
763 // unconditionally include in API requests. By default, fields with empty or
764 // default values are omitted from API requests. See
765 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
766 // details.
767 ForceSendFields []string `json:"-"`
768 // NullFields is a list of field names (e.g. "CreateTime") to include in API
769 // requests with the JSON null value. By default, fields with empty values are
770 // omitted from API requests. See
771 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
772 NullFields []string `json:"-"`
773 }
774
775 func (s Dataset) MarshalJSON() ([]byte, error) {
776 type NoMethod Dataset
777 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
778 }
779
780 // DatasetInputConfig: Input configuration for datasets.
781 type DatasetInputConfig struct {
782 // InputFiles: Files containing the sentence pairs to be imported to the
783 // dataset.
784 InputFiles []*InputFile `json:"inputFiles,omitempty"`
785 // ForceSendFields is a list of field names (e.g. "InputFiles") to
786 // unconditionally include in API requests. By default, fields with empty or
787 // default values are omitted from API requests. See
788 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
789 // details.
790 ForceSendFields []string `json:"-"`
791 // NullFields is a list of field names (e.g. "InputFiles") to include in API
792 // requests with the JSON null value. By default, fields with empty values are
793 // omitted from API requests. See
794 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
795 NullFields []string `json:"-"`
796 }
797
798 func (s DatasetInputConfig) MarshalJSON() ([]byte, error) {
799 type NoMethod DatasetInputConfig
800 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
801 }
802
803 // DatasetOutputConfig: Output configuration for datasets.
804 type DatasetOutputConfig struct {
805 // GcsDestination: Google Cloud Storage destination to write the output.
806 GcsDestination *GcsOutputDestination `json:"gcsDestination,omitempty"`
807 // ForceSendFields is a list of field names (e.g. "GcsDestination") to
808 // unconditionally include in API requests. By default, fields with empty or
809 // default values are omitted from API requests. See
810 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
811 // details.
812 ForceSendFields []string `json:"-"`
813 // NullFields is a list of field names (e.g. "GcsDestination") to include in
814 // API requests with the JSON null value. By default, fields with empty values
815 // are omitted from API requests. See
816 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
817 NullFields []string `json:"-"`
818 }
819
820 func (s DatasetOutputConfig) MarshalJSON() ([]byte, error) {
821 type NoMethod DatasetOutputConfig
822 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
823 }
824
825 // DetectLanguageRequest: The request message for language detection.
826 type DetectLanguageRequest struct {
827 // Content: The content of the input stored as a string.
828 Content string `json:"content,omitempty"`
829 // DocumentInputConfig: Optional. The document configuration of the input.
830 DocumentInputConfig *DocumentInputConfig `json:"documentInputConfig,omitempty"`
831 // Labels: Optional. The labels with user-defined metadata for the request.
832 // Label keys and values can be no longer than 63 characters (Unicode
833 // codepoints), can only contain lowercase letters, numeric characters,
834 // underscores and dashes. International characters are allowed. Label values
835 // are optional. Label keys must start with a letter. See
836 // https://cloud.google.com/translate/docs/advanced/labels for more
837 // information.
838 Labels map[string]string `json:"labels,omitempty"`
839 // MimeType: Optional. The format of the source text, for example, "text/html",
840 // "text/plain". If left blank, the MIME type defaults to "text/html".
841 MimeType string `json:"mimeType,omitempty"`
842 // Model: Optional. The language detection model to be used. Format:
843 // `projects/{project-number-or-id}/locations/{location-id}/models/language-dete
844 // ction/{model-id}` Only one language detection model is currently supported:
845 // `projects/{project-number-or-id}/locations/{location-id}/models/language-dete
846 // ction/default`. If not specified, the default model is used.
847 Model string `json:"model,omitempty"`
848 // ForceSendFields is a list of field names (e.g. "Content") to unconditionally
849 // include in API requests. By default, fields with empty or default values are
850 // omitted from API requests. See
851 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
852 // details.
853 ForceSendFields []string `json:"-"`
854 // NullFields is a list of field names (e.g. "Content") to include in API
855 // requests with the JSON null value. By default, fields with empty values are
856 // omitted from API requests. See
857 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
858 NullFields []string `json:"-"`
859 }
860
861 func (s DetectLanguageRequest) MarshalJSON() ([]byte, error) {
862 type NoMethod DetectLanguageRequest
863 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
864 }
865
866 // DetectLanguageResponse: The response message for language detection.
867 type DetectLanguageResponse struct {
868 // Languages: The most probable language detected by the Translation API. For
869 // each request, the Translation API will always return only one result.
870 Languages []*DetectedLanguage `json:"languages,omitempty"`
871
872 // ServerResponse contains the HTTP response code and headers from the server.
873 googleapi.ServerResponse `json:"-"`
874 // ForceSendFields is a list of field names (e.g. "Languages") to
875 // unconditionally include in API requests. By default, fields with empty or
876 // default values are omitted from API requests. See
877 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
878 // details.
879 ForceSendFields []string `json:"-"`
880 // NullFields is a list of field names (e.g. "Languages") to include in API
881 // requests with the JSON null value. By default, fields with empty values are
882 // omitted from API requests. See
883 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
884 NullFields []string `json:"-"`
885 }
886
887 func (s DetectLanguageResponse) MarshalJSON() ([]byte, error) {
888 type NoMethod DetectLanguageResponse
889 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
890 }
891
892 // DetectedLanguage: The response message for language detection.
893 type DetectedLanguage struct {
894 // Confidence: The confidence of the detection result for this language.
895 Confidence float64 `json:"confidence,omitempty"`
896 // LanguageCode: The ISO-639 language code of the source content in the
897 // request, detected automatically.
898 LanguageCode string `json:"languageCode,omitempty"`
899 // ForceSendFields is a list of field names (e.g. "Confidence") to
900 // unconditionally include in API requests. By default, fields with empty or
901 // default values are omitted from API requests. See
902 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
903 // details.
904 ForceSendFields []string `json:"-"`
905 // NullFields is a list of field names (e.g. "Confidence") to include in API
906 // requests with the JSON null value. By default, fields with empty values are
907 // omitted from API requests. See
908 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
909 NullFields []string `json:"-"`
910 }
911
912 func (s DetectedLanguage) MarshalJSON() ([]byte, error) {
913 type NoMethod DetectedLanguage
914 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
915 }
916
917 func (s *DetectedLanguage) UnmarshalJSON(data []byte) error {
918 type NoMethod DetectedLanguage
919 var s1 struct {
920 Confidence gensupport.JSONFloat64 `json:"confidence"`
921 *NoMethod
922 }
923 s1.NoMethod = (*NoMethod)(s)
924 if err := json.Unmarshal(data, &s1); err != nil {
925 return err
926 }
927 s.Confidence = float64(s1.Confidence)
928 return nil
929 }
930
931 // DocumentInputConfig: A document translation request input config.
932 type DocumentInputConfig struct {
933 // Content: Document's content represented as a stream of bytes.
934 Content string `json:"content,omitempty"`
935 // GcsSource: Google Cloud Storage location. This must be a single file. For
936 // example: gs://example_bucket/example_file.pdf
937 GcsSource *GcsSource `json:"gcsSource,omitempty"`
938 // MimeType: Specifies the input document's mime_type. If not specified it will
939 // be determined using the file extension for gcs_source provided files. For a
940 // file provided through bytes content the mime_type must be provided.
941 // Currently supported mime types are: - application/pdf -
942 // application/vnd.openxmlformats-officedocument.wordprocessingml.document -
943 // application/vnd.openxmlformats-officedocument.presentationml.presentation -
944 // application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
945 MimeType string `json:"mimeType,omitempty"`
946 // ForceSendFields is a list of field names (e.g. "Content") to unconditionally
947 // include in API requests. By default, fields with empty or default values are
948 // omitted from API requests. See
949 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
950 // details.
951 ForceSendFields []string `json:"-"`
952 // NullFields is a list of field names (e.g. "Content") to include in API
953 // requests with the JSON null value. By default, fields with empty values are
954 // omitted from API requests. See
955 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
956 NullFields []string `json:"-"`
957 }
958
959 func (s DocumentInputConfig) MarshalJSON() ([]byte, error) {
960 type NoMethod DocumentInputConfig
961 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
962 }
963
964 // DocumentOutputConfig: A document translation request output config.
965 type DocumentOutputConfig struct {
966 // GcsDestination: Optional. Google Cloud Storage destination for the
967 // translation output, e.g., `gs://my_bucket/my_directory/`. The destination
968 // directory provided does not have to be empty, but the bucket must exist. If
969 // a file with the same name as the output file already exists in the
970 // destination an error will be returned. For a DocumentInputConfig.contents
971 // provided document, the output file will have the name
972 // "output_[trg]_translations.[ext]", where - [trg] corresponds to the
973 // translated file's language code, - [ext] corresponds to the translated
974 // file's extension according to its mime type. For a
975 // DocumentInputConfig.gcs_uri provided document, the output file will have a
976 // name according to its URI. For example: an input file with URI:
977 // `gs://a/b/c.[extension]` stored in a gcs_destination bucket with name
978 // "my_bucket" will have an output URI:
979 // `gs://my_bucket/a_b_c_[trg]_translations.[ext]`, where - [trg] corresponds
980 // to the translated file's language code, - [ext] corresponds to the
981 // translated file's extension according to its mime type. If the document was
982 // directly provided through the request, then the output document will have
983 // the format: `gs://my_bucket/translated_document_[trg]_translations.[ext]`,
984 // where - [trg] corresponds to the translated file's language code, - [ext]
985 // corresponds to the translated file's extension according to its mime type.
986 // If a glossary was provided, then the output URI for the glossary translation
987 // will be equal to the default output URI but have `glossary_translations`
988 // instead of `translations`. For the previous example, its glossary URI would
989 // be: `gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]`. Thus the max
990 // number of output files will be 2 (Translated document, Glossary translated
991 // document). Callers should expect no partial outputs. If there is any error
992 // during document translation, no output will be stored in the Cloud Storage
993 // bucket.
994 GcsDestination *GcsDestination `json:"gcsDestination,omitempty"`
995 // MimeType: Optional. Specifies the translated document's mime_type. If not
996 // specified, the translated file's mime type will be the same as the input
997 // file's mime type. Currently only support the output mime type to be the same
998 // as input mime type. - application/pdf -
999 // application/vnd.openxmlformats-officedocument.wordprocessingml.document -
1000 // application/vnd.openxmlformats-officedocument.presentationml.presentation -
1001 // application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
1002 MimeType string `json:"mimeType,omitempty"`
1003 // ForceSendFields is a list of field names (e.g. "GcsDestination") to
1004 // unconditionally include in API requests. By default, fields with empty or
1005 // default values are omitted from API requests. See
1006 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1007 // details.
1008 ForceSendFields []string `json:"-"`
1009 // NullFields is a list of field names (e.g. "GcsDestination") to include in
1010 // API requests with the JSON null value. By default, fields with empty values
1011 // are omitted from API requests. See
1012 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1013 NullFields []string `json:"-"`
1014 }
1015
1016 func (s DocumentOutputConfig) MarshalJSON() ([]byte, error) {
1017 type NoMethod DocumentOutputConfig
1018 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1019 }
1020
1021 // DocumentTranslation: A translated document message.
1022 type DocumentTranslation struct {
1023 // ByteStreamOutputs: The array of translated documents. It is expected to be
1024 // size 1 for now. We may produce multiple translated documents in the future
1025 // for other type of file formats.
1026 ByteStreamOutputs []string `json:"byteStreamOutputs,omitempty"`
1027 // DetectedLanguageCode: The detected language for the input document. If the
1028 // user did not provide the source language for the input document, this field
1029 // will have the language code automatically detected. If the source language
1030 // was passed, auto-detection of the language does not occur and this field is
1031 // empty.
1032 DetectedLanguageCode string `json:"detectedLanguageCode,omitempty"`
1033 // MimeType: The translated document's mime type.
1034 MimeType string `json:"mimeType,omitempty"`
1035 // ForceSendFields is a list of field names (e.g. "ByteStreamOutputs") to
1036 // unconditionally include in API requests. By default, fields with empty or
1037 // default values are omitted from API requests. See
1038 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1039 // details.
1040 ForceSendFields []string `json:"-"`
1041 // NullFields is a list of field names (e.g. "ByteStreamOutputs") to include in
1042 // API requests with the JSON null value. By default, fields with empty values
1043 // are omitted from API requests. See
1044 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1045 NullFields []string `json:"-"`
1046 }
1047
1048 func (s DocumentTranslation) MarshalJSON() ([]byte, error) {
1049 type NoMethod DocumentTranslation
1050 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1051 }
1052
1053 // Empty: A generic empty message that you can re-use to avoid defining
1054 // duplicated empty messages in your APIs. A typical example is to use it as
1055 // the request or the response type of an API method. For instance: service Foo
1056 // { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
1057 type Empty struct {
1058 // ServerResponse contains the HTTP response code and headers from the server.
1059 googleapi.ServerResponse `json:"-"`
1060 }
1061
1062 // Example: A sentence pair.
1063 type Example struct {
1064 // Name: Output only. The resource name of the example, in form of
1065 // `projects/{project-number-or-id}/locations/{location_id}/datasets/{dataset_id
1066 // }/examples/{example_id}`
1067 Name string `json:"name,omitempty"`
1068 // SourceText: Sentence in source language.
1069 SourceText string `json:"sourceText,omitempty"`
1070 // TargetText: Sentence in target language.
1071 TargetText string `json:"targetText,omitempty"`
1072 // Usage: Output only. Usage of the sentence pair. Options are
1073 // TRAIN|VALIDATION|TEST.
1074 Usage string `json:"usage,omitempty"`
1075 // ForceSendFields is a list of field names (e.g. "Name") to unconditionally
1076 // include in API requests. By default, fields with empty or default values are
1077 // omitted from API requests. See
1078 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1079 // details.
1080 ForceSendFields []string `json:"-"`
1081 // NullFields is a list of field names (e.g. "Name") to include in API requests
1082 // with the JSON null value. By default, fields with empty values are omitted
1083 // from API requests. See
1084 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1085 NullFields []string `json:"-"`
1086 }
1087
1088 func (s Example) MarshalJSON() ([]byte, error) {
1089 type NoMethod Example
1090 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1091 }
1092
1093 // ExportDataRequest: Request message for ExportData.
1094 type ExportDataRequest struct {
1095 // OutputConfig: Required. The config for the output content.
1096 OutputConfig *DatasetOutputConfig `json:"outputConfig,omitempty"`
1097 // ForceSendFields is a list of field names (e.g. "OutputConfig") to
1098 // unconditionally include in API requests. By default, fields with empty or
1099 // default values are omitted from API requests. See
1100 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1101 // details.
1102 ForceSendFields []string `json:"-"`
1103 // NullFields is a list of field names (e.g. "OutputConfig") to include in API
1104 // requests with the JSON null value. By default, fields with empty values are
1105 // omitted from API requests. See
1106 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1107 NullFields []string `json:"-"`
1108 }
1109
1110 func (s ExportDataRequest) MarshalJSON() ([]byte, error) {
1111 type NoMethod ExportDataRequest
1112 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1113 }
1114
1115 // FileInputSource: An inlined file.
1116 type FileInputSource struct {
1117 // Content: Required. The file's byte contents.
1118 Content string `json:"content,omitempty"`
1119 // DisplayName: Required. The file's display name.
1120 DisplayName string `json:"displayName,omitempty"`
1121 // MimeType: Required. The file's mime type.
1122 MimeType string `json:"mimeType,omitempty"`
1123 // ForceSendFields is a list of field names (e.g. "Content") to unconditionally
1124 // include in API requests. By default, fields with empty or default values are
1125 // omitted from API requests. See
1126 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1127 // details.
1128 ForceSendFields []string `json:"-"`
1129 // NullFields is a list of field names (e.g. "Content") to include in API
1130 // requests with the JSON null value. By default, fields with empty values are
1131 // omitted from API requests. See
1132 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1133 NullFields []string `json:"-"`
1134 }
1135
1136 func (s FileInputSource) MarshalJSON() ([]byte, error) {
1137 type NoMethod FileInputSource
1138 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1139 }
1140
1141 // GcsDestination: The Google Cloud Storage location for the output content.
1142 type GcsDestination struct {
1143 // OutputUriPrefix: Required. The bucket used in 'output_uri_prefix' must exist
1144 // and there must be no files under 'output_uri_prefix'. 'output_uri_prefix'
1145 // must end with "/" and start with "gs://". One 'output_uri_prefix' can only
1146 // be used by one batch translation job at a time. Otherwise an
1147 // INVALID_ARGUMENT (400) error is returned.
1148 OutputUriPrefix string `json:"outputUriPrefix,omitempty"`
1149 // ForceSendFields is a list of field names (e.g. "OutputUriPrefix") to
1150 // unconditionally include in API requests. By default, fields with empty or
1151 // default values are omitted from API requests. See
1152 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1153 // details.
1154 ForceSendFields []string `json:"-"`
1155 // NullFields is a list of field names (e.g. "OutputUriPrefix") to include in
1156 // API requests with the JSON null value. By default, fields with empty values
1157 // are omitted from API requests. See
1158 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1159 NullFields []string `json:"-"`
1160 }
1161
1162 func (s GcsDestination) MarshalJSON() ([]byte, error) {
1163 type NoMethod GcsDestination
1164 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1165 }
1166
1167 // GcsInputSource: The Google Cloud Storage location for the input content.
1168 type GcsInputSource struct {
1169 // InputUri: Required. Source data URI. For example,
1170 // `gs://my_bucket/my_object`.
1171 InputUri string `json:"inputUri,omitempty"`
1172 // ForceSendFields is a list of field names (e.g. "InputUri") to
1173 // unconditionally include in API requests. By default, fields with empty or
1174 // default values are omitted from API requests. See
1175 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1176 // details.
1177 ForceSendFields []string `json:"-"`
1178 // NullFields is a list of field names (e.g. "InputUri") to include in API
1179 // requests with the JSON null value. By default, fields with empty values are
1180 // omitted from API requests. See
1181 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1182 NullFields []string `json:"-"`
1183 }
1184
1185 func (s GcsInputSource) MarshalJSON() ([]byte, error) {
1186 type NoMethod GcsInputSource
1187 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1188 }
1189
1190 // GcsOutputDestination: The Google Cloud Storage location for the output
1191 // content.
1192 type GcsOutputDestination struct {
1193 // OutputUriPrefix: Required. Google Cloud Storage URI to output directory. For
1194 // example, `gs://bucket/directory`. The requesting user must have write
1195 // permission to the bucket. The directory will be created if it doesn't exist.
1196 OutputUriPrefix string `json:"outputUriPrefix,omitempty"`
1197 // ForceSendFields is a list of field names (e.g. "OutputUriPrefix") to
1198 // unconditionally include in API requests. By default, fields with empty or
1199 // default values are omitted from API requests. See
1200 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1201 // details.
1202 ForceSendFields []string `json:"-"`
1203 // NullFields is a list of field names (e.g. "OutputUriPrefix") to include in
1204 // API requests with the JSON null value. By default, fields with empty values
1205 // are omitted from API requests. See
1206 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1207 NullFields []string `json:"-"`
1208 }
1209
1210 func (s GcsOutputDestination) MarshalJSON() ([]byte, error) {
1211 type NoMethod GcsOutputDestination
1212 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1213 }
1214
1215 // GcsSource: The Google Cloud Storage location for the input content.
1216 type GcsSource struct {
1217 // InputUri: Required. Source data URI. For example,
1218 // `gs://my_bucket/my_object`.
1219 InputUri string `json:"inputUri,omitempty"`
1220 // ForceSendFields is a list of field names (e.g. "InputUri") to
1221 // unconditionally include in API requests. By default, fields with empty or
1222 // default values are omitted from API requests. See
1223 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1224 // details.
1225 ForceSendFields []string `json:"-"`
1226 // NullFields is a list of field names (e.g. "InputUri") to include in API
1227 // requests with the JSON null value. By default, fields with empty values are
1228 // omitted from API requests. See
1229 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1230 NullFields []string `json:"-"`
1231 }
1232
1233 func (s GcsSource) MarshalJSON() ([]byte, error) {
1234 type NoMethod GcsSource
1235 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1236 }
1237
1238 // Glossary: Represents a glossary built from user-provided data.
1239 type Glossary struct {
1240 // DisplayName: Optional. The display name of the glossary.
1241 DisplayName string `json:"displayName,omitempty"`
1242 // EndTime: Output only. When the glossary creation was finished.
1243 EndTime string `json:"endTime,omitempty"`
1244 // EntryCount: Output only. The number of entries defined in the glossary.
1245 EntryCount int64 `json:"entryCount,omitempty"`
1246 // InputConfig: Required. Provides examples to build the glossary from. Total
1247 // glossary must not exceed 10M Unicode codepoints.
1248 InputConfig *GlossaryInputConfig `json:"inputConfig,omitempty"`
1249 // LanguageCodesSet: Used with equivalent term set glossaries.
1250 LanguageCodesSet *LanguageCodesSet `json:"languageCodesSet,omitempty"`
1251 // LanguagePair: Used with unidirectional glossaries.
1252 LanguagePair *LanguageCodePair `json:"languagePair,omitempty"`
1253 // Name: Identifier. The resource name of the glossary. Glossary names have the
1254 // form
1255 // `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary
1256 // -id}`.
1257 Name string `json:"name,omitempty"`
1258 // SubmitTime: Output only. When CreateGlossary was called.
1259 SubmitTime string `json:"submitTime,omitempty"`
1260
1261 // ServerResponse contains the HTTP response code and headers from the server.
1262 googleapi.ServerResponse `json:"-"`
1263 // ForceSendFields is a list of field names (e.g. "DisplayName") to
1264 // unconditionally include in API requests. By default, fields with empty or
1265 // default values are omitted from API requests. See
1266 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1267 // details.
1268 ForceSendFields []string `json:"-"`
1269 // NullFields is a list of field names (e.g. "DisplayName") to include in API
1270 // requests with the JSON null value. By default, fields with empty values are
1271 // omitted from API requests. See
1272 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1273 NullFields []string `json:"-"`
1274 }
1275
1276 func (s Glossary) MarshalJSON() ([]byte, error) {
1277 type NoMethod Glossary
1278 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1279 }
1280
1281 // GlossaryConfig: Configures which glossary is used for a specific target
1282 // language and defines options for applying that glossary.
1283 type GlossaryConfig struct {
1284 // ContextualTranslationEnabled: Optional. If set to true, the glossary will be
1285 // used for contextual translation.
1286 ContextualTranslationEnabled bool `json:"contextualTranslationEnabled,omitempty"`
1287 // Glossary: Required. The `glossary` to be applied for this translation. The
1288 // format depends on the glossary: - User-provided custom glossary:
1289 // `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary
1290 // -id}`
1291 Glossary string `json:"glossary,omitempty"`
1292 // IgnoreCase: Optional. Indicates match is case insensitive. The default value
1293 // is `false` if missing.
1294 IgnoreCase bool `json:"ignoreCase,omitempty"`
1295 // ForceSendFields is a list of field names (e.g.
1296 // "ContextualTranslationEnabled") to unconditionally include in API requests.
1297 // By default, fields with empty or default values are omitted from API
1298 // requests. See https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields
1299 // for more details.
1300 ForceSendFields []string `json:"-"`
1301 // NullFields is a list of field names (e.g. "ContextualTranslationEnabled") to
1302 // include in API requests with the JSON null value. By default, fields with
1303 // empty values are omitted from API requests. See
1304 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1305 NullFields []string `json:"-"`
1306 }
1307
1308 func (s GlossaryConfig) MarshalJSON() ([]byte, error) {
1309 type NoMethod GlossaryConfig
1310 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1311 }
1312
1313 // GlossaryEntry: Represents a single entry in a glossary.
1314 type GlossaryEntry struct {
1315 // Description: Describes the glossary entry.
1316 Description string `json:"description,omitempty"`
1317 // Name: Identifier. The resource name of the entry. Format:
1318 // `projects/*/locations/*/glossaries/*/glossaryEntries/*`
1319 Name string `json:"name,omitempty"`
1320 // TermsPair: Used for an unidirectional glossary.
1321 TermsPair *GlossaryTermsPair `json:"termsPair,omitempty"`
1322 // TermsSet: Used for an equivalent term sets glossary.
1323 TermsSet *GlossaryTermsSet `json:"termsSet,omitempty"`
1324
1325 // ServerResponse contains the HTTP response code and headers from the server.
1326 googleapi.ServerResponse `json:"-"`
1327 // ForceSendFields is a list of field names (e.g. "Description") to
1328 // unconditionally include in API requests. By default, fields with empty or
1329 // default values are omitted from API requests. See
1330 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1331 // details.
1332 ForceSendFields []string `json:"-"`
1333 // NullFields is a list of field names (e.g. "Description") to include in API
1334 // requests with the JSON null value. By default, fields with empty values are
1335 // omitted from API requests. See
1336 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1337 NullFields []string `json:"-"`
1338 }
1339
1340 func (s GlossaryEntry) MarshalJSON() ([]byte, error) {
1341 type NoMethod GlossaryEntry
1342 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1343 }
1344
1345 // GlossaryInputConfig: Input configuration for glossaries.
1346 type GlossaryInputConfig struct {
1347 // GcsSource: Required. Google Cloud Storage location of glossary data. File
1348 // format is determined based on the filename extension. API returns
1349 // [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file formats.
1350 // Wildcards are not allowed. This must be a single file in one of the
1351 // following formats: For unidirectional glossaries: - TSV/CSV (`.tsv`/`.csv`):
1352 // Two column file, tab- or comma-separated. The first column is source text.
1353 // The second column is target text. No headers in this file. The first row
1354 // contains data and not column names. - TMX (`.tmx`): TMX file with parallel
1355 // data defining source/target term pairs. For equivalent term sets glossaries:
1356 // - CSV (`.csv`): Multi-column CSV file defining equivalent glossary terms in
1357 // multiple languages. See documentation for more information - glossaries
1358 // (https://cloud.google.com/translate/docs/advanced/glossary).
1359 GcsSource *GcsSource `json:"gcsSource,omitempty"`
1360 // ForceSendFields is a list of field names (e.g. "GcsSource") to
1361 // unconditionally include in API requests. By default, fields with empty or
1362 // default values are omitted from API requests. See
1363 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1364 // details.
1365 ForceSendFields []string `json:"-"`
1366 // NullFields is a list of field names (e.g. "GcsSource") to include in API
1367 // requests with the JSON null value. By default, fields with empty values are
1368 // omitted from API requests. See
1369 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1370 NullFields []string `json:"-"`
1371 }
1372
1373 func (s GlossaryInputConfig) MarshalJSON() ([]byte, error) {
1374 type NoMethod GlossaryInputConfig
1375 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1376 }
1377
1378 // GlossaryTerm: Represents a single glossary term
1379 type GlossaryTerm struct {
1380 // LanguageCode: The language for this glossary term.
1381 LanguageCode string `json:"languageCode,omitempty"`
1382 // Text: The text for the glossary term.
1383 Text string `json:"text,omitempty"`
1384 // ForceSendFields is a list of field names (e.g. "LanguageCode") to
1385 // unconditionally include in API requests. By default, fields with empty or
1386 // default values are omitted from API requests. See
1387 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1388 // details.
1389 ForceSendFields []string `json:"-"`
1390 // NullFields is a list of field names (e.g. "LanguageCode") to include in API
1391 // requests with the JSON null value. By default, fields with empty values are
1392 // omitted from API requests. See
1393 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1394 NullFields []string `json:"-"`
1395 }
1396
1397 func (s GlossaryTerm) MarshalJSON() ([]byte, error) {
1398 type NoMethod GlossaryTerm
1399 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1400 }
1401
1402 // GlossaryTermsPair: Represents a single entry for an unidirectional glossary.
1403 type GlossaryTermsPair struct {
1404 // SourceTerm: The source term is the term that will get match in the text,
1405 SourceTerm *GlossaryTerm `json:"sourceTerm,omitempty"`
1406 // TargetTerm: The term that will replace the match source term.
1407 TargetTerm *GlossaryTerm `json:"targetTerm,omitempty"`
1408 // ForceSendFields is a list of field names (e.g. "SourceTerm") to
1409 // unconditionally include in API requests. By default, fields with empty or
1410 // default values are omitted from API requests. See
1411 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1412 // details.
1413 ForceSendFields []string `json:"-"`
1414 // NullFields is a list of field names (e.g. "SourceTerm") to include in API
1415 // requests with the JSON null value. By default, fields with empty values are
1416 // omitted from API requests. See
1417 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1418 NullFields []string `json:"-"`
1419 }
1420
1421 func (s GlossaryTermsPair) MarshalJSON() ([]byte, error) {
1422 type NoMethod GlossaryTermsPair
1423 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1424 }
1425
1426 // GlossaryTermsSet: Represents a single entry for an equivalent term set
1427 // glossary. This is used for equivalent term sets where each term can be
1428 // replaced by the other terms in the set.
1429 type GlossaryTermsSet struct {
1430 // Terms: Each term in the set represents a term that can be replaced by the
1431 // other terms.
1432 Terms []*GlossaryTerm `json:"terms,omitempty"`
1433 // ForceSendFields is a list of field names (e.g. "Terms") to unconditionally
1434 // include in API requests. By default, fields with empty or default values are
1435 // omitted from API requests. See
1436 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1437 // details.
1438 ForceSendFields []string `json:"-"`
1439 // NullFields is a list of field names (e.g. "Terms") to include in API
1440 // requests with the JSON null value. By default, fields with empty values are
1441 // omitted from API requests. See
1442 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1443 NullFields []string `json:"-"`
1444 }
1445
1446 func (s GlossaryTermsSet) MarshalJSON() ([]byte, error) {
1447 type NoMethod GlossaryTermsSet
1448 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1449 }
1450
1451 // ImportAdaptiveMtFileRequest: The request for importing an AdaptiveMt file
1452 // along with its sentences.
1453 type ImportAdaptiveMtFileRequest struct {
1454 // FileInputSource: Inline file source.
1455 FileInputSource *FileInputSource `json:"fileInputSource,omitempty"`
1456 // GcsInputSource: Google Cloud Storage file source.
1457 GcsInputSource *GcsInputSource `json:"gcsInputSource,omitempty"`
1458 // ForceSendFields is a list of field names (e.g. "FileInputSource") to
1459 // unconditionally include in API requests. By default, fields with empty or
1460 // default values are omitted from API requests. See
1461 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1462 // details.
1463 ForceSendFields []string `json:"-"`
1464 // NullFields is a list of field names (e.g. "FileInputSource") to include in
1465 // API requests with the JSON null value. By default, fields with empty values
1466 // are omitted from API requests. See
1467 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1468 NullFields []string `json:"-"`
1469 }
1470
1471 func (s ImportAdaptiveMtFileRequest) MarshalJSON() ([]byte, error) {
1472 type NoMethod ImportAdaptiveMtFileRequest
1473 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1474 }
1475
1476 // ImportAdaptiveMtFileResponse: The response for importing an AdaptiveMtFile
1477 type ImportAdaptiveMtFileResponse struct {
1478 // AdaptiveMtFile: Output only. The Adaptive MT file that was imported.
1479 AdaptiveMtFile *AdaptiveMtFile `json:"adaptiveMtFile,omitempty"`
1480
1481 // ServerResponse contains the HTTP response code and headers from the server.
1482 googleapi.ServerResponse `json:"-"`
1483 // ForceSendFields is a list of field names (e.g. "AdaptiveMtFile") to
1484 // unconditionally include in API requests. By default, fields with empty or
1485 // default values are omitted from API requests. See
1486 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1487 // details.
1488 ForceSendFields []string `json:"-"`
1489 // NullFields is a list of field names (e.g. "AdaptiveMtFile") to include in
1490 // API requests with the JSON null value. By default, fields with empty values
1491 // are omitted from API requests. See
1492 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1493 NullFields []string `json:"-"`
1494 }
1495
1496 func (s ImportAdaptiveMtFileResponse) MarshalJSON() ([]byte, error) {
1497 type NoMethod ImportAdaptiveMtFileResponse
1498 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1499 }
1500
1501 // ImportDataRequest: Request message for ImportData.
1502 type ImportDataRequest struct {
1503 // InputConfig: Required. The config for the input content.
1504 InputConfig *DatasetInputConfig `json:"inputConfig,omitempty"`
1505 // ForceSendFields is a list of field names (e.g. "InputConfig") to
1506 // unconditionally include in API requests. By default, fields with empty or
1507 // default values are omitted from API requests. See
1508 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1509 // details.
1510 ForceSendFields []string `json:"-"`
1511 // NullFields is a list of field names (e.g. "InputConfig") to include in API
1512 // requests with the JSON null value. By default, fields with empty values are
1513 // omitted from API requests. See
1514 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1515 NullFields []string `json:"-"`
1516 }
1517
1518 func (s ImportDataRequest) MarshalJSON() ([]byte, error) {
1519 type NoMethod ImportDataRequest
1520 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1521 }
1522
1523 // InputConfig: Input configuration for BatchTranslateText request.
1524 type InputConfig struct {
1525 // GcsSource: Required. Google Cloud Storage location for the source input.
1526 // This can be a single file (for example, `gs://translation-test/input.tsv`)
1527 // or a wildcard (for example, `gs://translation-test/*`). If a file extension
1528 // is `.tsv`, it can contain either one or two columns. The first column
1529 // (optional) is the id of the text request. If the first column is missing, we
1530 // use the row number (0-based) from the input file as the ID in the output
1531 // file. The second column is the actual text to be translated. We recommend
1532 // each row be <= 10K Unicode codepoints, otherwise an error might be returned.
1533 // Note that the input tsv must be RFC 4180 compliant. You could use
1534 // https://github.com/Clever/csvlint to check potential formatting errors in
1535 // your tsv file. csvlint --delimiter='\t' your_input_file.tsv The other
1536 // supported file extensions are `.txt` or `.html`, which is treated as a
1537 // single large chunk of text.
1538 GcsSource *GcsSource `json:"gcsSource,omitempty"`
1539 // MimeType: Optional. Can be "text/plain" or "text/html". For `.tsv`,
1540 // "text/html" is used if mime_type is missing. For `.html`, this field must be
1541 // "text/html" or empty. For `.txt`, this field must be "text/plain" or empty.
1542 MimeType string `json:"mimeType,omitempty"`
1543 // ForceSendFields is a list of field names (e.g. "GcsSource") to
1544 // unconditionally include in API requests. By default, fields with empty or
1545 // default values are omitted from API requests. See
1546 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1547 // details.
1548 ForceSendFields []string `json:"-"`
1549 // NullFields is a list of field names (e.g. "GcsSource") to include in API
1550 // requests with the JSON null value. By default, fields with empty values are
1551 // omitted from API requests. See
1552 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1553 NullFields []string `json:"-"`
1554 }
1555
1556 func (s InputConfig) MarshalJSON() ([]byte, error) {
1557 type NoMethod InputConfig
1558 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1559 }
1560
1561 // InputFile: An input file.
1562 type InputFile struct {
1563 // GcsSource: Google Cloud Storage file source.
1564 GcsSource *GcsInputSource `json:"gcsSource,omitempty"`
1565 // Usage: Optional. Usage of the file contents. Options are
1566 // TRAIN|VALIDATION|TEST, or UNASSIGNED (by default) for auto split.
1567 Usage string `json:"usage,omitempty"`
1568 // ForceSendFields is a list of field names (e.g. "GcsSource") to
1569 // unconditionally include in API requests. By default, fields with empty or
1570 // default values are omitted from API requests. See
1571 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1572 // details.
1573 ForceSendFields []string `json:"-"`
1574 // NullFields is a list of field names (e.g. "GcsSource") to include in API
1575 // requests with the JSON null value. By default, fields with empty values are
1576 // omitted from API requests. See
1577 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1578 NullFields []string `json:"-"`
1579 }
1580
1581 func (s InputFile) MarshalJSON() ([]byte, error) {
1582 type NoMethod InputFile
1583 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1584 }
1585
1586 // LanguageCodePair: Used with unidirectional glossaries.
1587 type LanguageCodePair struct {
1588 // SourceLanguageCode: Required. The ISO-639 language code of the input text,
1589 // for example, "en-US". Expected to be an exact match for
1590 // GlossaryTerm.language_code.
1591 SourceLanguageCode string `json:"sourceLanguageCode,omitempty"`
1592 // TargetLanguageCode: Required. The ISO-639 language code for translation
1593 // output, for example, "zh-CN". Expected to be an exact match for
1594 // GlossaryTerm.language_code.
1595 TargetLanguageCode string `json:"targetLanguageCode,omitempty"`
1596 // ForceSendFields is a list of field names (e.g. "SourceLanguageCode") to
1597 // unconditionally include in API requests. By default, fields with empty or
1598 // default values are omitted from API requests. See
1599 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1600 // details.
1601 ForceSendFields []string `json:"-"`
1602 // NullFields is a list of field names (e.g. "SourceLanguageCode") to include
1603 // in API requests with the JSON null value. By default, fields with empty
1604 // values are omitted from API requests. See
1605 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1606 NullFields []string `json:"-"`
1607 }
1608
1609 func (s LanguageCodePair) MarshalJSON() ([]byte, error) {
1610 type NoMethod LanguageCodePair
1611 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1612 }
1613
1614 // LanguageCodesSet: Used with equivalent term set glossaries.
1615 type LanguageCodesSet struct {
1616 // LanguageCodes: Optional. The ISO-639 language code(s) for terms defined in
1617 // the glossary. All entries are unique. The list contains at least two
1618 // entries. Expected to be an exact match for GlossaryTerm.language_code.
1619 LanguageCodes []string `json:"languageCodes,omitempty"`
1620 // ForceSendFields is a list of field names (e.g. "LanguageCodes") to
1621 // unconditionally include in API requests. By default, fields with empty or
1622 // default values are omitted from API requests. See
1623 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1624 // details.
1625 ForceSendFields []string `json:"-"`
1626 // NullFields is a list of field names (e.g. "LanguageCodes") to include in API
1627 // requests with the JSON null value. By default, fields with empty values are
1628 // omitted from API requests. See
1629 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1630 NullFields []string `json:"-"`
1631 }
1632
1633 func (s LanguageCodesSet) MarshalJSON() ([]byte, error) {
1634 type NoMethod LanguageCodesSet
1635 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1636 }
1637
1638 // ListAdaptiveMtDatasetsResponse: A list of AdaptiveMtDatasets.
1639 type ListAdaptiveMtDatasetsResponse struct {
1640 // AdaptiveMtDatasets: Output only. A list of Adaptive MT datasets.
1641 AdaptiveMtDatasets []*AdaptiveMtDataset `json:"adaptiveMtDatasets,omitempty"`
1642 // NextPageToken: Optional. A token to retrieve a page of results. Pass this
1643 // value in the [ListAdaptiveMtDatasetsRequest.page_token] field in the
1644 // subsequent call to `ListAdaptiveMtDatasets` method to retrieve the next page
1645 // of results.
1646 NextPageToken string `json:"nextPageToken,omitempty"`
1647
1648 // ServerResponse contains the HTTP response code and headers from the server.
1649 googleapi.ServerResponse `json:"-"`
1650 // ForceSendFields is a list of field names (e.g. "AdaptiveMtDatasets") to
1651 // unconditionally include in API requests. By default, fields with empty or
1652 // default values are omitted from API requests. See
1653 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1654 // details.
1655 ForceSendFields []string `json:"-"`
1656 // NullFields is a list of field names (e.g. "AdaptiveMtDatasets") to include
1657 // in API requests with the JSON null value. By default, fields with empty
1658 // values are omitted from API requests. See
1659 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1660 NullFields []string `json:"-"`
1661 }
1662
1663 func (s ListAdaptiveMtDatasetsResponse) MarshalJSON() ([]byte, error) {
1664 type NoMethod ListAdaptiveMtDatasetsResponse
1665 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1666 }
1667
1668 // ListAdaptiveMtFilesResponse: The response for listing all AdaptiveMt files
1669 // under a given dataset.
1670 type ListAdaptiveMtFilesResponse struct {
1671 // AdaptiveMtFiles: Output only. The Adaptive MT files.
1672 AdaptiveMtFiles []*AdaptiveMtFile `json:"adaptiveMtFiles,omitempty"`
1673 // NextPageToken: Optional. A token to retrieve a page of results. Pass this
1674 // value in the ListAdaptiveMtFilesRequest.page_token field in the subsequent
1675 // call to `ListAdaptiveMtFiles` method to retrieve the next page of results.
1676 NextPageToken string `json:"nextPageToken,omitempty"`
1677
1678 // ServerResponse contains the HTTP response code and headers from the server.
1679 googleapi.ServerResponse `json:"-"`
1680 // ForceSendFields is a list of field names (e.g. "AdaptiveMtFiles") to
1681 // unconditionally include in API requests. By default, fields with empty or
1682 // default values are omitted from API requests. See
1683 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1684 // details.
1685 ForceSendFields []string `json:"-"`
1686 // NullFields is a list of field names (e.g. "AdaptiveMtFiles") to include in
1687 // API requests with the JSON null value. By default, fields with empty values
1688 // are omitted from API requests. See
1689 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1690 NullFields []string `json:"-"`
1691 }
1692
1693 func (s ListAdaptiveMtFilesResponse) MarshalJSON() ([]byte, error) {
1694 type NoMethod ListAdaptiveMtFilesResponse
1695 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1696 }
1697
1698 // ListAdaptiveMtSentencesResponse: List AdaptiveMt sentences response.
1699 type ListAdaptiveMtSentencesResponse struct {
1700 // AdaptiveMtSentences: Output only. The list of AdaptiveMtSentences.
1701 AdaptiveMtSentences []*AdaptiveMtSentence `json:"adaptiveMtSentences,omitempty"`
1702 // NextPageToken: Optional.
1703 NextPageToken string `json:"nextPageToken,omitempty"`
1704
1705 // ServerResponse contains the HTTP response code and headers from the server.
1706 googleapi.ServerResponse `json:"-"`
1707 // ForceSendFields is a list of field names (e.g. "AdaptiveMtSentences") to
1708 // unconditionally include in API requests. By default, fields with empty or
1709 // default values are omitted from API requests. See
1710 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1711 // details.
1712 ForceSendFields []string `json:"-"`
1713 // NullFields is a list of field names (e.g. "AdaptiveMtSentences") to include
1714 // in API requests with the JSON null value. By default, fields with empty
1715 // values are omitted from API requests. See
1716 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1717 NullFields []string `json:"-"`
1718 }
1719
1720 func (s ListAdaptiveMtSentencesResponse) MarshalJSON() ([]byte, error) {
1721 type NoMethod ListAdaptiveMtSentencesResponse
1722 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1723 }
1724
1725 // ListDatasetsResponse: Response message for ListDatasets.
1726 type ListDatasetsResponse struct {
1727 // Datasets: The datasets read.
1728 Datasets []*Dataset `json:"datasets,omitempty"`
1729 // NextPageToken: A token to retrieve next page of results. Pass this token to
1730 // the page_token field in the ListDatasetsRequest to obtain the corresponding
1731 // page.
1732 NextPageToken string `json:"nextPageToken,omitempty"`
1733
1734 // ServerResponse contains the HTTP response code and headers from the server.
1735 googleapi.ServerResponse `json:"-"`
1736 // ForceSendFields is a list of field names (e.g. "Datasets") to
1737 // unconditionally include in API requests. By default, fields with empty or
1738 // default values are omitted from API requests. See
1739 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1740 // details.
1741 ForceSendFields []string `json:"-"`
1742 // NullFields is a list of field names (e.g. "Datasets") to include in API
1743 // requests with the JSON null value. By default, fields with empty values are
1744 // omitted from API requests. See
1745 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1746 NullFields []string `json:"-"`
1747 }
1748
1749 func (s ListDatasetsResponse) MarshalJSON() ([]byte, error) {
1750 type NoMethod ListDatasetsResponse
1751 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1752 }
1753
1754 // ListExamplesResponse: Response message for ListExamples.
1755 type ListExamplesResponse struct {
1756 // Examples: The sentence pairs.
1757 Examples []*Example `json:"examples,omitempty"`
1758 // NextPageToken: A token to retrieve next page of results. Pass this token to
1759 // the page_token field in the ListExamplesRequest to obtain the corresponding
1760 // page.
1761 NextPageToken string `json:"nextPageToken,omitempty"`
1762
1763 // ServerResponse contains the HTTP response code and headers from the server.
1764 googleapi.ServerResponse `json:"-"`
1765 // ForceSendFields is a list of field names (e.g. "Examples") to
1766 // unconditionally include in API requests. By default, fields with empty or
1767 // default values are omitted from API requests. See
1768 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1769 // details.
1770 ForceSendFields []string `json:"-"`
1771 // NullFields is a list of field names (e.g. "Examples") to include in API
1772 // requests with the JSON null value. By default, fields with empty values are
1773 // omitted from API requests. See
1774 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1775 NullFields []string `json:"-"`
1776 }
1777
1778 func (s ListExamplesResponse) MarshalJSON() ([]byte, error) {
1779 type NoMethod ListExamplesResponse
1780 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1781 }
1782
1783 // ListGlossariesResponse: Response message for ListGlossaries.
1784 type ListGlossariesResponse struct {
1785 // Glossaries: The list of glossaries for a project.
1786 Glossaries []*Glossary `json:"glossaries,omitempty"`
1787 // NextPageToken: A token to retrieve a page of results. Pass this value in the
1788 // [ListGlossariesRequest.page_token] field in the subsequent call to
1789 // `ListGlossaries` method to retrieve the next page of results.
1790 NextPageToken string `json:"nextPageToken,omitempty"`
1791
1792 // ServerResponse contains the HTTP response code and headers from the server.
1793 googleapi.ServerResponse `json:"-"`
1794 // ForceSendFields is a list of field names (e.g. "Glossaries") to
1795 // unconditionally include in API requests. By default, fields with empty or
1796 // default values are omitted from API requests. See
1797 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1798 // details.
1799 ForceSendFields []string `json:"-"`
1800 // NullFields is a list of field names (e.g. "Glossaries") to include in API
1801 // requests with the JSON null value. By default, fields with empty values are
1802 // omitted from API requests. See
1803 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1804 NullFields []string `json:"-"`
1805 }
1806
1807 func (s ListGlossariesResponse) MarshalJSON() ([]byte, error) {
1808 type NoMethod ListGlossariesResponse
1809 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1810 }
1811
1812 // ListGlossaryEntriesResponse: Response message for ListGlossaryEntries
1813 type ListGlossaryEntriesResponse struct {
1814 // GlossaryEntries: Optional. The Glossary Entries
1815 GlossaryEntries []*GlossaryEntry `json:"glossaryEntries,omitempty"`
1816 // NextPageToken: Optional. A token to retrieve a page of results. Pass this
1817 // value in the [ListGLossaryEntriesRequest.page_token] field in the subsequent
1818 // calls.
1819 NextPageToken string `json:"nextPageToken,omitempty"`
1820
1821 // ServerResponse contains the HTTP response code and headers from the server.
1822 googleapi.ServerResponse `json:"-"`
1823 // ForceSendFields is a list of field names (e.g. "GlossaryEntries") to
1824 // unconditionally include in API requests. By default, fields with empty or
1825 // default values are omitted from API requests. See
1826 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1827 // details.
1828 ForceSendFields []string `json:"-"`
1829 // NullFields is a list of field names (e.g. "GlossaryEntries") to include in
1830 // API requests with the JSON null value. By default, fields with empty values
1831 // are omitted from API requests. See
1832 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1833 NullFields []string `json:"-"`
1834 }
1835
1836 func (s ListGlossaryEntriesResponse) MarshalJSON() ([]byte, error) {
1837 type NoMethod ListGlossaryEntriesResponse
1838 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1839 }
1840
1841 // ListLocationsResponse: The response message for Locations.ListLocations.
1842 type ListLocationsResponse struct {
1843 // Locations: A list of locations that matches the specified filter in the
1844 // request.
1845 Locations []*Location `json:"locations,omitempty"`
1846 // NextPageToken: The standard List next-page token.
1847 NextPageToken string `json:"nextPageToken,omitempty"`
1848
1849 // ServerResponse contains the HTTP response code and headers from the server.
1850 googleapi.ServerResponse `json:"-"`
1851 // ForceSendFields is a list of field names (e.g. "Locations") to
1852 // unconditionally include in API requests. By default, fields with empty or
1853 // default values are omitted from API requests. See
1854 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1855 // details.
1856 ForceSendFields []string `json:"-"`
1857 // NullFields is a list of field names (e.g. "Locations") to include in API
1858 // requests with the JSON null value. By default, fields with empty values are
1859 // omitted from API requests. See
1860 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1861 NullFields []string `json:"-"`
1862 }
1863
1864 func (s ListLocationsResponse) MarshalJSON() ([]byte, error) {
1865 type NoMethod ListLocationsResponse
1866 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1867 }
1868
1869 // ListModelsResponse: Response message for ListModels.
1870 type ListModelsResponse struct {
1871 // Models: The models read.
1872 Models []*Model `json:"models,omitempty"`
1873 // NextPageToken: A token to retrieve next page of results. Pass this token to
1874 // the page_token field in the ListModelsRequest to obtain the corresponding
1875 // page.
1876 NextPageToken string `json:"nextPageToken,omitempty"`
1877
1878 // ServerResponse contains the HTTP response code and headers from the server.
1879 googleapi.ServerResponse `json:"-"`
1880 // ForceSendFields is a list of field names (e.g. "Models") to unconditionally
1881 // include in API requests. By default, fields with empty or default values are
1882 // omitted from API requests. See
1883 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1884 // details.
1885 ForceSendFields []string `json:"-"`
1886 // NullFields is a list of field names (e.g. "Models") to include in API
1887 // requests with the JSON null value. By default, fields with empty values are
1888 // omitted from API requests. See
1889 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1890 NullFields []string `json:"-"`
1891 }
1892
1893 func (s ListModelsResponse) MarshalJSON() ([]byte, error) {
1894 type NoMethod ListModelsResponse
1895 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1896 }
1897
1898 // ListOperationsResponse: The response message for Operations.ListOperations.
1899 type ListOperationsResponse struct {
1900 // NextPageToken: The standard List next-page token.
1901 NextPageToken string `json:"nextPageToken,omitempty"`
1902 // Operations: A list of operations that matches the specified filter in the
1903 // request.
1904 Operations []*Operation `json:"operations,omitempty"`
1905 // Unreachable: Unordered list. Unreachable resources. Populated when the
1906 // request sets `ListOperationsRequest.return_partial_success` and reads across
1907 // collections. For example, when attempting to list all resources across all
1908 // supported locations.
1909 Unreachable []string `json:"unreachable,omitempty"`
1910
1911 // ServerResponse contains the HTTP response code and headers from the server.
1912 googleapi.ServerResponse `json:"-"`
1913 // ForceSendFields is a list of field names (e.g. "NextPageToken") to
1914 // unconditionally include in API requests. By default, fields with empty or
1915 // default values are omitted from API requests. See
1916 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1917 // details.
1918 ForceSendFields []string `json:"-"`
1919 // NullFields is a list of field names (e.g. "NextPageToken") to include in API
1920 // requests with the JSON null value. By default, fields with empty values are
1921 // omitted from API requests. See
1922 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1923 NullFields []string `json:"-"`
1924 }
1925
1926 func (s ListOperationsResponse) MarshalJSON() ([]byte, error) {
1927 type NoMethod ListOperationsResponse
1928 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1929 }
1930
1931 // Location: A resource that represents a Google Cloud location.
1932 type Location struct {
1933 // DisplayName: The friendly name for this location, typically a nearby city
1934 // name. For example, "Tokyo".
1935 DisplayName string `json:"displayName,omitempty"`
1936 // Labels: Cross-service attributes for the location. For example
1937 // {"cloud.googleapis.com/region": "us-east1"}
1938 Labels map[string]string `json:"labels,omitempty"`
1939 // LocationId: The canonical id for this location. For example: "us-east1".
1940 LocationId string `json:"locationId,omitempty"`
1941 // Metadata: Service-specific metadata. For example the available capacity at
1942 // the given location.
1943 Metadata googleapi.RawMessage `json:"metadata,omitempty"`
1944 // Name: Resource name for the location, which may vary between
1945 // implementations. For example:
1946 // "projects/example-project/locations/us-east1"
1947 Name string `json:"name,omitempty"`
1948
1949 // ServerResponse contains the HTTP response code and headers from the server.
1950 googleapi.ServerResponse `json:"-"`
1951 // ForceSendFields is a list of field names (e.g. "DisplayName") to
1952 // unconditionally include in API requests. By default, fields with empty or
1953 // default values are omitted from API requests. See
1954 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
1955 // details.
1956 ForceSendFields []string `json:"-"`
1957 // NullFields is a list of field names (e.g. "DisplayName") to include in API
1958 // requests with the JSON null value. By default, fields with empty values are
1959 // omitted from API requests. See
1960 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
1961 NullFields []string `json:"-"`
1962 }
1963
1964 func (s Location) MarshalJSON() ([]byte, error) {
1965 type NoMethod Location
1966 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
1967 }
1968
1969 // Model: A trained translation model.
1970 type Model struct {
1971 // CreateTime: Output only. Timestamp when the model resource was created,
1972 // which is also when the training started.
1973 CreateTime string `json:"createTime,omitempty"`
1974 // Dataset: Required. The dataset from which the model is trained, in form of
1975 // `projects/{project-number-or-id}/locations/{location_id}/datasets/{dataset_id
1976 // }`
1977 Dataset string `json:"dataset,omitempty"`
1978 // DisplayName: The name of the model to show in the interface. The name can be
1979 // up to 32 characters long and can consist only of ASCII Latin letters A-Z and
1980 // a-z, underscores (_), and ASCII digits 0-9.
1981 DisplayName string `json:"displayName,omitempty"`
1982 // Name: The resource name of the model, in form of
1983 // `projects/{project-number-or-id}/locations/{location_id}/models/{model_id}`
1984 Name string `json:"name,omitempty"`
1985 // SourceLanguageCode: Output only. The BCP-47 language code of the source
1986 // language.
1987 SourceLanguageCode string `json:"sourceLanguageCode,omitempty"`
1988 // TargetLanguageCode: Output only. The BCP-47 language code of the target
1989 // language.
1990 TargetLanguageCode string `json:"targetLanguageCode,omitempty"`
1991 // TestExampleCount: Output only. Number of examples (sentence pairs) used to
1992 // test the model.
1993 TestExampleCount int64 `json:"testExampleCount,omitempty"`
1994 // TrainExampleCount: Output only. Number of examples (sentence pairs) used to
1995 // train the model.
1996 TrainExampleCount int64 `json:"trainExampleCount,omitempty"`
1997 // UpdateTime: Output only. Timestamp when this model was last updated.
1998 UpdateTime string `json:"updateTime,omitempty"`
1999 // ValidateExampleCount: Output only. Number of examples (sentence pairs) used
2000 // to validate the model.
2001 ValidateExampleCount int64 `json:"validateExampleCount,omitempty"`
2002
2003 // ServerResponse contains the HTTP response code and headers from the server.
2004 googleapi.ServerResponse `json:"-"`
2005 // ForceSendFields is a list of field names (e.g. "CreateTime") to
2006 // unconditionally include in API requests. By default, fields with empty or
2007 // default values are omitted from API requests. See
2008 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2009 // details.
2010 ForceSendFields []string `json:"-"`
2011 // NullFields is a list of field names (e.g. "CreateTime") to include in API
2012 // requests with the JSON null value. By default, fields with empty values are
2013 // omitted from API requests. See
2014 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2015 NullFields []string `json:"-"`
2016 }
2017
2018 func (s Model) MarshalJSON() ([]byte, error) {
2019 type NoMethod Model
2020 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2021 }
2022
2023 // Operation: This resource represents a long-running operation that is the
2024 // result of a network API call.
2025 type Operation struct {
2026 // Done: If the value is `false`, it means the operation is still in progress.
2027 // If `true`, the operation is completed, and either `error` or `response` is
2028 // available.
2029 Done bool `json:"done,omitempty"`
2030 // Error: The error result of the operation in case of failure or cancellation.
2031 Error *Status `json:"error,omitempty"`
2032 // Metadata: Service-specific metadata associated with the operation. It
2033 // typically contains progress information and common metadata such as create
2034 // time. Some services might not provide such metadata. Any method that returns
2035 // a long-running operation should document the metadata type, if any.
2036 Metadata googleapi.RawMessage `json:"metadata,omitempty"`
2037 // Name: The server-assigned name, which is only unique within the same service
2038 // that originally returns it. If you use the default HTTP mapping, the `name`
2039 // should be a resource name ending with `operations/{unique_id}`.
2040 Name string `json:"name,omitempty"`
2041 // Response: The normal, successful response of the operation. If the original
2042 // method returns no data on success, such as `Delete`, the response is
2043 // `google.protobuf.Empty`. If the original method is standard
2044 // `Get`/`Create`/`Update`, the response should be the resource. For other
2045 // methods, the response should have the type `XxxResponse`, where `Xxx` is the
2046 // original method name. For example, if the original method name is
2047 // `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`.
2048 Response googleapi.RawMessage `json:"response,omitempty"`
2049
2050 // ServerResponse contains the HTTP response code and headers from the server.
2051 googleapi.ServerResponse `json:"-"`
2052 // ForceSendFields is a list of field names (e.g. "Done") to unconditionally
2053 // include in API requests. By default, fields with empty or default values are
2054 // omitted from API requests. See
2055 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2056 // details.
2057 ForceSendFields []string `json:"-"`
2058 // NullFields is a list of field names (e.g. "Done") to include in API requests
2059 // with the JSON null value. By default, fields with empty values are omitted
2060 // from API requests. See
2061 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2062 NullFields []string `json:"-"`
2063 }
2064
2065 func (s Operation) MarshalJSON() ([]byte, error) {
2066 type NoMethod Operation
2067 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2068 }
2069
2070 // OutputConfig: Output configuration for BatchTranslateText request.
2071 type OutputConfig struct {
2072 // GcsDestination: Google Cloud Storage destination for output content. For
2073 // every single input file (for example, gs://a/b/c.[extension]), we generate
2074 // at most 2 * n output files. (n is the # of target_language_codes in the
2075 // BatchTranslateTextRequest). Output files (tsv) generated are compliant with
2076 // RFC 4180 except that record delimiters are '\n' instead of '\r\n'. We don't
2077 // provide any way to change record delimiters. While the input files are being
2078 // processed, we write/update an index file 'index.csv' under
2079 // 'output_uri_prefix' (for example, gs://translation-test/index.csv) The index
2080 // file is generated/updated as new files are being translated. The format is:
2081 // input_file,target_language_code,translations_file,errors_file,
2082 // glossary_translations_file,glossary_errors_file input_file is one file we
2083 // matched using gcs_source.input_uri. target_language_code is provided in the
2084 // request. translations_file contains the translations. (details provided
2085 // below) errors_file contains the errors during processing of the file.
2086 // (details below). Both translations_file and errors_file could be empty
2087 // strings if we have no content to output. glossary_translations_file and
2088 // glossary_errors_file are always empty strings if the input_file is tsv. They
2089 // could also be empty if we have no content to output. Once a row is present
2090 // in index.csv, the input/output matching never changes. Callers should also
2091 // expect all the content in input_file are processed and ready to be consumed
2092 // (that is, no partial output file is written). Since index.csv will be
2093 // keeping updated during the process, please make sure there is no custom
2094 // retention policy applied on the output bucket that may avoid file updating.
2095 // (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) The
2096 // format of translations_file (for target language code 'trg') is:
2097 // `gs://translation_test/a_b_c_'trg'_translations.[extension]` If the input
2098 // file extension is tsv, the output has the following columns: Column 1: ID of
2099 // the request provided in the input, if it's not provided in the input, then
2100 // the input row number is used (0-based). Column 2: source sentence. Column 3:
2101 // translation without applying a glossary. Empty string if there is an error.
2102 // Column 4 (only present if a glossary is provided in the request):
2103 // translation after applying the glossary. Empty string if there is an error
2104 // applying the glossary. Could be same string as column 3 if there is no
2105 // glossary applied. If input file extension is a txt or html, the translation
2106 // is directly written to the output file. If glossary is requested, a separate
2107 // glossary_translations_file has format of
2108 // `gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]` The
2109 // format of errors file (for target language code 'trg') is:
2110 // `gs://translation_test/a_b_c_'trg'_errors.[extension]` If the input file
2111 // extension is tsv, errors_file contains the following: Column 1: ID of the
2112 // request provided in the input, if it's not provided in the input, then the
2113 // input row number is used (0-based). Column 2: source sentence. Column 3:
2114 // Error detail for the translation. Could be empty. Column 4 (only present if
2115 // a glossary is provided in the request): Error when applying the glossary. If
2116 // the input file extension is txt or html, glossary_error_file will be
2117 // generated that contains error details. glossary_error_file has format of
2118 // `gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]`
2119 GcsDestination *GcsDestination `json:"gcsDestination,omitempty"`
2120 // ForceSendFields is a list of field names (e.g. "GcsDestination") to
2121 // unconditionally include in API requests. By default, fields with empty or
2122 // default values are omitted from API requests. See
2123 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2124 // details.
2125 ForceSendFields []string `json:"-"`
2126 // NullFields is a list of field names (e.g. "GcsDestination") to include in
2127 // API requests with the JSON null value. By default, fields with empty values
2128 // are omitted from API requests. See
2129 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2130 NullFields []string `json:"-"`
2131 }
2132
2133 func (s OutputConfig) MarshalJSON() ([]byte, error) {
2134 type NoMethod OutputConfig
2135 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2136 }
2137
2138 // ReferenceSentenceConfig: Message of caller-provided reference configuration.
2139 type ReferenceSentenceConfig struct {
2140 // ReferenceSentencePairLists: Reference sentences pair lists. Each list will
2141 // be used as the references to translate the sentence under "content" field at
2142 // the corresponding index. Length of the list is required to be equal to the
2143 // length of "content" field.
2144 ReferenceSentencePairLists []*ReferenceSentencePairList `json:"referenceSentencePairLists,omitempty"`
2145 // SourceLanguageCode: Source language code.
2146 SourceLanguageCode string `json:"sourceLanguageCode,omitempty"`
2147 // TargetLanguageCode: Target language code.
2148 TargetLanguageCode string `json:"targetLanguageCode,omitempty"`
2149 // ForceSendFields is a list of field names (e.g. "ReferenceSentencePairLists")
2150 // to unconditionally include in API requests. By default, fields with empty or
2151 // default values are omitted from API requests. See
2152 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2153 // details.
2154 ForceSendFields []string `json:"-"`
2155 // NullFields is a list of field names (e.g. "ReferenceSentencePairLists") to
2156 // include in API requests with the JSON null value. By default, fields with
2157 // empty values are omitted from API requests. See
2158 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2159 NullFields []string `json:"-"`
2160 }
2161
2162 func (s ReferenceSentenceConfig) MarshalJSON() ([]byte, error) {
2163 type NoMethod ReferenceSentenceConfig
2164 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2165 }
2166
2167 // ReferenceSentencePair: A pair of sentences used as reference in source and
2168 // target languages.
2169 type ReferenceSentencePair struct {
2170 // SourceSentence: Source sentence in the sentence pair.
2171 SourceSentence string `json:"sourceSentence,omitempty"`
2172 // TargetSentence: Target sentence in the sentence pair.
2173 TargetSentence string `json:"targetSentence,omitempty"`
2174 // ForceSendFields is a list of field names (e.g. "SourceSentence") to
2175 // unconditionally include in API requests. By default, fields with empty or
2176 // default values are omitted from API requests. See
2177 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2178 // details.
2179 ForceSendFields []string `json:"-"`
2180 // NullFields is a list of field names (e.g. "SourceSentence") to include in
2181 // API requests with the JSON null value. By default, fields with empty values
2182 // are omitted from API requests. See
2183 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2184 NullFields []string `json:"-"`
2185 }
2186
2187 func (s ReferenceSentencePair) MarshalJSON() ([]byte, error) {
2188 type NoMethod ReferenceSentencePair
2189 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2190 }
2191
2192 // ReferenceSentencePairList: A list of reference sentence pairs.
2193 type ReferenceSentencePairList struct {
2194 // ReferenceSentencePairs: Reference sentence pairs.
2195 ReferenceSentencePairs []*ReferenceSentencePair `json:"referenceSentencePairs,omitempty"`
2196 // ForceSendFields is a list of field names (e.g. "ReferenceSentencePairs") to
2197 // unconditionally include in API requests. By default, fields with empty or
2198 // default values are omitted from API requests. See
2199 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2200 // details.
2201 ForceSendFields []string `json:"-"`
2202 // NullFields is a list of field names (e.g. "ReferenceSentencePairs") to
2203 // include in API requests with the JSON null value. By default, fields with
2204 // empty values are omitted from API requests. See
2205 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2206 NullFields []string `json:"-"`
2207 }
2208
2209 func (s ReferenceSentencePairList) MarshalJSON() ([]byte, error) {
2210 type NoMethod ReferenceSentencePairList
2211 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2212 }
2213
2214 // RefineTextRequest: Request message for RefineText.
2215 type RefineTextRequest struct {
2216 // RefinementEntries: Required. The source texts and original translations in
2217 // the source and target languages.
2218 RefinementEntries []*RefinementEntry `json:"refinementEntries,omitempty"`
2219 // SourceLanguageCode: Required. The BCP-47 language code of the source text in
2220 // the request, for example, "en-US".
2221 SourceLanguageCode string `json:"sourceLanguageCode,omitempty"`
2222 // TargetLanguageCode: Required. The BCP-47 language code for translation
2223 // output, for example, "zh-CN".
2224 TargetLanguageCode string `json:"targetLanguageCode,omitempty"`
2225 // ForceSendFields is a list of field names (e.g. "RefinementEntries") to
2226 // unconditionally include in API requests. By default, fields with empty or
2227 // default values are omitted from API requests. See
2228 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2229 // details.
2230 ForceSendFields []string `json:"-"`
2231 // NullFields is a list of field names (e.g. "RefinementEntries") to include in
2232 // API requests with the JSON null value. By default, fields with empty values
2233 // are omitted from API requests. See
2234 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2235 NullFields []string `json:"-"`
2236 }
2237
2238 func (s RefineTextRequest) MarshalJSON() ([]byte, error) {
2239 type NoMethod RefineTextRequest
2240 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2241 }
2242
2243 // RefineTextResponse: Response message for RefineText.
2244 type RefineTextResponse struct {
2245 // RefinedTranslations: The refined translations obtained from the original
2246 // translations.
2247 RefinedTranslations []string `json:"refinedTranslations,omitempty"`
2248
2249 // ServerResponse contains the HTTP response code and headers from the server.
2250 googleapi.ServerResponse `json:"-"`
2251 // ForceSendFields is a list of field names (e.g. "RefinedTranslations") to
2252 // unconditionally include in API requests. By default, fields with empty or
2253 // default values are omitted from API requests. See
2254 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2255 // details.
2256 ForceSendFields []string `json:"-"`
2257 // NullFields is a list of field names (e.g. "RefinedTranslations") to include
2258 // in API requests with the JSON null value. By default, fields with empty
2259 // values are omitted from API requests. See
2260 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2261 NullFields []string `json:"-"`
2262 }
2263
2264 func (s RefineTextResponse) MarshalJSON() ([]byte, error) {
2265 type NoMethod RefineTextResponse
2266 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2267 }
2268
2269 // RefinementEntry: A single refinement entry for RefineTextRequest.
2270 type RefinementEntry struct {
2271 // OriginalTranslation: Required. The original translation of the source text.
2272 OriginalTranslation string `json:"originalTranslation,omitempty"`
2273 // SourceText: Required. The source text to be refined.
2274 SourceText string `json:"sourceText,omitempty"`
2275 // ForceSendFields is a list of field names (e.g. "OriginalTranslation") to
2276 // unconditionally include in API requests. By default, fields with empty or
2277 // default values are omitted from API requests. See
2278 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2279 // details.
2280 ForceSendFields []string `json:"-"`
2281 // NullFields is a list of field names (e.g. "OriginalTranslation") to include
2282 // in API requests with the JSON null value. By default, fields with empty
2283 // values are omitted from API requests. See
2284 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2285 NullFields []string `json:"-"`
2286 }
2287
2288 func (s RefinementEntry) MarshalJSON() ([]byte, error) {
2289 type NoMethod RefinementEntry
2290 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2291 }
2292
2293 // Romanization: A single romanization response.
2294 type Romanization struct {
2295 // DetectedLanguageCode: The ISO-639 language code of source text in the
2296 // initial request, detected automatically, if no source language was passed
2297 // within the initial request. If the source language was passed,
2298 // auto-detection of the language does not occur and this field is empty.
2299 DetectedLanguageCode string `json:"detectedLanguageCode,omitempty"`
2300 // RomanizedText: Romanized text. If an error occurs during romanization, this
2301 // field might be excluded from the response.
2302 RomanizedText string `json:"romanizedText,omitempty"`
2303 // ForceSendFields is a list of field names (e.g. "DetectedLanguageCode") to
2304 // unconditionally include in API requests. By default, fields with empty or
2305 // default values are omitted from API requests. See
2306 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2307 // details.
2308 ForceSendFields []string `json:"-"`
2309 // NullFields is a list of field names (e.g. "DetectedLanguageCode") to include
2310 // in API requests with the JSON null value. By default, fields with empty
2311 // values are omitted from API requests. See
2312 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2313 NullFields []string `json:"-"`
2314 }
2315
2316 func (s Romanization) MarshalJSON() ([]byte, error) {
2317 type NoMethod Romanization
2318 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2319 }
2320
2321 // RomanizeTextRequest: The request message for synchronous romanization.
2322 type RomanizeTextRequest struct {
2323 // Contents: Required. The content of the input in string format.
2324 Contents []string `json:"contents,omitempty"`
2325 // SourceLanguageCode: Optional. The ISO-639 language code of the input text if
2326 // known, for example, "hi" or "zh". Supported language codes are listed in
2327 // Language Support (https://cloud.google.com/translate/docs/languages#roman).
2328 // If the source language isn't specified, the API attempts to identify the
2329 // source language automatically and returns the source language for each
2330 // content in the response.
2331 SourceLanguageCode string `json:"sourceLanguageCode,omitempty"`
2332 // ForceSendFields is a list of field names (e.g. "Contents") to
2333 // unconditionally include in API requests. By default, fields with empty or
2334 // default values are omitted from API requests. See
2335 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2336 // details.
2337 ForceSendFields []string `json:"-"`
2338 // NullFields is a list of field names (e.g. "Contents") to include in API
2339 // requests with the JSON null value. By default, fields with empty values are
2340 // omitted from API requests. See
2341 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2342 NullFields []string `json:"-"`
2343 }
2344
2345 func (s RomanizeTextRequest) MarshalJSON() ([]byte, error) {
2346 type NoMethod RomanizeTextRequest
2347 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2348 }
2349
2350 // RomanizeTextResponse: The response message for synchronous romanization.
2351 type RomanizeTextResponse struct {
2352 // Romanizations: Text romanization responses. This field has the same length
2353 // as `contents`.
2354 Romanizations []*Romanization `json:"romanizations,omitempty"`
2355
2356 // ServerResponse contains the HTTP response code and headers from the server.
2357 googleapi.ServerResponse `json:"-"`
2358 // ForceSendFields is a list of field names (e.g. "Romanizations") to
2359 // unconditionally include in API requests. By default, fields with empty or
2360 // default values are omitted from API requests. See
2361 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2362 // details.
2363 ForceSendFields []string `json:"-"`
2364 // NullFields is a list of field names (e.g. "Romanizations") to include in API
2365 // requests with the JSON null value. By default, fields with empty values are
2366 // omitted from API requests. See
2367 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2368 NullFields []string `json:"-"`
2369 }
2370
2371 func (s RomanizeTextResponse) MarshalJSON() ([]byte, error) {
2372 type NoMethod RomanizeTextResponse
2373 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2374 }
2375
2376 // Status: The `Status` type defines a logical error model that is suitable for
2377 // different programming environments, including REST APIs and RPC APIs. It is
2378 // used by gRPC (https://github.com/grpc). Each `Status` message contains three
2379 // pieces of data: error code, error message, and error details. You can find
2380 // out more about this error model and how to work with it in the API Design
2381 // Guide (https://cloud.google.com/apis/design/errors).
2382 type Status struct {
2383 // Code: The status code, which should be an enum value of google.rpc.Code.
2384 Code int64 `json:"code,omitempty"`
2385 // Details: A list of messages that carry the error details. There is a common
2386 // set of message types for APIs to use.
2387 Details []googleapi.RawMessage `json:"details,omitempty"`
2388 // Message: A developer-facing error message, which should be in English. Any
2389 // user-facing error message should be localized and sent in the
2390 // google.rpc.Status.details field, or localized by the client.
2391 Message string `json:"message,omitempty"`
2392 // ForceSendFields is a list of field names (e.g. "Code") to unconditionally
2393 // include in API requests. By default, fields with empty or default values are
2394 // omitted from API requests. See
2395 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2396 // details.
2397 ForceSendFields []string `json:"-"`
2398 // NullFields is a list of field names (e.g. "Code") to include in API requests
2399 // with the JSON null value. By default, fields with empty values are omitted
2400 // from API requests. See
2401 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2402 NullFields []string `json:"-"`
2403 }
2404
2405 func (s Status) MarshalJSON() ([]byte, error) {
2406 type NoMethod Status
2407 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2408 }
2409
2410 // SupportedLanguage: A single supported language response corresponds to
2411 // information related to one supported language.
2412 type SupportedLanguage struct {
2413 // DisplayName: Human-readable name of the language localized in the display
2414 // language specified in the request.
2415 DisplayName string `json:"displayName,omitempty"`
2416 // LanguageCode: Supported language code, generally consisting of its ISO 639-1
2417 // identifier, for example, 'en', 'ja'. In certain cases, ISO-639 codes
2418 // including language and region identifiers are returned (for example, 'zh-TW'
2419 // and 'zh-CN').
2420 LanguageCode string `json:"languageCode,omitempty"`
2421 // SupportSource: Can be used as a source language.
2422 SupportSource bool `json:"supportSource,omitempty"`
2423 // SupportTarget: Can be used as a target language.
2424 SupportTarget bool `json:"supportTarget,omitempty"`
2425 // ForceSendFields is a list of field names (e.g. "DisplayName") to
2426 // unconditionally include in API requests. By default, fields with empty or
2427 // default values are omitted from API requests. See
2428 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2429 // details.
2430 ForceSendFields []string `json:"-"`
2431 // NullFields is a list of field names (e.g. "DisplayName") to include in API
2432 // requests with the JSON null value. By default, fields with empty values are
2433 // omitted from API requests. See
2434 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2435 NullFields []string `json:"-"`
2436 }
2437
2438 func (s SupportedLanguage) MarshalJSON() ([]byte, error) {
2439 type NoMethod SupportedLanguage
2440 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2441 }
2442
2443 // SupportedLanguages: The response message for discovering supported
2444 // languages.
2445 type SupportedLanguages struct {
2446 // Languages: A list of supported language responses. This list contains an
2447 // entry for each language the Translation API supports.
2448 Languages []*SupportedLanguage `json:"languages,omitempty"`
2449
2450 // ServerResponse contains the HTTP response code and headers from the server.
2451 googleapi.ServerResponse `json:"-"`
2452 // ForceSendFields is a list of field names (e.g. "Languages") to
2453 // unconditionally include in API requests. By default, fields with empty or
2454 // default values are omitted from API requests. See
2455 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2456 // details.
2457 ForceSendFields []string `json:"-"`
2458 // NullFields is a list of field names (e.g. "Languages") to include in API
2459 // requests with the JSON null value. By default, fields with empty values are
2460 // omitted from API requests. See
2461 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2462 NullFields []string `json:"-"`
2463 }
2464
2465 func (s SupportedLanguages) MarshalJSON() ([]byte, error) {
2466 type NoMethod SupportedLanguages
2467 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2468 }
2469
2470 // TranslateDocumentRequest: A document translation request.
2471 type TranslateDocumentRequest struct {
2472 // CustomizedAttribution: Optional. This flag is to support user customized
2473 // attribution. If not provided, the default is `Machine Translated by Google`.
2474 // Customized attribution should follow rules in
2475 // https://cloud.google.com/translate/attribution#attribution_and_logos
2476 CustomizedAttribution string `json:"customizedAttribution,omitempty"`
2477 // DocumentInputConfig: Required. Input configurations.
2478 DocumentInputConfig *DocumentInputConfig `json:"documentInputConfig,omitempty"`
2479 // DocumentOutputConfig: Optional. Output configurations. Defines if the output
2480 // file should be stored within Cloud Storage as well as the desired output
2481 // format. If not provided the translated file will only be returned through a
2482 // byte-stream and its output mime type will be the same as the input file's
2483 // mime type.
2484 DocumentOutputConfig *DocumentOutputConfig `json:"documentOutputConfig,omitempty"`
2485 // EnableRotationCorrection: Optional. If true, enable auto rotation correction
2486 // in DVS.
2487 EnableRotationCorrection bool `json:"enableRotationCorrection,omitempty"`
2488 // EnableShadowRemovalNativePdf: Optional. If true, use the text removal server
2489 // to remove the shadow text on background image for native pdf translation.
2490 // Shadow removal feature can only be enabled when
2491 // is_translate_native_pdf_only: false && pdf_native_only: false
2492 EnableShadowRemovalNativePdf bool `json:"enableShadowRemovalNativePdf,omitempty"`
2493 // GlossaryConfig: Optional. Glossary to be applied. The glossary must be
2494 // within the same region (have the same location-id) as the model, otherwise
2495 // an INVALID_ARGUMENT (400) error is returned.
2496 GlossaryConfig *TranslateTextGlossaryConfig `json:"glossaryConfig,omitempty"`
2497 // IsTranslateNativePdfOnly: Optional. is_translate_native_pdf_only field for
2498 // external customers. If true, the page limit of online native pdf translation
2499 // is 300 and only native pdf pages will be translated.
2500 IsTranslateNativePdfOnly bool `json:"isTranslateNativePdfOnly,omitempty"`
2501 // Labels: Optional. The labels with user-defined metadata for the request.
2502 // Label keys and values can be no longer than 63 characters (Unicode
2503 // codepoints), can only contain lowercase letters, numeric characters,
2504 // underscores and dashes. International characters are allowed. Label values
2505 // are optional. Label keys must start with a letter. See
2506 // https://cloud.google.com/translate/docs/advanced/labels for more
2507 // information.
2508 Labels map[string]string `json:"labels,omitempty"`
2509 // Model: Optional. The `model` type requested for this translation. The format
2510 // depends on model type: - AutoML Translation models:
2511 // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
2512 // - General (built-in) models:
2513 // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
2514 // If not provided, the default Google model (NMT) will be used for
2515 // translation.
2516 Model string `json:"model,omitempty"`
2517 // SourceLanguageCode: Optional. The ISO-639 language code of the input
2518 // document if known, for example, "en-US" or "sr-Latn". Supported language
2519 // codes are listed in Language Support
2520 // (https://cloud.google.com/translate/docs/languages). If the source language
2521 // isn't specified, the API attempts to identify the source language
2522 // automatically and returns the source language within the response. Source
2523 // language must be specified if the request contains a glossary or a custom
2524 // model.
2525 SourceLanguageCode string `json:"sourceLanguageCode,omitempty"`
2526 // TargetLanguageCode: Required. The ISO-639 language code to use for
2527 // translation of the input document, set to one of the language codes listed
2528 // in Language Support (https://cloud.google.com/translate/docs/languages).
2529 TargetLanguageCode string `json:"targetLanguageCode,omitempty"`
2530 // ForceSendFields is a list of field names (e.g. "CustomizedAttribution") to
2531 // unconditionally include in API requests. By default, fields with empty or
2532 // default values are omitted from API requests. See
2533 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2534 // details.
2535 ForceSendFields []string `json:"-"`
2536 // NullFields is a list of field names (e.g. "CustomizedAttribution") to
2537 // include in API requests with the JSON null value. By default, fields with
2538 // empty values are omitted from API requests. See
2539 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2540 NullFields []string `json:"-"`
2541 }
2542
2543 func (s TranslateDocumentRequest) MarshalJSON() ([]byte, error) {
2544 type NoMethod TranslateDocumentRequest
2545 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2546 }
2547
2548 // TranslateDocumentResponse: A translated document response message.
2549 type TranslateDocumentResponse struct {
2550 // DocumentTranslation: Translated document.
2551 DocumentTranslation *DocumentTranslation `json:"documentTranslation,omitempty"`
2552 // GlossaryConfig: The `glossary_config` used for this translation.
2553 GlossaryConfig *TranslateTextGlossaryConfig `json:"glossaryConfig,omitempty"`
2554 // GlossaryDocumentTranslation: The document's translation output if a glossary
2555 // is provided in the request. This can be the same as
2556 // [TranslateDocumentResponse.document_translation] if no glossary terms apply.
2557 GlossaryDocumentTranslation *DocumentTranslation `json:"glossaryDocumentTranslation,omitempty"`
2558 // Model: Only present when 'model' is present in the request. 'model' is
2559 // normalized to have a project number. For example: If the 'model' field in
2560 // TranslateDocumentRequest is:
2561 // `projects/{project-id}/locations/{location-id}/models/general/nmt` then
2562 // `model` here would be normalized to
2563 // `projects/{project-number}/locations/{location-id}/models/general/nmt`.
2564 Model string `json:"model,omitempty"`
2565
2566 // ServerResponse contains the HTTP response code and headers from the server.
2567 googleapi.ServerResponse `json:"-"`
2568 // ForceSendFields is a list of field names (e.g. "DocumentTranslation") to
2569 // unconditionally include in API requests. By default, fields with empty or
2570 // default values are omitted from API requests. See
2571 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2572 // details.
2573 ForceSendFields []string `json:"-"`
2574 // NullFields is a list of field names (e.g. "DocumentTranslation") to include
2575 // in API requests with the JSON null value. By default, fields with empty
2576 // values are omitted from API requests. See
2577 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2578 NullFields []string `json:"-"`
2579 }
2580
2581 func (s TranslateDocumentResponse) MarshalJSON() ([]byte, error) {
2582 type NoMethod TranslateDocumentResponse
2583 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2584 }
2585
2586 // TranslateTextGlossaryConfig: Configures which glossary is used for a
2587 // specific target language and defines options for applying that glossary.
2588 type TranslateTextGlossaryConfig struct {
2589 // ContextualTranslationEnabled: Optional. If set to true, the glossary will be
2590 // used for contextual translation.
2591 ContextualTranslationEnabled bool `json:"contextualTranslationEnabled,omitempty"`
2592 // Glossary: Required. The `glossary` to be applied for this translation. The
2593 // format depends on the glossary: - User-provided custom glossary:
2594 // `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary
2595 // -id}`
2596 Glossary string `json:"glossary,omitempty"`
2597 // IgnoreCase: Optional. Indicates match is case insensitive. The default value
2598 // is `false` if missing.
2599 IgnoreCase bool `json:"ignoreCase,omitempty"`
2600 // ForceSendFields is a list of field names (e.g.
2601 // "ContextualTranslationEnabled") to unconditionally include in API requests.
2602 // By default, fields with empty or default values are omitted from API
2603 // requests. See https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields
2604 // for more details.
2605 ForceSendFields []string `json:"-"`
2606 // NullFields is a list of field names (e.g. "ContextualTranslationEnabled") to
2607 // include in API requests with the JSON null value. By default, fields with
2608 // empty values are omitted from API requests. See
2609 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2610 NullFields []string `json:"-"`
2611 }
2612
2613 func (s TranslateTextGlossaryConfig) MarshalJSON() ([]byte, error) {
2614 type NoMethod TranslateTextGlossaryConfig
2615 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2616 }
2617
2618 // TranslateTextRequest: The request message for synchronous translation.
2619 type TranslateTextRequest struct {
2620 // Contents: Required. The content of the input in string format. We recommend
2621 // the total content be less than 30,000 codepoints. The max length of this
2622 // field is 1024. Use BatchTranslateText for larger text.
2623 Contents []string `json:"contents,omitempty"`
2624 // GlossaryConfig: Optional. Glossary to be applied. The glossary must be
2625 // within the same region (have the same location-id) as the model, otherwise
2626 // an INVALID_ARGUMENT (400) error is returned.
2627 GlossaryConfig *TranslateTextGlossaryConfig `json:"glossaryConfig,omitempty"`
2628 // Labels: Optional. The labels with user-defined metadata for the request.
2629 // Label keys and values can be no longer than 63 characters (Unicode
2630 // codepoints), can only contain lowercase letters, numeric characters,
2631 // underscores and dashes. International characters are allowed. Label values
2632 // are optional. Label keys must start with a letter. See
2633 // https://cloud.google.com/translate/docs/advanced/labels for more
2634 // information.
2635 Labels map[string]string `json:"labels,omitempty"`
2636 // MimeType: Optional. The format of the source text, for example, "text/html",
2637 // "text/plain". If left blank, the MIME type defaults to "text/html".
2638 MimeType string `json:"mimeType,omitempty"`
2639 // Model: Optional. The `model` type requested for this translation. The format
2640 // depends on model type: - AutoML Translation models:
2641 // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
2642 // - General (built-in) models:
2643 // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
2644 // - Translation LLM models:
2645 // `projects/{project-number-or-id}/locations/{location-id}/models/general/trans
2646 // lation-llm`, For global (non-regionalized) requests, use `location-id`
2647 // `global`. For example,
2648 // `projects/{project-number-or-id}/locations/global/models/general/nmt`. If
2649 // not provided, the default Google model (NMT) will be used
2650 Model string `json:"model,omitempty"`
2651 // SourceLanguageCode: Optional. The ISO-639 language code of the input text if
2652 // known, for example, "en-US" or "sr-Latn". Supported language codes are
2653 // listed in Language Support
2654 // (https://cloud.google.com/translate/docs/languages). If the source language
2655 // isn't specified, the API attempts to identify the source language
2656 // automatically and returns the source language within the response.
2657 SourceLanguageCode string `json:"sourceLanguageCode,omitempty"`
2658 // TargetLanguageCode: Required. The ISO-639 language code to use for
2659 // translation of the input text, set to one of the language codes listed in
2660 // Language Support (https://cloud.google.com/translate/docs/languages).
2661 TargetLanguageCode string `json:"targetLanguageCode,omitempty"`
2662 // TransliterationConfig: Optional. Transliteration to be applied.
2663 TransliterationConfig *TransliterationConfig `json:"transliterationConfig,omitempty"`
2664 // ForceSendFields is a list of field names (e.g. "Contents") to
2665 // unconditionally include in API requests. By default, fields with empty or
2666 // default values are omitted from API requests. See
2667 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2668 // details.
2669 ForceSendFields []string `json:"-"`
2670 // NullFields is a list of field names (e.g. "Contents") to include in API
2671 // requests with the JSON null value. By default, fields with empty values are
2672 // omitted from API requests. See
2673 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2674 NullFields []string `json:"-"`
2675 }
2676
2677 func (s TranslateTextRequest) MarshalJSON() ([]byte, error) {
2678 type NoMethod TranslateTextRequest
2679 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2680 }
2681
2682 type TranslateTextResponse struct {
2683 // GlossaryTranslations: Text translation responses if a glossary is provided
2684 // in the request. This can be the same as `translations` if no terms apply.
2685 // This field has the same length as `contents`.
2686 GlossaryTranslations []*Translation `json:"glossaryTranslations,omitempty"`
2687 // Translations: Text translation responses with no glossary applied. This
2688 // field has the same length as `contents`.
2689 Translations []*Translation `json:"translations,omitempty"`
2690
2691 // ServerResponse contains the HTTP response code and headers from the server.
2692 googleapi.ServerResponse `json:"-"`
2693 // ForceSendFields is a list of field names (e.g. "GlossaryTranslations") to
2694 // unconditionally include in API requests. By default, fields with empty or
2695 // default values are omitted from API requests. See
2696 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2697 // details.
2698 ForceSendFields []string `json:"-"`
2699 // NullFields is a list of field names (e.g. "GlossaryTranslations") to include
2700 // in API requests with the JSON null value. By default, fields with empty
2701 // values are omitted from API requests. See
2702 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2703 NullFields []string `json:"-"`
2704 }
2705
2706 func (s TranslateTextResponse) MarshalJSON() ([]byte, error) {
2707 type NoMethod TranslateTextResponse
2708 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2709 }
2710
2711 // Translation: A single translation response.
2712 type Translation struct {
2713 // DetectedLanguageCode: The ISO-639 language code of source text in the
2714 // initial request, detected automatically, if no source language was passed
2715 // within the initial request. If the source language was passed,
2716 // auto-detection of the language does not occur and this field is empty.
2717 DetectedLanguageCode string `json:"detectedLanguageCode,omitempty"`
2718 // GlossaryConfig: The `glossary_config` used for this translation.
2719 GlossaryConfig *TranslateTextGlossaryConfig `json:"glossaryConfig,omitempty"`
2720 // Model: Only present when `model` is present in the request. `model` here is
2721 // normalized to have project number. For example: If the `model` requested in
2722 // TranslationTextRequest is
2723 // `projects/{project-id}/locations/{location-id}/models/general/nmt` then
2724 // `model` here would be normalized to
2725 // `projects/{project-number}/locations/{location-id}/models/general/nmt`.
2726 Model string `json:"model,omitempty"`
2727 // TranslatedText: Text translated into the target language. If an error occurs
2728 // during translation, this field might be excluded from the response.
2729 TranslatedText string `json:"translatedText,omitempty"`
2730 // ForceSendFields is a list of field names (e.g. "DetectedLanguageCode") to
2731 // unconditionally include in API requests. By default, fields with empty or
2732 // default values are omitted from API requests. See
2733 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2734 // details.
2735 ForceSendFields []string `json:"-"`
2736 // NullFields is a list of field names (e.g. "DetectedLanguageCode") to include
2737 // in API requests with the JSON null value. By default, fields with empty
2738 // values are omitted from API requests. See
2739 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2740 NullFields []string `json:"-"`
2741 }
2742
2743 func (s Translation) MarshalJSON() ([]byte, error) {
2744 type NoMethod Translation
2745 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2746 }
2747
2748 // TransliterationConfig: Configures transliteration feature on top of
2749 // translation.
2750 type TransliterationConfig struct {
2751 // EnableTransliteration: If true, source text in romanized form can be
2752 // translated to the target language.
2753 EnableTransliteration bool `json:"enableTransliteration,omitempty"`
2754 // ForceSendFields is a list of field names (e.g. "EnableTransliteration") to
2755 // unconditionally include in API requests. By default, fields with empty or
2756 // default values are omitted from API requests. See
2757 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2758 // details.
2759 ForceSendFields []string `json:"-"`
2760 // NullFields is a list of field names (e.g. "EnableTransliteration") to
2761 // include in API requests with the JSON null value. By default, fields with
2762 // empty values are omitted from API requests. See
2763 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2764 NullFields []string `json:"-"`
2765 }
2766
2767 func (s TransliterationConfig) MarshalJSON() ([]byte, error) {
2768 type NoMethod TransliterationConfig
2769 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2770 }
2771
2772 // WaitOperationRequest: The request message for Operations.WaitOperation.
2773 type WaitOperationRequest struct {
2774 // Timeout: The maximum duration to wait before timing out. If left blank, the
2775 // wait will be at most the time permitted by the underlying HTTP/RPC protocol.
2776 // If RPC context deadline is also specified, the shorter one will be used.
2777 Timeout string `json:"timeout,omitempty"`
2778 // ForceSendFields is a list of field names (e.g. "Timeout") to unconditionally
2779 // include in API requests. By default, fields with empty or default values are
2780 // omitted from API requests. See
2781 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
2782 // details.
2783 ForceSendFields []string `json:"-"`
2784 // NullFields is a list of field names (e.g. "Timeout") to include in API
2785 // requests with the JSON null value. By default, fields with empty values are
2786 // omitted from API requests. See
2787 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
2788 NullFields []string `json:"-"`
2789 }
2790
2791 func (s WaitOperationRequest) MarshalJSON() ([]byte, error) {
2792 type NoMethod WaitOperationRequest
2793 return gensupport.MarshalJSON(NoMethod(s), s.ForceSendFields, s.NullFields)
2794 }
2795
2796 type ProjectsDetectLanguageCall struct {
2797 s *Service
2798 parent string
2799 detectlanguagerequest *DetectLanguageRequest
2800 urlParams_ gensupport.URLParams
2801 ctx_ context.Context
2802 header_ http.Header
2803 }
2804
2805 // DetectLanguage: Detects the language of text within a request.
2806 //
2807 // - parent: Project or location to make a call. Must refer to a caller's
2808 // project. Format: `projects/{project-number-or-id}/locations/{location-id}`
2809 // or `projects/{project-number-or-id}`. For global calls, use
2810 // `projects/{project-number-or-id}/locations/global` or
2811 // `projects/{project-number-or-id}`. Only models within the same region (has
2812 // same location-id) can be used. Otherwise an INVALID_ARGUMENT (400) error
2813 // is returned.
2814 func (r *ProjectsService) DetectLanguage(parent string, detectlanguagerequest *DetectLanguageRequest) *ProjectsDetectLanguageCall {
2815 c := &ProjectsDetectLanguageCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2816 c.parent = parent
2817 c.detectlanguagerequest = detectlanguagerequest
2818 return c
2819 }
2820
2821 // Fields allows partial responses to be retrieved. See
2822 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2823 // details.
2824 func (c *ProjectsDetectLanguageCall) Fields(s ...googleapi.Field) *ProjectsDetectLanguageCall {
2825 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2826 return c
2827 }
2828
2829 // Context sets the context to be used in this call's Do method.
2830 func (c *ProjectsDetectLanguageCall) Context(ctx context.Context) *ProjectsDetectLanguageCall {
2831 c.ctx_ = ctx
2832 return c
2833 }
2834
2835 // Header returns a http.Header that can be modified by the caller to add
2836 // headers to the request.
2837 func (c *ProjectsDetectLanguageCall) Header() http.Header {
2838 if c.header_ == nil {
2839 c.header_ = make(http.Header)
2840 }
2841 return c.header_
2842 }
2843
2844 func (c *ProjectsDetectLanguageCall) doRequest(alt string) (*http.Response, error) {
2845 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2846 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.detectlanguagerequest)
2847 if err != nil {
2848 return nil, err
2849 }
2850 c.urlParams_.Set("alt", alt)
2851 c.urlParams_.Set("prettyPrint", "false")
2852 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}:detectLanguage")
2853 urls += "?" + c.urlParams_.Encode()
2854 req, err := http.NewRequest("POST", urls, body)
2855 if err != nil {
2856 return nil, err
2857 }
2858 req.Header = reqHeaders
2859 googleapi.Expand(req.URL, map[string]string{
2860 "parent": c.parent,
2861 })
2862 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.detectLanguage", "request", internallog.HTTPRequest(req, body.Bytes()))
2863 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2864 }
2865
2866 // Do executes the "translate.projects.detectLanguage" call.
2867 // Any non-2xx status code is an error. Response headers are in either
2868 // *DetectLanguageResponse.ServerResponse.Header or (if a response was returned
2869 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
2870 // check whether the returned error was because http.StatusNotModified was
2871 // returned.
2872 func (c *ProjectsDetectLanguageCall) Do(opts ...googleapi.CallOption) (*DetectLanguageResponse, error) {
2873 gensupport.SetOptions(c.urlParams_, opts...)
2874 res, err := c.doRequest("json")
2875 if res != nil && res.StatusCode == http.StatusNotModified {
2876 if res.Body != nil {
2877 res.Body.Close()
2878 }
2879 return nil, gensupport.WrapError(&googleapi.Error{
2880 Code: res.StatusCode,
2881 Header: res.Header,
2882 })
2883 }
2884 if err != nil {
2885 return nil, err
2886 }
2887 defer googleapi.CloseBody(res)
2888 if err := googleapi.CheckResponse(res); err != nil {
2889 return nil, gensupport.WrapError(err)
2890 }
2891 ret := &DetectLanguageResponse{
2892 ServerResponse: googleapi.ServerResponse{
2893 Header: res.Header,
2894 HTTPStatusCode: res.StatusCode,
2895 },
2896 }
2897 target := &ret
2898 b, err := gensupport.DecodeResponseBytes(target, res)
2899 if err != nil {
2900 return nil, err
2901 }
2902 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.detectLanguage", "response", internallog.HTTPResponse(res, b))
2903 return ret, nil
2904 }
2905
2906 type ProjectsGetSupportedLanguagesCall struct {
2907 s *Service
2908 parent string
2909 urlParams_ gensupport.URLParams
2910 ifNoneMatch_ string
2911 ctx_ context.Context
2912 header_ http.Header
2913 }
2914
2915 // GetSupportedLanguages: Returns a list of supported languages for
2916 // translation.
2917 //
2918 // - parent: Project or location to make a call. Must refer to a caller's
2919 // project. Format: `projects/{project-number-or-id}` or
2920 // `projects/{project-number-or-id}/locations/{location-id}`. For global
2921 // calls, use `projects/{project-number-or-id}/locations/global` or
2922 // `projects/{project-number-or-id}`. Non-global location is required for
2923 // AutoML models. Only models within the same region (have same location-id)
2924 // can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
2925 func (r *ProjectsService) GetSupportedLanguages(parent string) *ProjectsGetSupportedLanguagesCall {
2926 c := &ProjectsGetSupportedLanguagesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2927 c.parent = parent
2928 return c
2929 }
2930
2931 // DisplayLanguageCode sets the optional parameter "displayLanguageCode": The
2932 // language to use to return localized, human readable names of supported
2933 // languages. If missing, then display names are not returned in a response.
2934 func (c *ProjectsGetSupportedLanguagesCall) DisplayLanguageCode(displayLanguageCode string) *ProjectsGetSupportedLanguagesCall {
2935 c.urlParams_.Set("displayLanguageCode", displayLanguageCode)
2936 return c
2937 }
2938
2939 // Model sets the optional parameter "model": Get supported languages of this
2940 // model. The format depends on model type: - AutoML Translation models:
2941 // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
2942 // - General (built-in) models:
2943 // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
2944 //
2945 // Returns languages supported by the specified model. If missing, we get
2946 //
2947 // supported languages of Google general NMT model.
2948 func (c *ProjectsGetSupportedLanguagesCall) Model(model string) *ProjectsGetSupportedLanguagesCall {
2949 c.urlParams_.Set("model", model)
2950 return c
2951 }
2952
2953 // Fields allows partial responses to be retrieved. See
2954 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
2955 // details.
2956 func (c *ProjectsGetSupportedLanguagesCall) Fields(s ...googleapi.Field) *ProjectsGetSupportedLanguagesCall {
2957 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2958 return c
2959 }
2960
2961 // IfNoneMatch sets an optional parameter which makes the operation fail if the
2962 // object's ETag matches the given value. This is useful for getting updates
2963 // only after the object has changed since the last request.
2964 func (c *ProjectsGetSupportedLanguagesCall) IfNoneMatch(entityTag string) *ProjectsGetSupportedLanguagesCall {
2965 c.ifNoneMatch_ = entityTag
2966 return c
2967 }
2968
2969 // Context sets the context to be used in this call's Do method.
2970 func (c *ProjectsGetSupportedLanguagesCall) Context(ctx context.Context) *ProjectsGetSupportedLanguagesCall {
2971 c.ctx_ = ctx
2972 return c
2973 }
2974
2975 // Header returns a http.Header that can be modified by the caller to add
2976 // headers to the request.
2977 func (c *ProjectsGetSupportedLanguagesCall) Header() http.Header {
2978 if c.header_ == nil {
2979 c.header_ = make(http.Header)
2980 }
2981 return c.header_
2982 }
2983
2984 func (c *ProjectsGetSupportedLanguagesCall) doRequest(alt string) (*http.Response, error) {
2985 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2986 if c.ifNoneMatch_ != "" {
2987 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2988 }
2989 c.urlParams_.Set("alt", alt)
2990 c.urlParams_.Set("prettyPrint", "false")
2991 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/supportedLanguages")
2992 urls += "?" + c.urlParams_.Encode()
2993 req, err := http.NewRequest("GET", urls, nil)
2994 if err != nil {
2995 return nil, err
2996 }
2997 req.Header = reqHeaders
2998 googleapi.Expand(req.URL, map[string]string{
2999 "parent": c.parent,
3000 })
3001 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.getSupportedLanguages", "request", internallog.HTTPRequest(req, nil))
3002 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3003 }
3004
3005 // Do executes the "translate.projects.getSupportedLanguages" call.
3006 // Any non-2xx status code is an error. Response headers are in either
3007 // *SupportedLanguages.ServerResponse.Header or (if a response was returned at
3008 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
3009 // check whether the returned error was because http.StatusNotModified was
3010 // returned.
3011 func (c *ProjectsGetSupportedLanguagesCall) Do(opts ...googleapi.CallOption) (*SupportedLanguages, error) {
3012 gensupport.SetOptions(c.urlParams_, opts...)
3013 res, err := c.doRequest("json")
3014 if res != nil && res.StatusCode == http.StatusNotModified {
3015 if res.Body != nil {
3016 res.Body.Close()
3017 }
3018 return nil, gensupport.WrapError(&googleapi.Error{
3019 Code: res.StatusCode,
3020 Header: res.Header,
3021 })
3022 }
3023 if err != nil {
3024 return nil, err
3025 }
3026 defer googleapi.CloseBody(res)
3027 if err := googleapi.CheckResponse(res); err != nil {
3028 return nil, gensupport.WrapError(err)
3029 }
3030 ret := &SupportedLanguages{
3031 ServerResponse: googleapi.ServerResponse{
3032 Header: res.Header,
3033 HTTPStatusCode: res.StatusCode,
3034 },
3035 }
3036 target := &ret
3037 b, err := gensupport.DecodeResponseBytes(target, res)
3038 if err != nil {
3039 return nil, err
3040 }
3041 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.getSupportedLanguages", "response", internallog.HTTPResponse(res, b))
3042 return ret, nil
3043 }
3044
3045 type ProjectsRomanizeTextCall struct {
3046 s *Service
3047 parent string
3048 romanizetextrequest *RomanizeTextRequest
3049 urlParams_ gensupport.URLParams
3050 ctx_ context.Context
3051 header_ http.Header
3052 }
3053
3054 // RomanizeText: Romanize input text written in non-Latin scripts to Latin
3055 // text.
3056 //
3057 // - parent: Project or location to make a call. Must refer to a caller's
3058 // project. Format: `projects/{project-number-or-id}/locations/{location-id}`
3059 // or `projects/{project-number-or-id}`. For global calls, use
3060 // `projects/{project-number-or-id}/locations/global` or
3061 // `projects/{project-number-or-id}`.
3062 func (r *ProjectsService) RomanizeText(parent string, romanizetextrequest *RomanizeTextRequest) *ProjectsRomanizeTextCall {
3063 c := &ProjectsRomanizeTextCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3064 c.parent = parent
3065 c.romanizetextrequest = romanizetextrequest
3066 return c
3067 }
3068
3069 // Fields allows partial responses to be retrieved. See
3070 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3071 // details.
3072 func (c *ProjectsRomanizeTextCall) Fields(s ...googleapi.Field) *ProjectsRomanizeTextCall {
3073 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3074 return c
3075 }
3076
3077 // Context sets the context to be used in this call's Do method.
3078 func (c *ProjectsRomanizeTextCall) Context(ctx context.Context) *ProjectsRomanizeTextCall {
3079 c.ctx_ = ctx
3080 return c
3081 }
3082
3083 // Header returns a http.Header that can be modified by the caller to add
3084 // headers to the request.
3085 func (c *ProjectsRomanizeTextCall) Header() http.Header {
3086 if c.header_ == nil {
3087 c.header_ = make(http.Header)
3088 }
3089 return c.header_
3090 }
3091
3092 func (c *ProjectsRomanizeTextCall) doRequest(alt string) (*http.Response, error) {
3093 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3094 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.romanizetextrequest)
3095 if err != nil {
3096 return nil, err
3097 }
3098 c.urlParams_.Set("alt", alt)
3099 c.urlParams_.Set("prettyPrint", "false")
3100 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}:romanizeText")
3101 urls += "?" + c.urlParams_.Encode()
3102 req, err := http.NewRequest("POST", urls, body)
3103 if err != nil {
3104 return nil, err
3105 }
3106 req.Header = reqHeaders
3107 googleapi.Expand(req.URL, map[string]string{
3108 "parent": c.parent,
3109 })
3110 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.romanizeText", "request", internallog.HTTPRequest(req, body.Bytes()))
3111 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3112 }
3113
3114 // Do executes the "translate.projects.romanizeText" call.
3115 // Any non-2xx status code is an error. Response headers are in either
3116 // *RomanizeTextResponse.ServerResponse.Header or (if a response was returned
3117 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
3118 // check whether the returned error was because http.StatusNotModified was
3119 // returned.
3120 func (c *ProjectsRomanizeTextCall) Do(opts ...googleapi.CallOption) (*RomanizeTextResponse, error) {
3121 gensupport.SetOptions(c.urlParams_, opts...)
3122 res, err := c.doRequest("json")
3123 if res != nil && res.StatusCode == http.StatusNotModified {
3124 if res.Body != nil {
3125 res.Body.Close()
3126 }
3127 return nil, gensupport.WrapError(&googleapi.Error{
3128 Code: res.StatusCode,
3129 Header: res.Header,
3130 })
3131 }
3132 if err != nil {
3133 return nil, err
3134 }
3135 defer googleapi.CloseBody(res)
3136 if err := googleapi.CheckResponse(res); err != nil {
3137 return nil, gensupport.WrapError(err)
3138 }
3139 ret := &RomanizeTextResponse{
3140 ServerResponse: googleapi.ServerResponse{
3141 Header: res.Header,
3142 HTTPStatusCode: res.StatusCode,
3143 },
3144 }
3145 target := &ret
3146 b, err := gensupport.DecodeResponseBytes(target, res)
3147 if err != nil {
3148 return nil, err
3149 }
3150 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.romanizeText", "response", internallog.HTTPResponse(res, b))
3151 return ret, nil
3152 }
3153
3154 type ProjectsTranslateTextCall struct {
3155 s *Service
3156 parent string
3157 translatetextrequest *TranslateTextRequest
3158 urlParams_ gensupport.URLParams
3159 ctx_ context.Context
3160 header_ http.Header
3161 }
3162
3163 // TranslateText: Translates input text and returns translated text.
3164 //
3165 // - parent: Project or location to make a call. Must refer to a caller's
3166 // project. Format: `projects/{project-number-or-id}` or
3167 // `projects/{project-number-or-id}/locations/{location-id}`. For global
3168 // calls, use `projects/{project-number-or-id}/locations/global` or
3169 // `projects/{project-number-or-id}`. Non-global location is required for
3170 // requests using AutoML models or custom glossaries. Models and glossaries
3171 // must be within the same region (have same location-id), otherwise an
3172 // INVALID_ARGUMENT (400) error is returned.
3173 func (r *ProjectsService) TranslateText(parent string, translatetextrequest *TranslateTextRequest) *ProjectsTranslateTextCall {
3174 c := &ProjectsTranslateTextCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3175 c.parent = parent
3176 c.translatetextrequest = translatetextrequest
3177 return c
3178 }
3179
3180 // Fields allows partial responses to be retrieved. See
3181 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3182 // details.
3183 func (c *ProjectsTranslateTextCall) Fields(s ...googleapi.Field) *ProjectsTranslateTextCall {
3184 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3185 return c
3186 }
3187
3188 // Context sets the context to be used in this call's Do method.
3189 func (c *ProjectsTranslateTextCall) Context(ctx context.Context) *ProjectsTranslateTextCall {
3190 c.ctx_ = ctx
3191 return c
3192 }
3193
3194 // Header returns a http.Header that can be modified by the caller to add
3195 // headers to the request.
3196 func (c *ProjectsTranslateTextCall) Header() http.Header {
3197 if c.header_ == nil {
3198 c.header_ = make(http.Header)
3199 }
3200 return c.header_
3201 }
3202
3203 func (c *ProjectsTranslateTextCall) doRequest(alt string) (*http.Response, error) {
3204 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3205 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.translatetextrequest)
3206 if err != nil {
3207 return nil, err
3208 }
3209 c.urlParams_.Set("alt", alt)
3210 c.urlParams_.Set("prettyPrint", "false")
3211 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}:translateText")
3212 urls += "?" + c.urlParams_.Encode()
3213 req, err := http.NewRequest("POST", urls, body)
3214 if err != nil {
3215 return nil, err
3216 }
3217 req.Header = reqHeaders
3218 googleapi.Expand(req.URL, map[string]string{
3219 "parent": c.parent,
3220 })
3221 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.translateText", "request", internallog.HTTPRequest(req, body.Bytes()))
3222 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3223 }
3224
3225 // Do executes the "translate.projects.translateText" call.
3226 // Any non-2xx status code is an error. Response headers are in either
3227 // *TranslateTextResponse.ServerResponse.Header or (if a response was returned
3228 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
3229 // check whether the returned error was because http.StatusNotModified was
3230 // returned.
3231 func (c *ProjectsTranslateTextCall) Do(opts ...googleapi.CallOption) (*TranslateTextResponse, error) {
3232 gensupport.SetOptions(c.urlParams_, opts...)
3233 res, err := c.doRequest("json")
3234 if res != nil && res.StatusCode == http.StatusNotModified {
3235 if res.Body != nil {
3236 res.Body.Close()
3237 }
3238 return nil, gensupport.WrapError(&googleapi.Error{
3239 Code: res.StatusCode,
3240 Header: res.Header,
3241 })
3242 }
3243 if err != nil {
3244 return nil, err
3245 }
3246 defer googleapi.CloseBody(res)
3247 if err := googleapi.CheckResponse(res); err != nil {
3248 return nil, gensupport.WrapError(err)
3249 }
3250 ret := &TranslateTextResponse{
3251 ServerResponse: googleapi.ServerResponse{
3252 Header: res.Header,
3253 HTTPStatusCode: res.StatusCode,
3254 },
3255 }
3256 target := &ret
3257 b, err := gensupport.DecodeResponseBytes(target, res)
3258 if err != nil {
3259 return nil, err
3260 }
3261 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.translateText", "response", internallog.HTTPResponse(res, b))
3262 return ret, nil
3263 }
3264
3265 type ProjectsLocationsAdaptiveMtTranslateCall struct {
3266 s *Service
3267 parent string
3268 adaptivemttranslaterequest *AdaptiveMtTranslateRequest
3269 urlParams_ gensupport.URLParams
3270 ctx_ context.Context
3271 header_ http.Header
3272 }
3273
3274 // AdaptiveMtTranslate: Translate text using Adaptive MT.
3275 //
3276 // - parent: Location to make a regional call. Format:
3277 // `projects/{project-number-or-id}/locations/{location-id}`.
3278 func (r *ProjectsLocationsService) AdaptiveMtTranslate(parent string, adaptivemttranslaterequest *AdaptiveMtTranslateRequest) *ProjectsLocationsAdaptiveMtTranslateCall {
3279 c := &ProjectsLocationsAdaptiveMtTranslateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3280 c.parent = parent
3281 c.adaptivemttranslaterequest = adaptivemttranslaterequest
3282 return c
3283 }
3284
3285 // Fields allows partial responses to be retrieved. See
3286 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3287 // details.
3288 func (c *ProjectsLocationsAdaptiveMtTranslateCall) Fields(s ...googleapi.Field) *ProjectsLocationsAdaptiveMtTranslateCall {
3289 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3290 return c
3291 }
3292
3293 // Context sets the context to be used in this call's Do method.
3294 func (c *ProjectsLocationsAdaptiveMtTranslateCall) Context(ctx context.Context) *ProjectsLocationsAdaptiveMtTranslateCall {
3295 c.ctx_ = ctx
3296 return c
3297 }
3298
3299 // Header returns a http.Header that can be modified by the caller to add
3300 // headers to the request.
3301 func (c *ProjectsLocationsAdaptiveMtTranslateCall) Header() http.Header {
3302 if c.header_ == nil {
3303 c.header_ = make(http.Header)
3304 }
3305 return c.header_
3306 }
3307
3308 func (c *ProjectsLocationsAdaptiveMtTranslateCall) doRequest(alt string) (*http.Response, error) {
3309 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3310 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.adaptivemttranslaterequest)
3311 if err != nil {
3312 return nil, err
3313 }
3314 c.urlParams_.Set("alt", alt)
3315 c.urlParams_.Set("prettyPrint", "false")
3316 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}:adaptiveMtTranslate")
3317 urls += "?" + c.urlParams_.Encode()
3318 req, err := http.NewRequest("POST", urls, body)
3319 if err != nil {
3320 return nil, err
3321 }
3322 req.Header = reqHeaders
3323 googleapi.Expand(req.URL, map[string]string{
3324 "parent": c.parent,
3325 })
3326 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtTranslate", "request", internallog.HTTPRequest(req, body.Bytes()))
3327 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3328 }
3329
3330 // Do executes the "translate.projects.locations.adaptiveMtTranslate" call.
3331 // Any non-2xx status code is an error. Response headers are in either
3332 // *AdaptiveMtTranslateResponse.ServerResponse.Header or (if a response was
3333 // returned at all) in error.(*googleapi.Error).Header. Use
3334 // googleapi.IsNotModified to check whether the returned error was because
3335 // http.StatusNotModified was returned.
3336 func (c *ProjectsLocationsAdaptiveMtTranslateCall) Do(opts ...googleapi.CallOption) (*AdaptiveMtTranslateResponse, error) {
3337 gensupport.SetOptions(c.urlParams_, opts...)
3338 res, err := c.doRequest("json")
3339 if res != nil && res.StatusCode == http.StatusNotModified {
3340 if res.Body != nil {
3341 res.Body.Close()
3342 }
3343 return nil, gensupport.WrapError(&googleapi.Error{
3344 Code: res.StatusCode,
3345 Header: res.Header,
3346 })
3347 }
3348 if err != nil {
3349 return nil, err
3350 }
3351 defer googleapi.CloseBody(res)
3352 if err := googleapi.CheckResponse(res); err != nil {
3353 return nil, gensupport.WrapError(err)
3354 }
3355 ret := &AdaptiveMtTranslateResponse{
3356 ServerResponse: googleapi.ServerResponse{
3357 Header: res.Header,
3358 HTTPStatusCode: res.StatusCode,
3359 },
3360 }
3361 target := &ret
3362 b, err := gensupport.DecodeResponseBytes(target, res)
3363 if err != nil {
3364 return nil, err
3365 }
3366 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtTranslate", "response", internallog.HTTPResponse(res, b))
3367 return ret, nil
3368 }
3369
3370 type ProjectsLocationsBatchTranslateDocumentCall struct {
3371 s *Service
3372 parent string
3373 batchtranslatedocumentrequest *BatchTranslateDocumentRequest
3374 urlParams_ gensupport.URLParams
3375 ctx_ context.Context
3376 header_ http.Header
3377 }
3378
3379 // BatchTranslateDocument: Translates a large volume of document in
3380 // asynchronous batch mode. This function provides real-time output as the
3381 // inputs are being processed. If caller cancels a request, the partial results
3382 // (for an input file, it's all or nothing) may still be available on the
3383 // specified output location. This call returns immediately and you can use
3384 // google.longrunning.Operation.name to poll the status of the call.
3385 //
3386 // - parent: Location to make a regional call. Format:
3387 // `projects/{project-number-or-id}/locations/{location-id}`. The `global`
3388 // location is not supported for batch translation. Only AutoML Translation
3389 // models or glossaries within the same region (have the same location-id)
3390 // can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
3391 func (r *ProjectsLocationsService) BatchTranslateDocument(parent string, batchtranslatedocumentrequest *BatchTranslateDocumentRequest) *ProjectsLocationsBatchTranslateDocumentCall {
3392 c := &ProjectsLocationsBatchTranslateDocumentCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3393 c.parent = parent
3394 c.batchtranslatedocumentrequest = batchtranslatedocumentrequest
3395 return c
3396 }
3397
3398 // Fields allows partial responses to be retrieved. See
3399 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3400 // details.
3401 func (c *ProjectsLocationsBatchTranslateDocumentCall) Fields(s ...googleapi.Field) *ProjectsLocationsBatchTranslateDocumentCall {
3402 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3403 return c
3404 }
3405
3406 // Context sets the context to be used in this call's Do method.
3407 func (c *ProjectsLocationsBatchTranslateDocumentCall) Context(ctx context.Context) *ProjectsLocationsBatchTranslateDocumentCall {
3408 c.ctx_ = ctx
3409 return c
3410 }
3411
3412 // Header returns a http.Header that can be modified by the caller to add
3413 // headers to the request.
3414 func (c *ProjectsLocationsBatchTranslateDocumentCall) Header() http.Header {
3415 if c.header_ == nil {
3416 c.header_ = make(http.Header)
3417 }
3418 return c.header_
3419 }
3420
3421 func (c *ProjectsLocationsBatchTranslateDocumentCall) doRequest(alt string) (*http.Response, error) {
3422 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3423 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.batchtranslatedocumentrequest)
3424 if err != nil {
3425 return nil, err
3426 }
3427 c.urlParams_.Set("alt", alt)
3428 c.urlParams_.Set("prettyPrint", "false")
3429 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}:batchTranslateDocument")
3430 urls += "?" + c.urlParams_.Encode()
3431 req, err := http.NewRequest("POST", urls, body)
3432 if err != nil {
3433 return nil, err
3434 }
3435 req.Header = reqHeaders
3436 googleapi.Expand(req.URL, map[string]string{
3437 "parent": c.parent,
3438 })
3439 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.batchTranslateDocument", "request", internallog.HTTPRequest(req, body.Bytes()))
3440 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3441 }
3442
3443 // Do executes the "translate.projects.locations.batchTranslateDocument" call.
3444 // Any non-2xx status code is an error. Response headers are in either
3445 // *Operation.ServerResponse.Header or (if a response was returned at all) in
3446 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
3447 // whether the returned error was because http.StatusNotModified was returned.
3448 func (c *ProjectsLocationsBatchTranslateDocumentCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
3449 gensupport.SetOptions(c.urlParams_, opts...)
3450 res, err := c.doRequest("json")
3451 if res != nil && res.StatusCode == http.StatusNotModified {
3452 if res.Body != nil {
3453 res.Body.Close()
3454 }
3455 return nil, gensupport.WrapError(&googleapi.Error{
3456 Code: res.StatusCode,
3457 Header: res.Header,
3458 })
3459 }
3460 if err != nil {
3461 return nil, err
3462 }
3463 defer googleapi.CloseBody(res)
3464 if err := googleapi.CheckResponse(res); err != nil {
3465 return nil, gensupport.WrapError(err)
3466 }
3467 ret := &Operation{
3468 ServerResponse: googleapi.ServerResponse{
3469 Header: res.Header,
3470 HTTPStatusCode: res.StatusCode,
3471 },
3472 }
3473 target := &ret
3474 b, err := gensupport.DecodeResponseBytes(target, res)
3475 if err != nil {
3476 return nil, err
3477 }
3478 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.batchTranslateDocument", "response", internallog.HTTPResponse(res, b))
3479 return ret, nil
3480 }
3481
3482 type ProjectsLocationsBatchTranslateTextCall struct {
3483 s *Service
3484 parent string
3485 batchtranslatetextrequest *BatchTranslateTextRequest
3486 urlParams_ gensupport.URLParams
3487 ctx_ context.Context
3488 header_ http.Header
3489 }
3490
3491 // BatchTranslateText: Translates a large volume of text in asynchronous batch
3492 // mode. This function provides real-time output as the inputs are being
3493 // processed. If caller cancels a request, the partial results (for an input
3494 // file, it's all or nothing) may still be available on the specified output
3495 // location. This call returns immediately and you can use
3496 // google.longrunning.Operation.name to poll the status of the call.
3497 //
3498 // - parent: Location to make a call. Must refer to a caller's project. Format:
3499 // `projects/{project-number-or-id}/locations/{location-id}`. The `global`
3500 // location is not supported for batch translation. Only AutoML Translation
3501 // models or glossaries within the same region (have the same location-id)
3502 // can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
3503 func (r *ProjectsLocationsService) BatchTranslateText(parent string, batchtranslatetextrequest *BatchTranslateTextRequest) *ProjectsLocationsBatchTranslateTextCall {
3504 c := &ProjectsLocationsBatchTranslateTextCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3505 c.parent = parent
3506 c.batchtranslatetextrequest = batchtranslatetextrequest
3507 return c
3508 }
3509
3510 // Fields allows partial responses to be retrieved. See
3511 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3512 // details.
3513 func (c *ProjectsLocationsBatchTranslateTextCall) Fields(s ...googleapi.Field) *ProjectsLocationsBatchTranslateTextCall {
3514 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3515 return c
3516 }
3517
3518 // Context sets the context to be used in this call's Do method.
3519 func (c *ProjectsLocationsBatchTranslateTextCall) Context(ctx context.Context) *ProjectsLocationsBatchTranslateTextCall {
3520 c.ctx_ = ctx
3521 return c
3522 }
3523
3524 // Header returns a http.Header that can be modified by the caller to add
3525 // headers to the request.
3526 func (c *ProjectsLocationsBatchTranslateTextCall) Header() http.Header {
3527 if c.header_ == nil {
3528 c.header_ = make(http.Header)
3529 }
3530 return c.header_
3531 }
3532
3533 func (c *ProjectsLocationsBatchTranslateTextCall) doRequest(alt string) (*http.Response, error) {
3534 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3535 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.batchtranslatetextrequest)
3536 if err != nil {
3537 return nil, err
3538 }
3539 c.urlParams_.Set("alt", alt)
3540 c.urlParams_.Set("prettyPrint", "false")
3541 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}:batchTranslateText")
3542 urls += "?" + c.urlParams_.Encode()
3543 req, err := http.NewRequest("POST", urls, body)
3544 if err != nil {
3545 return nil, err
3546 }
3547 req.Header = reqHeaders
3548 googleapi.Expand(req.URL, map[string]string{
3549 "parent": c.parent,
3550 })
3551 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.batchTranslateText", "request", internallog.HTTPRequest(req, body.Bytes()))
3552 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3553 }
3554
3555 // Do executes the "translate.projects.locations.batchTranslateText" call.
3556 // Any non-2xx status code is an error. Response headers are in either
3557 // *Operation.ServerResponse.Header or (if a response was returned at all) in
3558 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
3559 // whether the returned error was because http.StatusNotModified was returned.
3560 func (c *ProjectsLocationsBatchTranslateTextCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
3561 gensupport.SetOptions(c.urlParams_, opts...)
3562 res, err := c.doRequest("json")
3563 if res != nil && res.StatusCode == http.StatusNotModified {
3564 if res.Body != nil {
3565 res.Body.Close()
3566 }
3567 return nil, gensupport.WrapError(&googleapi.Error{
3568 Code: res.StatusCode,
3569 Header: res.Header,
3570 })
3571 }
3572 if err != nil {
3573 return nil, err
3574 }
3575 defer googleapi.CloseBody(res)
3576 if err := googleapi.CheckResponse(res); err != nil {
3577 return nil, gensupport.WrapError(err)
3578 }
3579 ret := &Operation{
3580 ServerResponse: googleapi.ServerResponse{
3581 Header: res.Header,
3582 HTTPStatusCode: res.StatusCode,
3583 },
3584 }
3585 target := &ret
3586 b, err := gensupport.DecodeResponseBytes(target, res)
3587 if err != nil {
3588 return nil, err
3589 }
3590 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.batchTranslateText", "response", internallog.HTTPResponse(res, b))
3591 return ret, nil
3592 }
3593
3594 type ProjectsLocationsDetectLanguageCall struct {
3595 s *Service
3596 parent string
3597 detectlanguagerequest *DetectLanguageRequest
3598 urlParams_ gensupport.URLParams
3599 ctx_ context.Context
3600 header_ http.Header
3601 }
3602
3603 // DetectLanguage: Detects the language of text within a request.
3604 //
3605 // - parent: Project or location to make a call. Must refer to a caller's
3606 // project. Format: `projects/{project-number-or-id}/locations/{location-id}`
3607 // or `projects/{project-number-or-id}`. For global calls, use
3608 // `projects/{project-number-or-id}/locations/global` or
3609 // `projects/{project-number-or-id}`. Only models within the same region (has
3610 // same location-id) can be used. Otherwise an INVALID_ARGUMENT (400) error
3611 // is returned.
3612 func (r *ProjectsLocationsService) DetectLanguage(parent string, detectlanguagerequest *DetectLanguageRequest) *ProjectsLocationsDetectLanguageCall {
3613 c := &ProjectsLocationsDetectLanguageCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3614 c.parent = parent
3615 c.detectlanguagerequest = detectlanguagerequest
3616 return c
3617 }
3618
3619 // Fields allows partial responses to be retrieved. See
3620 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3621 // details.
3622 func (c *ProjectsLocationsDetectLanguageCall) Fields(s ...googleapi.Field) *ProjectsLocationsDetectLanguageCall {
3623 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3624 return c
3625 }
3626
3627 // Context sets the context to be used in this call's Do method.
3628 func (c *ProjectsLocationsDetectLanguageCall) Context(ctx context.Context) *ProjectsLocationsDetectLanguageCall {
3629 c.ctx_ = ctx
3630 return c
3631 }
3632
3633 // Header returns a http.Header that can be modified by the caller to add
3634 // headers to the request.
3635 func (c *ProjectsLocationsDetectLanguageCall) Header() http.Header {
3636 if c.header_ == nil {
3637 c.header_ = make(http.Header)
3638 }
3639 return c.header_
3640 }
3641
3642 func (c *ProjectsLocationsDetectLanguageCall) doRequest(alt string) (*http.Response, error) {
3643 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3644 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.detectlanguagerequest)
3645 if err != nil {
3646 return nil, err
3647 }
3648 c.urlParams_.Set("alt", alt)
3649 c.urlParams_.Set("prettyPrint", "false")
3650 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}:detectLanguage")
3651 urls += "?" + c.urlParams_.Encode()
3652 req, err := http.NewRequest("POST", urls, body)
3653 if err != nil {
3654 return nil, err
3655 }
3656 req.Header = reqHeaders
3657 googleapi.Expand(req.URL, map[string]string{
3658 "parent": c.parent,
3659 })
3660 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.detectLanguage", "request", internallog.HTTPRequest(req, body.Bytes()))
3661 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3662 }
3663
3664 // Do executes the "translate.projects.locations.detectLanguage" call.
3665 // Any non-2xx status code is an error. Response headers are in either
3666 // *DetectLanguageResponse.ServerResponse.Header or (if a response was returned
3667 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
3668 // check whether the returned error was because http.StatusNotModified was
3669 // returned.
3670 func (c *ProjectsLocationsDetectLanguageCall) Do(opts ...googleapi.CallOption) (*DetectLanguageResponse, error) {
3671 gensupport.SetOptions(c.urlParams_, opts...)
3672 res, err := c.doRequest("json")
3673 if res != nil && res.StatusCode == http.StatusNotModified {
3674 if res.Body != nil {
3675 res.Body.Close()
3676 }
3677 return nil, gensupport.WrapError(&googleapi.Error{
3678 Code: res.StatusCode,
3679 Header: res.Header,
3680 })
3681 }
3682 if err != nil {
3683 return nil, err
3684 }
3685 defer googleapi.CloseBody(res)
3686 if err := googleapi.CheckResponse(res); err != nil {
3687 return nil, gensupport.WrapError(err)
3688 }
3689 ret := &DetectLanguageResponse{
3690 ServerResponse: googleapi.ServerResponse{
3691 Header: res.Header,
3692 HTTPStatusCode: res.StatusCode,
3693 },
3694 }
3695 target := &ret
3696 b, err := gensupport.DecodeResponseBytes(target, res)
3697 if err != nil {
3698 return nil, err
3699 }
3700 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.detectLanguage", "response", internallog.HTTPResponse(res, b))
3701 return ret, nil
3702 }
3703
3704 type ProjectsLocationsGetCall struct {
3705 s *Service
3706 name string
3707 urlParams_ gensupport.URLParams
3708 ifNoneMatch_ string
3709 ctx_ context.Context
3710 header_ http.Header
3711 }
3712
3713 // Get: Gets information about a location.
3714 //
3715 // - name: Resource name for the location.
3716 func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall {
3717 c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3718 c.name = name
3719 return c
3720 }
3721
3722 // Fields allows partial responses to be retrieved. See
3723 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3724 // details.
3725 func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall {
3726 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3727 return c
3728 }
3729
3730 // IfNoneMatch sets an optional parameter which makes the operation fail if the
3731 // object's ETag matches the given value. This is useful for getting updates
3732 // only after the object has changed since the last request.
3733 func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {
3734 c.ifNoneMatch_ = entityTag
3735 return c
3736 }
3737
3738 // Context sets the context to be used in this call's Do method.
3739 func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall {
3740 c.ctx_ = ctx
3741 return c
3742 }
3743
3744 // Header returns a http.Header that can be modified by the caller to add
3745 // headers to the request.
3746 func (c *ProjectsLocationsGetCall) Header() http.Header {
3747 if c.header_ == nil {
3748 c.header_ = make(http.Header)
3749 }
3750 return c.header_
3751 }
3752
3753 func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) {
3754 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3755 if c.ifNoneMatch_ != "" {
3756 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3757 }
3758 c.urlParams_.Set("alt", alt)
3759 c.urlParams_.Set("prettyPrint", "false")
3760 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
3761 urls += "?" + c.urlParams_.Encode()
3762 req, err := http.NewRequest("GET", urls, nil)
3763 if err != nil {
3764 return nil, err
3765 }
3766 req.Header = reqHeaders
3767 googleapi.Expand(req.URL, map[string]string{
3768 "name": c.name,
3769 })
3770 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.get", "request", internallog.HTTPRequest(req, nil))
3771 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3772 }
3773
3774 // Do executes the "translate.projects.locations.get" call.
3775 // Any non-2xx status code is an error. Response headers are in either
3776 // *Location.ServerResponse.Header or (if a response was returned at all) in
3777 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
3778 // whether the returned error was because http.StatusNotModified was returned.
3779 func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) {
3780 gensupport.SetOptions(c.urlParams_, opts...)
3781 res, err := c.doRequest("json")
3782 if res != nil && res.StatusCode == http.StatusNotModified {
3783 if res.Body != nil {
3784 res.Body.Close()
3785 }
3786 return nil, gensupport.WrapError(&googleapi.Error{
3787 Code: res.StatusCode,
3788 Header: res.Header,
3789 })
3790 }
3791 if err != nil {
3792 return nil, err
3793 }
3794 defer googleapi.CloseBody(res)
3795 if err := googleapi.CheckResponse(res); err != nil {
3796 return nil, gensupport.WrapError(err)
3797 }
3798 ret := &Location{
3799 ServerResponse: googleapi.ServerResponse{
3800 Header: res.Header,
3801 HTTPStatusCode: res.StatusCode,
3802 },
3803 }
3804 target := &ret
3805 b, err := gensupport.DecodeResponseBytes(target, res)
3806 if err != nil {
3807 return nil, err
3808 }
3809 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.get", "response", internallog.HTTPResponse(res, b))
3810 return ret, nil
3811 }
3812
3813 type ProjectsLocationsGetSupportedLanguagesCall struct {
3814 s *Service
3815 parent string
3816 urlParams_ gensupport.URLParams
3817 ifNoneMatch_ string
3818 ctx_ context.Context
3819 header_ http.Header
3820 }
3821
3822 // GetSupportedLanguages: Returns a list of supported languages for
3823 // translation.
3824 //
3825 // - parent: Project or location to make a call. Must refer to a caller's
3826 // project. Format: `projects/{project-number-or-id}` or
3827 // `projects/{project-number-or-id}/locations/{location-id}`. For global
3828 // calls, use `projects/{project-number-or-id}/locations/global` or
3829 // `projects/{project-number-or-id}`. Non-global location is required for
3830 // AutoML models. Only models within the same region (have same location-id)
3831 // can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
3832 func (r *ProjectsLocationsService) GetSupportedLanguages(parent string) *ProjectsLocationsGetSupportedLanguagesCall {
3833 c := &ProjectsLocationsGetSupportedLanguagesCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3834 c.parent = parent
3835 return c
3836 }
3837
3838 // DisplayLanguageCode sets the optional parameter "displayLanguageCode": The
3839 // language to use to return localized, human readable names of supported
3840 // languages. If missing, then display names are not returned in a response.
3841 func (c *ProjectsLocationsGetSupportedLanguagesCall) DisplayLanguageCode(displayLanguageCode string) *ProjectsLocationsGetSupportedLanguagesCall {
3842 c.urlParams_.Set("displayLanguageCode", displayLanguageCode)
3843 return c
3844 }
3845
3846 // Model sets the optional parameter "model": Get supported languages of this
3847 // model. The format depends on model type: - AutoML Translation models:
3848 // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}`
3849 // - General (built-in) models:
3850 // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
3851 //
3852 // Returns languages supported by the specified model. If missing, we get
3853 //
3854 // supported languages of Google general NMT model.
3855 func (c *ProjectsLocationsGetSupportedLanguagesCall) Model(model string) *ProjectsLocationsGetSupportedLanguagesCall {
3856 c.urlParams_.Set("model", model)
3857 return c
3858 }
3859
3860 // Fields allows partial responses to be retrieved. See
3861 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
3862 // details.
3863 func (c *ProjectsLocationsGetSupportedLanguagesCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetSupportedLanguagesCall {
3864 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3865 return c
3866 }
3867
3868 // IfNoneMatch sets an optional parameter which makes the operation fail if the
3869 // object's ETag matches the given value. This is useful for getting updates
3870 // only after the object has changed since the last request.
3871 func (c *ProjectsLocationsGetSupportedLanguagesCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetSupportedLanguagesCall {
3872 c.ifNoneMatch_ = entityTag
3873 return c
3874 }
3875
3876 // Context sets the context to be used in this call's Do method.
3877 func (c *ProjectsLocationsGetSupportedLanguagesCall) Context(ctx context.Context) *ProjectsLocationsGetSupportedLanguagesCall {
3878 c.ctx_ = ctx
3879 return c
3880 }
3881
3882 // Header returns a http.Header that can be modified by the caller to add
3883 // headers to the request.
3884 func (c *ProjectsLocationsGetSupportedLanguagesCall) Header() http.Header {
3885 if c.header_ == nil {
3886 c.header_ = make(http.Header)
3887 }
3888 return c.header_
3889 }
3890
3891 func (c *ProjectsLocationsGetSupportedLanguagesCall) doRequest(alt string) (*http.Response, error) {
3892 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3893 if c.ifNoneMatch_ != "" {
3894 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3895 }
3896 c.urlParams_.Set("alt", alt)
3897 c.urlParams_.Set("prettyPrint", "false")
3898 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/supportedLanguages")
3899 urls += "?" + c.urlParams_.Encode()
3900 req, err := http.NewRequest("GET", urls, nil)
3901 if err != nil {
3902 return nil, err
3903 }
3904 req.Header = reqHeaders
3905 googleapi.Expand(req.URL, map[string]string{
3906 "parent": c.parent,
3907 })
3908 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.getSupportedLanguages", "request", internallog.HTTPRequest(req, nil))
3909 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3910 }
3911
3912 // Do executes the "translate.projects.locations.getSupportedLanguages" call.
3913 // Any non-2xx status code is an error. Response headers are in either
3914 // *SupportedLanguages.ServerResponse.Header or (if a response was returned at
3915 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
3916 // check whether the returned error was because http.StatusNotModified was
3917 // returned.
3918 func (c *ProjectsLocationsGetSupportedLanguagesCall) Do(opts ...googleapi.CallOption) (*SupportedLanguages, error) {
3919 gensupport.SetOptions(c.urlParams_, opts...)
3920 res, err := c.doRequest("json")
3921 if res != nil && res.StatusCode == http.StatusNotModified {
3922 if res.Body != nil {
3923 res.Body.Close()
3924 }
3925 return nil, gensupport.WrapError(&googleapi.Error{
3926 Code: res.StatusCode,
3927 Header: res.Header,
3928 })
3929 }
3930 if err != nil {
3931 return nil, err
3932 }
3933 defer googleapi.CloseBody(res)
3934 if err := googleapi.CheckResponse(res); err != nil {
3935 return nil, gensupport.WrapError(err)
3936 }
3937 ret := &SupportedLanguages{
3938 ServerResponse: googleapi.ServerResponse{
3939 Header: res.Header,
3940 HTTPStatusCode: res.StatusCode,
3941 },
3942 }
3943 target := &ret
3944 b, err := gensupport.DecodeResponseBytes(target, res)
3945 if err != nil {
3946 return nil, err
3947 }
3948 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.getSupportedLanguages", "response", internallog.HTTPResponse(res, b))
3949 return ret, nil
3950 }
3951
3952 type ProjectsLocationsListCall struct {
3953 s *Service
3954 name string
3955 urlParams_ gensupport.URLParams
3956 ifNoneMatch_ string
3957 ctx_ context.Context
3958 header_ http.Header
3959 }
3960
3961 // List: Lists information about the supported locations for this service. This
3962 // method can be called in two ways: * **List all public locations:** Use the
3963 // path `GET /v1/locations`. * **List project-visible locations:** Use the path
3964 // `GET /v1/projects/{project_id}/locations`. This may include public locations
3965 // as well as private or other locations specifically visible to the project.
3966 //
3967 // - name: The resource that owns the locations collection, if applicable.
3968 func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall {
3969 c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3970 c.name = name
3971 return c
3972 }
3973
3974 // ExtraLocationTypes sets the optional parameter "extraLocationTypes": Do not
3975 // use this field. It is unsupported and is ignored unless explicitly
3976 // documented otherwise. This is primarily for internal usage.
3977 func (c *ProjectsLocationsListCall) ExtraLocationTypes(extraLocationTypes ...string) *ProjectsLocationsListCall {
3978 c.urlParams_.SetMulti("extraLocationTypes", append([]string{}, extraLocationTypes...))
3979 return c
3980 }
3981
3982 // Filter sets the optional parameter "filter": A filter to narrow down results
3983 // to a preferred subset. The filtering language accepts strings like
3984 // "displayName=tokyo", and is documented in more detail in AIP-160
3985 // (https://google.aip.dev/160).
3986 func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall {
3987 c.urlParams_.Set("filter", filter)
3988 return c
3989 }
3990
3991 // PageSize sets the optional parameter "pageSize": The maximum number of
3992 // results to return. If not set, the service selects a default.
3993 func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall {
3994 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
3995 return c
3996 }
3997
3998 // PageToken sets the optional parameter "pageToken": A page token received
3999 // from the `next_page_token` field in the response. Send that page token to
4000 // receive the subsequent page.
4001 func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall {
4002 c.urlParams_.Set("pageToken", pageToken)
4003 return c
4004 }
4005
4006 // Fields allows partial responses to be retrieved. See
4007 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
4008 // details.
4009 func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {
4010 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4011 return c
4012 }
4013
4014 // IfNoneMatch sets an optional parameter which makes the operation fail if the
4015 // object's ETag matches the given value. This is useful for getting updates
4016 // only after the object has changed since the last request.
4017 func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall {
4018 c.ifNoneMatch_ = entityTag
4019 return c
4020 }
4021
4022 // Context sets the context to be used in this call's Do method.
4023 func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall {
4024 c.ctx_ = ctx
4025 return c
4026 }
4027
4028 // Header returns a http.Header that can be modified by the caller to add
4029 // headers to the request.
4030 func (c *ProjectsLocationsListCall) Header() http.Header {
4031 if c.header_ == nil {
4032 c.header_ = make(http.Header)
4033 }
4034 return c.header_
4035 }
4036
4037 func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
4038 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
4039 if c.ifNoneMatch_ != "" {
4040 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
4041 }
4042 c.urlParams_.Set("alt", alt)
4043 c.urlParams_.Set("prettyPrint", "false")
4044 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/locations")
4045 urls += "?" + c.urlParams_.Encode()
4046 req, err := http.NewRequest("GET", urls, nil)
4047 if err != nil {
4048 return nil, err
4049 }
4050 req.Header = reqHeaders
4051 googleapi.Expand(req.URL, map[string]string{
4052 "name": c.name,
4053 })
4054 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.list", "request", internallog.HTTPRequest(req, nil))
4055 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4056 }
4057
4058 // Do executes the "translate.projects.locations.list" call.
4059 // Any non-2xx status code is an error. Response headers are in either
4060 // *ListLocationsResponse.ServerResponse.Header or (if a response was returned
4061 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
4062 // check whether the returned error was because http.StatusNotModified was
4063 // returned.
4064 func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) {
4065 gensupport.SetOptions(c.urlParams_, opts...)
4066 res, err := c.doRequest("json")
4067 if res != nil && res.StatusCode == http.StatusNotModified {
4068 if res.Body != nil {
4069 res.Body.Close()
4070 }
4071 return nil, gensupport.WrapError(&googleapi.Error{
4072 Code: res.StatusCode,
4073 Header: res.Header,
4074 })
4075 }
4076 if err != nil {
4077 return nil, err
4078 }
4079 defer googleapi.CloseBody(res)
4080 if err := googleapi.CheckResponse(res); err != nil {
4081 return nil, gensupport.WrapError(err)
4082 }
4083 ret := &ListLocationsResponse{
4084 ServerResponse: googleapi.ServerResponse{
4085 Header: res.Header,
4086 HTTPStatusCode: res.StatusCode,
4087 },
4088 }
4089 target := &ret
4090 b, err := gensupport.DecodeResponseBytes(target, res)
4091 if err != nil {
4092 return nil, err
4093 }
4094 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.list", "response", internallog.HTTPResponse(res, b))
4095 return ret, nil
4096 }
4097
4098 // Pages invokes f for each page of results.
4099 // A non-nil error returned from f will halt the iteration.
4100 // The provided context supersedes any context provided to the Context method.
4101 func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error {
4102 c.ctx_ = ctx
4103 defer c.PageToken(c.urlParams_.Get("pageToken"))
4104 for {
4105 x, err := c.Do()
4106 if err != nil {
4107 return err
4108 }
4109 if err := f(x); err != nil {
4110 return err
4111 }
4112 if x.NextPageToken == "" {
4113 return nil
4114 }
4115 c.PageToken(x.NextPageToken)
4116 }
4117 }
4118
4119 type ProjectsLocationsRefineTextCall struct {
4120 s *Service
4121 parent string
4122 refinetextrequest *RefineTextRequest
4123 urlParams_ gensupport.URLParams
4124 ctx_ context.Context
4125 header_ http.Header
4126 }
4127
4128 // RefineText: Refines the input translated text to improve the quality.
4129 //
4130 // - parent: Project or location to make a call. Must refer to a caller's
4131 // project. Format:
4132 // `projects/{project-number-or-id}/locations/{location-id}`. For global
4133 // calls, use `projects/{project-number-or-id}/locations/global` or
4134 // `projects/{project-number-or-id}`.
4135 func (r *ProjectsLocationsService) RefineText(parent string, refinetextrequest *RefineTextRequest) *ProjectsLocationsRefineTextCall {
4136 c := &ProjectsLocationsRefineTextCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4137 c.parent = parent
4138 c.refinetextrequest = refinetextrequest
4139 return c
4140 }
4141
4142 // Fields allows partial responses to be retrieved. See
4143 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
4144 // details.
4145 func (c *ProjectsLocationsRefineTextCall) Fields(s ...googleapi.Field) *ProjectsLocationsRefineTextCall {
4146 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4147 return c
4148 }
4149
4150 // Context sets the context to be used in this call's Do method.
4151 func (c *ProjectsLocationsRefineTextCall) Context(ctx context.Context) *ProjectsLocationsRefineTextCall {
4152 c.ctx_ = ctx
4153 return c
4154 }
4155
4156 // Header returns a http.Header that can be modified by the caller to add
4157 // headers to the request.
4158 func (c *ProjectsLocationsRefineTextCall) Header() http.Header {
4159 if c.header_ == nil {
4160 c.header_ = make(http.Header)
4161 }
4162 return c.header_
4163 }
4164
4165 func (c *ProjectsLocationsRefineTextCall) doRequest(alt string) (*http.Response, error) {
4166 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
4167 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.refinetextrequest)
4168 if err != nil {
4169 return nil, err
4170 }
4171 c.urlParams_.Set("alt", alt)
4172 c.urlParams_.Set("prettyPrint", "false")
4173 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}:refineText")
4174 urls += "?" + c.urlParams_.Encode()
4175 req, err := http.NewRequest("POST", urls, body)
4176 if err != nil {
4177 return nil, err
4178 }
4179 req.Header = reqHeaders
4180 googleapi.Expand(req.URL, map[string]string{
4181 "parent": c.parent,
4182 })
4183 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.refineText", "request", internallog.HTTPRequest(req, body.Bytes()))
4184 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4185 }
4186
4187 // Do executes the "translate.projects.locations.refineText" call.
4188 // Any non-2xx status code is an error. Response headers are in either
4189 // *RefineTextResponse.ServerResponse.Header or (if a response was returned at
4190 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
4191 // check whether the returned error was because http.StatusNotModified was
4192 // returned.
4193 func (c *ProjectsLocationsRefineTextCall) Do(opts ...googleapi.CallOption) (*RefineTextResponse, error) {
4194 gensupport.SetOptions(c.urlParams_, opts...)
4195 res, err := c.doRequest("json")
4196 if res != nil && res.StatusCode == http.StatusNotModified {
4197 if res.Body != nil {
4198 res.Body.Close()
4199 }
4200 return nil, gensupport.WrapError(&googleapi.Error{
4201 Code: res.StatusCode,
4202 Header: res.Header,
4203 })
4204 }
4205 if err != nil {
4206 return nil, err
4207 }
4208 defer googleapi.CloseBody(res)
4209 if err := googleapi.CheckResponse(res); err != nil {
4210 return nil, gensupport.WrapError(err)
4211 }
4212 ret := &RefineTextResponse{
4213 ServerResponse: googleapi.ServerResponse{
4214 Header: res.Header,
4215 HTTPStatusCode: res.StatusCode,
4216 },
4217 }
4218 target := &ret
4219 b, err := gensupport.DecodeResponseBytes(target, res)
4220 if err != nil {
4221 return nil, err
4222 }
4223 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.refineText", "response", internallog.HTTPResponse(res, b))
4224 return ret, nil
4225 }
4226
4227 type ProjectsLocationsRomanizeTextCall struct {
4228 s *Service
4229 parent string
4230 romanizetextrequest *RomanizeTextRequest
4231 urlParams_ gensupport.URLParams
4232 ctx_ context.Context
4233 header_ http.Header
4234 }
4235
4236 // RomanizeText: Romanize input text written in non-Latin scripts to Latin
4237 // text.
4238 //
4239 // - parent: Project or location to make a call. Must refer to a caller's
4240 // project. Format: `projects/{project-number-or-id}/locations/{location-id}`
4241 // or `projects/{project-number-or-id}`. For global calls, use
4242 // `projects/{project-number-or-id}/locations/global` or
4243 // `projects/{project-number-or-id}`.
4244 func (r *ProjectsLocationsService) RomanizeText(parent string, romanizetextrequest *RomanizeTextRequest) *ProjectsLocationsRomanizeTextCall {
4245 c := &ProjectsLocationsRomanizeTextCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4246 c.parent = parent
4247 c.romanizetextrequest = romanizetextrequest
4248 return c
4249 }
4250
4251 // Fields allows partial responses to be retrieved. See
4252 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
4253 // details.
4254 func (c *ProjectsLocationsRomanizeTextCall) Fields(s ...googleapi.Field) *ProjectsLocationsRomanizeTextCall {
4255 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4256 return c
4257 }
4258
4259 // Context sets the context to be used in this call's Do method.
4260 func (c *ProjectsLocationsRomanizeTextCall) Context(ctx context.Context) *ProjectsLocationsRomanizeTextCall {
4261 c.ctx_ = ctx
4262 return c
4263 }
4264
4265 // Header returns a http.Header that can be modified by the caller to add
4266 // headers to the request.
4267 func (c *ProjectsLocationsRomanizeTextCall) Header() http.Header {
4268 if c.header_ == nil {
4269 c.header_ = make(http.Header)
4270 }
4271 return c.header_
4272 }
4273
4274 func (c *ProjectsLocationsRomanizeTextCall) doRequest(alt string) (*http.Response, error) {
4275 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
4276 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.romanizetextrequest)
4277 if err != nil {
4278 return nil, err
4279 }
4280 c.urlParams_.Set("alt", alt)
4281 c.urlParams_.Set("prettyPrint", "false")
4282 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}:romanizeText")
4283 urls += "?" + c.urlParams_.Encode()
4284 req, err := http.NewRequest("POST", urls, body)
4285 if err != nil {
4286 return nil, err
4287 }
4288 req.Header = reqHeaders
4289 googleapi.Expand(req.URL, map[string]string{
4290 "parent": c.parent,
4291 })
4292 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.romanizeText", "request", internallog.HTTPRequest(req, body.Bytes()))
4293 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4294 }
4295
4296 // Do executes the "translate.projects.locations.romanizeText" call.
4297 // Any non-2xx status code is an error. Response headers are in either
4298 // *RomanizeTextResponse.ServerResponse.Header or (if a response was returned
4299 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
4300 // check whether the returned error was because http.StatusNotModified was
4301 // returned.
4302 func (c *ProjectsLocationsRomanizeTextCall) Do(opts ...googleapi.CallOption) (*RomanizeTextResponse, error) {
4303 gensupport.SetOptions(c.urlParams_, opts...)
4304 res, err := c.doRequest("json")
4305 if res != nil && res.StatusCode == http.StatusNotModified {
4306 if res.Body != nil {
4307 res.Body.Close()
4308 }
4309 return nil, gensupport.WrapError(&googleapi.Error{
4310 Code: res.StatusCode,
4311 Header: res.Header,
4312 })
4313 }
4314 if err != nil {
4315 return nil, err
4316 }
4317 defer googleapi.CloseBody(res)
4318 if err := googleapi.CheckResponse(res); err != nil {
4319 return nil, gensupport.WrapError(err)
4320 }
4321 ret := &RomanizeTextResponse{
4322 ServerResponse: googleapi.ServerResponse{
4323 Header: res.Header,
4324 HTTPStatusCode: res.StatusCode,
4325 },
4326 }
4327 target := &ret
4328 b, err := gensupport.DecodeResponseBytes(target, res)
4329 if err != nil {
4330 return nil, err
4331 }
4332 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.romanizeText", "response", internallog.HTTPResponse(res, b))
4333 return ret, nil
4334 }
4335
4336 type ProjectsLocationsTranslateDocumentCall struct {
4337 s *Service
4338 parent string
4339 translatedocumentrequest *TranslateDocumentRequest
4340 urlParams_ gensupport.URLParams
4341 ctx_ context.Context
4342 header_ http.Header
4343 }
4344
4345 // TranslateDocument: Translates documents in synchronous mode.
4346 //
4347 // - parent: Location to make a regional call. Format:
4348 // `projects/{project-number-or-id}/locations/{location-id}`. For global
4349 // calls, use `projects/{project-number-or-id}/locations/global` or
4350 // `projects/{project-number-or-id}`. Non-global location is required for
4351 // requests using AutoML models or custom glossaries. Models and glossaries
4352 // must be within the same region (have the same location-id), otherwise an
4353 // INVALID_ARGUMENT (400) error is returned.
4354 func (r *ProjectsLocationsService) TranslateDocument(parent string, translatedocumentrequest *TranslateDocumentRequest) *ProjectsLocationsTranslateDocumentCall {
4355 c := &ProjectsLocationsTranslateDocumentCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4356 c.parent = parent
4357 c.translatedocumentrequest = translatedocumentrequest
4358 return c
4359 }
4360
4361 // Fields allows partial responses to be retrieved. See
4362 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
4363 // details.
4364 func (c *ProjectsLocationsTranslateDocumentCall) Fields(s ...googleapi.Field) *ProjectsLocationsTranslateDocumentCall {
4365 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4366 return c
4367 }
4368
4369 // Context sets the context to be used in this call's Do method.
4370 func (c *ProjectsLocationsTranslateDocumentCall) Context(ctx context.Context) *ProjectsLocationsTranslateDocumentCall {
4371 c.ctx_ = ctx
4372 return c
4373 }
4374
4375 // Header returns a http.Header that can be modified by the caller to add
4376 // headers to the request.
4377 func (c *ProjectsLocationsTranslateDocumentCall) Header() http.Header {
4378 if c.header_ == nil {
4379 c.header_ = make(http.Header)
4380 }
4381 return c.header_
4382 }
4383
4384 func (c *ProjectsLocationsTranslateDocumentCall) doRequest(alt string) (*http.Response, error) {
4385 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
4386 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.translatedocumentrequest)
4387 if err != nil {
4388 return nil, err
4389 }
4390 c.urlParams_.Set("alt", alt)
4391 c.urlParams_.Set("prettyPrint", "false")
4392 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}:translateDocument")
4393 urls += "?" + c.urlParams_.Encode()
4394 req, err := http.NewRequest("POST", urls, body)
4395 if err != nil {
4396 return nil, err
4397 }
4398 req.Header = reqHeaders
4399 googleapi.Expand(req.URL, map[string]string{
4400 "parent": c.parent,
4401 })
4402 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.translateDocument", "request", internallog.HTTPRequest(req, body.Bytes()))
4403 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4404 }
4405
4406 // Do executes the "translate.projects.locations.translateDocument" call.
4407 // Any non-2xx status code is an error. Response headers are in either
4408 // *TranslateDocumentResponse.ServerResponse.Header or (if a response was
4409 // returned at all) in error.(*googleapi.Error).Header. Use
4410 // googleapi.IsNotModified to check whether the returned error was because
4411 // http.StatusNotModified was returned.
4412 func (c *ProjectsLocationsTranslateDocumentCall) Do(opts ...googleapi.CallOption) (*TranslateDocumentResponse, error) {
4413 gensupport.SetOptions(c.urlParams_, opts...)
4414 res, err := c.doRequest("json")
4415 if res != nil && res.StatusCode == http.StatusNotModified {
4416 if res.Body != nil {
4417 res.Body.Close()
4418 }
4419 return nil, gensupport.WrapError(&googleapi.Error{
4420 Code: res.StatusCode,
4421 Header: res.Header,
4422 })
4423 }
4424 if err != nil {
4425 return nil, err
4426 }
4427 defer googleapi.CloseBody(res)
4428 if err := googleapi.CheckResponse(res); err != nil {
4429 return nil, gensupport.WrapError(err)
4430 }
4431 ret := &TranslateDocumentResponse{
4432 ServerResponse: googleapi.ServerResponse{
4433 Header: res.Header,
4434 HTTPStatusCode: res.StatusCode,
4435 },
4436 }
4437 target := &ret
4438 b, err := gensupport.DecodeResponseBytes(target, res)
4439 if err != nil {
4440 return nil, err
4441 }
4442 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.translateDocument", "response", internallog.HTTPResponse(res, b))
4443 return ret, nil
4444 }
4445
4446 type ProjectsLocationsTranslateTextCall struct {
4447 s *Service
4448 parent string
4449 translatetextrequest *TranslateTextRequest
4450 urlParams_ gensupport.URLParams
4451 ctx_ context.Context
4452 header_ http.Header
4453 }
4454
4455 // TranslateText: Translates input text and returns translated text.
4456 //
4457 // - parent: Project or location to make a call. Must refer to a caller's
4458 // project. Format: `projects/{project-number-or-id}` or
4459 // `projects/{project-number-or-id}/locations/{location-id}`. For global
4460 // calls, use `projects/{project-number-or-id}/locations/global` or
4461 // `projects/{project-number-or-id}`. Non-global location is required for
4462 // requests using AutoML models or custom glossaries. Models and glossaries
4463 // must be within the same region (have same location-id), otherwise an
4464 // INVALID_ARGUMENT (400) error is returned.
4465 func (r *ProjectsLocationsService) TranslateText(parent string, translatetextrequest *TranslateTextRequest) *ProjectsLocationsTranslateTextCall {
4466 c := &ProjectsLocationsTranslateTextCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4467 c.parent = parent
4468 c.translatetextrequest = translatetextrequest
4469 return c
4470 }
4471
4472 // Fields allows partial responses to be retrieved. See
4473 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
4474 // details.
4475 func (c *ProjectsLocationsTranslateTextCall) Fields(s ...googleapi.Field) *ProjectsLocationsTranslateTextCall {
4476 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4477 return c
4478 }
4479
4480 // Context sets the context to be used in this call's Do method.
4481 func (c *ProjectsLocationsTranslateTextCall) Context(ctx context.Context) *ProjectsLocationsTranslateTextCall {
4482 c.ctx_ = ctx
4483 return c
4484 }
4485
4486 // Header returns a http.Header that can be modified by the caller to add
4487 // headers to the request.
4488 func (c *ProjectsLocationsTranslateTextCall) Header() http.Header {
4489 if c.header_ == nil {
4490 c.header_ = make(http.Header)
4491 }
4492 return c.header_
4493 }
4494
4495 func (c *ProjectsLocationsTranslateTextCall) doRequest(alt string) (*http.Response, error) {
4496 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
4497 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.translatetextrequest)
4498 if err != nil {
4499 return nil, err
4500 }
4501 c.urlParams_.Set("alt", alt)
4502 c.urlParams_.Set("prettyPrint", "false")
4503 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}:translateText")
4504 urls += "?" + c.urlParams_.Encode()
4505 req, err := http.NewRequest("POST", urls, body)
4506 if err != nil {
4507 return nil, err
4508 }
4509 req.Header = reqHeaders
4510 googleapi.Expand(req.URL, map[string]string{
4511 "parent": c.parent,
4512 })
4513 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.translateText", "request", internallog.HTTPRequest(req, body.Bytes()))
4514 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4515 }
4516
4517 // Do executes the "translate.projects.locations.translateText" call.
4518 // Any non-2xx status code is an error. Response headers are in either
4519 // *TranslateTextResponse.ServerResponse.Header or (if a response was returned
4520 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
4521 // check whether the returned error was because http.StatusNotModified was
4522 // returned.
4523 func (c *ProjectsLocationsTranslateTextCall) Do(opts ...googleapi.CallOption) (*TranslateTextResponse, error) {
4524 gensupport.SetOptions(c.urlParams_, opts...)
4525 res, err := c.doRequest("json")
4526 if res != nil && res.StatusCode == http.StatusNotModified {
4527 if res.Body != nil {
4528 res.Body.Close()
4529 }
4530 return nil, gensupport.WrapError(&googleapi.Error{
4531 Code: res.StatusCode,
4532 Header: res.Header,
4533 })
4534 }
4535 if err != nil {
4536 return nil, err
4537 }
4538 defer googleapi.CloseBody(res)
4539 if err := googleapi.CheckResponse(res); err != nil {
4540 return nil, gensupport.WrapError(err)
4541 }
4542 ret := &TranslateTextResponse{
4543 ServerResponse: googleapi.ServerResponse{
4544 Header: res.Header,
4545 HTTPStatusCode: res.StatusCode,
4546 },
4547 }
4548 target := &ret
4549 b, err := gensupport.DecodeResponseBytes(target, res)
4550 if err != nil {
4551 return nil, err
4552 }
4553 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.translateText", "response", internallog.HTTPResponse(res, b))
4554 return ret, nil
4555 }
4556
4557 type ProjectsLocationsAdaptiveMtDatasetsCreateCall struct {
4558 s *Service
4559 parent string
4560 adaptivemtdataset *AdaptiveMtDataset
4561 urlParams_ gensupport.URLParams
4562 ctx_ context.Context
4563 header_ http.Header
4564 }
4565
4566 // Create: Creates an Adaptive MT dataset.
4567 //
4568 // - parent: Name of the parent project. In form of
4569 // `projects/{project-number-or-id}/locations/{location-id}`.
4570 func (r *ProjectsLocationsAdaptiveMtDatasetsService) Create(parent string, adaptivemtdataset *AdaptiveMtDataset) *ProjectsLocationsAdaptiveMtDatasetsCreateCall {
4571 c := &ProjectsLocationsAdaptiveMtDatasetsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4572 c.parent = parent
4573 c.adaptivemtdataset = adaptivemtdataset
4574 return c
4575 }
4576
4577 // Fields allows partial responses to be retrieved. See
4578 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
4579 // details.
4580 func (c *ProjectsLocationsAdaptiveMtDatasetsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsAdaptiveMtDatasetsCreateCall {
4581 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4582 return c
4583 }
4584
4585 // Context sets the context to be used in this call's Do method.
4586 func (c *ProjectsLocationsAdaptiveMtDatasetsCreateCall) Context(ctx context.Context) *ProjectsLocationsAdaptiveMtDatasetsCreateCall {
4587 c.ctx_ = ctx
4588 return c
4589 }
4590
4591 // Header returns a http.Header that can be modified by the caller to add
4592 // headers to the request.
4593 func (c *ProjectsLocationsAdaptiveMtDatasetsCreateCall) Header() http.Header {
4594 if c.header_ == nil {
4595 c.header_ = make(http.Header)
4596 }
4597 return c.header_
4598 }
4599
4600 func (c *ProjectsLocationsAdaptiveMtDatasetsCreateCall) doRequest(alt string) (*http.Response, error) {
4601 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
4602 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.adaptivemtdataset)
4603 if err != nil {
4604 return nil, err
4605 }
4606 c.urlParams_.Set("alt", alt)
4607 c.urlParams_.Set("prettyPrint", "false")
4608 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/adaptiveMtDatasets")
4609 urls += "?" + c.urlParams_.Encode()
4610 req, err := http.NewRequest("POST", urls, body)
4611 if err != nil {
4612 return nil, err
4613 }
4614 req.Header = reqHeaders
4615 googleapi.Expand(req.URL, map[string]string{
4616 "parent": c.parent,
4617 })
4618 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.create", "request", internallog.HTTPRequest(req, body.Bytes()))
4619 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4620 }
4621
4622 // Do executes the "translate.projects.locations.adaptiveMtDatasets.create" call.
4623 // Any non-2xx status code is an error. Response headers are in either
4624 // *AdaptiveMtDataset.ServerResponse.Header or (if a response was returned at
4625 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
4626 // check whether the returned error was because http.StatusNotModified was
4627 // returned.
4628 func (c *ProjectsLocationsAdaptiveMtDatasetsCreateCall) Do(opts ...googleapi.CallOption) (*AdaptiveMtDataset, error) {
4629 gensupport.SetOptions(c.urlParams_, opts...)
4630 res, err := c.doRequest("json")
4631 if res != nil && res.StatusCode == http.StatusNotModified {
4632 if res.Body != nil {
4633 res.Body.Close()
4634 }
4635 return nil, gensupport.WrapError(&googleapi.Error{
4636 Code: res.StatusCode,
4637 Header: res.Header,
4638 })
4639 }
4640 if err != nil {
4641 return nil, err
4642 }
4643 defer googleapi.CloseBody(res)
4644 if err := googleapi.CheckResponse(res); err != nil {
4645 return nil, gensupport.WrapError(err)
4646 }
4647 ret := &AdaptiveMtDataset{
4648 ServerResponse: googleapi.ServerResponse{
4649 Header: res.Header,
4650 HTTPStatusCode: res.StatusCode,
4651 },
4652 }
4653 target := &ret
4654 b, err := gensupport.DecodeResponseBytes(target, res)
4655 if err != nil {
4656 return nil, err
4657 }
4658 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.create", "response", internallog.HTTPResponse(res, b))
4659 return ret, nil
4660 }
4661
4662 type ProjectsLocationsAdaptiveMtDatasetsDeleteCall struct {
4663 s *Service
4664 name string
4665 urlParams_ gensupport.URLParams
4666 ctx_ context.Context
4667 header_ http.Header
4668 }
4669
4670 // Delete: Deletes an Adaptive MT dataset, including all its entries and
4671 // associated metadata.
4672 //
4673 // - name: Name of the dataset. In the form of
4674 // `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets
4675 // /{adaptive-mt-dataset-id}`.
4676 func (r *ProjectsLocationsAdaptiveMtDatasetsService) Delete(name string) *ProjectsLocationsAdaptiveMtDatasetsDeleteCall {
4677 c := &ProjectsLocationsAdaptiveMtDatasetsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4678 c.name = name
4679 return c
4680 }
4681
4682 // Fields allows partial responses to be retrieved. See
4683 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
4684 // details.
4685 func (c *ProjectsLocationsAdaptiveMtDatasetsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsAdaptiveMtDatasetsDeleteCall {
4686 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4687 return c
4688 }
4689
4690 // Context sets the context to be used in this call's Do method.
4691 func (c *ProjectsLocationsAdaptiveMtDatasetsDeleteCall) Context(ctx context.Context) *ProjectsLocationsAdaptiveMtDatasetsDeleteCall {
4692 c.ctx_ = ctx
4693 return c
4694 }
4695
4696 // Header returns a http.Header that can be modified by the caller to add
4697 // headers to the request.
4698 func (c *ProjectsLocationsAdaptiveMtDatasetsDeleteCall) Header() http.Header {
4699 if c.header_ == nil {
4700 c.header_ = make(http.Header)
4701 }
4702 return c.header_
4703 }
4704
4705 func (c *ProjectsLocationsAdaptiveMtDatasetsDeleteCall) doRequest(alt string) (*http.Response, error) {
4706 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
4707 c.urlParams_.Set("alt", alt)
4708 c.urlParams_.Set("prettyPrint", "false")
4709 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
4710 urls += "?" + c.urlParams_.Encode()
4711 req, err := http.NewRequest("DELETE", urls, nil)
4712 if err != nil {
4713 return nil, err
4714 }
4715 req.Header = reqHeaders
4716 googleapi.Expand(req.URL, map[string]string{
4717 "name": c.name,
4718 })
4719 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.delete", "request", internallog.HTTPRequest(req, nil))
4720 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4721 }
4722
4723 // Do executes the "translate.projects.locations.adaptiveMtDatasets.delete" call.
4724 // Any non-2xx status code is an error. Response headers are in either
4725 // *Empty.ServerResponse.Header or (if a response was returned at all) in
4726 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
4727 // whether the returned error was because http.StatusNotModified was returned.
4728 func (c *ProjectsLocationsAdaptiveMtDatasetsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
4729 gensupport.SetOptions(c.urlParams_, opts...)
4730 res, err := c.doRequest("json")
4731 if res != nil && res.StatusCode == http.StatusNotModified {
4732 if res.Body != nil {
4733 res.Body.Close()
4734 }
4735 return nil, gensupport.WrapError(&googleapi.Error{
4736 Code: res.StatusCode,
4737 Header: res.Header,
4738 })
4739 }
4740 if err != nil {
4741 return nil, err
4742 }
4743 defer googleapi.CloseBody(res)
4744 if err := googleapi.CheckResponse(res); err != nil {
4745 return nil, gensupport.WrapError(err)
4746 }
4747 ret := &Empty{
4748 ServerResponse: googleapi.ServerResponse{
4749 Header: res.Header,
4750 HTTPStatusCode: res.StatusCode,
4751 },
4752 }
4753 target := &ret
4754 b, err := gensupport.DecodeResponseBytes(target, res)
4755 if err != nil {
4756 return nil, err
4757 }
4758 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.delete", "response", internallog.HTTPResponse(res, b))
4759 return ret, nil
4760 }
4761
4762 type ProjectsLocationsAdaptiveMtDatasetsGetCall struct {
4763 s *Service
4764 name string
4765 urlParams_ gensupport.URLParams
4766 ifNoneMatch_ string
4767 ctx_ context.Context
4768 header_ http.Header
4769 }
4770
4771 // Get: Gets the Adaptive MT dataset.
4772 //
4773 // - name: Name of the dataset. In the form of
4774 // `projects/{project-number-or-id}/locations/{location-id}/adaptiveMtDatasets
4775 // /{adaptive-mt-dataset-id}`.
4776 func (r *ProjectsLocationsAdaptiveMtDatasetsService) Get(name string) *ProjectsLocationsAdaptiveMtDatasetsGetCall {
4777 c := &ProjectsLocationsAdaptiveMtDatasetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4778 c.name = name
4779 return c
4780 }
4781
4782 // Fields allows partial responses to be retrieved. See
4783 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
4784 // details.
4785 func (c *ProjectsLocationsAdaptiveMtDatasetsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsAdaptiveMtDatasetsGetCall {
4786 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4787 return c
4788 }
4789
4790 // IfNoneMatch sets an optional parameter which makes the operation fail if the
4791 // object's ETag matches the given value. This is useful for getting updates
4792 // only after the object has changed since the last request.
4793 func (c *ProjectsLocationsAdaptiveMtDatasetsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsAdaptiveMtDatasetsGetCall {
4794 c.ifNoneMatch_ = entityTag
4795 return c
4796 }
4797
4798 // Context sets the context to be used in this call's Do method.
4799 func (c *ProjectsLocationsAdaptiveMtDatasetsGetCall) Context(ctx context.Context) *ProjectsLocationsAdaptiveMtDatasetsGetCall {
4800 c.ctx_ = ctx
4801 return c
4802 }
4803
4804 // Header returns a http.Header that can be modified by the caller to add
4805 // headers to the request.
4806 func (c *ProjectsLocationsAdaptiveMtDatasetsGetCall) Header() http.Header {
4807 if c.header_ == nil {
4808 c.header_ = make(http.Header)
4809 }
4810 return c.header_
4811 }
4812
4813 func (c *ProjectsLocationsAdaptiveMtDatasetsGetCall) doRequest(alt string) (*http.Response, error) {
4814 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
4815 if c.ifNoneMatch_ != "" {
4816 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
4817 }
4818 c.urlParams_.Set("alt", alt)
4819 c.urlParams_.Set("prettyPrint", "false")
4820 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
4821 urls += "?" + c.urlParams_.Encode()
4822 req, err := http.NewRequest("GET", urls, nil)
4823 if err != nil {
4824 return nil, err
4825 }
4826 req.Header = reqHeaders
4827 googleapi.Expand(req.URL, map[string]string{
4828 "name": c.name,
4829 })
4830 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.get", "request", internallog.HTTPRequest(req, nil))
4831 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4832 }
4833
4834 // Do executes the "translate.projects.locations.adaptiveMtDatasets.get" call.
4835 // Any non-2xx status code is an error. Response headers are in either
4836 // *AdaptiveMtDataset.ServerResponse.Header or (if a response was returned at
4837 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
4838 // check whether the returned error was because http.StatusNotModified was
4839 // returned.
4840 func (c *ProjectsLocationsAdaptiveMtDatasetsGetCall) Do(opts ...googleapi.CallOption) (*AdaptiveMtDataset, error) {
4841 gensupport.SetOptions(c.urlParams_, opts...)
4842 res, err := c.doRequest("json")
4843 if res != nil && res.StatusCode == http.StatusNotModified {
4844 if res.Body != nil {
4845 res.Body.Close()
4846 }
4847 return nil, gensupport.WrapError(&googleapi.Error{
4848 Code: res.StatusCode,
4849 Header: res.Header,
4850 })
4851 }
4852 if err != nil {
4853 return nil, err
4854 }
4855 defer googleapi.CloseBody(res)
4856 if err := googleapi.CheckResponse(res); err != nil {
4857 return nil, gensupport.WrapError(err)
4858 }
4859 ret := &AdaptiveMtDataset{
4860 ServerResponse: googleapi.ServerResponse{
4861 Header: res.Header,
4862 HTTPStatusCode: res.StatusCode,
4863 },
4864 }
4865 target := &ret
4866 b, err := gensupport.DecodeResponseBytes(target, res)
4867 if err != nil {
4868 return nil, err
4869 }
4870 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.get", "response", internallog.HTTPResponse(res, b))
4871 return ret, nil
4872 }
4873
4874 type ProjectsLocationsAdaptiveMtDatasetsImportAdaptiveMtFileCall struct {
4875 s *Service
4876 parent string
4877 importadaptivemtfilerequest *ImportAdaptiveMtFileRequest
4878 urlParams_ gensupport.URLParams
4879 ctx_ context.Context
4880 header_ http.Header
4881 }
4882
4883 // ImportAdaptiveMtFile: Imports an AdaptiveMtFile and adds all of its
4884 // sentences into the AdaptiveMtDataset.
4885 //
4886 // - parent: The resource name of the file, in form of
4887 // `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets
4888 // /{dataset}`.
4889 func (r *ProjectsLocationsAdaptiveMtDatasetsService) ImportAdaptiveMtFile(parent string, importadaptivemtfilerequest *ImportAdaptiveMtFileRequest) *ProjectsLocationsAdaptiveMtDatasetsImportAdaptiveMtFileCall {
4890 c := &ProjectsLocationsAdaptiveMtDatasetsImportAdaptiveMtFileCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4891 c.parent = parent
4892 c.importadaptivemtfilerequest = importadaptivemtfilerequest
4893 return c
4894 }
4895
4896 // Fields allows partial responses to be retrieved. See
4897 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
4898 // details.
4899 func (c *ProjectsLocationsAdaptiveMtDatasetsImportAdaptiveMtFileCall) Fields(s ...googleapi.Field) *ProjectsLocationsAdaptiveMtDatasetsImportAdaptiveMtFileCall {
4900 c.urlParams_.Set("fields", googleapi.CombineFields(s))
4901 return c
4902 }
4903
4904 // Context sets the context to be used in this call's Do method.
4905 func (c *ProjectsLocationsAdaptiveMtDatasetsImportAdaptiveMtFileCall) Context(ctx context.Context) *ProjectsLocationsAdaptiveMtDatasetsImportAdaptiveMtFileCall {
4906 c.ctx_ = ctx
4907 return c
4908 }
4909
4910 // Header returns a http.Header that can be modified by the caller to add
4911 // headers to the request.
4912 func (c *ProjectsLocationsAdaptiveMtDatasetsImportAdaptiveMtFileCall) Header() http.Header {
4913 if c.header_ == nil {
4914 c.header_ = make(http.Header)
4915 }
4916 return c.header_
4917 }
4918
4919 func (c *ProjectsLocationsAdaptiveMtDatasetsImportAdaptiveMtFileCall) doRequest(alt string) (*http.Response, error) {
4920 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
4921 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.importadaptivemtfilerequest)
4922 if err != nil {
4923 return nil, err
4924 }
4925 c.urlParams_.Set("alt", alt)
4926 c.urlParams_.Set("prettyPrint", "false")
4927 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}:importAdaptiveMtFile")
4928 urls += "?" + c.urlParams_.Encode()
4929 req, err := http.NewRequest("POST", urls, body)
4930 if err != nil {
4931 return nil, err
4932 }
4933 req.Header = reqHeaders
4934 googleapi.Expand(req.URL, map[string]string{
4935 "parent": c.parent,
4936 })
4937 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.importAdaptiveMtFile", "request", internallog.HTTPRequest(req, body.Bytes()))
4938 return gensupport.SendRequest(c.ctx_, c.s.client, req)
4939 }
4940
4941 // Do executes the "translate.projects.locations.adaptiveMtDatasets.importAdaptiveMtFile" call.
4942 // Any non-2xx status code is an error. Response headers are in either
4943 // *ImportAdaptiveMtFileResponse.ServerResponse.Header or (if a response was
4944 // returned at all) in error.(*googleapi.Error).Header. Use
4945 // googleapi.IsNotModified to check whether the returned error was because
4946 // http.StatusNotModified was returned.
4947 func (c *ProjectsLocationsAdaptiveMtDatasetsImportAdaptiveMtFileCall) Do(opts ...googleapi.CallOption) (*ImportAdaptiveMtFileResponse, error) {
4948 gensupport.SetOptions(c.urlParams_, opts...)
4949 res, err := c.doRequest("json")
4950 if res != nil && res.StatusCode == http.StatusNotModified {
4951 if res.Body != nil {
4952 res.Body.Close()
4953 }
4954 return nil, gensupport.WrapError(&googleapi.Error{
4955 Code: res.StatusCode,
4956 Header: res.Header,
4957 })
4958 }
4959 if err != nil {
4960 return nil, err
4961 }
4962 defer googleapi.CloseBody(res)
4963 if err := googleapi.CheckResponse(res); err != nil {
4964 return nil, gensupport.WrapError(err)
4965 }
4966 ret := &ImportAdaptiveMtFileResponse{
4967 ServerResponse: googleapi.ServerResponse{
4968 Header: res.Header,
4969 HTTPStatusCode: res.StatusCode,
4970 },
4971 }
4972 target := &ret
4973 b, err := gensupport.DecodeResponseBytes(target, res)
4974 if err != nil {
4975 return nil, err
4976 }
4977 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.importAdaptiveMtFile", "response", internallog.HTTPResponse(res, b))
4978 return ret, nil
4979 }
4980
4981 type ProjectsLocationsAdaptiveMtDatasetsListCall struct {
4982 s *Service
4983 parent string
4984 urlParams_ gensupport.URLParams
4985 ifNoneMatch_ string
4986 ctx_ context.Context
4987 header_ http.Header
4988 }
4989
4990 // List: Lists all Adaptive MT datasets for which the caller has read
4991 // permission.
4992 //
4993 // - parent: The resource name of the project from which to list the Adaptive
4994 // MT datasets. `projects/{project-number-or-id}/locations/{location-id}`.
4995 func (r *ProjectsLocationsAdaptiveMtDatasetsService) List(parent string) *ProjectsLocationsAdaptiveMtDatasetsListCall {
4996 c := &ProjectsLocationsAdaptiveMtDatasetsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4997 c.parent = parent
4998 return c
4999 }
5000
5001 // Filter sets the optional parameter "filter": An expression for filtering the
5002 // results of the request. Filter is not supported yet.
5003 func (c *ProjectsLocationsAdaptiveMtDatasetsListCall) Filter(filter string) *ProjectsLocationsAdaptiveMtDatasetsListCall {
5004 c.urlParams_.Set("filter", filter)
5005 return c
5006 }
5007
5008 // PageSize sets the optional parameter "pageSize": Requested page size. The
5009 // server may return fewer results than requested. If unspecified, the server
5010 // picks an appropriate default.
5011 func (c *ProjectsLocationsAdaptiveMtDatasetsListCall) PageSize(pageSize int64) *ProjectsLocationsAdaptiveMtDatasetsListCall {
5012 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
5013 return c
5014 }
5015
5016 // PageToken sets the optional parameter "pageToken": A token identifying a
5017 // page of results the server should return. Typically, this is the value of
5018 // ListAdaptiveMtDatasetsResponse.next_page_token returned from the previous
5019 // call to `ListAdaptiveMtDatasets` method. The first page is returned if
5020 // `page_token`is empty or missing.
5021 func (c *ProjectsLocationsAdaptiveMtDatasetsListCall) PageToken(pageToken string) *ProjectsLocationsAdaptiveMtDatasetsListCall {
5022 c.urlParams_.Set("pageToken", pageToken)
5023 return c
5024 }
5025
5026 // Fields allows partial responses to be retrieved. See
5027 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
5028 // details.
5029 func (c *ProjectsLocationsAdaptiveMtDatasetsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsAdaptiveMtDatasetsListCall {
5030 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5031 return c
5032 }
5033
5034 // IfNoneMatch sets an optional parameter which makes the operation fail if the
5035 // object's ETag matches the given value. This is useful for getting updates
5036 // only after the object has changed since the last request.
5037 func (c *ProjectsLocationsAdaptiveMtDatasetsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsAdaptiveMtDatasetsListCall {
5038 c.ifNoneMatch_ = entityTag
5039 return c
5040 }
5041
5042 // Context sets the context to be used in this call's Do method.
5043 func (c *ProjectsLocationsAdaptiveMtDatasetsListCall) Context(ctx context.Context) *ProjectsLocationsAdaptiveMtDatasetsListCall {
5044 c.ctx_ = ctx
5045 return c
5046 }
5047
5048 // Header returns a http.Header that can be modified by the caller to add
5049 // headers to the request.
5050 func (c *ProjectsLocationsAdaptiveMtDatasetsListCall) Header() http.Header {
5051 if c.header_ == nil {
5052 c.header_ = make(http.Header)
5053 }
5054 return c.header_
5055 }
5056
5057 func (c *ProjectsLocationsAdaptiveMtDatasetsListCall) doRequest(alt string) (*http.Response, error) {
5058 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5059 if c.ifNoneMatch_ != "" {
5060 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
5061 }
5062 c.urlParams_.Set("alt", alt)
5063 c.urlParams_.Set("prettyPrint", "false")
5064 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/adaptiveMtDatasets")
5065 urls += "?" + c.urlParams_.Encode()
5066 req, err := http.NewRequest("GET", urls, nil)
5067 if err != nil {
5068 return nil, err
5069 }
5070 req.Header = reqHeaders
5071 googleapi.Expand(req.URL, map[string]string{
5072 "parent": c.parent,
5073 })
5074 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.list", "request", internallog.HTTPRequest(req, nil))
5075 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5076 }
5077
5078 // Do executes the "translate.projects.locations.adaptiveMtDatasets.list" call.
5079 // Any non-2xx status code is an error. Response headers are in either
5080 // *ListAdaptiveMtDatasetsResponse.ServerResponse.Header or (if a response was
5081 // returned at all) in error.(*googleapi.Error).Header. Use
5082 // googleapi.IsNotModified to check whether the returned error was because
5083 // http.StatusNotModified was returned.
5084 func (c *ProjectsLocationsAdaptiveMtDatasetsListCall) Do(opts ...googleapi.CallOption) (*ListAdaptiveMtDatasetsResponse, error) {
5085 gensupport.SetOptions(c.urlParams_, opts...)
5086 res, err := c.doRequest("json")
5087 if res != nil && res.StatusCode == http.StatusNotModified {
5088 if res.Body != nil {
5089 res.Body.Close()
5090 }
5091 return nil, gensupport.WrapError(&googleapi.Error{
5092 Code: res.StatusCode,
5093 Header: res.Header,
5094 })
5095 }
5096 if err != nil {
5097 return nil, err
5098 }
5099 defer googleapi.CloseBody(res)
5100 if err := googleapi.CheckResponse(res); err != nil {
5101 return nil, gensupport.WrapError(err)
5102 }
5103 ret := &ListAdaptiveMtDatasetsResponse{
5104 ServerResponse: googleapi.ServerResponse{
5105 Header: res.Header,
5106 HTTPStatusCode: res.StatusCode,
5107 },
5108 }
5109 target := &ret
5110 b, err := gensupport.DecodeResponseBytes(target, res)
5111 if err != nil {
5112 return nil, err
5113 }
5114 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.list", "response", internallog.HTTPResponse(res, b))
5115 return ret, nil
5116 }
5117
5118 // Pages invokes f for each page of results.
5119 // A non-nil error returned from f will halt the iteration.
5120 // The provided context supersedes any context provided to the Context method.
5121 func (c *ProjectsLocationsAdaptiveMtDatasetsListCall) Pages(ctx context.Context, f func(*ListAdaptiveMtDatasetsResponse) error) error {
5122 c.ctx_ = ctx
5123 defer c.PageToken(c.urlParams_.Get("pageToken"))
5124 for {
5125 x, err := c.Do()
5126 if err != nil {
5127 return err
5128 }
5129 if err := f(x); err != nil {
5130 return err
5131 }
5132 if x.NextPageToken == "" {
5133 return nil
5134 }
5135 c.PageToken(x.NextPageToken)
5136 }
5137 }
5138
5139 type ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesDeleteCall struct {
5140 s *Service
5141 name string
5142 urlParams_ gensupport.URLParams
5143 ctx_ context.Context
5144 header_ http.Header
5145 }
5146
5147 // Delete: Deletes an AdaptiveMtFile along with its sentences.
5148 //
5149 // - name: The resource name of the file to delete, in form of
5150 // `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets
5151 // /{dataset}/adaptiveMtFiles/{file}`.
5152 func (r *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesService) Delete(name string) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesDeleteCall {
5153 c := &ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5154 c.name = name
5155 return c
5156 }
5157
5158 // Fields allows partial responses to be retrieved. See
5159 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
5160 // details.
5161 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesDeleteCall {
5162 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5163 return c
5164 }
5165
5166 // Context sets the context to be used in this call's Do method.
5167 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesDeleteCall) Context(ctx context.Context) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesDeleteCall {
5168 c.ctx_ = ctx
5169 return c
5170 }
5171
5172 // Header returns a http.Header that can be modified by the caller to add
5173 // headers to the request.
5174 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesDeleteCall) Header() http.Header {
5175 if c.header_ == nil {
5176 c.header_ = make(http.Header)
5177 }
5178 return c.header_
5179 }
5180
5181 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesDeleteCall) doRequest(alt string) (*http.Response, error) {
5182 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5183 c.urlParams_.Set("alt", alt)
5184 c.urlParams_.Set("prettyPrint", "false")
5185 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
5186 urls += "?" + c.urlParams_.Encode()
5187 req, err := http.NewRequest("DELETE", urls, nil)
5188 if err != nil {
5189 return nil, err
5190 }
5191 req.Header = reqHeaders
5192 googleapi.Expand(req.URL, map[string]string{
5193 "name": c.name,
5194 })
5195 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.delete", "request", internallog.HTTPRequest(req, nil))
5196 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5197 }
5198
5199 // Do executes the "translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.delete" call.
5200 // Any non-2xx status code is an error. Response headers are in either
5201 // *Empty.ServerResponse.Header or (if a response was returned at all) in
5202 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
5203 // whether the returned error was because http.StatusNotModified was returned.
5204 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
5205 gensupport.SetOptions(c.urlParams_, opts...)
5206 res, err := c.doRequest("json")
5207 if res != nil && res.StatusCode == http.StatusNotModified {
5208 if res.Body != nil {
5209 res.Body.Close()
5210 }
5211 return nil, gensupport.WrapError(&googleapi.Error{
5212 Code: res.StatusCode,
5213 Header: res.Header,
5214 })
5215 }
5216 if err != nil {
5217 return nil, err
5218 }
5219 defer googleapi.CloseBody(res)
5220 if err := googleapi.CheckResponse(res); err != nil {
5221 return nil, gensupport.WrapError(err)
5222 }
5223 ret := &Empty{
5224 ServerResponse: googleapi.ServerResponse{
5225 Header: res.Header,
5226 HTTPStatusCode: res.StatusCode,
5227 },
5228 }
5229 target := &ret
5230 b, err := gensupport.DecodeResponseBytes(target, res)
5231 if err != nil {
5232 return nil, err
5233 }
5234 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.delete", "response", internallog.HTTPResponse(res, b))
5235 return ret, nil
5236 }
5237
5238 type ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesGetCall struct {
5239 s *Service
5240 name string
5241 urlParams_ gensupport.URLParams
5242 ifNoneMatch_ string
5243 ctx_ context.Context
5244 header_ http.Header
5245 }
5246
5247 // Get: Gets and AdaptiveMtFile
5248 //
5249 // - name: The resource name of the file, in form of
5250 // `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets
5251 // /{dataset}/adaptiveMtFiles/{file}`.
5252 func (r *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesService) Get(name string) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesGetCall {
5253 c := &ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5254 c.name = name
5255 return c
5256 }
5257
5258 // Fields allows partial responses to be retrieved. See
5259 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
5260 // details.
5261 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesGetCall {
5262 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5263 return c
5264 }
5265
5266 // IfNoneMatch sets an optional parameter which makes the operation fail if the
5267 // object's ETag matches the given value. This is useful for getting updates
5268 // only after the object has changed since the last request.
5269 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesGetCall {
5270 c.ifNoneMatch_ = entityTag
5271 return c
5272 }
5273
5274 // Context sets the context to be used in this call's Do method.
5275 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesGetCall) Context(ctx context.Context) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesGetCall {
5276 c.ctx_ = ctx
5277 return c
5278 }
5279
5280 // Header returns a http.Header that can be modified by the caller to add
5281 // headers to the request.
5282 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesGetCall) Header() http.Header {
5283 if c.header_ == nil {
5284 c.header_ = make(http.Header)
5285 }
5286 return c.header_
5287 }
5288
5289 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesGetCall) doRequest(alt string) (*http.Response, error) {
5290 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5291 if c.ifNoneMatch_ != "" {
5292 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
5293 }
5294 c.urlParams_.Set("alt", alt)
5295 c.urlParams_.Set("prettyPrint", "false")
5296 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
5297 urls += "?" + c.urlParams_.Encode()
5298 req, err := http.NewRequest("GET", urls, nil)
5299 if err != nil {
5300 return nil, err
5301 }
5302 req.Header = reqHeaders
5303 googleapi.Expand(req.URL, map[string]string{
5304 "name": c.name,
5305 })
5306 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.get", "request", internallog.HTTPRequest(req, nil))
5307 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5308 }
5309
5310 // Do executes the "translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.get" call.
5311 // Any non-2xx status code is an error. Response headers are in either
5312 // *AdaptiveMtFile.ServerResponse.Header or (if a response was returned at all)
5313 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
5314 // whether the returned error was because http.StatusNotModified was returned.
5315 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesGetCall) Do(opts ...googleapi.CallOption) (*AdaptiveMtFile, error) {
5316 gensupport.SetOptions(c.urlParams_, opts...)
5317 res, err := c.doRequest("json")
5318 if res != nil && res.StatusCode == http.StatusNotModified {
5319 if res.Body != nil {
5320 res.Body.Close()
5321 }
5322 return nil, gensupport.WrapError(&googleapi.Error{
5323 Code: res.StatusCode,
5324 Header: res.Header,
5325 })
5326 }
5327 if err != nil {
5328 return nil, err
5329 }
5330 defer googleapi.CloseBody(res)
5331 if err := googleapi.CheckResponse(res); err != nil {
5332 return nil, gensupport.WrapError(err)
5333 }
5334 ret := &AdaptiveMtFile{
5335 ServerResponse: googleapi.ServerResponse{
5336 Header: res.Header,
5337 HTTPStatusCode: res.StatusCode,
5338 },
5339 }
5340 target := &ret
5341 b, err := gensupport.DecodeResponseBytes(target, res)
5342 if err != nil {
5343 return nil, err
5344 }
5345 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.get", "response", internallog.HTTPResponse(res, b))
5346 return ret, nil
5347 }
5348
5349 type ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall struct {
5350 s *Service
5351 parent string
5352 urlParams_ gensupport.URLParams
5353 ifNoneMatch_ string
5354 ctx_ context.Context
5355 header_ http.Header
5356 }
5357
5358 // List: Lists all AdaptiveMtFiles associated to an AdaptiveMtDataset.
5359 //
5360 // - parent: The resource name of the dataset from which to list the Adaptive
5361 // MT files.
5362 // `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`.
5363 func (r *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesService) List(parent string) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall {
5364 c := &ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5365 c.parent = parent
5366 return c
5367 }
5368
5369 // PageSize sets the optional parameter "pageSize":
5370 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall) PageSize(pageSize int64) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall {
5371 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
5372 return c
5373 }
5374
5375 // PageToken sets the optional parameter "pageToken": A token identifying a
5376 // page of results the server should return. Typically, this is the value of
5377 // ListAdaptiveMtFilesResponse.next_page_token returned from the previous call
5378 // to `ListAdaptiveMtFiles` method. The first page is returned if
5379 // `page_token`is empty or missing.
5380 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall) PageToken(pageToken string) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall {
5381 c.urlParams_.Set("pageToken", pageToken)
5382 return c
5383 }
5384
5385 // Fields allows partial responses to be retrieved. See
5386 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
5387 // details.
5388 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall {
5389 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5390 return c
5391 }
5392
5393 // IfNoneMatch sets an optional parameter which makes the operation fail if the
5394 // object's ETag matches the given value. This is useful for getting updates
5395 // only after the object has changed since the last request.
5396 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall {
5397 c.ifNoneMatch_ = entityTag
5398 return c
5399 }
5400
5401 // Context sets the context to be used in this call's Do method.
5402 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall) Context(ctx context.Context) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall {
5403 c.ctx_ = ctx
5404 return c
5405 }
5406
5407 // Header returns a http.Header that can be modified by the caller to add
5408 // headers to the request.
5409 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall) Header() http.Header {
5410 if c.header_ == nil {
5411 c.header_ = make(http.Header)
5412 }
5413 return c.header_
5414 }
5415
5416 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall) doRequest(alt string) (*http.Response, error) {
5417 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5418 if c.ifNoneMatch_ != "" {
5419 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
5420 }
5421 c.urlParams_.Set("alt", alt)
5422 c.urlParams_.Set("prettyPrint", "false")
5423 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/adaptiveMtFiles")
5424 urls += "?" + c.urlParams_.Encode()
5425 req, err := http.NewRequest("GET", urls, nil)
5426 if err != nil {
5427 return nil, err
5428 }
5429 req.Header = reqHeaders
5430 googleapi.Expand(req.URL, map[string]string{
5431 "parent": c.parent,
5432 })
5433 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.list", "request", internallog.HTTPRequest(req, nil))
5434 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5435 }
5436
5437 // Do executes the "translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.list" call.
5438 // Any non-2xx status code is an error. Response headers are in either
5439 // *ListAdaptiveMtFilesResponse.ServerResponse.Header or (if a response was
5440 // returned at all) in error.(*googleapi.Error).Header. Use
5441 // googleapi.IsNotModified to check whether the returned error was because
5442 // http.StatusNotModified was returned.
5443 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall) Do(opts ...googleapi.CallOption) (*ListAdaptiveMtFilesResponse, error) {
5444 gensupport.SetOptions(c.urlParams_, opts...)
5445 res, err := c.doRequest("json")
5446 if res != nil && res.StatusCode == http.StatusNotModified {
5447 if res.Body != nil {
5448 res.Body.Close()
5449 }
5450 return nil, gensupport.WrapError(&googleapi.Error{
5451 Code: res.StatusCode,
5452 Header: res.Header,
5453 })
5454 }
5455 if err != nil {
5456 return nil, err
5457 }
5458 defer googleapi.CloseBody(res)
5459 if err := googleapi.CheckResponse(res); err != nil {
5460 return nil, gensupport.WrapError(err)
5461 }
5462 ret := &ListAdaptiveMtFilesResponse{
5463 ServerResponse: googleapi.ServerResponse{
5464 Header: res.Header,
5465 HTTPStatusCode: res.StatusCode,
5466 },
5467 }
5468 target := &ret
5469 b, err := gensupport.DecodeResponseBytes(target, res)
5470 if err != nil {
5471 return nil, err
5472 }
5473 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.list", "response", internallog.HTTPResponse(res, b))
5474 return ret, nil
5475 }
5476
5477 // Pages invokes f for each page of results.
5478 // A non-nil error returned from f will halt the iteration.
5479 // The provided context supersedes any context provided to the Context method.
5480 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesListCall) Pages(ctx context.Context, f func(*ListAdaptiveMtFilesResponse) error) error {
5481 c.ctx_ = ctx
5482 defer c.PageToken(c.urlParams_.Get("pageToken"))
5483 for {
5484 x, err := c.Do()
5485 if err != nil {
5486 return err
5487 }
5488 if err := f(x); err != nil {
5489 return err
5490 }
5491 if x.NextPageToken == "" {
5492 return nil
5493 }
5494 c.PageToken(x.NextPageToken)
5495 }
5496 }
5497
5498 type ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall struct {
5499 s *Service
5500 parent string
5501 urlParams_ gensupport.URLParams
5502 ifNoneMatch_ string
5503 ctx_ context.Context
5504 header_ http.Header
5505 }
5506
5507 // List: Lists all AdaptiveMtSentences under a given file/dataset.
5508 //
5509 // - parent: The resource name of the Adaptive MT file from which to list the
5510 // sentences. The following format lists all sentences under a file.
5511 // `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adapt
5512 // iveMtFiles/{file}` The following format lists all sentences within a
5513 // dataset.
5514 // `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`.
5515 func (r *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesService) List(parent string) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall {
5516 c := &ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5517 c.parent = parent
5518 return c
5519 }
5520
5521 // PageSize sets the optional parameter "pageSize":
5522 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall) PageSize(pageSize int64) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall {
5523 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
5524 return c
5525 }
5526
5527 // PageToken sets the optional parameter "pageToken": A token identifying a
5528 // page of results the server should return. Typically, this is the value of
5529 // ListAdaptiveMtSentencesRequest.next_page_token returned from the previous
5530 // call to `ListTranslationMemories` method. The first page is returned if
5531 // `page_token` is empty or missing.
5532 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall) PageToken(pageToken string) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall {
5533 c.urlParams_.Set("pageToken", pageToken)
5534 return c
5535 }
5536
5537 // Fields allows partial responses to be retrieved. See
5538 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
5539 // details.
5540 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall {
5541 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5542 return c
5543 }
5544
5545 // IfNoneMatch sets an optional parameter which makes the operation fail if the
5546 // object's ETag matches the given value. This is useful for getting updates
5547 // only after the object has changed since the last request.
5548 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall {
5549 c.ifNoneMatch_ = entityTag
5550 return c
5551 }
5552
5553 // Context sets the context to be used in this call's Do method.
5554 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall) Context(ctx context.Context) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall {
5555 c.ctx_ = ctx
5556 return c
5557 }
5558
5559 // Header returns a http.Header that can be modified by the caller to add
5560 // headers to the request.
5561 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall) Header() http.Header {
5562 if c.header_ == nil {
5563 c.header_ = make(http.Header)
5564 }
5565 return c.header_
5566 }
5567
5568 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall) doRequest(alt string) (*http.Response, error) {
5569 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5570 if c.ifNoneMatch_ != "" {
5571 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
5572 }
5573 c.urlParams_.Set("alt", alt)
5574 c.urlParams_.Set("prettyPrint", "false")
5575 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/adaptiveMtSentences")
5576 urls += "?" + c.urlParams_.Encode()
5577 req, err := http.NewRequest("GET", urls, nil)
5578 if err != nil {
5579 return nil, err
5580 }
5581 req.Header = reqHeaders
5582 googleapi.Expand(req.URL, map[string]string{
5583 "parent": c.parent,
5584 })
5585 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.adaptiveMtSentences.list", "request", internallog.HTTPRequest(req, nil))
5586 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5587 }
5588
5589 // Do executes the "translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.adaptiveMtSentences.list" call.
5590 // Any non-2xx status code is an error. Response headers are in either
5591 // *ListAdaptiveMtSentencesResponse.ServerResponse.Header or (if a response was
5592 // returned at all) in error.(*googleapi.Error).Header. Use
5593 // googleapi.IsNotModified to check whether the returned error was because
5594 // http.StatusNotModified was returned.
5595 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall) Do(opts ...googleapi.CallOption) (*ListAdaptiveMtSentencesResponse, error) {
5596 gensupport.SetOptions(c.urlParams_, opts...)
5597 res, err := c.doRequest("json")
5598 if res != nil && res.StatusCode == http.StatusNotModified {
5599 if res.Body != nil {
5600 res.Body.Close()
5601 }
5602 return nil, gensupport.WrapError(&googleapi.Error{
5603 Code: res.StatusCode,
5604 Header: res.Header,
5605 })
5606 }
5607 if err != nil {
5608 return nil, err
5609 }
5610 defer googleapi.CloseBody(res)
5611 if err := googleapi.CheckResponse(res); err != nil {
5612 return nil, gensupport.WrapError(err)
5613 }
5614 ret := &ListAdaptiveMtSentencesResponse{
5615 ServerResponse: googleapi.ServerResponse{
5616 Header: res.Header,
5617 HTTPStatusCode: res.StatusCode,
5618 },
5619 }
5620 target := &ret
5621 b, err := gensupport.DecodeResponseBytes(target, res)
5622 if err != nil {
5623 return nil, err
5624 }
5625 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.adaptiveMtFiles.adaptiveMtSentences.list", "response", internallog.HTTPResponse(res, b))
5626 return ret, nil
5627 }
5628
5629 // Pages invokes f for each page of results.
5630 // A non-nil error returned from f will halt the iteration.
5631 // The provided context supersedes any context provided to the Context method.
5632 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtFilesAdaptiveMtSentencesListCall) Pages(ctx context.Context, f func(*ListAdaptiveMtSentencesResponse) error) error {
5633 c.ctx_ = ctx
5634 defer c.PageToken(c.urlParams_.Get("pageToken"))
5635 for {
5636 x, err := c.Do()
5637 if err != nil {
5638 return err
5639 }
5640 if err := f(x); err != nil {
5641 return err
5642 }
5643 if x.NextPageToken == "" {
5644 return nil
5645 }
5646 c.PageToken(x.NextPageToken)
5647 }
5648 }
5649
5650 type ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall struct {
5651 s *Service
5652 parent string
5653 urlParams_ gensupport.URLParams
5654 ifNoneMatch_ string
5655 ctx_ context.Context
5656 header_ http.Header
5657 }
5658
5659 // List: Lists all AdaptiveMtSentences under a given file/dataset.
5660 //
5661 // - parent: The resource name of the Adaptive MT file from which to list the
5662 // sentences. The following format lists all sentences under a file.
5663 // `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}/adapt
5664 // iveMtFiles/{file}` The following format lists all sentences within a
5665 // dataset.
5666 // `projects/{project}/locations/{location}/adaptiveMtDatasets/{dataset}`.
5667 func (r *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesService) List(parent string) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall {
5668 c := &ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5669 c.parent = parent
5670 return c
5671 }
5672
5673 // PageSize sets the optional parameter "pageSize":
5674 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall) PageSize(pageSize int64) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall {
5675 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
5676 return c
5677 }
5678
5679 // PageToken sets the optional parameter "pageToken": A token identifying a
5680 // page of results the server should return. Typically, this is the value of
5681 // ListAdaptiveMtSentencesRequest.next_page_token returned from the previous
5682 // call to `ListTranslationMemories` method. The first page is returned if
5683 // `page_token` is empty or missing.
5684 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall) PageToken(pageToken string) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall {
5685 c.urlParams_.Set("pageToken", pageToken)
5686 return c
5687 }
5688
5689 // Fields allows partial responses to be retrieved. See
5690 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
5691 // details.
5692 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall {
5693 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5694 return c
5695 }
5696
5697 // IfNoneMatch sets an optional parameter which makes the operation fail if the
5698 // object's ETag matches the given value. This is useful for getting updates
5699 // only after the object has changed since the last request.
5700 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall {
5701 c.ifNoneMatch_ = entityTag
5702 return c
5703 }
5704
5705 // Context sets the context to be used in this call's Do method.
5706 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall) Context(ctx context.Context) *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall {
5707 c.ctx_ = ctx
5708 return c
5709 }
5710
5711 // Header returns a http.Header that can be modified by the caller to add
5712 // headers to the request.
5713 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall) Header() http.Header {
5714 if c.header_ == nil {
5715 c.header_ = make(http.Header)
5716 }
5717 return c.header_
5718 }
5719
5720 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall) doRequest(alt string) (*http.Response, error) {
5721 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5722 if c.ifNoneMatch_ != "" {
5723 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
5724 }
5725 c.urlParams_.Set("alt", alt)
5726 c.urlParams_.Set("prettyPrint", "false")
5727 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/adaptiveMtSentences")
5728 urls += "?" + c.urlParams_.Encode()
5729 req, err := http.NewRequest("GET", urls, nil)
5730 if err != nil {
5731 return nil, err
5732 }
5733 req.Header = reqHeaders
5734 googleapi.Expand(req.URL, map[string]string{
5735 "parent": c.parent,
5736 })
5737 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.adaptiveMtSentences.list", "request", internallog.HTTPRequest(req, nil))
5738 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5739 }
5740
5741 // Do executes the "translate.projects.locations.adaptiveMtDatasets.adaptiveMtSentences.list" call.
5742 // Any non-2xx status code is an error. Response headers are in either
5743 // *ListAdaptiveMtSentencesResponse.ServerResponse.Header or (if a response was
5744 // returned at all) in error.(*googleapi.Error).Header. Use
5745 // googleapi.IsNotModified to check whether the returned error was because
5746 // http.StatusNotModified was returned.
5747 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall) Do(opts ...googleapi.CallOption) (*ListAdaptiveMtSentencesResponse, error) {
5748 gensupport.SetOptions(c.urlParams_, opts...)
5749 res, err := c.doRequest("json")
5750 if res != nil && res.StatusCode == http.StatusNotModified {
5751 if res.Body != nil {
5752 res.Body.Close()
5753 }
5754 return nil, gensupport.WrapError(&googleapi.Error{
5755 Code: res.StatusCode,
5756 Header: res.Header,
5757 })
5758 }
5759 if err != nil {
5760 return nil, err
5761 }
5762 defer googleapi.CloseBody(res)
5763 if err := googleapi.CheckResponse(res); err != nil {
5764 return nil, gensupport.WrapError(err)
5765 }
5766 ret := &ListAdaptiveMtSentencesResponse{
5767 ServerResponse: googleapi.ServerResponse{
5768 Header: res.Header,
5769 HTTPStatusCode: res.StatusCode,
5770 },
5771 }
5772 target := &ret
5773 b, err := gensupport.DecodeResponseBytes(target, res)
5774 if err != nil {
5775 return nil, err
5776 }
5777 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.adaptiveMtDatasets.adaptiveMtSentences.list", "response", internallog.HTTPResponse(res, b))
5778 return ret, nil
5779 }
5780
5781 // Pages invokes f for each page of results.
5782 // A non-nil error returned from f will halt the iteration.
5783 // The provided context supersedes any context provided to the Context method.
5784 func (c *ProjectsLocationsAdaptiveMtDatasetsAdaptiveMtSentencesListCall) Pages(ctx context.Context, f func(*ListAdaptiveMtSentencesResponse) error) error {
5785 c.ctx_ = ctx
5786 defer c.PageToken(c.urlParams_.Get("pageToken"))
5787 for {
5788 x, err := c.Do()
5789 if err != nil {
5790 return err
5791 }
5792 if err := f(x); err != nil {
5793 return err
5794 }
5795 if x.NextPageToken == "" {
5796 return nil
5797 }
5798 c.PageToken(x.NextPageToken)
5799 }
5800 }
5801
5802 type ProjectsLocationsDatasetsCreateCall struct {
5803 s *Service
5804 parent string
5805 dataset *Dataset
5806 urlParams_ gensupport.URLParams
5807 ctx_ context.Context
5808 header_ http.Header
5809 }
5810
5811 // Create: Creates a Dataset.
5812 //
5813 // - parent: The project name.
5814 func (r *ProjectsLocationsDatasetsService) Create(parent string, dataset *Dataset) *ProjectsLocationsDatasetsCreateCall {
5815 c := &ProjectsLocationsDatasetsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5816 c.parent = parent
5817 c.dataset = dataset
5818 return c
5819 }
5820
5821 // Fields allows partial responses to be retrieved. See
5822 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
5823 // details.
5824 func (c *ProjectsLocationsDatasetsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsDatasetsCreateCall {
5825 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5826 return c
5827 }
5828
5829 // Context sets the context to be used in this call's Do method.
5830 func (c *ProjectsLocationsDatasetsCreateCall) Context(ctx context.Context) *ProjectsLocationsDatasetsCreateCall {
5831 c.ctx_ = ctx
5832 return c
5833 }
5834
5835 // Header returns a http.Header that can be modified by the caller to add
5836 // headers to the request.
5837 func (c *ProjectsLocationsDatasetsCreateCall) Header() http.Header {
5838 if c.header_ == nil {
5839 c.header_ = make(http.Header)
5840 }
5841 return c.header_
5842 }
5843
5844 func (c *ProjectsLocationsDatasetsCreateCall) doRequest(alt string) (*http.Response, error) {
5845 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
5846 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.dataset)
5847 if err != nil {
5848 return nil, err
5849 }
5850 c.urlParams_.Set("alt", alt)
5851 c.urlParams_.Set("prettyPrint", "false")
5852 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/datasets")
5853 urls += "?" + c.urlParams_.Encode()
5854 req, err := http.NewRequest("POST", urls, body)
5855 if err != nil {
5856 return nil, err
5857 }
5858 req.Header = reqHeaders
5859 googleapi.Expand(req.URL, map[string]string{
5860 "parent": c.parent,
5861 })
5862 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.create", "request", internallog.HTTPRequest(req, body.Bytes()))
5863 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5864 }
5865
5866 // Do executes the "translate.projects.locations.datasets.create" call.
5867 // Any non-2xx status code is an error. Response headers are in either
5868 // *Operation.ServerResponse.Header or (if a response was returned at all) in
5869 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
5870 // whether the returned error was because http.StatusNotModified was returned.
5871 func (c *ProjectsLocationsDatasetsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
5872 gensupport.SetOptions(c.urlParams_, opts...)
5873 res, err := c.doRequest("json")
5874 if res != nil && res.StatusCode == http.StatusNotModified {
5875 if res.Body != nil {
5876 res.Body.Close()
5877 }
5878 return nil, gensupport.WrapError(&googleapi.Error{
5879 Code: res.StatusCode,
5880 Header: res.Header,
5881 })
5882 }
5883 if err != nil {
5884 return nil, err
5885 }
5886 defer googleapi.CloseBody(res)
5887 if err := googleapi.CheckResponse(res); err != nil {
5888 return nil, gensupport.WrapError(err)
5889 }
5890 ret := &Operation{
5891 ServerResponse: googleapi.ServerResponse{
5892 Header: res.Header,
5893 HTTPStatusCode: res.StatusCode,
5894 },
5895 }
5896 target := &ret
5897 b, err := gensupport.DecodeResponseBytes(target, res)
5898 if err != nil {
5899 return nil, err
5900 }
5901 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.create", "response", internallog.HTTPResponse(res, b))
5902 return ret, nil
5903 }
5904
5905 type ProjectsLocationsDatasetsDeleteCall struct {
5906 s *Service
5907 name string
5908 urlParams_ gensupport.URLParams
5909 ctx_ context.Context
5910 header_ http.Header
5911 }
5912
5913 // Delete: Deletes a dataset and all of its contents.
5914 //
5915 // - name: The name of the dataset to delete.
5916 func (r *ProjectsLocationsDatasetsService) Delete(name string) *ProjectsLocationsDatasetsDeleteCall {
5917 c := &ProjectsLocationsDatasetsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5918 c.name = name
5919 return c
5920 }
5921
5922 // Fields allows partial responses to be retrieved. See
5923 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
5924 // details.
5925 func (c *ProjectsLocationsDatasetsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsDatasetsDeleteCall {
5926 c.urlParams_.Set("fields", googleapi.CombineFields(s))
5927 return c
5928 }
5929
5930 // Context sets the context to be used in this call's Do method.
5931 func (c *ProjectsLocationsDatasetsDeleteCall) Context(ctx context.Context) *ProjectsLocationsDatasetsDeleteCall {
5932 c.ctx_ = ctx
5933 return c
5934 }
5935
5936 // Header returns a http.Header that can be modified by the caller to add
5937 // headers to the request.
5938 func (c *ProjectsLocationsDatasetsDeleteCall) Header() http.Header {
5939 if c.header_ == nil {
5940 c.header_ = make(http.Header)
5941 }
5942 return c.header_
5943 }
5944
5945 func (c *ProjectsLocationsDatasetsDeleteCall) doRequest(alt string) (*http.Response, error) {
5946 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
5947 c.urlParams_.Set("alt", alt)
5948 c.urlParams_.Set("prettyPrint", "false")
5949 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
5950 urls += "?" + c.urlParams_.Encode()
5951 req, err := http.NewRequest("DELETE", urls, nil)
5952 if err != nil {
5953 return nil, err
5954 }
5955 req.Header = reqHeaders
5956 googleapi.Expand(req.URL, map[string]string{
5957 "name": c.name,
5958 })
5959 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.delete", "request", internallog.HTTPRequest(req, nil))
5960 return gensupport.SendRequest(c.ctx_, c.s.client, req)
5961 }
5962
5963 // Do executes the "translate.projects.locations.datasets.delete" call.
5964 // Any non-2xx status code is an error. Response headers are in either
5965 // *Operation.ServerResponse.Header or (if a response was returned at all) in
5966 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
5967 // whether the returned error was because http.StatusNotModified was returned.
5968 func (c *ProjectsLocationsDatasetsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
5969 gensupport.SetOptions(c.urlParams_, opts...)
5970 res, err := c.doRequest("json")
5971 if res != nil && res.StatusCode == http.StatusNotModified {
5972 if res.Body != nil {
5973 res.Body.Close()
5974 }
5975 return nil, gensupport.WrapError(&googleapi.Error{
5976 Code: res.StatusCode,
5977 Header: res.Header,
5978 })
5979 }
5980 if err != nil {
5981 return nil, err
5982 }
5983 defer googleapi.CloseBody(res)
5984 if err := googleapi.CheckResponse(res); err != nil {
5985 return nil, gensupport.WrapError(err)
5986 }
5987 ret := &Operation{
5988 ServerResponse: googleapi.ServerResponse{
5989 Header: res.Header,
5990 HTTPStatusCode: res.StatusCode,
5991 },
5992 }
5993 target := &ret
5994 b, err := gensupport.DecodeResponseBytes(target, res)
5995 if err != nil {
5996 return nil, err
5997 }
5998 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.delete", "response", internallog.HTTPResponse(res, b))
5999 return ret, nil
6000 }
6001
6002 type ProjectsLocationsDatasetsExportDataCall struct {
6003 s *Service
6004 dataset string
6005 exportdatarequest *ExportDataRequest
6006 urlParams_ gensupport.URLParams
6007 ctx_ context.Context
6008 header_ http.Header
6009 }
6010
6011 // ExportData: Exports dataset's data to the provided output location.
6012 //
6013 // - dataset: Name of the dataset. In form of
6014 // `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-
6015 // id}`.
6016 func (r *ProjectsLocationsDatasetsService) ExportData(dataset string, exportdatarequest *ExportDataRequest) *ProjectsLocationsDatasetsExportDataCall {
6017 c := &ProjectsLocationsDatasetsExportDataCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6018 c.dataset = dataset
6019 c.exportdatarequest = exportdatarequest
6020 return c
6021 }
6022
6023 // Fields allows partial responses to be retrieved. See
6024 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
6025 // details.
6026 func (c *ProjectsLocationsDatasetsExportDataCall) Fields(s ...googleapi.Field) *ProjectsLocationsDatasetsExportDataCall {
6027 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6028 return c
6029 }
6030
6031 // Context sets the context to be used in this call's Do method.
6032 func (c *ProjectsLocationsDatasetsExportDataCall) Context(ctx context.Context) *ProjectsLocationsDatasetsExportDataCall {
6033 c.ctx_ = ctx
6034 return c
6035 }
6036
6037 // Header returns a http.Header that can be modified by the caller to add
6038 // headers to the request.
6039 func (c *ProjectsLocationsDatasetsExportDataCall) Header() http.Header {
6040 if c.header_ == nil {
6041 c.header_ = make(http.Header)
6042 }
6043 return c.header_
6044 }
6045
6046 func (c *ProjectsLocationsDatasetsExportDataCall) doRequest(alt string) (*http.Response, error) {
6047 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
6048 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.exportdatarequest)
6049 if err != nil {
6050 return nil, err
6051 }
6052 c.urlParams_.Set("alt", alt)
6053 c.urlParams_.Set("prettyPrint", "false")
6054 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+dataset}:exportData")
6055 urls += "?" + c.urlParams_.Encode()
6056 req, err := http.NewRequest("POST", urls, body)
6057 if err != nil {
6058 return nil, err
6059 }
6060 req.Header = reqHeaders
6061 googleapi.Expand(req.URL, map[string]string{
6062 "dataset": c.dataset,
6063 })
6064 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.exportData", "request", internallog.HTTPRequest(req, body.Bytes()))
6065 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6066 }
6067
6068 // Do executes the "translate.projects.locations.datasets.exportData" call.
6069 // Any non-2xx status code is an error. Response headers are in either
6070 // *Operation.ServerResponse.Header or (if a response was returned at all) in
6071 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
6072 // whether the returned error was because http.StatusNotModified was returned.
6073 func (c *ProjectsLocationsDatasetsExportDataCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
6074 gensupport.SetOptions(c.urlParams_, opts...)
6075 res, err := c.doRequest("json")
6076 if res != nil && res.StatusCode == http.StatusNotModified {
6077 if res.Body != nil {
6078 res.Body.Close()
6079 }
6080 return nil, gensupport.WrapError(&googleapi.Error{
6081 Code: res.StatusCode,
6082 Header: res.Header,
6083 })
6084 }
6085 if err != nil {
6086 return nil, err
6087 }
6088 defer googleapi.CloseBody(res)
6089 if err := googleapi.CheckResponse(res); err != nil {
6090 return nil, gensupport.WrapError(err)
6091 }
6092 ret := &Operation{
6093 ServerResponse: googleapi.ServerResponse{
6094 Header: res.Header,
6095 HTTPStatusCode: res.StatusCode,
6096 },
6097 }
6098 target := &ret
6099 b, err := gensupport.DecodeResponseBytes(target, res)
6100 if err != nil {
6101 return nil, err
6102 }
6103 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.exportData", "response", internallog.HTTPResponse(res, b))
6104 return ret, nil
6105 }
6106
6107 type ProjectsLocationsDatasetsGetCall struct {
6108 s *Service
6109 name string
6110 urlParams_ gensupport.URLParams
6111 ifNoneMatch_ string
6112 ctx_ context.Context
6113 header_ http.Header
6114 }
6115
6116 // Get: Gets a Dataset.
6117 //
6118 // - name: The resource name of the dataset to retrieve.
6119 func (r *ProjectsLocationsDatasetsService) Get(name string) *ProjectsLocationsDatasetsGetCall {
6120 c := &ProjectsLocationsDatasetsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6121 c.name = name
6122 return c
6123 }
6124
6125 // Fields allows partial responses to be retrieved. See
6126 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
6127 // details.
6128 func (c *ProjectsLocationsDatasetsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsDatasetsGetCall {
6129 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6130 return c
6131 }
6132
6133 // IfNoneMatch sets an optional parameter which makes the operation fail if the
6134 // object's ETag matches the given value. This is useful for getting updates
6135 // only after the object has changed since the last request.
6136 func (c *ProjectsLocationsDatasetsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsDatasetsGetCall {
6137 c.ifNoneMatch_ = entityTag
6138 return c
6139 }
6140
6141 // Context sets the context to be used in this call's Do method.
6142 func (c *ProjectsLocationsDatasetsGetCall) Context(ctx context.Context) *ProjectsLocationsDatasetsGetCall {
6143 c.ctx_ = ctx
6144 return c
6145 }
6146
6147 // Header returns a http.Header that can be modified by the caller to add
6148 // headers to the request.
6149 func (c *ProjectsLocationsDatasetsGetCall) Header() http.Header {
6150 if c.header_ == nil {
6151 c.header_ = make(http.Header)
6152 }
6153 return c.header_
6154 }
6155
6156 func (c *ProjectsLocationsDatasetsGetCall) doRequest(alt string) (*http.Response, error) {
6157 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
6158 if c.ifNoneMatch_ != "" {
6159 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
6160 }
6161 c.urlParams_.Set("alt", alt)
6162 c.urlParams_.Set("prettyPrint", "false")
6163 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
6164 urls += "?" + c.urlParams_.Encode()
6165 req, err := http.NewRequest("GET", urls, nil)
6166 if err != nil {
6167 return nil, err
6168 }
6169 req.Header = reqHeaders
6170 googleapi.Expand(req.URL, map[string]string{
6171 "name": c.name,
6172 })
6173 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.get", "request", internallog.HTTPRequest(req, nil))
6174 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6175 }
6176
6177 // Do executes the "translate.projects.locations.datasets.get" call.
6178 // Any non-2xx status code is an error. Response headers are in either
6179 // *Dataset.ServerResponse.Header or (if a response was returned at all) in
6180 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
6181 // whether the returned error was because http.StatusNotModified was returned.
6182 func (c *ProjectsLocationsDatasetsGetCall) Do(opts ...googleapi.CallOption) (*Dataset, error) {
6183 gensupport.SetOptions(c.urlParams_, opts...)
6184 res, err := c.doRequest("json")
6185 if res != nil && res.StatusCode == http.StatusNotModified {
6186 if res.Body != nil {
6187 res.Body.Close()
6188 }
6189 return nil, gensupport.WrapError(&googleapi.Error{
6190 Code: res.StatusCode,
6191 Header: res.Header,
6192 })
6193 }
6194 if err != nil {
6195 return nil, err
6196 }
6197 defer googleapi.CloseBody(res)
6198 if err := googleapi.CheckResponse(res); err != nil {
6199 return nil, gensupport.WrapError(err)
6200 }
6201 ret := &Dataset{
6202 ServerResponse: googleapi.ServerResponse{
6203 Header: res.Header,
6204 HTTPStatusCode: res.StatusCode,
6205 },
6206 }
6207 target := &ret
6208 b, err := gensupport.DecodeResponseBytes(target, res)
6209 if err != nil {
6210 return nil, err
6211 }
6212 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.get", "response", internallog.HTTPResponse(res, b))
6213 return ret, nil
6214 }
6215
6216 type ProjectsLocationsDatasetsImportDataCall struct {
6217 s *Service
6218 dataset string
6219 importdatarequest *ImportDataRequest
6220 urlParams_ gensupport.URLParams
6221 ctx_ context.Context
6222 header_ http.Header
6223 }
6224
6225 // ImportData: Import sentence pairs into translation Dataset.
6226 //
6227 // - dataset: Name of the dataset. In form of
6228 // `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-
6229 // id}`.
6230 func (r *ProjectsLocationsDatasetsService) ImportData(dataset string, importdatarequest *ImportDataRequest) *ProjectsLocationsDatasetsImportDataCall {
6231 c := &ProjectsLocationsDatasetsImportDataCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6232 c.dataset = dataset
6233 c.importdatarequest = importdatarequest
6234 return c
6235 }
6236
6237 // Fields allows partial responses to be retrieved. See
6238 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
6239 // details.
6240 func (c *ProjectsLocationsDatasetsImportDataCall) Fields(s ...googleapi.Field) *ProjectsLocationsDatasetsImportDataCall {
6241 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6242 return c
6243 }
6244
6245 // Context sets the context to be used in this call's Do method.
6246 func (c *ProjectsLocationsDatasetsImportDataCall) Context(ctx context.Context) *ProjectsLocationsDatasetsImportDataCall {
6247 c.ctx_ = ctx
6248 return c
6249 }
6250
6251 // Header returns a http.Header that can be modified by the caller to add
6252 // headers to the request.
6253 func (c *ProjectsLocationsDatasetsImportDataCall) Header() http.Header {
6254 if c.header_ == nil {
6255 c.header_ = make(http.Header)
6256 }
6257 return c.header_
6258 }
6259
6260 func (c *ProjectsLocationsDatasetsImportDataCall) doRequest(alt string) (*http.Response, error) {
6261 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
6262 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.importdatarequest)
6263 if err != nil {
6264 return nil, err
6265 }
6266 c.urlParams_.Set("alt", alt)
6267 c.urlParams_.Set("prettyPrint", "false")
6268 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+dataset}:importData")
6269 urls += "?" + c.urlParams_.Encode()
6270 req, err := http.NewRequest("POST", urls, body)
6271 if err != nil {
6272 return nil, err
6273 }
6274 req.Header = reqHeaders
6275 googleapi.Expand(req.URL, map[string]string{
6276 "dataset": c.dataset,
6277 })
6278 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.importData", "request", internallog.HTTPRequest(req, body.Bytes()))
6279 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6280 }
6281
6282 // Do executes the "translate.projects.locations.datasets.importData" call.
6283 // Any non-2xx status code is an error. Response headers are in either
6284 // *Operation.ServerResponse.Header or (if a response was returned at all) in
6285 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
6286 // whether the returned error was because http.StatusNotModified was returned.
6287 func (c *ProjectsLocationsDatasetsImportDataCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
6288 gensupport.SetOptions(c.urlParams_, opts...)
6289 res, err := c.doRequest("json")
6290 if res != nil && res.StatusCode == http.StatusNotModified {
6291 if res.Body != nil {
6292 res.Body.Close()
6293 }
6294 return nil, gensupport.WrapError(&googleapi.Error{
6295 Code: res.StatusCode,
6296 Header: res.Header,
6297 })
6298 }
6299 if err != nil {
6300 return nil, err
6301 }
6302 defer googleapi.CloseBody(res)
6303 if err := googleapi.CheckResponse(res); err != nil {
6304 return nil, gensupport.WrapError(err)
6305 }
6306 ret := &Operation{
6307 ServerResponse: googleapi.ServerResponse{
6308 Header: res.Header,
6309 HTTPStatusCode: res.StatusCode,
6310 },
6311 }
6312 target := &ret
6313 b, err := gensupport.DecodeResponseBytes(target, res)
6314 if err != nil {
6315 return nil, err
6316 }
6317 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.importData", "response", internallog.HTTPResponse(res, b))
6318 return ret, nil
6319 }
6320
6321 type ProjectsLocationsDatasetsListCall struct {
6322 s *Service
6323 parent string
6324 urlParams_ gensupport.URLParams
6325 ifNoneMatch_ string
6326 ctx_ context.Context
6327 header_ http.Header
6328 }
6329
6330 // List: Lists datasets.
6331 //
6332 // - parent: Name of the parent project. In form of
6333 // `projects/{project-number-or-id}/locations/{location-id}`.
6334 func (r *ProjectsLocationsDatasetsService) List(parent string) *ProjectsLocationsDatasetsListCall {
6335 c := &ProjectsLocationsDatasetsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6336 c.parent = parent
6337 return c
6338 }
6339
6340 // PageSize sets the optional parameter "pageSize": Requested page size. The
6341 // server can return fewer results than requested.
6342 func (c *ProjectsLocationsDatasetsListCall) PageSize(pageSize int64) *ProjectsLocationsDatasetsListCall {
6343 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
6344 return c
6345 }
6346
6347 // PageToken sets the optional parameter "pageToken": A token identifying a
6348 // page of results for the server to return. Typically obtained from
6349 // next_page_token field in the response of a ListDatasets call.
6350 func (c *ProjectsLocationsDatasetsListCall) PageToken(pageToken string) *ProjectsLocationsDatasetsListCall {
6351 c.urlParams_.Set("pageToken", pageToken)
6352 return c
6353 }
6354
6355 // Fields allows partial responses to be retrieved. See
6356 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
6357 // details.
6358 func (c *ProjectsLocationsDatasetsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsDatasetsListCall {
6359 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6360 return c
6361 }
6362
6363 // IfNoneMatch sets an optional parameter which makes the operation fail if the
6364 // object's ETag matches the given value. This is useful for getting updates
6365 // only after the object has changed since the last request.
6366 func (c *ProjectsLocationsDatasetsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsDatasetsListCall {
6367 c.ifNoneMatch_ = entityTag
6368 return c
6369 }
6370
6371 // Context sets the context to be used in this call's Do method.
6372 func (c *ProjectsLocationsDatasetsListCall) Context(ctx context.Context) *ProjectsLocationsDatasetsListCall {
6373 c.ctx_ = ctx
6374 return c
6375 }
6376
6377 // Header returns a http.Header that can be modified by the caller to add
6378 // headers to the request.
6379 func (c *ProjectsLocationsDatasetsListCall) Header() http.Header {
6380 if c.header_ == nil {
6381 c.header_ = make(http.Header)
6382 }
6383 return c.header_
6384 }
6385
6386 func (c *ProjectsLocationsDatasetsListCall) doRequest(alt string) (*http.Response, error) {
6387 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
6388 if c.ifNoneMatch_ != "" {
6389 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
6390 }
6391 c.urlParams_.Set("alt", alt)
6392 c.urlParams_.Set("prettyPrint", "false")
6393 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/datasets")
6394 urls += "?" + c.urlParams_.Encode()
6395 req, err := http.NewRequest("GET", urls, nil)
6396 if err != nil {
6397 return nil, err
6398 }
6399 req.Header = reqHeaders
6400 googleapi.Expand(req.URL, map[string]string{
6401 "parent": c.parent,
6402 })
6403 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.list", "request", internallog.HTTPRequest(req, nil))
6404 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6405 }
6406
6407 // Do executes the "translate.projects.locations.datasets.list" call.
6408 // Any non-2xx status code is an error. Response headers are in either
6409 // *ListDatasetsResponse.ServerResponse.Header or (if a response was returned
6410 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
6411 // check whether the returned error was because http.StatusNotModified was
6412 // returned.
6413 func (c *ProjectsLocationsDatasetsListCall) Do(opts ...googleapi.CallOption) (*ListDatasetsResponse, error) {
6414 gensupport.SetOptions(c.urlParams_, opts...)
6415 res, err := c.doRequest("json")
6416 if res != nil && res.StatusCode == http.StatusNotModified {
6417 if res.Body != nil {
6418 res.Body.Close()
6419 }
6420 return nil, gensupport.WrapError(&googleapi.Error{
6421 Code: res.StatusCode,
6422 Header: res.Header,
6423 })
6424 }
6425 if err != nil {
6426 return nil, err
6427 }
6428 defer googleapi.CloseBody(res)
6429 if err := googleapi.CheckResponse(res); err != nil {
6430 return nil, gensupport.WrapError(err)
6431 }
6432 ret := &ListDatasetsResponse{
6433 ServerResponse: googleapi.ServerResponse{
6434 Header: res.Header,
6435 HTTPStatusCode: res.StatusCode,
6436 },
6437 }
6438 target := &ret
6439 b, err := gensupport.DecodeResponseBytes(target, res)
6440 if err != nil {
6441 return nil, err
6442 }
6443 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.list", "response", internallog.HTTPResponse(res, b))
6444 return ret, nil
6445 }
6446
6447 // Pages invokes f for each page of results.
6448 // A non-nil error returned from f will halt the iteration.
6449 // The provided context supersedes any context provided to the Context method.
6450 func (c *ProjectsLocationsDatasetsListCall) Pages(ctx context.Context, f func(*ListDatasetsResponse) error) error {
6451 c.ctx_ = ctx
6452 defer c.PageToken(c.urlParams_.Get("pageToken"))
6453 for {
6454 x, err := c.Do()
6455 if err != nil {
6456 return err
6457 }
6458 if err := f(x); err != nil {
6459 return err
6460 }
6461 if x.NextPageToken == "" {
6462 return nil
6463 }
6464 c.PageToken(x.NextPageToken)
6465 }
6466 }
6467
6468 type ProjectsLocationsDatasetsExamplesListCall struct {
6469 s *Service
6470 parent string
6471 urlParams_ gensupport.URLParams
6472 ifNoneMatch_ string
6473 ctx_ context.Context
6474 header_ http.Header
6475 }
6476
6477 // List: Lists sentence pairs in the dataset.
6478 //
6479 // - parent: Name of the parent dataset. In form of
6480 // `projects/{project-number-or-id}/locations/{location-id}/datasets/{dataset-
6481 // id}`.
6482 func (r *ProjectsLocationsDatasetsExamplesService) List(parent string) *ProjectsLocationsDatasetsExamplesListCall {
6483 c := &ProjectsLocationsDatasetsExamplesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6484 c.parent = parent
6485 return c
6486 }
6487
6488 // Filter sets the optional parameter "filter": An expression for filtering the
6489 // examples that will be returned. Example filter: * `usage=TRAIN`
6490 func (c *ProjectsLocationsDatasetsExamplesListCall) Filter(filter string) *ProjectsLocationsDatasetsExamplesListCall {
6491 c.urlParams_.Set("filter", filter)
6492 return c
6493 }
6494
6495 // PageSize sets the optional parameter "pageSize": Requested page size. The
6496 // server can return fewer results than requested.
6497 func (c *ProjectsLocationsDatasetsExamplesListCall) PageSize(pageSize int64) *ProjectsLocationsDatasetsExamplesListCall {
6498 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
6499 return c
6500 }
6501
6502 // PageToken sets the optional parameter "pageToken": A token identifying a
6503 // page of results for the server to return. Typically obtained from
6504 // next_page_token field in the response of a ListExamples call.
6505 func (c *ProjectsLocationsDatasetsExamplesListCall) PageToken(pageToken string) *ProjectsLocationsDatasetsExamplesListCall {
6506 c.urlParams_.Set("pageToken", pageToken)
6507 return c
6508 }
6509
6510 // Fields allows partial responses to be retrieved. See
6511 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
6512 // details.
6513 func (c *ProjectsLocationsDatasetsExamplesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsDatasetsExamplesListCall {
6514 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6515 return c
6516 }
6517
6518 // IfNoneMatch sets an optional parameter which makes the operation fail if the
6519 // object's ETag matches the given value. This is useful for getting updates
6520 // only after the object has changed since the last request.
6521 func (c *ProjectsLocationsDatasetsExamplesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsDatasetsExamplesListCall {
6522 c.ifNoneMatch_ = entityTag
6523 return c
6524 }
6525
6526 // Context sets the context to be used in this call's Do method.
6527 func (c *ProjectsLocationsDatasetsExamplesListCall) Context(ctx context.Context) *ProjectsLocationsDatasetsExamplesListCall {
6528 c.ctx_ = ctx
6529 return c
6530 }
6531
6532 // Header returns a http.Header that can be modified by the caller to add
6533 // headers to the request.
6534 func (c *ProjectsLocationsDatasetsExamplesListCall) Header() http.Header {
6535 if c.header_ == nil {
6536 c.header_ = make(http.Header)
6537 }
6538 return c.header_
6539 }
6540
6541 func (c *ProjectsLocationsDatasetsExamplesListCall) doRequest(alt string) (*http.Response, error) {
6542 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
6543 if c.ifNoneMatch_ != "" {
6544 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
6545 }
6546 c.urlParams_.Set("alt", alt)
6547 c.urlParams_.Set("prettyPrint", "false")
6548 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/examples")
6549 urls += "?" + c.urlParams_.Encode()
6550 req, err := http.NewRequest("GET", urls, nil)
6551 if err != nil {
6552 return nil, err
6553 }
6554 req.Header = reqHeaders
6555 googleapi.Expand(req.URL, map[string]string{
6556 "parent": c.parent,
6557 })
6558 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.examples.list", "request", internallog.HTTPRequest(req, nil))
6559 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6560 }
6561
6562 // Do executes the "translate.projects.locations.datasets.examples.list" call.
6563 // Any non-2xx status code is an error. Response headers are in either
6564 // *ListExamplesResponse.ServerResponse.Header or (if a response was returned
6565 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
6566 // check whether the returned error was because http.StatusNotModified was
6567 // returned.
6568 func (c *ProjectsLocationsDatasetsExamplesListCall) Do(opts ...googleapi.CallOption) (*ListExamplesResponse, error) {
6569 gensupport.SetOptions(c.urlParams_, opts...)
6570 res, err := c.doRequest("json")
6571 if res != nil && res.StatusCode == http.StatusNotModified {
6572 if res.Body != nil {
6573 res.Body.Close()
6574 }
6575 return nil, gensupport.WrapError(&googleapi.Error{
6576 Code: res.StatusCode,
6577 Header: res.Header,
6578 })
6579 }
6580 if err != nil {
6581 return nil, err
6582 }
6583 defer googleapi.CloseBody(res)
6584 if err := googleapi.CheckResponse(res); err != nil {
6585 return nil, gensupport.WrapError(err)
6586 }
6587 ret := &ListExamplesResponse{
6588 ServerResponse: googleapi.ServerResponse{
6589 Header: res.Header,
6590 HTTPStatusCode: res.StatusCode,
6591 },
6592 }
6593 target := &ret
6594 b, err := gensupport.DecodeResponseBytes(target, res)
6595 if err != nil {
6596 return nil, err
6597 }
6598 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.datasets.examples.list", "response", internallog.HTTPResponse(res, b))
6599 return ret, nil
6600 }
6601
6602 // Pages invokes f for each page of results.
6603 // A non-nil error returned from f will halt the iteration.
6604 // The provided context supersedes any context provided to the Context method.
6605 func (c *ProjectsLocationsDatasetsExamplesListCall) Pages(ctx context.Context, f func(*ListExamplesResponse) error) error {
6606 c.ctx_ = ctx
6607 defer c.PageToken(c.urlParams_.Get("pageToken"))
6608 for {
6609 x, err := c.Do()
6610 if err != nil {
6611 return err
6612 }
6613 if err := f(x); err != nil {
6614 return err
6615 }
6616 if x.NextPageToken == "" {
6617 return nil
6618 }
6619 c.PageToken(x.NextPageToken)
6620 }
6621 }
6622
6623 type ProjectsLocationsGlossariesCreateCall struct {
6624 s *Service
6625 parent string
6626 glossary *Glossary
6627 urlParams_ gensupport.URLParams
6628 ctx_ context.Context
6629 header_ http.Header
6630 }
6631
6632 // Create: Creates a glossary and returns the long-running operation. Returns
6633 // NOT_FOUND, if the project doesn't exist.
6634 //
6635 // - parent: The project name.
6636 func (r *ProjectsLocationsGlossariesService) Create(parent string, glossary *Glossary) *ProjectsLocationsGlossariesCreateCall {
6637 c := &ProjectsLocationsGlossariesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6638 c.parent = parent
6639 c.glossary = glossary
6640 return c
6641 }
6642
6643 // Fields allows partial responses to be retrieved. See
6644 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
6645 // details.
6646 func (c *ProjectsLocationsGlossariesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesCreateCall {
6647 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6648 return c
6649 }
6650
6651 // Context sets the context to be used in this call's Do method.
6652 func (c *ProjectsLocationsGlossariesCreateCall) Context(ctx context.Context) *ProjectsLocationsGlossariesCreateCall {
6653 c.ctx_ = ctx
6654 return c
6655 }
6656
6657 // Header returns a http.Header that can be modified by the caller to add
6658 // headers to the request.
6659 func (c *ProjectsLocationsGlossariesCreateCall) Header() http.Header {
6660 if c.header_ == nil {
6661 c.header_ = make(http.Header)
6662 }
6663 return c.header_
6664 }
6665
6666 func (c *ProjectsLocationsGlossariesCreateCall) doRequest(alt string) (*http.Response, error) {
6667 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
6668 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.glossary)
6669 if err != nil {
6670 return nil, err
6671 }
6672 c.urlParams_.Set("alt", alt)
6673 c.urlParams_.Set("prettyPrint", "false")
6674 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/glossaries")
6675 urls += "?" + c.urlParams_.Encode()
6676 req, err := http.NewRequest("POST", urls, body)
6677 if err != nil {
6678 return nil, err
6679 }
6680 req.Header = reqHeaders
6681 googleapi.Expand(req.URL, map[string]string{
6682 "parent": c.parent,
6683 })
6684 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.create", "request", internallog.HTTPRequest(req, body.Bytes()))
6685 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6686 }
6687
6688 // Do executes the "translate.projects.locations.glossaries.create" call.
6689 // Any non-2xx status code is an error. Response headers are in either
6690 // *Operation.ServerResponse.Header or (if a response was returned at all) in
6691 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
6692 // whether the returned error was because http.StatusNotModified was returned.
6693 func (c *ProjectsLocationsGlossariesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
6694 gensupport.SetOptions(c.urlParams_, opts...)
6695 res, err := c.doRequest("json")
6696 if res != nil && res.StatusCode == http.StatusNotModified {
6697 if res.Body != nil {
6698 res.Body.Close()
6699 }
6700 return nil, gensupport.WrapError(&googleapi.Error{
6701 Code: res.StatusCode,
6702 Header: res.Header,
6703 })
6704 }
6705 if err != nil {
6706 return nil, err
6707 }
6708 defer googleapi.CloseBody(res)
6709 if err := googleapi.CheckResponse(res); err != nil {
6710 return nil, gensupport.WrapError(err)
6711 }
6712 ret := &Operation{
6713 ServerResponse: googleapi.ServerResponse{
6714 Header: res.Header,
6715 HTTPStatusCode: res.StatusCode,
6716 },
6717 }
6718 target := &ret
6719 b, err := gensupport.DecodeResponseBytes(target, res)
6720 if err != nil {
6721 return nil, err
6722 }
6723 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.create", "response", internallog.HTTPResponse(res, b))
6724 return ret, nil
6725 }
6726
6727 type ProjectsLocationsGlossariesDeleteCall struct {
6728 s *Service
6729 name string
6730 urlParams_ gensupport.URLParams
6731 ctx_ context.Context
6732 header_ http.Header
6733 }
6734
6735 // Delete: Deletes a glossary, or cancels glossary construction if the glossary
6736 // isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.
6737 //
6738 // - name: The name of the glossary to delete.
6739 func (r *ProjectsLocationsGlossariesService) Delete(name string) *ProjectsLocationsGlossariesDeleteCall {
6740 c := &ProjectsLocationsGlossariesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6741 c.name = name
6742 return c
6743 }
6744
6745 // Fields allows partial responses to be retrieved. See
6746 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
6747 // details.
6748 func (c *ProjectsLocationsGlossariesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesDeleteCall {
6749 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6750 return c
6751 }
6752
6753 // Context sets the context to be used in this call's Do method.
6754 func (c *ProjectsLocationsGlossariesDeleteCall) Context(ctx context.Context) *ProjectsLocationsGlossariesDeleteCall {
6755 c.ctx_ = ctx
6756 return c
6757 }
6758
6759 // Header returns a http.Header that can be modified by the caller to add
6760 // headers to the request.
6761 func (c *ProjectsLocationsGlossariesDeleteCall) Header() http.Header {
6762 if c.header_ == nil {
6763 c.header_ = make(http.Header)
6764 }
6765 return c.header_
6766 }
6767
6768 func (c *ProjectsLocationsGlossariesDeleteCall) doRequest(alt string) (*http.Response, error) {
6769 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
6770 c.urlParams_.Set("alt", alt)
6771 c.urlParams_.Set("prettyPrint", "false")
6772 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
6773 urls += "?" + c.urlParams_.Encode()
6774 req, err := http.NewRequest("DELETE", urls, nil)
6775 if err != nil {
6776 return nil, err
6777 }
6778 req.Header = reqHeaders
6779 googleapi.Expand(req.URL, map[string]string{
6780 "name": c.name,
6781 })
6782 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.delete", "request", internallog.HTTPRequest(req, nil))
6783 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6784 }
6785
6786 // Do executes the "translate.projects.locations.glossaries.delete" call.
6787 // Any non-2xx status code is an error. Response headers are in either
6788 // *Operation.ServerResponse.Header or (if a response was returned at all) in
6789 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
6790 // whether the returned error was because http.StatusNotModified was returned.
6791 func (c *ProjectsLocationsGlossariesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
6792 gensupport.SetOptions(c.urlParams_, opts...)
6793 res, err := c.doRequest("json")
6794 if res != nil && res.StatusCode == http.StatusNotModified {
6795 if res.Body != nil {
6796 res.Body.Close()
6797 }
6798 return nil, gensupport.WrapError(&googleapi.Error{
6799 Code: res.StatusCode,
6800 Header: res.Header,
6801 })
6802 }
6803 if err != nil {
6804 return nil, err
6805 }
6806 defer googleapi.CloseBody(res)
6807 if err := googleapi.CheckResponse(res); err != nil {
6808 return nil, gensupport.WrapError(err)
6809 }
6810 ret := &Operation{
6811 ServerResponse: googleapi.ServerResponse{
6812 Header: res.Header,
6813 HTTPStatusCode: res.StatusCode,
6814 },
6815 }
6816 target := &ret
6817 b, err := gensupport.DecodeResponseBytes(target, res)
6818 if err != nil {
6819 return nil, err
6820 }
6821 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.delete", "response", internallog.HTTPResponse(res, b))
6822 return ret, nil
6823 }
6824
6825 type ProjectsLocationsGlossariesGetCall struct {
6826 s *Service
6827 name string
6828 urlParams_ gensupport.URLParams
6829 ifNoneMatch_ string
6830 ctx_ context.Context
6831 header_ http.Header
6832 }
6833
6834 // Get: Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
6835 //
6836 // - name: The name of the glossary to retrieve.
6837 func (r *ProjectsLocationsGlossariesService) Get(name string) *ProjectsLocationsGlossariesGetCall {
6838 c := &ProjectsLocationsGlossariesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6839 c.name = name
6840 return c
6841 }
6842
6843 // Fields allows partial responses to be retrieved. See
6844 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
6845 // details.
6846 func (c *ProjectsLocationsGlossariesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesGetCall {
6847 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6848 return c
6849 }
6850
6851 // IfNoneMatch sets an optional parameter which makes the operation fail if the
6852 // object's ETag matches the given value. This is useful for getting updates
6853 // only after the object has changed since the last request.
6854 func (c *ProjectsLocationsGlossariesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGlossariesGetCall {
6855 c.ifNoneMatch_ = entityTag
6856 return c
6857 }
6858
6859 // Context sets the context to be used in this call's Do method.
6860 func (c *ProjectsLocationsGlossariesGetCall) Context(ctx context.Context) *ProjectsLocationsGlossariesGetCall {
6861 c.ctx_ = ctx
6862 return c
6863 }
6864
6865 // Header returns a http.Header that can be modified by the caller to add
6866 // headers to the request.
6867 func (c *ProjectsLocationsGlossariesGetCall) Header() http.Header {
6868 if c.header_ == nil {
6869 c.header_ = make(http.Header)
6870 }
6871 return c.header_
6872 }
6873
6874 func (c *ProjectsLocationsGlossariesGetCall) doRequest(alt string) (*http.Response, error) {
6875 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
6876 if c.ifNoneMatch_ != "" {
6877 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
6878 }
6879 c.urlParams_.Set("alt", alt)
6880 c.urlParams_.Set("prettyPrint", "false")
6881 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
6882 urls += "?" + c.urlParams_.Encode()
6883 req, err := http.NewRequest("GET", urls, nil)
6884 if err != nil {
6885 return nil, err
6886 }
6887 req.Header = reqHeaders
6888 googleapi.Expand(req.URL, map[string]string{
6889 "name": c.name,
6890 })
6891 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.get", "request", internallog.HTTPRequest(req, nil))
6892 return gensupport.SendRequest(c.ctx_, c.s.client, req)
6893 }
6894
6895 // Do executes the "translate.projects.locations.glossaries.get" call.
6896 // Any non-2xx status code is an error. Response headers are in either
6897 // *Glossary.ServerResponse.Header or (if a response was returned at all) in
6898 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
6899 // whether the returned error was because http.StatusNotModified was returned.
6900 func (c *ProjectsLocationsGlossariesGetCall) Do(opts ...googleapi.CallOption) (*Glossary, error) {
6901 gensupport.SetOptions(c.urlParams_, opts...)
6902 res, err := c.doRequest("json")
6903 if res != nil && res.StatusCode == http.StatusNotModified {
6904 if res.Body != nil {
6905 res.Body.Close()
6906 }
6907 return nil, gensupport.WrapError(&googleapi.Error{
6908 Code: res.StatusCode,
6909 Header: res.Header,
6910 })
6911 }
6912 if err != nil {
6913 return nil, err
6914 }
6915 defer googleapi.CloseBody(res)
6916 if err := googleapi.CheckResponse(res); err != nil {
6917 return nil, gensupport.WrapError(err)
6918 }
6919 ret := &Glossary{
6920 ServerResponse: googleapi.ServerResponse{
6921 Header: res.Header,
6922 HTTPStatusCode: res.StatusCode,
6923 },
6924 }
6925 target := &ret
6926 b, err := gensupport.DecodeResponseBytes(target, res)
6927 if err != nil {
6928 return nil, err
6929 }
6930 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.get", "response", internallog.HTTPResponse(res, b))
6931 return ret, nil
6932 }
6933
6934 type ProjectsLocationsGlossariesListCall struct {
6935 s *Service
6936 parent string
6937 urlParams_ gensupport.URLParams
6938 ifNoneMatch_ string
6939 ctx_ context.Context
6940 header_ http.Header
6941 }
6942
6943 // List: Lists glossaries in a project. Returns NOT_FOUND, if the project
6944 // doesn't exist.
6945 //
6946 // - parent: The name of the project from which to list all of the glossaries.
6947 func (r *ProjectsLocationsGlossariesService) List(parent string) *ProjectsLocationsGlossariesListCall {
6948 c := &ProjectsLocationsGlossariesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6949 c.parent = parent
6950 return c
6951 }
6952
6953 // Filter sets the optional parameter "filter": Filter specifying constraints
6954 // of a list operation. Specify the constraint by the format of "key=value",
6955 // where key must be "src" or "tgt", and the value must be a valid language
6956 // code. For multiple restrictions, concatenate them by "AND" (uppercase only),
6957 // such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used
6958 // here, which means using 'en-US' and 'en' can lead to different results,
6959 // which depends on the language code you used when you create the glossary.
6960 // For the unidirectional glossaries, the "src" and "tgt" add restrictions on
6961 // the source and target language code separately. For the equivalent term set
6962 // glossaries, the "src" and/or "tgt" add restrictions on the term set. For
6963 // example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional
6964 // glossaries which exactly match the source language code as "en-US" and the
6965 // target language code "zh-CN", but all equivalent term set glossaries which
6966 // contain "en-US" and "zh-CN" in their language set will be picked. If
6967 // missing, no filtering is performed.
6968 func (c *ProjectsLocationsGlossariesListCall) Filter(filter string) *ProjectsLocationsGlossariesListCall {
6969 c.urlParams_.Set("filter", filter)
6970 return c
6971 }
6972
6973 // PageSize sets the optional parameter "pageSize": Requested page size. The
6974 // server may return fewer glossaries than requested. If unspecified, the
6975 // server picks an appropriate default.
6976 func (c *ProjectsLocationsGlossariesListCall) PageSize(pageSize int64) *ProjectsLocationsGlossariesListCall {
6977 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
6978 return c
6979 }
6980
6981 // PageToken sets the optional parameter "pageToken": A token identifying a
6982 // page of results the server should return. Typically, this is the value of
6983 // [ListGlossariesResponse.next_page_token] returned from the previous call to
6984 // `ListGlossaries` method. The first page is returned if `page_token`is empty
6985 // or missing.
6986 func (c *ProjectsLocationsGlossariesListCall) PageToken(pageToken string) *ProjectsLocationsGlossariesListCall {
6987 c.urlParams_.Set("pageToken", pageToken)
6988 return c
6989 }
6990
6991 // Fields allows partial responses to be retrieved. See
6992 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
6993 // details.
6994 func (c *ProjectsLocationsGlossariesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesListCall {
6995 c.urlParams_.Set("fields", googleapi.CombineFields(s))
6996 return c
6997 }
6998
6999 // IfNoneMatch sets an optional parameter which makes the operation fail if the
7000 // object's ETag matches the given value. This is useful for getting updates
7001 // only after the object has changed since the last request.
7002 func (c *ProjectsLocationsGlossariesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsGlossariesListCall {
7003 c.ifNoneMatch_ = entityTag
7004 return c
7005 }
7006
7007 // Context sets the context to be used in this call's Do method.
7008 func (c *ProjectsLocationsGlossariesListCall) Context(ctx context.Context) *ProjectsLocationsGlossariesListCall {
7009 c.ctx_ = ctx
7010 return c
7011 }
7012
7013 // Header returns a http.Header that can be modified by the caller to add
7014 // headers to the request.
7015 func (c *ProjectsLocationsGlossariesListCall) Header() http.Header {
7016 if c.header_ == nil {
7017 c.header_ = make(http.Header)
7018 }
7019 return c.header_
7020 }
7021
7022 func (c *ProjectsLocationsGlossariesListCall) doRequest(alt string) (*http.Response, error) {
7023 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
7024 if c.ifNoneMatch_ != "" {
7025 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
7026 }
7027 c.urlParams_.Set("alt", alt)
7028 c.urlParams_.Set("prettyPrint", "false")
7029 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/glossaries")
7030 urls += "?" + c.urlParams_.Encode()
7031 req, err := http.NewRequest("GET", urls, nil)
7032 if err != nil {
7033 return nil, err
7034 }
7035 req.Header = reqHeaders
7036 googleapi.Expand(req.URL, map[string]string{
7037 "parent": c.parent,
7038 })
7039 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.list", "request", internallog.HTTPRequest(req, nil))
7040 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7041 }
7042
7043 // Do executes the "translate.projects.locations.glossaries.list" call.
7044 // Any non-2xx status code is an error. Response headers are in either
7045 // *ListGlossariesResponse.ServerResponse.Header or (if a response was returned
7046 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
7047 // check whether the returned error was because http.StatusNotModified was
7048 // returned.
7049 func (c *ProjectsLocationsGlossariesListCall) Do(opts ...googleapi.CallOption) (*ListGlossariesResponse, error) {
7050 gensupport.SetOptions(c.urlParams_, opts...)
7051 res, err := c.doRequest("json")
7052 if res != nil && res.StatusCode == http.StatusNotModified {
7053 if res.Body != nil {
7054 res.Body.Close()
7055 }
7056 return nil, gensupport.WrapError(&googleapi.Error{
7057 Code: res.StatusCode,
7058 Header: res.Header,
7059 })
7060 }
7061 if err != nil {
7062 return nil, err
7063 }
7064 defer googleapi.CloseBody(res)
7065 if err := googleapi.CheckResponse(res); err != nil {
7066 return nil, gensupport.WrapError(err)
7067 }
7068 ret := &ListGlossariesResponse{
7069 ServerResponse: googleapi.ServerResponse{
7070 Header: res.Header,
7071 HTTPStatusCode: res.StatusCode,
7072 },
7073 }
7074 target := &ret
7075 b, err := gensupport.DecodeResponseBytes(target, res)
7076 if err != nil {
7077 return nil, err
7078 }
7079 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.list", "response", internallog.HTTPResponse(res, b))
7080 return ret, nil
7081 }
7082
7083 // Pages invokes f for each page of results.
7084 // A non-nil error returned from f will halt the iteration.
7085 // The provided context supersedes any context provided to the Context method.
7086 func (c *ProjectsLocationsGlossariesListCall) Pages(ctx context.Context, f func(*ListGlossariesResponse) error) error {
7087 c.ctx_ = ctx
7088 defer c.PageToken(c.urlParams_.Get("pageToken"))
7089 for {
7090 x, err := c.Do()
7091 if err != nil {
7092 return err
7093 }
7094 if err := f(x); err != nil {
7095 return err
7096 }
7097 if x.NextPageToken == "" {
7098 return nil
7099 }
7100 c.PageToken(x.NextPageToken)
7101 }
7102 }
7103
7104 type ProjectsLocationsGlossariesPatchCall struct {
7105 s *Service
7106 name string
7107 glossary *Glossary
7108 urlParams_ gensupport.URLParams
7109 ctx_ context.Context
7110 header_ http.Header
7111 }
7112
7113 // Patch: Updates a glossary. A LRO is used since the update can be async if
7114 // the glossary's entry file is updated.
7115 //
7116 // - name: Identifier. The resource name of the glossary. Glossary names have
7117 // the form
7118 // `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossa
7119 // ry-id}`.
7120 func (r *ProjectsLocationsGlossariesService) Patch(name string, glossary *Glossary) *ProjectsLocationsGlossariesPatchCall {
7121 c := &ProjectsLocationsGlossariesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7122 c.name = name
7123 c.glossary = glossary
7124 return c
7125 }
7126
7127 // UpdateMask sets the optional parameter "updateMask": The list of fields to
7128 // be updated. Currently, only `display_name` and `input_config` are supported.
7129 func (c *ProjectsLocationsGlossariesPatchCall) UpdateMask(updateMask string) *ProjectsLocationsGlossariesPatchCall {
7130 c.urlParams_.Set("updateMask", updateMask)
7131 return c
7132 }
7133
7134 // Fields allows partial responses to be retrieved. See
7135 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
7136 // details.
7137 func (c *ProjectsLocationsGlossariesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesPatchCall {
7138 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7139 return c
7140 }
7141
7142 // Context sets the context to be used in this call's Do method.
7143 func (c *ProjectsLocationsGlossariesPatchCall) Context(ctx context.Context) *ProjectsLocationsGlossariesPatchCall {
7144 c.ctx_ = ctx
7145 return c
7146 }
7147
7148 // Header returns a http.Header that can be modified by the caller to add
7149 // headers to the request.
7150 func (c *ProjectsLocationsGlossariesPatchCall) Header() http.Header {
7151 if c.header_ == nil {
7152 c.header_ = make(http.Header)
7153 }
7154 return c.header_
7155 }
7156
7157 func (c *ProjectsLocationsGlossariesPatchCall) doRequest(alt string) (*http.Response, error) {
7158 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
7159 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.glossary)
7160 if err != nil {
7161 return nil, err
7162 }
7163 c.urlParams_.Set("alt", alt)
7164 c.urlParams_.Set("prettyPrint", "false")
7165 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
7166 urls += "?" + c.urlParams_.Encode()
7167 req, err := http.NewRequest("PATCH", urls, body)
7168 if err != nil {
7169 return nil, err
7170 }
7171 req.Header = reqHeaders
7172 googleapi.Expand(req.URL, map[string]string{
7173 "name": c.name,
7174 })
7175 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.patch", "request", internallog.HTTPRequest(req, body.Bytes()))
7176 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7177 }
7178
7179 // Do executes the "translate.projects.locations.glossaries.patch" call.
7180 // Any non-2xx status code is an error. Response headers are in either
7181 // *Operation.ServerResponse.Header or (if a response was returned at all) in
7182 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
7183 // whether the returned error was because http.StatusNotModified was returned.
7184 func (c *ProjectsLocationsGlossariesPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
7185 gensupport.SetOptions(c.urlParams_, opts...)
7186 res, err := c.doRequest("json")
7187 if res != nil && res.StatusCode == http.StatusNotModified {
7188 if res.Body != nil {
7189 res.Body.Close()
7190 }
7191 return nil, gensupport.WrapError(&googleapi.Error{
7192 Code: res.StatusCode,
7193 Header: res.Header,
7194 })
7195 }
7196 if err != nil {
7197 return nil, err
7198 }
7199 defer googleapi.CloseBody(res)
7200 if err := googleapi.CheckResponse(res); err != nil {
7201 return nil, gensupport.WrapError(err)
7202 }
7203 ret := &Operation{
7204 ServerResponse: googleapi.ServerResponse{
7205 Header: res.Header,
7206 HTTPStatusCode: res.StatusCode,
7207 },
7208 }
7209 target := &ret
7210 b, err := gensupport.DecodeResponseBytes(target, res)
7211 if err != nil {
7212 return nil, err
7213 }
7214 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.patch", "response", internallog.HTTPResponse(res, b))
7215 return ret, nil
7216 }
7217
7218 type ProjectsLocationsGlossariesGlossaryEntriesCreateCall struct {
7219 s *Service
7220 parent string
7221 glossaryentry *GlossaryEntry
7222 urlParams_ gensupport.URLParams
7223 ctx_ context.Context
7224 header_ http.Header
7225 }
7226
7227 // Create: Creates a glossary entry.
7228 //
7229 // - parent: The resource name of the glossary to create the entry under.
7230 func (r *ProjectsLocationsGlossariesGlossaryEntriesService) Create(parent string, glossaryentry *GlossaryEntry) *ProjectsLocationsGlossariesGlossaryEntriesCreateCall {
7231 c := &ProjectsLocationsGlossariesGlossaryEntriesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7232 c.parent = parent
7233 c.glossaryentry = glossaryentry
7234 return c
7235 }
7236
7237 // Fields allows partial responses to be retrieved. See
7238 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
7239 // details.
7240 func (c *ProjectsLocationsGlossariesGlossaryEntriesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesGlossaryEntriesCreateCall {
7241 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7242 return c
7243 }
7244
7245 // Context sets the context to be used in this call's Do method.
7246 func (c *ProjectsLocationsGlossariesGlossaryEntriesCreateCall) Context(ctx context.Context) *ProjectsLocationsGlossariesGlossaryEntriesCreateCall {
7247 c.ctx_ = ctx
7248 return c
7249 }
7250
7251 // Header returns a http.Header that can be modified by the caller to add
7252 // headers to the request.
7253 func (c *ProjectsLocationsGlossariesGlossaryEntriesCreateCall) Header() http.Header {
7254 if c.header_ == nil {
7255 c.header_ = make(http.Header)
7256 }
7257 return c.header_
7258 }
7259
7260 func (c *ProjectsLocationsGlossariesGlossaryEntriesCreateCall) doRequest(alt string) (*http.Response, error) {
7261 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
7262 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.glossaryentry)
7263 if err != nil {
7264 return nil, err
7265 }
7266 c.urlParams_.Set("alt", alt)
7267 c.urlParams_.Set("prettyPrint", "false")
7268 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/glossaryEntries")
7269 urls += "?" + c.urlParams_.Encode()
7270 req, err := http.NewRequest("POST", urls, body)
7271 if err != nil {
7272 return nil, err
7273 }
7274 req.Header = reqHeaders
7275 googleapi.Expand(req.URL, map[string]string{
7276 "parent": c.parent,
7277 })
7278 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.glossaryEntries.create", "request", internallog.HTTPRequest(req, body.Bytes()))
7279 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7280 }
7281
7282 // Do executes the "translate.projects.locations.glossaries.glossaryEntries.create" call.
7283 // Any non-2xx status code is an error. Response headers are in either
7284 // *GlossaryEntry.ServerResponse.Header or (if a response was returned at all)
7285 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
7286 // whether the returned error was because http.StatusNotModified was returned.
7287 func (c *ProjectsLocationsGlossariesGlossaryEntriesCreateCall) Do(opts ...googleapi.CallOption) (*GlossaryEntry, error) {
7288 gensupport.SetOptions(c.urlParams_, opts...)
7289 res, err := c.doRequest("json")
7290 if res != nil && res.StatusCode == http.StatusNotModified {
7291 if res.Body != nil {
7292 res.Body.Close()
7293 }
7294 return nil, gensupport.WrapError(&googleapi.Error{
7295 Code: res.StatusCode,
7296 Header: res.Header,
7297 })
7298 }
7299 if err != nil {
7300 return nil, err
7301 }
7302 defer googleapi.CloseBody(res)
7303 if err := googleapi.CheckResponse(res); err != nil {
7304 return nil, gensupport.WrapError(err)
7305 }
7306 ret := &GlossaryEntry{
7307 ServerResponse: googleapi.ServerResponse{
7308 Header: res.Header,
7309 HTTPStatusCode: res.StatusCode,
7310 },
7311 }
7312 target := &ret
7313 b, err := gensupport.DecodeResponseBytes(target, res)
7314 if err != nil {
7315 return nil, err
7316 }
7317 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.glossaryEntries.create", "response", internallog.HTTPResponse(res, b))
7318 return ret, nil
7319 }
7320
7321 type ProjectsLocationsGlossariesGlossaryEntriesDeleteCall struct {
7322 s *Service
7323 name string
7324 urlParams_ gensupport.URLParams
7325 ctx_ context.Context
7326 header_ http.Header
7327 }
7328
7329 // Delete: Deletes a single entry from the glossary
7330 //
7331 // - name: The resource name of the glossary entry to delete.
7332 func (r *ProjectsLocationsGlossariesGlossaryEntriesService) Delete(name string) *ProjectsLocationsGlossariesGlossaryEntriesDeleteCall {
7333 c := &ProjectsLocationsGlossariesGlossaryEntriesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7334 c.name = name
7335 return c
7336 }
7337
7338 // Fields allows partial responses to be retrieved. See
7339 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
7340 // details.
7341 func (c *ProjectsLocationsGlossariesGlossaryEntriesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesGlossaryEntriesDeleteCall {
7342 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7343 return c
7344 }
7345
7346 // Context sets the context to be used in this call's Do method.
7347 func (c *ProjectsLocationsGlossariesGlossaryEntriesDeleteCall) Context(ctx context.Context) *ProjectsLocationsGlossariesGlossaryEntriesDeleteCall {
7348 c.ctx_ = ctx
7349 return c
7350 }
7351
7352 // Header returns a http.Header that can be modified by the caller to add
7353 // headers to the request.
7354 func (c *ProjectsLocationsGlossariesGlossaryEntriesDeleteCall) Header() http.Header {
7355 if c.header_ == nil {
7356 c.header_ = make(http.Header)
7357 }
7358 return c.header_
7359 }
7360
7361 func (c *ProjectsLocationsGlossariesGlossaryEntriesDeleteCall) doRequest(alt string) (*http.Response, error) {
7362 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
7363 c.urlParams_.Set("alt", alt)
7364 c.urlParams_.Set("prettyPrint", "false")
7365 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
7366 urls += "?" + c.urlParams_.Encode()
7367 req, err := http.NewRequest("DELETE", urls, nil)
7368 if err != nil {
7369 return nil, err
7370 }
7371 req.Header = reqHeaders
7372 googleapi.Expand(req.URL, map[string]string{
7373 "name": c.name,
7374 })
7375 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.glossaryEntries.delete", "request", internallog.HTTPRequest(req, nil))
7376 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7377 }
7378
7379 // Do executes the "translate.projects.locations.glossaries.glossaryEntries.delete" call.
7380 // Any non-2xx status code is an error. Response headers are in either
7381 // *Empty.ServerResponse.Header or (if a response was returned at all) in
7382 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
7383 // whether the returned error was because http.StatusNotModified was returned.
7384 func (c *ProjectsLocationsGlossariesGlossaryEntriesDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
7385 gensupport.SetOptions(c.urlParams_, opts...)
7386 res, err := c.doRequest("json")
7387 if res != nil && res.StatusCode == http.StatusNotModified {
7388 if res.Body != nil {
7389 res.Body.Close()
7390 }
7391 return nil, gensupport.WrapError(&googleapi.Error{
7392 Code: res.StatusCode,
7393 Header: res.Header,
7394 })
7395 }
7396 if err != nil {
7397 return nil, err
7398 }
7399 defer googleapi.CloseBody(res)
7400 if err := googleapi.CheckResponse(res); err != nil {
7401 return nil, gensupport.WrapError(err)
7402 }
7403 ret := &Empty{
7404 ServerResponse: googleapi.ServerResponse{
7405 Header: res.Header,
7406 HTTPStatusCode: res.StatusCode,
7407 },
7408 }
7409 target := &ret
7410 b, err := gensupport.DecodeResponseBytes(target, res)
7411 if err != nil {
7412 return nil, err
7413 }
7414 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.glossaryEntries.delete", "response", internallog.HTTPResponse(res, b))
7415 return ret, nil
7416 }
7417
7418 type ProjectsLocationsGlossariesGlossaryEntriesGetCall struct {
7419 s *Service
7420 name string
7421 urlParams_ gensupport.URLParams
7422 ifNoneMatch_ string
7423 ctx_ context.Context
7424 header_ http.Header
7425 }
7426
7427 // Get: Gets a single glossary entry by the given id.
7428 //
7429 // - name: The resource name of the glossary entry to get.
7430 func (r *ProjectsLocationsGlossariesGlossaryEntriesService) Get(name string) *ProjectsLocationsGlossariesGlossaryEntriesGetCall {
7431 c := &ProjectsLocationsGlossariesGlossaryEntriesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7432 c.name = name
7433 return c
7434 }
7435
7436 // Fields allows partial responses to be retrieved. See
7437 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
7438 // details.
7439 func (c *ProjectsLocationsGlossariesGlossaryEntriesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesGlossaryEntriesGetCall {
7440 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7441 return c
7442 }
7443
7444 // IfNoneMatch sets an optional parameter which makes the operation fail if the
7445 // object's ETag matches the given value. This is useful for getting updates
7446 // only after the object has changed since the last request.
7447 func (c *ProjectsLocationsGlossariesGlossaryEntriesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGlossariesGlossaryEntriesGetCall {
7448 c.ifNoneMatch_ = entityTag
7449 return c
7450 }
7451
7452 // Context sets the context to be used in this call's Do method.
7453 func (c *ProjectsLocationsGlossariesGlossaryEntriesGetCall) Context(ctx context.Context) *ProjectsLocationsGlossariesGlossaryEntriesGetCall {
7454 c.ctx_ = ctx
7455 return c
7456 }
7457
7458 // Header returns a http.Header that can be modified by the caller to add
7459 // headers to the request.
7460 func (c *ProjectsLocationsGlossariesGlossaryEntriesGetCall) Header() http.Header {
7461 if c.header_ == nil {
7462 c.header_ = make(http.Header)
7463 }
7464 return c.header_
7465 }
7466
7467 func (c *ProjectsLocationsGlossariesGlossaryEntriesGetCall) doRequest(alt string) (*http.Response, error) {
7468 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
7469 if c.ifNoneMatch_ != "" {
7470 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
7471 }
7472 c.urlParams_.Set("alt", alt)
7473 c.urlParams_.Set("prettyPrint", "false")
7474 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
7475 urls += "?" + c.urlParams_.Encode()
7476 req, err := http.NewRequest("GET", urls, nil)
7477 if err != nil {
7478 return nil, err
7479 }
7480 req.Header = reqHeaders
7481 googleapi.Expand(req.URL, map[string]string{
7482 "name": c.name,
7483 })
7484 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.glossaryEntries.get", "request", internallog.HTTPRequest(req, nil))
7485 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7486 }
7487
7488 // Do executes the "translate.projects.locations.glossaries.glossaryEntries.get" call.
7489 // Any non-2xx status code is an error. Response headers are in either
7490 // *GlossaryEntry.ServerResponse.Header or (if a response was returned at all)
7491 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
7492 // whether the returned error was because http.StatusNotModified was returned.
7493 func (c *ProjectsLocationsGlossariesGlossaryEntriesGetCall) Do(opts ...googleapi.CallOption) (*GlossaryEntry, error) {
7494 gensupport.SetOptions(c.urlParams_, opts...)
7495 res, err := c.doRequest("json")
7496 if res != nil && res.StatusCode == http.StatusNotModified {
7497 if res.Body != nil {
7498 res.Body.Close()
7499 }
7500 return nil, gensupport.WrapError(&googleapi.Error{
7501 Code: res.StatusCode,
7502 Header: res.Header,
7503 })
7504 }
7505 if err != nil {
7506 return nil, err
7507 }
7508 defer googleapi.CloseBody(res)
7509 if err := googleapi.CheckResponse(res); err != nil {
7510 return nil, gensupport.WrapError(err)
7511 }
7512 ret := &GlossaryEntry{
7513 ServerResponse: googleapi.ServerResponse{
7514 Header: res.Header,
7515 HTTPStatusCode: res.StatusCode,
7516 },
7517 }
7518 target := &ret
7519 b, err := gensupport.DecodeResponseBytes(target, res)
7520 if err != nil {
7521 return nil, err
7522 }
7523 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.glossaryEntries.get", "response", internallog.HTTPResponse(res, b))
7524 return ret, nil
7525 }
7526
7527 type ProjectsLocationsGlossariesGlossaryEntriesListCall struct {
7528 s *Service
7529 parent string
7530 urlParams_ gensupport.URLParams
7531 ifNoneMatch_ string
7532 ctx_ context.Context
7533 header_ http.Header
7534 }
7535
7536 // List: List the entries for the glossary.
7537 //
7538 // - parent: The parent glossary resource name for listing the glossary's
7539 // entries.
7540 func (r *ProjectsLocationsGlossariesGlossaryEntriesService) List(parent string) *ProjectsLocationsGlossariesGlossaryEntriesListCall {
7541 c := &ProjectsLocationsGlossariesGlossaryEntriesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7542 c.parent = parent
7543 return c
7544 }
7545
7546 // PageSize sets the optional parameter "pageSize": Requested page size. The
7547 // server may return fewer glossary entries than requested. If unspecified, the
7548 // server picks an appropriate default.
7549 func (c *ProjectsLocationsGlossariesGlossaryEntriesListCall) PageSize(pageSize int64) *ProjectsLocationsGlossariesGlossaryEntriesListCall {
7550 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
7551 return c
7552 }
7553
7554 // PageToken sets the optional parameter "pageToken": A token identifying a
7555 // page of results the server should return. Typically, this is the value of
7556 // [ListGlossaryEntriesResponse.next_page_token] returned from the previous
7557 // call. The first page is returned if `page_token`is empty or missing.
7558 func (c *ProjectsLocationsGlossariesGlossaryEntriesListCall) PageToken(pageToken string) *ProjectsLocationsGlossariesGlossaryEntriesListCall {
7559 c.urlParams_.Set("pageToken", pageToken)
7560 return c
7561 }
7562
7563 // Fields allows partial responses to be retrieved. See
7564 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
7565 // details.
7566 func (c *ProjectsLocationsGlossariesGlossaryEntriesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesGlossaryEntriesListCall {
7567 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7568 return c
7569 }
7570
7571 // IfNoneMatch sets an optional parameter which makes the operation fail if the
7572 // object's ETag matches the given value. This is useful for getting updates
7573 // only after the object has changed since the last request.
7574 func (c *ProjectsLocationsGlossariesGlossaryEntriesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsGlossariesGlossaryEntriesListCall {
7575 c.ifNoneMatch_ = entityTag
7576 return c
7577 }
7578
7579 // Context sets the context to be used in this call's Do method.
7580 func (c *ProjectsLocationsGlossariesGlossaryEntriesListCall) Context(ctx context.Context) *ProjectsLocationsGlossariesGlossaryEntriesListCall {
7581 c.ctx_ = ctx
7582 return c
7583 }
7584
7585 // Header returns a http.Header that can be modified by the caller to add
7586 // headers to the request.
7587 func (c *ProjectsLocationsGlossariesGlossaryEntriesListCall) Header() http.Header {
7588 if c.header_ == nil {
7589 c.header_ = make(http.Header)
7590 }
7591 return c.header_
7592 }
7593
7594 func (c *ProjectsLocationsGlossariesGlossaryEntriesListCall) doRequest(alt string) (*http.Response, error) {
7595 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
7596 if c.ifNoneMatch_ != "" {
7597 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
7598 }
7599 c.urlParams_.Set("alt", alt)
7600 c.urlParams_.Set("prettyPrint", "false")
7601 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/glossaryEntries")
7602 urls += "?" + c.urlParams_.Encode()
7603 req, err := http.NewRequest("GET", urls, nil)
7604 if err != nil {
7605 return nil, err
7606 }
7607 req.Header = reqHeaders
7608 googleapi.Expand(req.URL, map[string]string{
7609 "parent": c.parent,
7610 })
7611 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.glossaryEntries.list", "request", internallog.HTTPRequest(req, nil))
7612 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7613 }
7614
7615 // Do executes the "translate.projects.locations.glossaries.glossaryEntries.list" call.
7616 // Any non-2xx status code is an error. Response headers are in either
7617 // *ListGlossaryEntriesResponse.ServerResponse.Header or (if a response was
7618 // returned at all) in error.(*googleapi.Error).Header. Use
7619 // googleapi.IsNotModified to check whether the returned error was because
7620 // http.StatusNotModified was returned.
7621 func (c *ProjectsLocationsGlossariesGlossaryEntriesListCall) Do(opts ...googleapi.CallOption) (*ListGlossaryEntriesResponse, error) {
7622 gensupport.SetOptions(c.urlParams_, opts...)
7623 res, err := c.doRequest("json")
7624 if res != nil && res.StatusCode == http.StatusNotModified {
7625 if res.Body != nil {
7626 res.Body.Close()
7627 }
7628 return nil, gensupport.WrapError(&googleapi.Error{
7629 Code: res.StatusCode,
7630 Header: res.Header,
7631 })
7632 }
7633 if err != nil {
7634 return nil, err
7635 }
7636 defer googleapi.CloseBody(res)
7637 if err := googleapi.CheckResponse(res); err != nil {
7638 return nil, gensupport.WrapError(err)
7639 }
7640 ret := &ListGlossaryEntriesResponse{
7641 ServerResponse: googleapi.ServerResponse{
7642 Header: res.Header,
7643 HTTPStatusCode: res.StatusCode,
7644 },
7645 }
7646 target := &ret
7647 b, err := gensupport.DecodeResponseBytes(target, res)
7648 if err != nil {
7649 return nil, err
7650 }
7651 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.glossaryEntries.list", "response", internallog.HTTPResponse(res, b))
7652 return ret, nil
7653 }
7654
7655 // Pages invokes f for each page of results.
7656 // A non-nil error returned from f will halt the iteration.
7657 // The provided context supersedes any context provided to the Context method.
7658 func (c *ProjectsLocationsGlossariesGlossaryEntriesListCall) Pages(ctx context.Context, f func(*ListGlossaryEntriesResponse) error) error {
7659 c.ctx_ = ctx
7660 defer c.PageToken(c.urlParams_.Get("pageToken"))
7661 for {
7662 x, err := c.Do()
7663 if err != nil {
7664 return err
7665 }
7666 if err := f(x); err != nil {
7667 return err
7668 }
7669 if x.NextPageToken == "" {
7670 return nil
7671 }
7672 c.PageToken(x.NextPageToken)
7673 }
7674 }
7675
7676 type ProjectsLocationsGlossariesGlossaryEntriesPatchCall struct {
7677 s *Service
7678 name string
7679 glossaryentry *GlossaryEntry
7680 urlParams_ gensupport.URLParams
7681 ctx_ context.Context
7682 header_ http.Header
7683 }
7684
7685 // Patch: Updates a glossary entry.
7686 //
7687 // - name: Identifier. The resource name of the entry. Format:
7688 // `projects/*/locations/*/glossaries/*/glossaryEntries/*`.
7689 func (r *ProjectsLocationsGlossariesGlossaryEntriesService) Patch(name string, glossaryentry *GlossaryEntry) *ProjectsLocationsGlossariesGlossaryEntriesPatchCall {
7690 c := &ProjectsLocationsGlossariesGlossaryEntriesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7691 c.name = name
7692 c.glossaryentry = glossaryentry
7693 return c
7694 }
7695
7696 // Fields allows partial responses to be retrieved. See
7697 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
7698 // details.
7699 func (c *ProjectsLocationsGlossariesGlossaryEntriesPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesGlossaryEntriesPatchCall {
7700 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7701 return c
7702 }
7703
7704 // Context sets the context to be used in this call's Do method.
7705 func (c *ProjectsLocationsGlossariesGlossaryEntriesPatchCall) Context(ctx context.Context) *ProjectsLocationsGlossariesGlossaryEntriesPatchCall {
7706 c.ctx_ = ctx
7707 return c
7708 }
7709
7710 // Header returns a http.Header that can be modified by the caller to add
7711 // headers to the request.
7712 func (c *ProjectsLocationsGlossariesGlossaryEntriesPatchCall) Header() http.Header {
7713 if c.header_ == nil {
7714 c.header_ = make(http.Header)
7715 }
7716 return c.header_
7717 }
7718
7719 func (c *ProjectsLocationsGlossariesGlossaryEntriesPatchCall) doRequest(alt string) (*http.Response, error) {
7720 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
7721 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.glossaryentry)
7722 if err != nil {
7723 return nil, err
7724 }
7725 c.urlParams_.Set("alt", alt)
7726 c.urlParams_.Set("prettyPrint", "false")
7727 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
7728 urls += "?" + c.urlParams_.Encode()
7729 req, err := http.NewRequest("PATCH", urls, body)
7730 if err != nil {
7731 return nil, err
7732 }
7733 req.Header = reqHeaders
7734 googleapi.Expand(req.URL, map[string]string{
7735 "name": c.name,
7736 })
7737 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.glossaryEntries.patch", "request", internallog.HTTPRequest(req, body.Bytes()))
7738 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7739 }
7740
7741 // Do executes the "translate.projects.locations.glossaries.glossaryEntries.patch" call.
7742 // Any non-2xx status code is an error. Response headers are in either
7743 // *GlossaryEntry.ServerResponse.Header or (if a response was returned at all)
7744 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
7745 // whether the returned error was because http.StatusNotModified was returned.
7746 func (c *ProjectsLocationsGlossariesGlossaryEntriesPatchCall) Do(opts ...googleapi.CallOption) (*GlossaryEntry, error) {
7747 gensupport.SetOptions(c.urlParams_, opts...)
7748 res, err := c.doRequest("json")
7749 if res != nil && res.StatusCode == http.StatusNotModified {
7750 if res.Body != nil {
7751 res.Body.Close()
7752 }
7753 return nil, gensupport.WrapError(&googleapi.Error{
7754 Code: res.StatusCode,
7755 Header: res.Header,
7756 })
7757 }
7758 if err != nil {
7759 return nil, err
7760 }
7761 defer googleapi.CloseBody(res)
7762 if err := googleapi.CheckResponse(res); err != nil {
7763 return nil, gensupport.WrapError(err)
7764 }
7765 ret := &GlossaryEntry{
7766 ServerResponse: googleapi.ServerResponse{
7767 Header: res.Header,
7768 HTTPStatusCode: res.StatusCode,
7769 },
7770 }
7771 target := &ret
7772 b, err := gensupport.DecodeResponseBytes(target, res)
7773 if err != nil {
7774 return nil, err
7775 }
7776 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.glossaries.glossaryEntries.patch", "response", internallog.HTTPResponse(res, b))
7777 return ret, nil
7778 }
7779
7780 type ProjectsLocationsModelsCreateCall struct {
7781 s *Service
7782 parent string
7783 model *Model
7784 urlParams_ gensupport.URLParams
7785 ctx_ context.Context
7786 header_ http.Header
7787 }
7788
7789 // Create: Creates a Model.
7790 //
7791 // - parent: The project name, in form of
7792 // `projects/{project}/locations/{location}`.
7793 func (r *ProjectsLocationsModelsService) Create(parent string, model *Model) *ProjectsLocationsModelsCreateCall {
7794 c := &ProjectsLocationsModelsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7795 c.parent = parent
7796 c.model = model
7797 return c
7798 }
7799
7800 // Fields allows partial responses to be retrieved. See
7801 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
7802 // details.
7803 func (c *ProjectsLocationsModelsCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsModelsCreateCall {
7804 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7805 return c
7806 }
7807
7808 // Context sets the context to be used in this call's Do method.
7809 func (c *ProjectsLocationsModelsCreateCall) Context(ctx context.Context) *ProjectsLocationsModelsCreateCall {
7810 c.ctx_ = ctx
7811 return c
7812 }
7813
7814 // Header returns a http.Header that can be modified by the caller to add
7815 // headers to the request.
7816 func (c *ProjectsLocationsModelsCreateCall) Header() http.Header {
7817 if c.header_ == nil {
7818 c.header_ = make(http.Header)
7819 }
7820 return c.header_
7821 }
7822
7823 func (c *ProjectsLocationsModelsCreateCall) doRequest(alt string) (*http.Response, error) {
7824 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
7825 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.model)
7826 if err != nil {
7827 return nil, err
7828 }
7829 c.urlParams_.Set("alt", alt)
7830 c.urlParams_.Set("prettyPrint", "false")
7831 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/models")
7832 urls += "?" + c.urlParams_.Encode()
7833 req, err := http.NewRequest("POST", urls, body)
7834 if err != nil {
7835 return nil, err
7836 }
7837 req.Header = reqHeaders
7838 googleapi.Expand(req.URL, map[string]string{
7839 "parent": c.parent,
7840 })
7841 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.models.create", "request", internallog.HTTPRequest(req, body.Bytes()))
7842 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7843 }
7844
7845 // Do executes the "translate.projects.locations.models.create" call.
7846 // Any non-2xx status code is an error. Response headers are in either
7847 // *Operation.ServerResponse.Header or (if a response was returned at all) in
7848 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
7849 // whether the returned error was because http.StatusNotModified was returned.
7850 func (c *ProjectsLocationsModelsCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
7851 gensupport.SetOptions(c.urlParams_, opts...)
7852 res, err := c.doRequest("json")
7853 if res != nil && res.StatusCode == http.StatusNotModified {
7854 if res.Body != nil {
7855 res.Body.Close()
7856 }
7857 return nil, gensupport.WrapError(&googleapi.Error{
7858 Code: res.StatusCode,
7859 Header: res.Header,
7860 })
7861 }
7862 if err != nil {
7863 return nil, err
7864 }
7865 defer googleapi.CloseBody(res)
7866 if err := googleapi.CheckResponse(res); err != nil {
7867 return nil, gensupport.WrapError(err)
7868 }
7869 ret := &Operation{
7870 ServerResponse: googleapi.ServerResponse{
7871 Header: res.Header,
7872 HTTPStatusCode: res.StatusCode,
7873 },
7874 }
7875 target := &ret
7876 b, err := gensupport.DecodeResponseBytes(target, res)
7877 if err != nil {
7878 return nil, err
7879 }
7880 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.models.create", "response", internallog.HTTPResponse(res, b))
7881 return ret, nil
7882 }
7883
7884 type ProjectsLocationsModelsDeleteCall struct {
7885 s *Service
7886 name string
7887 urlParams_ gensupport.URLParams
7888 ctx_ context.Context
7889 header_ http.Header
7890 }
7891
7892 // Delete: Deletes a model.
7893 //
7894 // - name: The name of the model to delete.
7895 func (r *ProjectsLocationsModelsService) Delete(name string) *ProjectsLocationsModelsDeleteCall {
7896 c := &ProjectsLocationsModelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7897 c.name = name
7898 return c
7899 }
7900
7901 // Fields allows partial responses to be retrieved. See
7902 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
7903 // details.
7904 func (c *ProjectsLocationsModelsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsModelsDeleteCall {
7905 c.urlParams_.Set("fields", googleapi.CombineFields(s))
7906 return c
7907 }
7908
7909 // Context sets the context to be used in this call's Do method.
7910 func (c *ProjectsLocationsModelsDeleteCall) Context(ctx context.Context) *ProjectsLocationsModelsDeleteCall {
7911 c.ctx_ = ctx
7912 return c
7913 }
7914
7915 // Header returns a http.Header that can be modified by the caller to add
7916 // headers to the request.
7917 func (c *ProjectsLocationsModelsDeleteCall) Header() http.Header {
7918 if c.header_ == nil {
7919 c.header_ = make(http.Header)
7920 }
7921 return c.header_
7922 }
7923
7924 func (c *ProjectsLocationsModelsDeleteCall) doRequest(alt string) (*http.Response, error) {
7925 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
7926 c.urlParams_.Set("alt", alt)
7927 c.urlParams_.Set("prettyPrint", "false")
7928 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
7929 urls += "?" + c.urlParams_.Encode()
7930 req, err := http.NewRequest("DELETE", urls, nil)
7931 if err != nil {
7932 return nil, err
7933 }
7934 req.Header = reqHeaders
7935 googleapi.Expand(req.URL, map[string]string{
7936 "name": c.name,
7937 })
7938 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.models.delete", "request", internallog.HTTPRequest(req, nil))
7939 return gensupport.SendRequest(c.ctx_, c.s.client, req)
7940 }
7941
7942 // Do executes the "translate.projects.locations.models.delete" call.
7943 // Any non-2xx status code is an error. Response headers are in either
7944 // *Operation.ServerResponse.Header or (if a response was returned at all) in
7945 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
7946 // whether the returned error was because http.StatusNotModified was returned.
7947 func (c *ProjectsLocationsModelsDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
7948 gensupport.SetOptions(c.urlParams_, opts...)
7949 res, err := c.doRequest("json")
7950 if res != nil && res.StatusCode == http.StatusNotModified {
7951 if res.Body != nil {
7952 res.Body.Close()
7953 }
7954 return nil, gensupport.WrapError(&googleapi.Error{
7955 Code: res.StatusCode,
7956 Header: res.Header,
7957 })
7958 }
7959 if err != nil {
7960 return nil, err
7961 }
7962 defer googleapi.CloseBody(res)
7963 if err := googleapi.CheckResponse(res); err != nil {
7964 return nil, gensupport.WrapError(err)
7965 }
7966 ret := &Operation{
7967 ServerResponse: googleapi.ServerResponse{
7968 Header: res.Header,
7969 HTTPStatusCode: res.StatusCode,
7970 },
7971 }
7972 target := &ret
7973 b, err := gensupport.DecodeResponseBytes(target, res)
7974 if err != nil {
7975 return nil, err
7976 }
7977 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.models.delete", "response", internallog.HTTPResponse(res, b))
7978 return ret, nil
7979 }
7980
7981 type ProjectsLocationsModelsGetCall struct {
7982 s *Service
7983 name string
7984 urlParams_ gensupport.URLParams
7985 ifNoneMatch_ string
7986 ctx_ context.Context
7987 header_ http.Header
7988 }
7989
7990 // Get: Gets a model.
7991 //
7992 // - name: The resource name of the model to retrieve.
7993 func (r *ProjectsLocationsModelsService) Get(name string) *ProjectsLocationsModelsGetCall {
7994 c := &ProjectsLocationsModelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7995 c.name = name
7996 return c
7997 }
7998
7999 // Fields allows partial responses to be retrieved. See
8000 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
8001 // details.
8002 func (c *ProjectsLocationsModelsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsModelsGetCall {
8003 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8004 return c
8005 }
8006
8007 // IfNoneMatch sets an optional parameter which makes the operation fail if the
8008 // object's ETag matches the given value. This is useful for getting updates
8009 // only after the object has changed since the last request.
8010 func (c *ProjectsLocationsModelsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsModelsGetCall {
8011 c.ifNoneMatch_ = entityTag
8012 return c
8013 }
8014
8015 // Context sets the context to be used in this call's Do method.
8016 func (c *ProjectsLocationsModelsGetCall) Context(ctx context.Context) *ProjectsLocationsModelsGetCall {
8017 c.ctx_ = ctx
8018 return c
8019 }
8020
8021 // Header returns a http.Header that can be modified by the caller to add
8022 // headers to the request.
8023 func (c *ProjectsLocationsModelsGetCall) Header() http.Header {
8024 if c.header_ == nil {
8025 c.header_ = make(http.Header)
8026 }
8027 return c.header_
8028 }
8029
8030 func (c *ProjectsLocationsModelsGetCall) doRequest(alt string) (*http.Response, error) {
8031 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
8032 if c.ifNoneMatch_ != "" {
8033 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
8034 }
8035 c.urlParams_.Set("alt", alt)
8036 c.urlParams_.Set("prettyPrint", "false")
8037 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
8038 urls += "?" + c.urlParams_.Encode()
8039 req, err := http.NewRequest("GET", urls, nil)
8040 if err != nil {
8041 return nil, err
8042 }
8043 req.Header = reqHeaders
8044 googleapi.Expand(req.URL, map[string]string{
8045 "name": c.name,
8046 })
8047 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.models.get", "request", internallog.HTTPRequest(req, nil))
8048 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8049 }
8050
8051 // Do executes the "translate.projects.locations.models.get" call.
8052 // Any non-2xx status code is an error. Response headers are in either
8053 // *Model.ServerResponse.Header or (if a response was returned at all) in
8054 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
8055 // whether the returned error was because http.StatusNotModified was returned.
8056 func (c *ProjectsLocationsModelsGetCall) Do(opts ...googleapi.CallOption) (*Model, error) {
8057 gensupport.SetOptions(c.urlParams_, opts...)
8058 res, err := c.doRequest("json")
8059 if res != nil && res.StatusCode == http.StatusNotModified {
8060 if res.Body != nil {
8061 res.Body.Close()
8062 }
8063 return nil, gensupport.WrapError(&googleapi.Error{
8064 Code: res.StatusCode,
8065 Header: res.Header,
8066 })
8067 }
8068 if err != nil {
8069 return nil, err
8070 }
8071 defer googleapi.CloseBody(res)
8072 if err := googleapi.CheckResponse(res); err != nil {
8073 return nil, gensupport.WrapError(err)
8074 }
8075 ret := &Model{
8076 ServerResponse: googleapi.ServerResponse{
8077 Header: res.Header,
8078 HTTPStatusCode: res.StatusCode,
8079 },
8080 }
8081 target := &ret
8082 b, err := gensupport.DecodeResponseBytes(target, res)
8083 if err != nil {
8084 return nil, err
8085 }
8086 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.models.get", "response", internallog.HTTPResponse(res, b))
8087 return ret, nil
8088 }
8089
8090 type ProjectsLocationsModelsListCall struct {
8091 s *Service
8092 parent string
8093 urlParams_ gensupport.URLParams
8094 ifNoneMatch_ string
8095 ctx_ context.Context
8096 header_ http.Header
8097 }
8098
8099 // List: Lists models.
8100 //
8101 // - parent: Name of the parent project. In form of
8102 // `projects/{project-number-or-id}/locations/{location-id}`.
8103 func (r *ProjectsLocationsModelsService) List(parent string) *ProjectsLocationsModelsListCall {
8104 c := &ProjectsLocationsModelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8105 c.parent = parent
8106 return c
8107 }
8108
8109 // Filter sets the optional parameter "filter": An expression for filtering the
8110 // models that will be returned. Supported filter: `dataset_id=${dataset_id}`
8111 func (c *ProjectsLocationsModelsListCall) Filter(filter string) *ProjectsLocationsModelsListCall {
8112 c.urlParams_.Set("filter", filter)
8113 return c
8114 }
8115
8116 // PageSize sets the optional parameter "pageSize": Requested page size. The
8117 // server can return fewer results than requested.
8118 func (c *ProjectsLocationsModelsListCall) PageSize(pageSize int64) *ProjectsLocationsModelsListCall {
8119 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
8120 return c
8121 }
8122
8123 // PageToken sets the optional parameter "pageToken": A token identifying a
8124 // page of results for the server to return. Typically obtained from
8125 // next_page_token field in the response of a ListModels call.
8126 func (c *ProjectsLocationsModelsListCall) PageToken(pageToken string) *ProjectsLocationsModelsListCall {
8127 c.urlParams_.Set("pageToken", pageToken)
8128 return c
8129 }
8130
8131 // Fields allows partial responses to be retrieved. See
8132 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
8133 // details.
8134 func (c *ProjectsLocationsModelsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsModelsListCall {
8135 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8136 return c
8137 }
8138
8139 // IfNoneMatch sets an optional parameter which makes the operation fail if the
8140 // object's ETag matches the given value. This is useful for getting updates
8141 // only after the object has changed since the last request.
8142 func (c *ProjectsLocationsModelsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsModelsListCall {
8143 c.ifNoneMatch_ = entityTag
8144 return c
8145 }
8146
8147 // Context sets the context to be used in this call's Do method.
8148 func (c *ProjectsLocationsModelsListCall) Context(ctx context.Context) *ProjectsLocationsModelsListCall {
8149 c.ctx_ = ctx
8150 return c
8151 }
8152
8153 // Header returns a http.Header that can be modified by the caller to add
8154 // headers to the request.
8155 func (c *ProjectsLocationsModelsListCall) Header() http.Header {
8156 if c.header_ == nil {
8157 c.header_ = make(http.Header)
8158 }
8159 return c.header_
8160 }
8161
8162 func (c *ProjectsLocationsModelsListCall) doRequest(alt string) (*http.Response, error) {
8163 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
8164 if c.ifNoneMatch_ != "" {
8165 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
8166 }
8167 c.urlParams_.Set("alt", alt)
8168 c.urlParams_.Set("prettyPrint", "false")
8169 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+parent}/models")
8170 urls += "?" + c.urlParams_.Encode()
8171 req, err := http.NewRequest("GET", urls, nil)
8172 if err != nil {
8173 return nil, err
8174 }
8175 req.Header = reqHeaders
8176 googleapi.Expand(req.URL, map[string]string{
8177 "parent": c.parent,
8178 })
8179 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.models.list", "request", internallog.HTTPRequest(req, nil))
8180 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8181 }
8182
8183 // Do executes the "translate.projects.locations.models.list" call.
8184 // Any non-2xx status code is an error. Response headers are in either
8185 // *ListModelsResponse.ServerResponse.Header or (if a response was returned at
8186 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
8187 // check whether the returned error was because http.StatusNotModified was
8188 // returned.
8189 func (c *ProjectsLocationsModelsListCall) Do(opts ...googleapi.CallOption) (*ListModelsResponse, error) {
8190 gensupport.SetOptions(c.urlParams_, opts...)
8191 res, err := c.doRequest("json")
8192 if res != nil && res.StatusCode == http.StatusNotModified {
8193 if res.Body != nil {
8194 res.Body.Close()
8195 }
8196 return nil, gensupport.WrapError(&googleapi.Error{
8197 Code: res.StatusCode,
8198 Header: res.Header,
8199 })
8200 }
8201 if err != nil {
8202 return nil, err
8203 }
8204 defer googleapi.CloseBody(res)
8205 if err := googleapi.CheckResponse(res); err != nil {
8206 return nil, gensupport.WrapError(err)
8207 }
8208 ret := &ListModelsResponse{
8209 ServerResponse: googleapi.ServerResponse{
8210 Header: res.Header,
8211 HTTPStatusCode: res.StatusCode,
8212 },
8213 }
8214 target := &ret
8215 b, err := gensupport.DecodeResponseBytes(target, res)
8216 if err != nil {
8217 return nil, err
8218 }
8219 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.models.list", "response", internallog.HTTPResponse(res, b))
8220 return ret, nil
8221 }
8222
8223 // Pages invokes f for each page of results.
8224 // A non-nil error returned from f will halt the iteration.
8225 // The provided context supersedes any context provided to the Context method.
8226 func (c *ProjectsLocationsModelsListCall) Pages(ctx context.Context, f func(*ListModelsResponse) error) error {
8227 c.ctx_ = ctx
8228 defer c.PageToken(c.urlParams_.Get("pageToken"))
8229 for {
8230 x, err := c.Do()
8231 if err != nil {
8232 return err
8233 }
8234 if err := f(x); err != nil {
8235 return err
8236 }
8237 if x.NextPageToken == "" {
8238 return nil
8239 }
8240 c.PageToken(x.NextPageToken)
8241 }
8242 }
8243
8244 type ProjectsLocationsOperationsCancelCall struct {
8245 s *Service
8246 name string
8247 canceloperationrequest *CancelOperationRequest
8248 urlParams_ gensupport.URLParams
8249 ctx_ context.Context
8250 header_ http.Header
8251 }
8252
8253 // Cancel: Starts asynchronous cancellation on a long-running operation. The
8254 // server makes a best effort to cancel the operation, but success is not
8255 // guaranteed. If the server doesn't support this method, it returns
8256 // `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or
8257 // other methods to check whether the cancellation succeeded or whether the
8258 // operation completed despite cancellation. On successful cancellation, the
8259 // operation is not deleted; instead, it becomes an operation with an
8260 // Operation.error value with a google.rpc.Status.code of `1`, corresponding to
8261 // `Code.CANCELLED`.
8262 //
8263 // - name: The name of the operation resource to be cancelled.
8264 func (r *ProjectsLocationsOperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *ProjectsLocationsOperationsCancelCall {
8265 c := &ProjectsLocationsOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8266 c.name = name
8267 c.canceloperationrequest = canceloperationrequest
8268 return c
8269 }
8270
8271 // Fields allows partial responses to be retrieved. See
8272 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
8273 // details.
8274 func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall {
8275 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8276 return c
8277 }
8278
8279 // Context sets the context to be used in this call's Do method.
8280 func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall {
8281 c.ctx_ = ctx
8282 return c
8283 }
8284
8285 // Header returns a http.Header that can be modified by the caller to add
8286 // headers to the request.
8287 func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header {
8288 if c.header_ == nil {
8289 c.header_ = make(http.Header)
8290 }
8291 return c.header_
8292 }
8293
8294 func (c *ProjectsLocationsOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
8295 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
8296 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.canceloperationrequest)
8297 if err != nil {
8298 return nil, err
8299 }
8300 c.urlParams_.Set("alt", alt)
8301 c.urlParams_.Set("prettyPrint", "false")
8302 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}:cancel")
8303 urls += "?" + c.urlParams_.Encode()
8304 req, err := http.NewRequest("POST", urls, body)
8305 if err != nil {
8306 return nil, err
8307 }
8308 req.Header = reqHeaders
8309 googleapi.Expand(req.URL, map[string]string{
8310 "name": c.name,
8311 })
8312 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.operations.cancel", "request", internallog.HTTPRequest(req, body.Bytes()))
8313 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8314 }
8315
8316 // Do executes the "translate.projects.locations.operations.cancel" call.
8317 // Any non-2xx status code is an error. Response headers are in either
8318 // *Empty.ServerResponse.Header or (if a response was returned at all) in
8319 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
8320 // whether the returned error was because http.StatusNotModified was returned.
8321 func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
8322 gensupport.SetOptions(c.urlParams_, opts...)
8323 res, err := c.doRequest("json")
8324 if res != nil && res.StatusCode == http.StatusNotModified {
8325 if res.Body != nil {
8326 res.Body.Close()
8327 }
8328 return nil, gensupport.WrapError(&googleapi.Error{
8329 Code: res.StatusCode,
8330 Header: res.Header,
8331 })
8332 }
8333 if err != nil {
8334 return nil, err
8335 }
8336 defer googleapi.CloseBody(res)
8337 if err := googleapi.CheckResponse(res); err != nil {
8338 return nil, gensupport.WrapError(err)
8339 }
8340 ret := &Empty{
8341 ServerResponse: googleapi.ServerResponse{
8342 Header: res.Header,
8343 HTTPStatusCode: res.StatusCode,
8344 },
8345 }
8346 target := &ret
8347 b, err := gensupport.DecodeResponseBytes(target, res)
8348 if err != nil {
8349 return nil, err
8350 }
8351 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.operations.cancel", "response", internallog.HTTPResponse(res, b))
8352 return ret, nil
8353 }
8354
8355 type ProjectsLocationsOperationsDeleteCall struct {
8356 s *Service
8357 name string
8358 urlParams_ gensupport.URLParams
8359 ctx_ context.Context
8360 header_ http.Header
8361 }
8362
8363 // Delete: Deletes a long-running operation. This method indicates that the
8364 // client is no longer interested in the operation result. It does not cancel
8365 // the operation. If the server doesn't support this method, it returns
8366 // `google.rpc.Code.UNIMPLEMENTED`.
8367 //
8368 // - name: The name of the operation resource to be deleted.
8369 func (r *ProjectsLocationsOperationsService) Delete(name string) *ProjectsLocationsOperationsDeleteCall {
8370 c := &ProjectsLocationsOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8371 c.name = name
8372 return c
8373 }
8374
8375 // Fields allows partial responses to be retrieved. See
8376 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
8377 // details.
8378 func (c *ProjectsLocationsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsDeleteCall {
8379 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8380 return c
8381 }
8382
8383 // Context sets the context to be used in this call's Do method.
8384 func (c *ProjectsLocationsOperationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsOperationsDeleteCall {
8385 c.ctx_ = ctx
8386 return c
8387 }
8388
8389 // Header returns a http.Header that can be modified by the caller to add
8390 // headers to the request.
8391 func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header {
8392 if c.header_ == nil {
8393 c.header_ = make(http.Header)
8394 }
8395 return c.header_
8396 }
8397
8398 func (c *ProjectsLocationsOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
8399 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
8400 c.urlParams_.Set("alt", alt)
8401 c.urlParams_.Set("prettyPrint", "false")
8402 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
8403 urls += "?" + c.urlParams_.Encode()
8404 req, err := http.NewRequest("DELETE", urls, nil)
8405 if err != nil {
8406 return nil, err
8407 }
8408 req.Header = reqHeaders
8409 googleapi.Expand(req.URL, map[string]string{
8410 "name": c.name,
8411 })
8412 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.operations.delete", "request", internallog.HTTPRequest(req, nil))
8413 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8414 }
8415
8416 // Do executes the "translate.projects.locations.operations.delete" call.
8417 // Any non-2xx status code is an error. Response headers are in either
8418 // *Empty.ServerResponse.Header or (if a response was returned at all) in
8419 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
8420 // whether the returned error was because http.StatusNotModified was returned.
8421 func (c *ProjectsLocationsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
8422 gensupport.SetOptions(c.urlParams_, opts...)
8423 res, err := c.doRequest("json")
8424 if res != nil && res.StatusCode == http.StatusNotModified {
8425 if res.Body != nil {
8426 res.Body.Close()
8427 }
8428 return nil, gensupport.WrapError(&googleapi.Error{
8429 Code: res.StatusCode,
8430 Header: res.Header,
8431 })
8432 }
8433 if err != nil {
8434 return nil, err
8435 }
8436 defer googleapi.CloseBody(res)
8437 if err := googleapi.CheckResponse(res); err != nil {
8438 return nil, gensupport.WrapError(err)
8439 }
8440 ret := &Empty{
8441 ServerResponse: googleapi.ServerResponse{
8442 Header: res.Header,
8443 HTTPStatusCode: res.StatusCode,
8444 },
8445 }
8446 target := &ret
8447 b, err := gensupport.DecodeResponseBytes(target, res)
8448 if err != nil {
8449 return nil, err
8450 }
8451 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.operations.delete", "response", internallog.HTTPResponse(res, b))
8452 return ret, nil
8453 }
8454
8455 type ProjectsLocationsOperationsGetCall struct {
8456 s *Service
8457 name string
8458 urlParams_ gensupport.URLParams
8459 ifNoneMatch_ string
8460 ctx_ context.Context
8461 header_ http.Header
8462 }
8463
8464 // Get: Gets the latest state of a long-running operation. Clients can use this
8465 // method to poll the operation result at intervals as recommended by the API
8466 // service.
8467 //
8468 // - name: The name of the operation resource.
8469 func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall {
8470 c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8471 c.name = name
8472 return c
8473 }
8474
8475 // Fields allows partial responses to be retrieved. See
8476 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
8477 // details.
8478 func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall {
8479 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8480 return c
8481 }
8482
8483 // IfNoneMatch sets an optional parameter which makes the operation fail if the
8484 // object's ETag matches the given value. This is useful for getting updates
8485 // only after the object has changed since the last request.
8486 func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {
8487 c.ifNoneMatch_ = entityTag
8488 return c
8489 }
8490
8491 // Context sets the context to be used in this call's Do method.
8492 func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall {
8493 c.ctx_ = ctx
8494 return c
8495 }
8496
8497 // Header returns a http.Header that can be modified by the caller to add
8498 // headers to the request.
8499 func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
8500 if c.header_ == nil {
8501 c.header_ = make(http.Header)
8502 }
8503 return c.header_
8504 }
8505
8506 func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
8507 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
8508 if c.ifNoneMatch_ != "" {
8509 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
8510 }
8511 c.urlParams_.Set("alt", alt)
8512 c.urlParams_.Set("prettyPrint", "false")
8513 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}")
8514 urls += "?" + c.urlParams_.Encode()
8515 req, err := http.NewRequest("GET", urls, nil)
8516 if err != nil {
8517 return nil, err
8518 }
8519 req.Header = reqHeaders
8520 googleapi.Expand(req.URL, map[string]string{
8521 "name": c.name,
8522 })
8523 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.operations.get", "request", internallog.HTTPRequest(req, nil))
8524 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8525 }
8526
8527 // Do executes the "translate.projects.locations.operations.get" call.
8528 // Any non-2xx status code is an error. Response headers are in either
8529 // *Operation.ServerResponse.Header or (if a response was returned at all) in
8530 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
8531 // whether the returned error was because http.StatusNotModified was returned.
8532 func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
8533 gensupport.SetOptions(c.urlParams_, opts...)
8534 res, err := c.doRequest("json")
8535 if res != nil && res.StatusCode == http.StatusNotModified {
8536 if res.Body != nil {
8537 res.Body.Close()
8538 }
8539 return nil, gensupport.WrapError(&googleapi.Error{
8540 Code: res.StatusCode,
8541 Header: res.Header,
8542 })
8543 }
8544 if err != nil {
8545 return nil, err
8546 }
8547 defer googleapi.CloseBody(res)
8548 if err := googleapi.CheckResponse(res); err != nil {
8549 return nil, gensupport.WrapError(err)
8550 }
8551 ret := &Operation{
8552 ServerResponse: googleapi.ServerResponse{
8553 Header: res.Header,
8554 HTTPStatusCode: res.StatusCode,
8555 },
8556 }
8557 target := &ret
8558 b, err := gensupport.DecodeResponseBytes(target, res)
8559 if err != nil {
8560 return nil, err
8561 }
8562 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.operations.get", "response", internallog.HTTPResponse(res, b))
8563 return ret, nil
8564 }
8565
8566 type ProjectsLocationsOperationsListCall struct {
8567 s *Service
8568 name string
8569 urlParams_ gensupport.URLParams
8570 ifNoneMatch_ string
8571 ctx_ context.Context
8572 header_ http.Header
8573 }
8574
8575 // List: Lists operations that match the specified filter in the request. If
8576 // the server doesn't support this method, it returns `UNIMPLEMENTED`.
8577 //
8578 // - name: The name of the operation's parent resource.
8579 func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall {
8580 c := &ProjectsLocationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8581 c.name = name
8582 return c
8583 }
8584
8585 // Filter sets the optional parameter "filter": The standard list filter.
8586 func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall {
8587 c.urlParams_.Set("filter", filter)
8588 return c
8589 }
8590
8591 // PageSize sets the optional parameter "pageSize": The standard list page
8592 // size.
8593 func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall {
8594 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
8595 return c
8596 }
8597
8598 // PageToken sets the optional parameter "pageToken": The standard list page
8599 // token.
8600 func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall {
8601 c.urlParams_.Set("pageToken", pageToken)
8602 return c
8603 }
8604
8605 // ReturnPartialSuccess sets the optional parameter "returnPartialSuccess":
8606 // When set to `true`, operations that are reachable are returned as normal,
8607 // and those that are unreachable are returned in the
8608 // ListOperationsResponse.unreachable field. This can only be `true` when
8609 // reading across collections. For example, when `parent` is set to
8610 // "projects/example/locations/-". This field is not supported by default and
8611 // will result in an `UNIMPLEMENTED` error if set unless explicitly documented
8612 // otherwise in service or product specific documentation.
8613 func (c *ProjectsLocationsOperationsListCall) ReturnPartialSuccess(returnPartialSuccess bool) *ProjectsLocationsOperationsListCall {
8614 c.urlParams_.Set("returnPartialSuccess", fmt.Sprint(returnPartialSuccess))
8615 return c
8616 }
8617
8618 // Fields allows partial responses to be retrieved. See
8619 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
8620 // details.
8621 func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall {
8622 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8623 return c
8624 }
8625
8626 // IfNoneMatch sets an optional parameter which makes the operation fail if the
8627 // object's ETag matches the given value. This is useful for getting updates
8628 // only after the object has changed since the last request.
8629 func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall {
8630 c.ifNoneMatch_ = entityTag
8631 return c
8632 }
8633
8634 // Context sets the context to be used in this call's Do method.
8635 func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall {
8636 c.ctx_ = ctx
8637 return c
8638 }
8639
8640 // Header returns a http.Header that can be modified by the caller to add
8641 // headers to the request.
8642 func (c *ProjectsLocationsOperationsListCall) Header() http.Header {
8643 if c.header_ == nil {
8644 c.header_ = make(http.Header)
8645 }
8646 return c.header_
8647 }
8648
8649 func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) {
8650 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
8651 if c.ifNoneMatch_ != "" {
8652 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
8653 }
8654 c.urlParams_.Set("alt", alt)
8655 c.urlParams_.Set("prettyPrint", "false")
8656 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}/operations")
8657 urls += "?" + c.urlParams_.Encode()
8658 req, err := http.NewRequest("GET", urls, nil)
8659 if err != nil {
8660 return nil, err
8661 }
8662 req.Header = reqHeaders
8663 googleapi.Expand(req.URL, map[string]string{
8664 "name": c.name,
8665 })
8666 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.operations.list", "request", internallog.HTTPRequest(req, nil))
8667 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8668 }
8669
8670 // Do executes the "translate.projects.locations.operations.list" call.
8671 // Any non-2xx status code is an error. Response headers are in either
8672 // *ListOperationsResponse.ServerResponse.Header or (if a response was returned
8673 // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
8674 // check whether the returned error was because http.StatusNotModified was
8675 // returned.
8676 func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
8677 gensupport.SetOptions(c.urlParams_, opts...)
8678 res, err := c.doRequest("json")
8679 if res != nil && res.StatusCode == http.StatusNotModified {
8680 if res.Body != nil {
8681 res.Body.Close()
8682 }
8683 return nil, gensupport.WrapError(&googleapi.Error{
8684 Code: res.StatusCode,
8685 Header: res.Header,
8686 })
8687 }
8688 if err != nil {
8689 return nil, err
8690 }
8691 defer googleapi.CloseBody(res)
8692 if err := googleapi.CheckResponse(res); err != nil {
8693 return nil, gensupport.WrapError(err)
8694 }
8695 ret := &ListOperationsResponse{
8696 ServerResponse: googleapi.ServerResponse{
8697 Header: res.Header,
8698 HTTPStatusCode: res.StatusCode,
8699 },
8700 }
8701 target := &ret
8702 b, err := gensupport.DecodeResponseBytes(target, res)
8703 if err != nil {
8704 return nil, err
8705 }
8706 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.operations.list", "response", internallog.HTTPResponse(res, b))
8707 return ret, nil
8708 }
8709
8710 // Pages invokes f for each page of results.
8711 // A non-nil error returned from f will halt the iteration.
8712 // The provided context supersedes any context provided to the Context method.
8713 func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
8714 c.ctx_ = ctx
8715 defer c.PageToken(c.urlParams_.Get("pageToken"))
8716 for {
8717 x, err := c.Do()
8718 if err != nil {
8719 return err
8720 }
8721 if err := f(x); err != nil {
8722 return err
8723 }
8724 if x.NextPageToken == "" {
8725 return nil
8726 }
8727 c.PageToken(x.NextPageToken)
8728 }
8729 }
8730
8731 type ProjectsLocationsOperationsWaitCall struct {
8732 s *Service
8733 name string
8734 waitoperationrequest *WaitOperationRequest
8735 urlParams_ gensupport.URLParams
8736 ctx_ context.Context
8737 header_ http.Header
8738 }
8739
8740 // Wait: Waits until the specified long-running operation is done or reaches at
8741 // most a specified timeout, returning the latest state. If the operation is
8742 // already done, the latest state is immediately returned. If the timeout
8743 // specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout
8744 // is used. If the server does not support this method, it returns
8745 // `google.rpc.Code.UNIMPLEMENTED`. Note that this method is on a best-effort
8746 // basis. It may return the latest state before the specified timeout
8747 // (including immediately), meaning even an immediate response is no guarantee
8748 // that the operation is done.
8749 //
8750 // - name: The name of the operation resource to wait on.
8751 func (r *ProjectsLocationsOperationsService) Wait(name string, waitoperationrequest *WaitOperationRequest) *ProjectsLocationsOperationsWaitCall {
8752 c := &ProjectsLocationsOperationsWaitCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8753 c.name = name
8754 c.waitoperationrequest = waitoperationrequest
8755 return c
8756 }
8757
8758 // Fields allows partial responses to be retrieved. See
8759 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
8760 // details.
8761 func (c *ProjectsLocationsOperationsWaitCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsWaitCall {
8762 c.urlParams_.Set("fields", googleapi.CombineFields(s))
8763 return c
8764 }
8765
8766 // Context sets the context to be used in this call's Do method.
8767 func (c *ProjectsLocationsOperationsWaitCall) Context(ctx context.Context) *ProjectsLocationsOperationsWaitCall {
8768 c.ctx_ = ctx
8769 return c
8770 }
8771
8772 // Header returns a http.Header that can be modified by the caller to add
8773 // headers to the request.
8774 func (c *ProjectsLocationsOperationsWaitCall) Header() http.Header {
8775 if c.header_ == nil {
8776 c.header_ = make(http.Header)
8777 }
8778 return c.header_
8779 }
8780
8781 func (c *ProjectsLocationsOperationsWaitCall) doRequest(alt string) (*http.Response, error) {
8782 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
8783 body, err := googleapi.WithoutDataWrapper.JSONBuffer(c.waitoperationrequest)
8784 if err != nil {
8785 return nil, err
8786 }
8787 c.urlParams_.Set("alt", alt)
8788 c.urlParams_.Set("prettyPrint", "false")
8789 urls := googleapi.ResolveRelative(c.s.BasePath, "v3/{+name}:wait")
8790 urls += "?" + c.urlParams_.Encode()
8791 req, err := http.NewRequest("POST", urls, body)
8792 if err != nil {
8793 return nil, err
8794 }
8795 req.Header = reqHeaders
8796 googleapi.Expand(req.URL, map[string]string{
8797 "name": c.name,
8798 })
8799 c.s.logger.DebugContext(c.ctx_, "api request", "serviceName", apiName, "rpcName", "translate.projects.locations.operations.wait", "request", internallog.HTTPRequest(req, body.Bytes()))
8800 return gensupport.SendRequest(c.ctx_, c.s.client, req)
8801 }
8802
8803 // Do executes the "translate.projects.locations.operations.wait" call.
8804 // Any non-2xx status code is an error. Response headers are in either
8805 // *Operation.ServerResponse.Header or (if a response was returned at all) in
8806 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
8807 // whether the returned error was because http.StatusNotModified was returned.
8808 func (c *ProjectsLocationsOperationsWaitCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
8809 gensupport.SetOptions(c.urlParams_, opts...)
8810 res, err := c.doRequest("json")
8811 if res != nil && res.StatusCode == http.StatusNotModified {
8812 if res.Body != nil {
8813 res.Body.Close()
8814 }
8815 return nil, gensupport.WrapError(&googleapi.Error{
8816 Code: res.StatusCode,
8817 Header: res.Header,
8818 })
8819 }
8820 if err != nil {
8821 return nil, err
8822 }
8823 defer googleapi.CloseBody(res)
8824 if err := googleapi.CheckResponse(res); err != nil {
8825 return nil, gensupport.WrapError(err)
8826 }
8827 ret := &Operation{
8828 ServerResponse: googleapi.ServerResponse{
8829 Header: res.Header,
8830 HTTPStatusCode: res.StatusCode,
8831 },
8832 }
8833 target := &ret
8834 b, err := gensupport.DecodeResponseBytes(target, res)
8835 if err != nil {
8836 return nil, err
8837 }
8838 c.s.logger.DebugContext(c.ctx_, "api response", "serviceName", apiName, "rpcName", "translate.projects.locations.operations.wait", "response", internallog.HTTPResponse(res, b))
8839 return ret, nil
8840 }