Documentation ¶
Overview ¶
Package translate provides access to the Cloud Translation API.
This package is DEPRECATED. Use package cloud.google.com/go/translate instead.
For product documentation, see: https://cloud.google.com/translate/docs/quickstarts
Library status ¶
These client libraries are officially supported by Google. However, this library is considered complete and is in maintenance mode. This means that we will address critical bugs and security issues but will not add any new features.
When possible, we recommend using our newer [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) that are still actively being worked and iterated on.
Creating a client ¶
Usage example:
import "google.golang.org/api/translate/v3beta1" ... ctx := context.Background() translateService, err := translate.NewService(ctx)
In this example, Google Application Default Credentials are used for authentication. For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
Other authentication options ¶
By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use google.golang.org/api/option.WithScopes:
translateService, err := translate.NewService(ctx, option.WithScopes(translate.CloudTranslationScope))
To use an API key for authentication (note: some APIs do not support API keys), use google.golang.org/api/option.WithAPIKey:
translateService, err := translate.NewService(ctx, option.WithAPIKey("AIza..."))
To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow, use google.golang.org/api/option.WithTokenSource:
config := &oauth2.Config{...} // ... token, err := config.Exchange(ctx, ...) translateService, err := translate.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
See google.golang.org/api/option.ClientOption for details on options.
Index ¶
- Constants
- type BatchDocumentInputConfig
- type BatchDocumentOutputConfig
- type BatchTranslateDocumentRequest
- type BatchTranslateTextRequest
- type CancelOperationRequest
- type DetectLanguageRequest
- type DetectLanguageResponse
- type DetectedLanguage
- type DocumentInputConfig
- type DocumentOutputConfig
- type DocumentTranslation
- type Empty
- type GcsDestination
- type GcsSource
- type Glossary
- type GlossaryInputConfig
- type InputConfig
- type LanguageCodePair
- type LanguageCodesSet
- type ListGlossariesResponse
- type ListLocationsResponse
- type ListOperationsResponse
- type Location
- type Operation
- type OutputConfig
- type ProjectsDetectLanguageCall
- func (c *ProjectsDetectLanguageCall) Context(ctx context.Context) *ProjectsDetectLanguageCall
- func (c *ProjectsDetectLanguageCall) Do(opts ...googleapi.CallOption) (*DetectLanguageResponse, error)
- func (c *ProjectsDetectLanguageCall) Fields(s ...googleapi.Field) *ProjectsDetectLanguageCall
- func (c *ProjectsDetectLanguageCall) Header() http.Header
- type ProjectsGetSupportedLanguagesCall
- func (c *ProjectsGetSupportedLanguagesCall) Context(ctx context.Context) *ProjectsGetSupportedLanguagesCall
- func (c *ProjectsGetSupportedLanguagesCall) DisplayLanguageCode(displayLanguageCode string) *ProjectsGetSupportedLanguagesCall
- func (c *ProjectsGetSupportedLanguagesCall) Do(opts ...googleapi.CallOption) (*SupportedLanguages, error)
- func (c *ProjectsGetSupportedLanguagesCall) Fields(s ...googleapi.Field) *ProjectsGetSupportedLanguagesCall
- func (c *ProjectsGetSupportedLanguagesCall) Header() http.Header
- func (c *ProjectsGetSupportedLanguagesCall) IfNoneMatch(entityTag string) *ProjectsGetSupportedLanguagesCall
- func (c *ProjectsGetSupportedLanguagesCall) Model(model string) *ProjectsGetSupportedLanguagesCall
- type ProjectsLocationsBatchTranslateDocumentCall
- func (c *ProjectsLocationsBatchTranslateDocumentCall) Context(ctx context.Context) *ProjectsLocationsBatchTranslateDocumentCall
- func (c *ProjectsLocationsBatchTranslateDocumentCall) Do(opts ...googleapi.CallOption) (*Operation, error)
- func (c *ProjectsLocationsBatchTranslateDocumentCall) Fields(s ...googleapi.Field) *ProjectsLocationsBatchTranslateDocumentCall
- func (c *ProjectsLocationsBatchTranslateDocumentCall) Header() http.Header
- type ProjectsLocationsBatchTranslateTextCall
- func (c *ProjectsLocationsBatchTranslateTextCall) Context(ctx context.Context) *ProjectsLocationsBatchTranslateTextCall
- func (c *ProjectsLocationsBatchTranslateTextCall) Do(opts ...googleapi.CallOption) (*Operation, error)
- func (c *ProjectsLocationsBatchTranslateTextCall) Fields(s ...googleapi.Field) *ProjectsLocationsBatchTranslateTextCall
- func (c *ProjectsLocationsBatchTranslateTextCall) Header() http.Header
- type ProjectsLocationsDetectLanguageCall
- func (c *ProjectsLocationsDetectLanguageCall) Context(ctx context.Context) *ProjectsLocationsDetectLanguageCall
- func (c *ProjectsLocationsDetectLanguageCall) Do(opts ...googleapi.CallOption) (*DetectLanguageResponse, error)
- func (c *ProjectsLocationsDetectLanguageCall) Fields(s ...googleapi.Field) *ProjectsLocationsDetectLanguageCall
- func (c *ProjectsLocationsDetectLanguageCall) Header() http.Header
- type ProjectsLocationsGetCall
- func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall
- func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error)
- func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall
- func (c *ProjectsLocationsGetCall) Header() http.Header
- func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall
- type ProjectsLocationsGetSupportedLanguagesCall
- func (c *ProjectsLocationsGetSupportedLanguagesCall) Context(ctx context.Context) *ProjectsLocationsGetSupportedLanguagesCall
- func (c *ProjectsLocationsGetSupportedLanguagesCall) DisplayLanguageCode(displayLanguageCode string) *ProjectsLocationsGetSupportedLanguagesCall
- func (c *ProjectsLocationsGetSupportedLanguagesCall) Do(opts ...googleapi.CallOption) (*SupportedLanguages, error)
- func (c *ProjectsLocationsGetSupportedLanguagesCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetSupportedLanguagesCall
- func (c *ProjectsLocationsGetSupportedLanguagesCall) Header() http.Header
- func (c *ProjectsLocationsGetSupportedLanguagesCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetSupportedLanguagesCall
- func (c *ProjectsLocationsGetSupportedLanguagesCall) Model(model string) *ProjectsLocationsGetSupportedLanguagesCall
- type ProjectsLocationsGlossariesCreateCall
- func (c *ProjectsLocationsGlossariesCreateCall) Context(ctx context.Context) *ProjectsLocationsGlossariesCreateCall
- func (c *ProjectsLocationsGlossariesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error)
- func (c *ProjectsLocationsGlossariesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesCreateCall
- func (c *ProjectsLocationsGlossariesCreateCall) Header() http.Header
- type ProjectsLocationsGlossariesDeleteCall
- func (c *ProjectsLocationsGlossariesDeleteCall) Context(ctx context.Context) *ProjectsLocationsGlossariesDeleteCall
- func (c *ProjectsLocationsGlossariesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error)
- func (c *ProjectsLocationsGlossariesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesDeleteCall
- func (c *ProjectsLocationsGlossariesDeleteCall) Header() http.Header
- type ProjectsLocationsGlossariesGetCall
- func (c *ProjectsLocationsGlossariesGetCall) Context(ctx context.Context) *ProjectsLocationsGlossariesGetCall
- func (c *ProjectsLocationsGlossariesGetCall) Do(opts ...googleapi.CallOption) (*Glossary, error)
- func (c *ProjectsLocationsGlossariesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesGetCall
- func (c *ProjectsLocationsGlossariesGetCall) Header() http.Header
- func (c *ProjectsLocationsGlossariesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGlossariesGetCall
- type ProjectsLocationsGlossariesListCall
- func (c *ProjectsLocationsGlossariesListCall) Context(ctx context.Context) *ProjectsLocationsGlossariesListCall
- func (c *ProjectsLocationsGlossariesListCall) Do(opts ...googleapi.CallOption) (*ListGlossariesResponse, error)
- func (c *ProjectsLocationsGlossariesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesListCall
- func (c *ProjectsLocationsGlossariesListCall) Filter(filter string) *ProjectsLocationsGlossariesListCall
- func (c *ProjectsLocationsGlossariesListCall) Header() http.Header
- func (c *ProjectsLocationsGlossariesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsGlossariesListCall
- func (c *ProjectsLocationsGlossariesListCall) PageSize(pageSize int64) *ProjectsLocationsGlossariesListCall
- func (c *ProjectsLocationsGlossariesListCall) PageToken(pageToken string) *ProjectsLocationsGlossariesListCall
- func (c *ProjectsLocationsGlossariesListCall) Pages(ctx context.Context, f func(*ListGlossariesResponse) error) error
- type ProjectsLocationsGlossariesService
- func (r *ProjectsLocationsGlossariesService) Create(parent string, glossary *Glossary) *ProjectsLocationsGlossariesCreateCall
- func (r *ProjectsLocationsGlossariesService) Delete(name string) *ProjectsLocationsGlossariesDeleteCall
- func (r *ProjectsLocationsGlossariesService) Get(name string) *ProjectsLocationsGlossariesGetCall
- func (r *ProjectsLocationsGlossariesService) List(parent string) *ProjectsLocationsGlossariesListCall
- type ProjectsLocationsListCall
- func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall
- func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error)
- func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall
- func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall
- func (c *ProjectsLocationsListCall) Header() http.Header
- func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall
- func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall
- func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall
- func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error
- type ProjectsLocationsOperationsCancelCall
- func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall
- func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error)
- func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall
- func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header
- type ProjectsLocationsOperationsDeleteCall
- func (c *ProjectsLocationsOperationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsOperationsDeleteCall
- func (c *ProjectsLocationsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error)
- func (c *ProjectsLocationsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsDeleteCall
- func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header
- type ProjectsLocationsOperationsGetCall
- func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall
- func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error)
- func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall
- func (c *ProjectsLocationsOperationsGetCall) Header() http.Header
- func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall
- type ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error)
- func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) Header() http.Header
- func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall
- func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error
- type ProjectsLocationsOperationsService
- func (r *ProjectsLocationsOperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *ProjectsLocationsOperationsCancelCall
- func (r *ProjectsLocationsOperationsService) Delete(name string) *ProjectsLocationsOperationsDeleteCall
- func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall
- func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall
- func (r *ProjectsLocationsOperationsService) Wait(name string, waitoperationrequest *WaitOperationRequest) *ProjectsLocationsOperationsWaitCall
- type ProjectsLocationsOperationsWaitCall
- func (c *ProjectsLocationsOperationsWaitCall) Context(ctx context.Context) *ProjectsLocationsOperationsWaitCall
- func (c *ProjectsLocationsOperationsWaitCall) Do(opts ...googleapi.CallOption) (*Operation, error)
- func (c *ProjectsLocationsOperationsWaitCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsWaitCall
- func (c *ProjectsLocationsOperationsWaitCall) Header() http.Header
- type ProjectsLocationsService
- func (r *ProjectsLocationsService) BatchTranslateDocument(parent string, batchtranslatedocumentrequest *BatchTranslateDocumentRequest) *ProjectsLocationsBatchTranslateDocumentCall
- func (r *ProjectsLocationsService) BatchTranslateText(parent string, batchtranslatetextrequest *BatchTranslateTextRequest) *ProjectsLocationsBatchTranslateTextCall
- func (r *ProjectsLocationsService) DetectLanguage(parent string, detectlanguagerequest *DetectLanguageRequest) *ProjectsLocationsDetectLanguageCall
- func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall
- func (r *ProjectsLocationsService) GetSupportedLanguages(parent string) *ProjectsLocationsGetSupportedLanguagesCall
- func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall
- func (r *ProjectsLocationsService) TranslateDocument(parent string, translatedocumentrequest *TranslateDocumentRequest) *ProjectsLocationsTranslateDocumentCall
- func (r *ProjectsLocationsService) TranslateText(parent string, translatetextrequest *TranslateTextRequest) *ProjectsLocationsTranslateTextCall
- type ProjectsLocationsTranslateDocumentCall
- func (c *ProjectsLocationsTranslateDocumentCall) Context(ctx context.Context) *ProjectsLocationsTranslateDocumentCall
- func (c *ProjectsLocationsTranslateDocumentCall) Do(opts ...googleapi.CallOption) (*TranslateDocumentResponse, error)
- func (c *ProjectsLocationsTranslateDocumentCall) Fields(s ...googleapi.Field) *ProjectsLocationsTranslateDocumentCall
- func (c *ProjectsLocationsTranslateDocumentCall) Header() http.Header
- type ProjectsLocationsTranslateTextCall
- func (c *ProjectsLocationsTranslateTextCall) Context(ctx context.Context) *ProjectsLocationsTranslateTextCall
- func (c *ProjectsLocationsTranslateTextCall) Do(opts ...googleapi.CallOption) (*TranslateTextResponse, error)
- func (c *ProjectsLocationsTranslateTextCall) Fields(s ...googleapi.Field) *ProjectsLocationsTranslateTextCall
- func (c *ProjectsLocationsTranslateTextCall) Header() http.Header
- type ProjectsService
- func (r *ProjectsService) DetectLanguage(parent string, detectlanguagerequest *DetectLanguageRequest) *ProjectsDetectLanguageCall
- func (r *ProjectsService) GetSupportedLanguages(parent string) *ProjectsGetSupportedLanguagesCall
- func (r *ProjectsService) TranslateText(parent string, translatetextrequest *TranslateTextRequest) *ProjectsTranslateTextCall
- type ProjectsTranslateTextCall
- func (c *ProjectsTranslateTextCall) Context(ctx context.Context) *ProjectsTranslateTextCall
- func (c *ProjectsTranslateTextCall) Do(opts ...googleapi.CallOption) (*TranslateTextResponse, error)
- func (c *ProjectsTranslateTextCall) Fields(s ...googleapi.Field) *ProjectsTranslateTextCall
- func (c *ProjectsTranslateTextCall) Header() http.Header
- type Service
- type Status
- type SupportedLanguage
- type SupportedLanguages
- type TranslateDocumentRequest
- type TranslateDocumentResponse
- type TranslateTextGlossaryConfig
- type TranslateTextRequest
- type TranslateTextResponse
- type Translation
- type WaitOperationRequest
Constants ¶
const ( // See, edit, configure, and delete your Google Cloud data and see the email // address for your Google Account. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" // Translate text from one language to another using Google Translate CloudTranslationScope = "https://www.googleapis.com/auth/cloud-translation" )
OAuth2 scopes used by this API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchDocumentInputConfig ¶
type BatchDocumentInputConfig struct { // GcsSource: Google Cloud Storage location for the source input. This can be a // single file (for example, `gs://translation-test/input.docx`) or a wildcard // (for example, `gs://translation-test/*`). File mime type is determined based // on extension. Supported mime type includes: - `pdf`, application/pdf - // `docx`, // application/vnd.openxmlformats-officedocument.wordprocessingml.document - // `pptx`, // application/vnd.openxmlformats-officedocument.presentationml.presentation - // `xlsx`, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet // The max file size to support for `.docx`, `.pptx` and `.xlsx` is 100MB. The // max file size to support for `.pdf` is 1GB and the max page limit is 1000 // pages. The max file size to support for all input documents is 1GB. GcsSource *GcsSource `json:"gcsSource,omitempty"` // ForceSendFields is a list of field names (e.g. "GcsSource") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "GcsSource") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
BatchDocumentInputConfig: Input configuration for BatchTranslateDocument request.
func (BatchDocumentInputConfig) MarshalJSON ¶
func (s BatchDocumentInputConfig) MarshalJSON() ([]byte, error)
type BatchDocumentOutputConfig ¶
type BatchDocumentOutputConfig struct { // GcsDestination: Google Cloud Storage destination for output content. For // every single input document (for example, gs://a/b/c.[extension]), we // generate at most 2 * n output files. (n is the # of target_language_codes in // the BatchTranslateDocumentRequest). While the input documents are being // processed, we write/update an index file `index.csv` under // `gcs_destination.output_uri_prefix` (for example, // gs://translation_output/index.csv) The index file is generated/updated as // new files are being translated. The format is: // input_document,target_language_code,translation_output,error_output, // glossary_translation_output,glossary_error_output `input_document` is one // file we matched using gcs_source.input_uri. `target_language_code` is // provided in the request. `translation_output` contains the translations. // (details provided below) `error_output` contains the error message during // processing of the file. Both translations_file and errors_file could be // empty strings if we have no content to output. `glossary_translation_output` // and `glossary_error_output` are the translated output/error when we apply // glossaries. They could also be empty if we have no content to output. Once a // row is present in index.csv, the input/output matching never changes. // Callers should also expect all the content in input_file are processed and // ready to be consumed (that is, no partial output file is written). Since // index.csv will be keeping updated during the process, please make sure there // is no custom retention policy applied on the output bucket that may avoid // file updating. // (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) The // naming format of translation output files follows (for target language code // [trg]): `translation_output`: // `gs://translation_output/a_b_c_[trg]_translation.[extension]` // `glossary_translation_output`: // `gs://translation_test/a_b_c_[trg]_glossary_translation.[extension]`. The // output document will maintain the same file format as the input document. // The naming format of error output files follows (for target language code // [trg]): `error_output`: `gs://translation_test/a_b_c_[trg]_errors.txt` // `glossary_error_output`: // `gs://translation_test/a_b_c_[trg]_glossary_translation.txt` The error // output is a txt file containing error details. GcsDestination *GcsDestination `json:"gcsDestination,omitempty"` // ForceSendFields is a list of field names (e.g. "GcsDestination") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "GcsDestination") to include in // API requests with the JSON null value. By default, fields with empty values // are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
BatchDocumentOutputConfig: Output configuration for BatchTranslateDocument request.
func (BatchDocumentOutputConfig) MarshalJSON ¶
func (s BatchDocumentOutputConfig) MarshalJSON() ([]byte, error)
type BatchTranslateDocumentRequest ¶
type BatchTranslateDocumentRequest struct { // CustomizedAttribution: Optional. This flag is to support user customized // attribution. If not provided, the default is `Machine Translated by Google`. // Customized attribution should follow rules in // https://cloud.google.com/translate/attribution#attribution_and_logos CustomizedAttribution string `json:"customizedAttribution,omitempty"` // EnableRotationCorrection: Optional. If true, enable auto rotation correction // in DVS. EnableRotationCorrection bool `json:"enableRotationCorrection,omitempty"` // EnableShadowRemovalNativePdf: Optional. If true, use the text removal server // to remove the shadow text on background image for native pdf translation. // Shadow removal feature can only be enabled when // is_translate_native_pdf_only: false && pdf_native_only: false EnableShadowRemovalNativePdf bool `json:"enableShadowRemovalNativePdf,omitempty"` // FormatConversions: Optional. File format conversion map to be applied to all // input files. Map's key is the original mime_type. Map's value is the target // mime_type of translated documents. Supported file format conversion // includes: - `application/pdf` to // `application/vnd.openxmlformats-officedocument.wordprocessingml.document` If // nothing specified, output files will be in the same format as the original // file. FormatConversions map[string]string `json:"formatConversions,omitempty"` // Glossaries: Optional. Glossaries to be applied. It's keyed by target // language code. Glossaries map[string]TranslateTextGlossaryConfig `json:"glossaries,omitempty"` // InputConfigs: Required. Input configurations. The total number of files // matched should be <= 100. The total content size to translate should be <= // 100M Unicode codepoints. The files must use UTF-8 encoding. InputConfigs []*BatchDocumentInputConfig `json:"inputConfigs,omitempty"` // Models: Optional. The models to use for translation. Map's key is target // language code. Map's value is the model name. Value can be a built-in // general model, or an AutoML Translation model. The value format depends on // model type: - AutoML Translation models: // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` // - General (built-in) models: // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, // If the map is empty or a specific model is not requested for a language // pair, then default google model (nmt) is used. Models map[string]string `json:"models,omitempty"` // OutputConfig: Required. Output configuration. If 2 input configs match to // the same file (that is, same input path), we don't generate output for // duplicate inputs. OutputConfig *BatchDocumentOutputConfig `json:"outputConfig,omitempty"` // SourceLanguageCode: Required. The BCP-47 language code of the input document // if known, for example, "en-US" or "sr-Latn". Supported language codes are // listed in Language Support // (https://cloud.google.com/translate/docs/languages). SourceLanguageCode string `json:"sourceLanguageCode,omitempty"` // TargetLanguageCodes: Required. The BCP-47 language code to use for // translation of the input document. Specify up to 10 language codes here. TargetLanguageCodes []string `json:"targetLanguageCodes,omitempty"` // ForceSendFields is a list of field names (e.g. "CustomizedAttribution") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "CustomizedAttribution") to // include in API requests with the JSON null value. By default, fields with // empty values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
BatchTranslateDocumentRequest: The BatchTranslateDocument request.
func (BatchTranslateDocumentRequest) MarshalJSON ¶
func (s BatchTranslateDocumentRequest) MarshalJSON() ([]byte, error)
type BatchTranslateTextRequest ¶
type BatchTranslateTextRequest struct { // Glossaries: Optional. Glossaries to be applied for translation. It's keyed // by target language code. Glossaries map[string]TranslateTextGlossaryConfig `json:"glossaries,omitempty"` // InputConfigs: Required. Input configurations. The total number of files // matched should be <= 100. The total content size should be <= 100M Unicode // codepoints. The files must use UTF-8 encoding. InputConfigs []*InputConfig `json:"inputConfigs,omitempty"` // Labels: Optional. The labels with user-defined metadata for the request. // Label keys and values can be no longer than 63 characters (Unicode // codepoints), can only contain lowercase letters, numeric characters, // underscores and dashes. International characters are allowed. Label values // are optional. Label keys must start with a letter. See // https://cloud.google.com/translate/docs/labels for more information. Labels map[string]string `json:"labels,omitempty"` // Models: Optional. The models to use for translation. Map's key is target // language code. Map's value is model name. Value can be a built-in general // model, or an AutoML Translation model. The value format depends on model // type: - AutoML Translation models: // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` // - General (built-in) models: // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, // If the map is empty or a specific model is not requested for a language // pair, then default google model (nmt) is used. Models map[string]string `json:"models,omitempty"` // OutputConfig: Required. Output configuration. If 2 input configs match to // the same file (that is, same input path), we don't generate output for // duplicate inputs. OutputConfig *OutputConfig `json:"outputConfig,omitempty"` // SourceLanguageCode: Required. Source language code. SourceLanguageCode string `json:"sourceLanguageCode,omitempty"` // TargetLanguageCodes: Required. Specify up to 10 language codes here. TargetLanguageCodes []string `json:"targetLanguageCodes,omitempty"` // ForceSendFields is a list of field names (e.g. "Glossaries") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Glossaries") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
BatchTranslateTextRequest: The batch translation request.
func (BatchTranslateTextRequest) MarshalJSON ¶
func (s BatchTranslateTextRequest) MarshalJSON() ([]byte, error)
type CancelOperationRequest ¶
type CancelOperationRequest struct { }
CancelOperationRequest: The request message for Operations.CancelOperation.
type DetectLanguageRequest ¶
type DetectLanguageRequest struct { // Content: The content of the input stored as a string. Content string `json:"content,omitempty"` // Labels: Optional. The labels with user-defined metadata for the request. // Label keys and values can be no longer than 63 characters (Unicode // codepoints), can only contain lowercase letters, numeric characters, // underscores and dashes. International characters are allowed. Label values // are optional. Label keys must start with a letter. See // https://cloud.google.com/translate/docs/labels for more information. Labels map[string]string `json:"labels,omitempty"` // MimeType: Optional. The format of the source text, for example, "text/html", // "text/plain". If left blank, the MIME type defaults to "text/html". MimeType string `json:"mimeType,omitempty"` // Model: Optional. The language detection model to be used. Format: // `projects/{project-number-or-id}/locations/{location-id}/models/language-dete // ction/{model-id}` Only one language detection model is currently supported: // `projects/{project-number-or-id}/locations/{location-id}/models/language-dete // ction/default`. If not specified, the default model is used. Model string `json:"model,omitempty"` // ForceSendFields is a list of field names (e.g. "Content") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Content") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
DetectLanguageRequest: The request message for language detection.
func (DetectLanguageRequest) MarshalJSON ¶
func (s DetectLanguageRequest) MarshalJSON() ([]byte, error)
type DetectLanguageResponse ¶
type DetectLanguageResponse struct { // Languages: A list of detected languages sorted by detection confidence in // descending order. The most probable language first. Languages []*DetectedLanguage `json:"languages,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Languages") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Languages") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
DetectLanguageResponse: The response message for language detection.
func (DetectLanguageResponse) MarshalJSON ¶
func (s DetectLanguageResponse) MarshalJSON() ([]byte, error)
type DetectedLanguage ¶
type DetectedLanguage struct { // Confidence: The confidence of the detection result for this language. Confidence float64 `json:"confidence,omitempty"` // LanguageCode: The BCP-47 language code of source content in the request, // detected automatically. LanguageCode string `json:"languageCode,omitempty"` // ForceSendFields is a list of field names (e.g. "Confidence") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Confidence") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
DetectedLanguage: The response message for language detection.
func (DetectedLanguage) MarshalJSON ¶
func (s DetectedLanguage) MarshalJSON() ([]byte, error)
func (*DetectedLanguage) UnmarshalJSON ¶
func (s *DetectedLanguage) UnmarshalJSON(data []byte) error
type DocumentInputConfig ¶
type DocumentInputConfig struct { // Content: Document's content represented as a stream of bytes. Content string `json:"content,omitempty"` // GcsSource: Google Cloud Storage location. This must be a single file. For // example: gs://example_bucket/example_file.pdf GcsSource *GcsSource `json:"gcsSource,omitempty"` // MimeType: Specifies the input document's mime_type. If not specified it will // be determined using the file extension for gcs_source provided files. For a // file provided through bytes content the mime_type must be provided. // Currently supported mime types are: - application/pdf - // application/vnd.openxmlformats-officedocument.wordprocessingml.document - // application/vnd.openxmlformats-officedocument.presentationml.presentation - // application/vnd.openxmlformats-officedocument.spreadsheetml.sheet MimeType string `json:"mimeType,omitempty"` // ForceSendFields is a list of field names (e.g. "Content") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Content") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
DocumentInputConfig: A document translation request input config.
func (DocumentInputConfig) MarshalJSON ¶
func (s DocumentInputConfig) MarshalJSON() ([]byte, error)
type DocumentOutputConfig ¶
type DocumentOutputConfig struct { // GcsDestination: Optional. Google Cloud Storage destination for the // translation output, e.g., `gs://my_bucket/my_directory/`. The destination // directory provided does not have to be empty, but the bucket must exist. If // a file with the same name as the output file already exists in the // destination an error will be returned. For a DocumentInputConfig.contents // provided document, the output file will have the name // "output_[trg]_translations.[ext]", where - [trg] corresponds to the // translated file's language code, - [ext] corresponds to the translated // file's extension according to its mime type. For a // DocumentInputConfig.gcs_uri provided document, the output file will have a // name according to its URI. For example: an input file with URI: // `gs://a/b/c.[extension]` stored in a gcs_destination bucket with name // "my_bucket" will have an output URI: // `gs://my_bucket/a_b_c_[trg]_translations.[ext]`, where - [trg] corresponds // to the translated file's language code, - [ext] corresponds to the // translated file's extension according to its mime type. If the document was // directly provided through the request, then the output document will have // the format: `gs://my_bucket/translated_document_[trg]_translations.[ext]`, // where - [trg] corresponds to the translated file's language code, - [ext] // corresponds to the translated file's extension according to its mime type. // If a glossary was provided, then the output URI for the glossary translation // will be equal to the default output URI but have `glossary_translations` // instead of `translations`. For the previous example, its glossary URI would // be: `gs://my_bucket/a_b_c_[trg]_glossary_translations.[ext]`. Thus the max // number of output files will be 2 (Translated document, Glossary translated // document). Callers should expect no partial outputs. If there is any error // during document translation, no output will be stored in the Cloud Storage // bucket. GcsDestination *GcsDestination `json:"gcsDestination,omitempty"` // MimeType: Optional. Specifies the translated document's mime_type. If not // specified, the translated file's mime type will be the same as the input // file's mime type. Currently only support the output mime type to be the same // as input mime type. - application/pdf - // application/vnd.openxmlformats-officedocument.wordprocessingml.document - // application/vnd.openxmlformats-officedocument.presentationml.presentation - // application/vnd.openxmlformats-officedocument.spreadsheetml.sheet MimeType string `json:"mimeType,omitempty"` // ForceSendFields is a list of field names (e.g. "GcsDestination") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "GcsDestination") to include in // API requests with the JSON null value. By default, fields with empty values // are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
DocumentOutputConfig: A document translation request output config.
func (DocumentOutputConfig) MarshalJSON ¶
func (s DocumentOutputConfig) MarshalJSON() ([]byte, error)
type DocumentTranslation ¶
type DocumentTranslation struct { // ByteStreamOutputs: The array of translated documents. It is expected to be // size 1 for now. We may produce multiple translated documents in the future // for other type of file formats. ByteStreamOutputs []string `json:"byteStreamOutputs,omitempty"` // DetectedLanguageCode: The detected language for the input document. If the // user did not provide the source language for the input document, this field // will have the language code automatically detected. If the source language // was passed, auto-detection of the language does not occur and this field is // empty. DetectedLanguageCode string `json:"detectedLanguageCode,omitempty"` // MimeType: The translated document's mime type. MimeType string `json:"mimeType,omitempty"` // ForceSendFields is a list of field names (e.g. "ByteStreamOutputs") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "ByteStreamOutputs") to include in // API requests with the JSON null value. By default, fields with empty values // are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
DocumentTranslation: A translated document message.
func (DocumentTranslation) MarshalJSON ¶
func (s DocumentTranslation) MarshalJSON() ([]byte, error)
type Empty ¶
type Empty struct { // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` }
Empty: A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
type GcsDestination ¶
type GcsDestination struct { // OutputUriPrefix: Required. There must be no files under 'output_uri_prefix'. // 'output_uri_prefix' must end with "/" and start with "gs://", otherwise an // INVALID_ARGUMENT (400) error is returned. OutputUriPrefix string `json:"outputUriPrefix,omitempty"` // ForceSendFields is a list of field names (e.g. "OutputUriPrefix") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "OutputUriPrefix") to include in // API requests with the JSON null value. By default, fields with empty values // are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
GcsDestination: The Google Cloud Storage location for the output content.
func (GcsDestination) MarshalJSON ¶
func (s GcsDestination) MarshalJSON() ([]byte, error)
type GcsSource ¶
type GcsSource struct { // InputUri: Required. Source data URI. For example, // `gs://my_bucket/my_object`. InputUri string `json:"inputUri,omitempty"` // ForceSendFields is a list of field names (e.g. "InputUri") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "InputUri") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
GcsSource: The Google Cloud Storage location for the input content.
func (GcsSource) MarshalJSON ¶
type Glossary ¶
type Glossary struct { // EndTime: Output only. When the glossary creation was finished. EndTime string `json:"endTime,omitempty"` // EntryCount: Output only. The number of entries defined in the glossary. EntryCount int64 `json:"entryCount,omitempty"` // InputConfig: Required. Provides examples to build the glossary from. Total // glossary must not exceed 10M Unicode codepoints. InputConfig *GlossaryInputConfig `json:"inputConfig,omitempty"` // LanguageCodesSet: Used with equivalent term set glossaries. LanguageCodesSet *LanguageCodesSet `json:"languageCodesSet,omitempty"` // LanguagePair: Used with unidirectional glossaries. LanguagePair *LanguageCodePair `json:"languagePair,omitempty"` // Name: Required. The resource name of the glossary. Glossary names have the // form // `projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary // -id}`. Name string `json:"name,omitempty"` // SubmitTime: Output only. When CreateGlossary was called. SubmitTime string `json:"submitTime,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "EndTime") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "EndTime") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
Glossary: Represents a glossary built from user provided data.
func (Glossary) MarshalJSON ¶
type GlossaryInputConfig ¶
type GlossaryInputConfig struct { // GcsSource: Required. Google Cloud Storage location of glossary data. File // format is determined based on the filename extension. API returns // [google.rpc.Code.INVALID_ARGUMENT] for unsupported URI-s and file formats. // Wildcards are not allowed. This must be a single file in one of the // following formats: For unidirectional glossaries: - TSV/CSV (`.tsv`/`.csv`): // 2 column file, tab- or comma-separated. The first column is source text. The // second column is target text. The file must not contain headers. That is, // the first row is data, not column names. - TMX (`.tmx`): TMX file with // parallel data defining source/target term pairs. For equivalent term sets // glossaries: - CSV (`.csv`): Multi-column CSV file defining equivalent // glossary terms in multiple languages. See documentation for more information // - glossaries (https://cloud.google.com/translate/docs/advanced/glossary). GcsSource *GcsSource `json:"gcsSource,omitempty"` // ForceSendFields is a list of field names (e.g. "GcsSource") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "GcsSource") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
GlossaryInputConfig: Input configuration for glossaries.
func (GlossaryInputConfig) MarshalJSON ¶
func (s GlossaryInputConfig) MarshalJSON() ([]byte, error)
type InputConfig ¶
type InputConfig struct { // GcsSource: Required. Google Cloud Storage location for the source input. // This can be a single file (for example, `gs://translation-test/input.tsv`) // or a wildcard (for example, `gs://translation-test/*`). If a file extension // is `.tsv`, it can contain either one or two columns. The first column // (optional) is the id of the text request. If the first column is missing, we // use the row number (0-based) from the input file as the ID in the output // file. The second column is the actual text to be translated. We recommend // each row be <= 10K Unicode codepoints, otherwise an error might be returned. // Note that the input tsv must be RFC 4180 compliant. You could use // https://github.com/Clever/csvlint to check potential formatting errors in // your tsv file. csvlint --delimiter='\t' your_input_file.tsv The other // supported file extensions are `.txt` or `.html`, which is treated as a // single large chunk of text. GcsSource *GcsSource `json:"gcsSource,omitempty"` // MimeType: Optional. Can be "text/plain" or "text/html". For `.tsv`, // "text/html" is used if mime_type is missing. For `.html`, this field must be // "text/html" or empty. For `.txt`, this field must be "text/plain" or empty. MimeType string `json:"mimeType,omitempty"` // ForceSendFields is a list of field names (e.g. "GcsSource") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "GcsSource") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
InputConfig: Input configuration for BatchTranslateText request.
func (InputConfig) MarshalJSON ¶
func (s InputConfig) MarshalJSON() ([]byte, error)
type LanguageCodePair ¶
type LanguageCodePair struct { // SourceLanguageCode: Required. The BCP-47 language code of the input text, // for example, "en-US". Expected to be an exact match for // GlossaryTerm.language_code. SourceLanguageCode string `json:"sourceLanguageCode,omitempty"` // TargetLanguageCode: Required. The BCP-47 language code for translation // output, for example, "zh-CN". Expected to be an exact match for // GlossaryTerm.language_code. TargetLanguageCode string `json:"targetLanguageCode,omitempty"` // ForceSendFields is a list of field names (e.g. "SourceLanguageCode") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "SourceLanguageCode") to include // in API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
LanguageCodePair: Used with unidirectional glossaries.
func (LanguageCodePair) MarshalJSON ¶
func (s LanguageCodePair) MarshalJSON() ([]byte, error)
type LanguageCodesSet ¶
type LanguageCodesSet struct { // LanguageCodes: The BCP-47 language code(s) for terms defined in the // glossary. All entries are unique. The list contains at least two entries. // Expected to be an exact match for GlossaryTerm.language_code. LanguageCodes []string `json:"languageCodes,omitempty"` // ForceSendFields is a list of field names (e.g. "LanguageCodes") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "LanguageCodes") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
LanguageCodesSet: Used with equivalent term set glossaries.
func (LanguageCodesSet) MarshalJSON ¶
func (s LanguageCodesSet) MarshalJSON() ([]byte, error)
type ListGlossariesResponse ¶
type ListGlossariesResponse struct { // Glossaries: The list of glossaries for a project. Glossaries []*Glossary `json:"glossaries,omitempty"` // NextPageToken: A token to retrieve a page of results. Pass this value in the // [ListGlossariesRequest.page_token] field in the subsequent call to // `ListGlossaries` method to retrieve the next page of results. NextPageToken string `json:"nextPageToken,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Glossaries") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Glossaries") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
ListGlossariesResponse: Response message for ListGlossaries.
func (ListGlossariesResponse) MarshalJSON ¶
func (s ListGlossariesResponse) MarshalJSON() ([]byte, error)
type ListLocationsResponse ¶
type ListLocationsResponse struct { // Locations: A list of locations that matches the specified filter in the // request. Locations []*Location `json:"locations,omitempty"` // NextPageToken: The standard List next-page token. NextPageToken string `json:"nextPageToken,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Locations") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Locations") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
ListLocationsResponse: The response message for Locations.ListLocations.
func (ListLocationsResponse) MarshalJSON ¶
func (s ListLocationsResponse) MarshalJSON() ([]byte, error)
type ListOperationsResponse ¶
type ListOperationsResponse struct { // NextPageToken: The standard List next-page token. NextPageToken string `json:"nextPageToken,omitempty"` // Operations: A list of operations that matches the specified filter in the // request. Operations []*Operation `json:"operations,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "NextPageToken") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "NextPageToken") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
ListOperationsResponse: The response message for Operations.ListOperations.
func (ListOperationsResponse) MarshalJSON ¶
func (s ListOperationsResponse) MarshalJSON() ([]byte, error)
type Location ¶
type Location struct { // DisplayName: The friendly name for this location, typically a nearby city // name. For example, "Tokyo". DisplayName string `json:"displayName,omitempty"` // Labels: Cross-service attributes for the location. For example // {"cloud.googleapis.com/region": "us-east1"} Labels map[string]string `json:"labels,omitempty"` // LocationId: The canonical id for this location. For example: "us-east1". LocationId string `json:"locationId,omitempty"` // Metadata: Service-specific metadata. For example the available capacity at // the given location. Metadata googleapi.RawMessage `json:"metadata,omitempty"` // Name: Resource name for the location, which may vary between // implementations. For example: // "projects/example-project/locations/us-east1" Name string `json:"name,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "DisplayName") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "DisplayName") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
Location: A resource that represents a Google Cloud location.
func (Location) MarshalJSON ¶
type Operation ¶
type Operation struct { // Done: If the value is `false`, it means the operation is still in progress. // If `true`, the operation is completed, and either `error` or `response` is // available. Done bool `json:"done,omitempty"` // Error: The error result of the operation in case of failure or cancellation. Error *Status `json:"error,omitempty"` // Metadata: Service-specific metadata associated with the operation. It // typically contains progress information and common metadata such as create // time. Some services might not provide such metadata. Any method that returns // a long-running operation should document the metadata type, if any. Metadata googleapi.RawMessage `json:"metadata,omitempty"` // Name: The server-assigned name, which is only unique within the same service // that originally returns it. If you use the default HTTP mapping, the `name` // should be a resource name ending with `operations/{unique_id}`. Name string `json:"name,omitempty"` // Response: The normal, successful response of the operation. If the original // method returns no data on success, such as `Delete`, the response is // `google.protobuf.Empty`. If the original method is standard // `Get`/`Create`/`Update`, the response should be the resource. For other // methods, the response should have the type `XxxResponse`, where `Xxx` is the // original method name. For example, if the original method name is // `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. Response googleapi.RawMessage `json:"response,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Done") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Done") to include in API requests // with the JSON null value. By default, fields with empty values are omitted // from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
Operation: This resource represents a long-running operation that is the result of a network API call.
func (Operation) MarshalJSON ¶
type OutputConfig ¶
type OutputConfig struct { // GcsDestination: Google Cloud Storage destination for output content. For // every single input file (for example, gs://a/b/c.[extension]), we generate // at most 2 * n output files. (n is the # of target_language_codes in the // BatchTranslateTextRequest). Output files (tsv) generated are compliant with // RFC 4180 except that record delimiters are '\n' instead of '\r\n'. We don't // provide any way to change record delimiters. While the input files are being // processed, we write/update an index file 'index.csv' under // 'output_uri_prefix' (for example, gs://translation-test/index.csv) The index // file is generated/updated as new files are being translated. The format is: // input_file,target_language_code,translations_file,errors_file, // glossary_translations_file,glossary_errors_file input_file is one file we // matched using gcs_source.input_uri. target_language_code is provided in the // request. translations_file contains the translations. (details provided // below) errors_file contains the errors during processing of the file. // (details below). Both translations_file and errors_file could be empty // strings if we have no content to output. glossary_translations_file and // glossary_errors_file are always empty strings if the input_file is tsv. They // could also be empty if we have no content to output. Once a row is present // in index.csv, the input/output matching never changes. Callers should also // expect all the content in input_file are processed and ready to be consumed // (that is, no partial output file is written). Since index.csv will be // keeping updated during the process, please make sure there is no custom // retention policy applied on the output bucket that may avoid file updating. // (https://cloud.google.com/storage/docs/bucket-lock#retention-policy) The // format of translations_file (for target language code 'trg') is: // `gs://translation_test/a_b_c_'trg'_translations.[extension]` If the input // file extension is tsv, the output has the following columns: Column 1: ID of // the request provided in the input, if it's not provided in the input, then // the input row number is used (0-based). Column 2: source sentence. Column 3: // translation without applying a glossary. Empty string if there is an error. // Column 4 (only present if a glossary is provided in the request): // translation after applying the glossary. Empty string if there is an error // applying the glossary. Could be same string as column 3 if there is no // glossary applied. If input file extension is a txt or html, the translation // is directly written to the output file. If glossary is requested, a separate // glossary_translations_file has format of // `gs://translation_test/a_b_c_'trg'_glossary_translations.[extension]` The // format of errors file (for target language code 'trg') is: // `gs://translation_test/a_b_c_'trg'_errors.[extension]` If the input file // extension is tsv, errors_file contains the following: Column 1: ID of the // request provided in the input, if it's not provided in the input, then the // input row number is used (0-based). Column 2: source sentence. Column 3: // Error detail for the translation. Could be empty. Column 4 (only present if // a glossary is provided in the request): Error when applying the glossary. If // the input file extension is txt or html, glossary_error_file will be // generated that contains error details. glossary_error_file has format of // `gs://translation_test/a_b_c_'trg'_glossary_errors.[extension]` GcsDestination *GcsDestination `json:"gcsDestination,omitempty"` // ForceSendFields is a list of field names (e.g. "GcsDestination") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "GcsDestination") to include in // API requests with the JSON null value. By default, fields with empty values // are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
OutputConfig: Output configuration for BatchTranslateText request.
func (OutputConfig) MarshalJSON ¶
func (s OutputConfig) MarshalJSON() ([]byte, error)
type ProjectsDetectLanguageCall ¶
type ProjectsDetectLanguageCall struct {
// contains filtered or unexported fields
}
func (*ProjectsDetectLanguageCall) Context ¶
func (c *ProjectsDetectLanguageCall) Context(ctx context.Context) *ProjectsDetectLanguageCall
Context sets the context to be used in this call's Do method.
func (*ProjectsDetectLanguageCall) Do ¶
func (c *ProjectsDetectLanguageCall) Do(opts ...googleapi.CallOption) (*DetectLanguageResponse, error)
Do executes the "translate.projects.detectLanguage" call. Any non-2xx status code is an error. Response headers are in either *DetectLanguageResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsDetectLanguageCall) Fields ¶
func (c *ProjectsDetectLanguageCall) Fields(s ...googleapi.Field) *ProjectsDetectLanguageCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsDetectLanguageCall) Header ¶
func (c *ProjectsDetectLanguageCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type ProjectsGetSupportedLanguagesCall ¶
type ProjectsGetSupportedLanguagesCall struct {
// contains filtered or unexported fields
}
func (*ProjectsGetSupportedLanguagesCall) Context ¶
func (c *ProjectsGetSupportedLanguagesCall) Context(ctx context.Context) *ProjectsGetSupportedLanguagesCall
Context sets the context to be used in this call's Do method.
func (*ProjectsGetSupportedLanguagesCall) DisplayLanguageCode ¶
func (c *ProjectsGetSupportedLanguagesCall) DisplayLanguageCode(displayLanguageCode string) *ProjectsGetSupportedLanguagesCall
DisplayLanguageCode sets the optional parameter "displayLanguageCode": The language to use to return localized, human readable names of supported languages. If missing, then display names are not returned in a response.
func (*ProjectsGetSupportedLanguagesCall) Do ¶
func (c *ProjectsGetSupportedLanguagesCall) Do(opts ...googleapi.CallOption) (*SupportedLanguages, error)
Do executes the "translate.projects.getSupportedLanguages" call. Any non-2xx status code is an error. Response headers are in either *SupportedLanguages.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsGetSupportedLanguagesCall) Fields ¶
func (c *ProjectsGetSupportedLanguagesCall) Fields(s ...googleapi.Field) *ProjectsGetSupportedLanguagesCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsGetSupportedLanguagesCall) Header ¶
func (c *ProjectsGetSupportedLanguagesCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*ProjectsGetSupportedLanguagesCall) IfNoneMatch ¶
func (c *ProjectsGetSupportedLanguagesCall) IfNoneMatch(entityTag string) *ProjectsGetSupportedLanguagesCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
func (*ProjectsGetSupportedLanguagesCall) Model ¶
func (c *ProjectsGetSupportedLanguagesCall) Model(model string) *ProjectsGetSupportedLanguagesCall
Model sets the optional parameter "model": Get supported languages of this model. The format depends on model type: - AutoML Translation models: `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - General (built-in) models: `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
Returns languages supported by the specified model. If missing, we get
supported languages of Google general NMT model.
type ProjectsLocationsBatchTranslateDocumentCall ¶
type ProjectsLocationsBatchTranslateDocumentCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsBatchTranslateDocumentCall) Context ¶
func (c *ProjectsLocationsBatchTranslateDocumentCall) Context(ctx context.Context) *ProjectsLocationsBatchTranslateDocumentCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsBatchTranslateDocumentCall) Do ¶
func (c *ProjectsLocationsBatchTranslateDocumentCall) Do(opts ...googleapi.CallOption) (*Operation, error)
Do executes the "translate.projects.locations.batchTranslateDocument" call. Any non-2xx status code is an error. Response headers are in either *Operation.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsBatchTranslateDocumentCall) Fields ¶
func (c *ProjectsLocationsBatchTranslateDocumentCall) Fields(s ...googleapi.Field) *ProjectsLocationsBatchTranslateDocumentCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsBatchTranslateDocumentCall) Header ¶
func (c *ProjectsLocationsBatchTranslateDocumentCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type ProjectsLocationsBatchTranslateTextCall ¶
type ProjectsLocationsBatchTranslateTextCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsBatchTranslateTextCall) Context ¶
func (c *ProjectsLocationsBatchTranslateTextCall) Context(ctx context.Context) *ProjectsLocationsBatchTranslateTextCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsBatchTranslateTextCall) Do ¶
func (c *ProjectsLocationsBatchTranslateTextCall) Do(opts ...googleapi.CallOption) (*Operation, error)
Do executes the "translate.projects.locations.batchTranslateText" call. Any non-2xx status code is an error. Response headers are in either *Operation.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsBatchTranslateTextCall) Fields ¶
func (c *ProjectsLocationsBatchTranslateTextCall) Fields(s ...googleapi.Field) *ProjectsLocationsBatchTranslateTextCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsBatchTranslateTextCall) Header ¶
func (c *ProjectsLocationsBatchTranslateTextCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type ProjectsLocationsDetectLanguageCall ¶
type ProjectsLocationsDetectLanguageCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsDetectLanguageCall) Context ¶
func (c *ProjectsLocationsDetectLanguageCall) Context(ctx context.Context) *ProjectsLocationsDetectLanguageCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsDetectLanguageCall) Do ¶
func (c *ProjectsLocationsDetectLanguageCall) Do(opts ...googleapi.CallOption) (*DetectLanguageResponse, error)
Do executes the "translate.projects.locations.detectLanguage" call. Any non-2xx status code is an error. Response headers are in either *DetectLanguageResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsDetectLanguageCall) Fields ¶
func (c *ProjectsLocationsDetectLanguageCall) Fields(s ...googleapi.Field) *ProjectsLocationsDetectLanguageCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsDetectLanguageCall) Header ¶
func (c *ProjectsLocationsDetectLanguageCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type ProjectsLocationsGetCall ¶
type ProjectsLocationsGetCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsGetCall) Context ¶
func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsGetCall) Do ¶
func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error)
Do executes the "translate.projects.locations.get" call. Any non-2xx status code is an error. Response headers are in either *Location.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsGetCall) Fields ¶
func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsGetCall) Header ¶
func (c *ProjectsLocationsGetCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*ProjectsLocationsGetCall) IfNoneMatch ¶
func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
type ProjectsLocationsGetSupportedLanguagesCall ¶
type ProjectsLocationsGetSupportedLanguagesCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsGetSupportedLanguagesCall) Context ¶
func (c *ProjectsLocationsGetSupportedLanguagesCall) Context(ctx context.Context) *ProjectsLocationsGetSupportedLanguagesCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsGetSupportedLanguagesCall) DisplayLanguageCode ¶
func (c *ProjectsLocationsGetSupportedLanguagesCall) DisplayLanguageCode(displayLanguageCode string) *ProjectsLocationsGetSupportedLanguagesCall
DisplayLanguageCode sets the optional parameter "displayLanguageCode": The language to use to return localized, human readable names of supported languages. If missing, then display names are not returned in a response.
func (*ProjectsLocationsGetSupportedLanguagesCall) Do ¶
func (c *ProjectsLocationsGetSupportedLanguagesCall) Do(opts ...googleapi.CallOption) (*SupportedLanguages, error)
Do executes the "translate.projects.locations.getSupportedLanguages" call. Any non-2xx status code is an error. Response headers are in either *SupportedLanguages.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsGetSupportedLanguagesCall) Fields ¶
func (c *ProjectsLocationsGetSupportedLanguagesCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetSupportedLanguagesCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsGetSupportedLanguagesCall) Header ¶
func (c *ProjectsLocationsGetSupportedLanguagesCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*ProjectsLocationsGetSupportedLanguagesCall) IfNoneMatch ¶
func (c *ProjectsLocationsGetSupportedLanguagesCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetSupportedLanguagesCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
func (*ProjectsLocationsGetSupportedLanguagesCall) Model ¶
func (c *ProjectsLocationsGetSupportedLanguagesCall) Model(model string) *ProjectsLocationsGetSupportedLanguagesCall
Model sets the optional parameter "model": Get supported languages of this model. The format depends on model type: - AutoML Translation models: `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` - General (built-in) models: `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`,
Returns languages supported by the specified model. If missing, we get
supported languages of Google general NMT model.
type ProjectsLocationsGlossariesCreateCall ¶
type ProjectsLocationsGlossariesCreateCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsGlossariesCreateCall) Context ¶
func (c *ProjectsLocationsGlossariesCreateCall) Context(ctx context.Context) *ProjectsLocationsGlossariesCreateCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsGlossariesCreateCall) Do ¶
func (c *ProjectsLocationsGlossariesCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error)
Do executes the "translate.projects.locations.glossaries.create" call. Any non-2xx status code is an error. Response headers are in either *Operation.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsGlossariesCreateCall) Fields ¶
func (c *ProjectsLocationsGlossariesCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesCreateCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsGlossariesCreateCall) Header ¶
func (c *ProjectsLocationsGlossariesCreateCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type ProjectsLocationsGlossariesDeleteCall ¶
type ProjectsLocationsGlossariesDeleteCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsGlossariesDeleteCall) Context ¶
func (c *ProjectsLocationsGlossariesDeleteCall) Context(ctx context.Context) *ProjectsLocationsGlossariesDeleteCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsGlossariesDeleteCall) Do ¶
func (c *ProjectsLocationsGlossariesDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error)
Do executes the "translate.projects.locations.glossaries.delete" call. Any non-2xx status code is an error. Response headers are in either *Operation.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsGlossariesDeleteCall) Fields ¶
func (c *ProjectsLocationsGlossariesDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesDeleteCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsGlossariesDeleteCall) Header ¶
func (c *ProjectsLocationsGlossariesDeleteCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type ProjectsLocationsGlossariesGetCall ¶
type ProjectsLocationsGlossariesGetCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsGlossariesGetCall) Context ¶
func (c *ProjectsLocationsGlossariesGetCall) Context(ctx context.Context) *ProjectsLocationsGlossariesGetCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsGlossariesGetCall) Do ¶
func (c *ProjectsLocationsGlossariesGetCall) Do(opts ...googleapi.CallOption) (*Glossary, error)
Do executes the "translate.projects.locations.glossaries.get" call. Any non-2xx status code is an error. Response headers are in either *Glossary.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsGlossariesGetCall) Fields ¶
func (c *ProjectsLocationsGlossariesGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesGetCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsGlossariesGetCall) Header ¶
func (c *ProjectsLocationsGlossariesGetCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*ProjectsLocationsGlossariesGetCall) IfNoneMatch ¶
func (c *ProjectsLocationsGlossariesGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGlossariesGetCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
type ProjectsLocationsGlossariesListCall ¶
type ProjectsLocationsGlossariesListCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsGlossariesListCall) Context ¶
func (c *ProjectsLocationsGlossariesListCall) Context(ctx context.Context) *ProjectsLocationsGlossariesListCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsGlossariesListCall) Do ¶
func (c *ProjectsLocationsGlossariesListCall) Do(opts ...googleapi.CallOption) (*ListGlossariesResponse, error)
Do executes the "translate.projects.locations.glossaries.list" call. Any non-2xx status code is an error. Response headers are in either *ListGlossariesResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsGlossariesListCall) Fields ¶
func (c *ProjectsLocationsGlossariesListCall) Fields(s ...googleapi.Field) *ProjectsLocationsGlossariesListCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsGlossariesListCall) Filter ¶
func (c *ProjectsLocationsGlossariesListCall) Filter(filter string) *ProjectsLocationsGlossariesListCall
Filter sets the optional parameter "filter": Filter specifying constraints of a list operation. Specify the constraint by the format of "key=value", where key must be "src" or "tgt", and the value must be a valid language code. For multiple restrictions, concatenate them by "AND" (uppercase only), such as: "src=en-US AND tgt=zh-CN". Notice that the exact match is used here, which means using 'en-US' and 'en' can lead to different results, which depends on the language code you used when you create the glossary. For the unidirectional glossaries, the "src" and "tgt" add restrictions on the source and target language code separately. For the equivalent term set glossaries, the "src" and/or "tgt" add restrictions on the term set. For example: "src=en-US AND tgt=zh-CN" will only pick the unidirectional glossaries which exactly match the source language code as "en-US" and the target language code "zh-CN", but all equivalent term set glossaries which contain "en-US" and "zh-CN" in their language set will be picked. If missing, no filtering is performed.
func (*ProjectsLocationsGlossariesListCall) Header ¶
func (c *ProjectsLocationsGlossariesListCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*ProjectsLocationsGlossariesListCall) IfNoneMatch ¶
func (c *ProjectsLocationsGlossariesListCall) IfNoneMatch(entityTag string) *ProjectsLocationsGlossariesListCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
func (*ProjectsLocationsGlossariesListCall) PageSize ¶
func (c *ProjectsLocationsGlossariesListCall) PageSize(pageSize int64) *ProjectsLocationsGlossariesListCall
PageSize sets the optional parameter "pageSize": Requested page size. The server may return fewer glossaries than requested. If unspecified, the server picks an appropriate default.
func (*ProjectsLocationsGlossariesListCall) PageToken ¶
func (c *ProjectsLocationsGlossariesListCall) PageToken(pageToken string) *ProjectsLocationsGlossariesListCall
PageToken sets the optional parameter "pageToken": A token identifying a page of results the server should return. Typically, this is the value of [ListGlossariesResponse.next_page_token] returned from the previous call to `ListGlossaries` method. The first page is returned if `page_token`is empty or missing.
func (*ProjectsLocationsGlossariesListCall) Pages ¶
func (c *ProjectsLocationsGlossariesListCall) Pages(ctx context.Context, f func(*ListGlossariesResponse) error) error
Pages invokes f for each page of results. A non-nil error returned from f will halt the iteration. The provided context supersedes any context provided to the Context method.
type ProjectsLocationsGlossariesService ¶
type ProjectsLocationsGlossariesService struct {
// contains filtered or unexported fields
}
func NewProjectsLocationsGlossariesService ¶
func NewProjectsLocationsGlossariesService(s *Service) *ProjectsLocationsGlossariesService
func (*ProjectsLocationsGlossariesService) Create ¶
func (r *ProjectsLocationsGlossariesService) Create(parent string, glossary *Glossary) *ProjectsLocationsGlossariesCreateCall
Create: Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
- parent: The project name.
func (*ProjectsLocationsGlossariesService) Delete ¶
func (r *ProjectsLocationsGlossariesService) Delete(name string) *ProjectsLocationsGlossariesDeleteCall
Delete: Deletes a glossary, or cancels glossary construction if the glossary isn't created yet. Returns NOT_FOUND, if the glossary doesn't exist.
- name: The name of the glossary to delete.
func (*ProjectsLocationsGlossariesService) Get ¶
func (r *ProjectsLocationsGlossariesService) Get(name string) *ProjectsLocationsGlossariesGetCall
Get: Gets a glossary. Returns NOT_FOUND, if the glossary doesn't exist.
- name: The name of the glossary to retrieve.
func (*ProjectsLocationsGlossariesService) List ¶
func (r *ProjectsLocationsGlossariesService) List(parent string) *ProjectsLocationsGlossariesListCall
List: Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
- parent: The name of the project from which to list all of the glossaries.
type ProjectsLocationsListCall ¶
type ProjectsLocationsListCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsListCall) Context ¶
func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsListCall) Do ¶
func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error)
Do executes the "translate.projects.locations.list" call. Any non-2xx status code is an error. Response headers are in either *ListLocationsResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsListCall) Fields ¶
func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsListCall) Filter ¶
func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall
Filter sets the optional parameter "filter": A filter to narrow down results to a preferred subset. The filtering language accepts strings like "displayName=tokyo", and is documented in more detail in AIP-160 (https://google.aip.dev/160).
func (*ProjectsLocationsListCall) Header ¶
func (c *ProjectsLocationsListCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*ProjectsLocationsListCall) IfNoneMatch ¶
func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
func (*ProjectsLocationsListCall) PageSize ¶
func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall
PageSize sets the optional parameter "pageSize": The maximum number of results to return. If not set, the service selects a default.
func (*ProjectsLocationsListCall) PageToken ¶
func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall
PageToken sets the optional parameter "pageToken": A page token received from the `next_page_token` field in the response. Send that page token to receive the subsequent page.
func (*ProjectsLocationsListCall) Pages ¶
func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error
Pages invokes f for each page of results. A non-nil error returned from f will halt the iteration. The provided context supersedes any context provided to the Context method.
type ProjectsLocationsOperationsCancelCall ¶
type ProjectsLocationsOperationsCancelCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsOperationsCancelCall) Context ¶
func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsOperationsCancelCall) Do ¶
func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error)
Do executes the "translate.projects.locations.operations.cancel" call. Any non-2xx status code is an error. Response headers are in either *Empty.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsOperationsCancelCall) Fields ¶
func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsOperationsCancelCall) Header ¶
func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type ProjectsLocationsOperationsDeleteCall ¶
type ProjectsLocationsOperationsDeleteCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsOperationsDeleteCall) Context ¶
func (c *ProjectsLocationsOperationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsOperationsDeleteCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsOperationsDeleteCall) Do ¶
func (c *ProjectsLocationsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error)
Do executes the "translate.projects.locations.operations.delete" call. Any non-2xx status code is an error. Response headers are in either *Empty.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsOperationsDeleteCall) Fields ¶
func (c *ProjectsLocationsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsDeleteCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsOperationsDeleteCall) Header ¶
func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type ProjectsLocationsOperationsGetCall ¶
type ProjectsLocationsOperationsGetCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsOperationsGetCall) Context ¶
func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsOperationsGetCall) Do ¶
func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error)
Do executes the "translate.projects.locations.operations.get" call. Any non-2xx status code is an error. Response headers are in either *Operation.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsOperationsGetCall) Fields ¶
func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsOperationsGetCall) Header ¶
func (c *ProjectsLocationsOperationsGetCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*ProjectsLocationsOperationsGetCall) IfNoneMatch ¶
func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
type ProjectsLocationsOperationsListCall ¶
type ProjectsLocationsOperationsListCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsOperationsListCall) Context ¶
func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsOperationsListCall) Do ¶
func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error)
Do executes the "translate.projects.locations.operations.list" call. Any non-2xx status code is an error. Response headers are in either *ListOperationsResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsOperationsListCall) Fields ¶
func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsOperationsListCall) Filter ¶
func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall
Filter sets the optional parameter "filter": The standard list filter.
func (*ProjectsLocationsOperationsListCall) Header ¶
func (c *ProjectsLocationsOperationsListCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*ProjectsLocationsOperationsListCall) IfNoneMatch ¶
func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
func (*ProjectsLocationsOperationsListCall) PageSize ¶
func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall
PageSize sets the optional parameter "pageSize": The standard list page size.
func (*ProjectsLocationsOperationsListCall) PageToken ¶
func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall
PageToken sets the optional parameter "pageToken": The standard list page token.
func (*ProjectsLocationsOperationsListCall) Pages ¶
func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error
Pages invokes f for each page of results. A non-nil error returned from f will halt the iteration. The provided context supersedes any context provided to the Context method.
type ProjectsLocationsOperationsService ¶
type ProjectsLocationsOperationsService struct {
// contains filtered or unexported fields
}
func NewProjectsLocationsOperationsService ¶
func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService
func (*ProjectsLocationsOperationsService) Cancel ¶
func (r *ProjectsLocationsOperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *ProjectsLocationsOperationsCancelCall
Cancel: Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
- name: The name of the operation resource to be cancelled.
func (*ProjectsLocationsOperationsService) Delete ¶
func (r *ProjectsLocationsOperationsService) Delete(name string) *ProjectsLocationsOperationsDeleteCall
Delete: Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
- name: The name of the operation resource to be deleted.
func (*ProjectsLocationsOperationsService) Get ¶
func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall
Get: Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
- name: The name of the operation resource.
func (*ProjectsLocationsOperationsService) List ¶
func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall
List: Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`.
- name: The name of the operation's parent resource.
func (*ProjectsLocationsOperationsService) Wait ¶
func (r *ProjectsLocationsOperationsService) Wait(name string, waitoperationrequest *WaitOperationRequest) *ProjectsLocationsOperationsWaitCall
Wait: Waits until the specified long-running operation is done or reaches at most a specified timeout, returning the latest state. If the operation is already done, the latest state is immediately returned. If the timeout specified is greater than the default HTTP/RPC timeout, the HTTP/RPC timeout is used. If the server does not support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Note that this method is on a best-effort basis. It may return the latest state before the specified timeout (including immediately), meaning even an immediate response is no guarantee that the operation is done.
- name: The name of the operation resource to wait on.
type ProjectsLocationsOperationsWaitCall ¶
type ProjectsLocationsOperationsWaitCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsOperationsWaitCall) Context ¶
func (c *ProjectsLocationsOperationsWaitCall) Context(ctx context.Context) *ProjectsLocationsOperationsWaitCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsOperationsWaitCall) Do ¶
func (c *ProjectsLocationsOperationsWaitCall) Do(opts ...googleapi.CallOption) (*Operation, error)
Do executes the "translate.projects.locations.operations.wait" call. Any non-2xx status code is an error. Response headers are in either *Operation.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsOperationsWaitCall) Fields ¶
func (c *ProjectsLocationsOperationsWaitCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsWaitCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsOperationsWaitCall) Header ¶
func (c *ProjectsLocationsOperationsWaitCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type ProjectsLocationsService ¶
type ProjectsLocationsService struct { Glossaries *ProjectsLocationsGlossariesService Operations *ProjectsLocationsOperationsService // contains filtered or unexported fields }
func NewProjectsLocationsService ¶
func NewProjectsLocationsService(s *Service) *ProjectsLocationsService
func (*ProjectsLocationsService) BatchTranslateDocument ¶
func (r *ProjectsLocationsService) BatchTranslateDocument(parent string, batchtranslatedocumentrequest *BatchTranslateDocumentRequest) *ProjectsLocationsBatchTranslateDocumentCall
BatchTranslateDocument: Translates a large volume of document in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
- parent: Location to make a regional call. Format: `projects/{project-number-or-id}/locations/{location-id}`. The `global` location is not supported for batch translation. Only AutoML Translation models or glossaries within the same region (have the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
func (*ProjectsLocationsService) BatchTranslateText ¶
func (r *ProjectsLocationsService) BatchTranslateText(parent string, batchtranslatetextrequest *BatchTranslateTextRequest) *ProjectsLocationsBatchTranslateTextCall
BatchTranslateText: Translates a large volume of text in asynchronous batch mode. This function provides real-time output as the inputs are being processed. If caller cancels a request, the partial results (for an input file, it's all or nothing) may still be available on the specified output location. This call returns immediately and you can use google.longrunning.Operation.name to poll the status of the call.
- parent: Location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id}/locations/{location-id}`. The `global` location is not supported for batch translation. Only AutoML Translation models or glossaries within the same region (have the same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
func (*ProjectsLocationsService) DetectLanguage ¶
func (r *ProjectsLocationsService) DetectLanguage(parent string, detectlanguagerequest *DetectLanguageRequest) *ProjectsLocationsDetectLanguageCall
DetectLanguage: Detects the language of text within a request.
- parent: Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id}/locations/{location-id}` or `projects/{project-number-or-id}`. For global calls, use `projects/{project-number-or-id}/locations/global` or `projects/{project-number-or-id}`. Only models within the same region (has same location-id) can be used. Otherwise an INVALID_ARGUMENT (400) error is returned.
func (*ProjectsLocationsService) Get ¶
func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall
Get: Gets information about a location.
- name: Resource name for the location.
func (*ProjectsLocationsService) GetSupportedLanguages ¶
func (r *ProjectsLocationsService) GetSupportedLanguages(parent string) *ProjectsLocationsGetSupportedLanguagesCall
GetSupportedLanguages: Returns a list of supported languages for translation.
- parent: Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id}` or `projects/{project-number-or-id}/locations/{location-id}`. For global calls, use `projects/{project-number-or-id}/locations/global` or `projects/{project-number-or-id}`. Non-global location is required for AutoML models. Only models within the same region (have same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
func (*ProjectsLocationsService) List ¶
func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall
List: Lists information about the supported locations for this service.
- name: The resource that owns the locations collection, if applicable.
func (*ProjectsLocationsService) TranslateDocument ¶
func (r *ProjectsLocationsService) TranslateDocument(parent string, translatedocumentrequest *TranslateDocumentRequest) *ProjectsLocationsTranslateDocumentCall
TranslateDocument: Translates documents in synchronous mode.
- parent: Location to make a regional call. Format: `projects/{project-number-or-id}/locations/{location-id}`. For global calls, use `projects/{project-number-or-id}/locations/global`. Non-global location is required for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have the same location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
func (*ProjectsLocationsService) TranslateText ¶
func (r *ProjectsLocationsService) TranslateText(parent string, translatetextrequest *TranslateTextRequest) *ProjectsLocationsTranslateTextCall
TranslateText: Translates input text and returns translated text.
- parent: Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id}` or `projects/{project-number-or-id}/locations/{location-id}`. For global calls, use `projects/{project-number-or-id}/locations/global` or `projects/{project-number-or-id}`. Non-global location is required for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have same location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
type ProjectsLocationsTranslateDocumentCall ¶
type ProjectsLocationsTranslateDocumentCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsTranslateDocumentCall) Context ¶
func (c *ProjectsLocationsTranslateDocumentCall) Context(ctx context.Context) *ProjectsLocationsTranslateDocumentCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsTranslateDocumentCall) Do ¶
func (c *ProjectsLocationsTranslateDocumentCall) Do(opts ...googleapi.CallOption) (*TranslateDocumentResponse, error)
Do executes the "translate.projects.locations.translateDocument" call. Any non-2xx status code is an error. Response headers are in either *TranslateDocumentResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsTranslateDocumentCall) Fields ¶
func (c *ProjectsLocationsTranslateDocumentCall) Fields(s ...googleapi.Field) *ProjectsLocationsTranslateDocumentCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsTranslateDocumentCall) Header ¶
func (c *ProjectsLocationsTranslateDocumentCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type ProjectsLocationsTranslateTextCall ¶
type ProjectsLocationsTranslateTextCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsTranslateTextCall) Context ¶
func (c *ProjectsLocationsTranslateTextCall) Context(ctx context.Context) *ProjectsLocationsTranslateTextCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsTranslateTextCall) Do ¶
func (c *ProjectsLocationsTranslateTextCall) Do(opts ...googleapi.CallOption) (*TranslateTextResponse, error)
Do executes the "translate.projects.locations.translateText" call. Any non-2xx status code is an error. Response headers are in either *TranslateTextResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsTranslateTextCall) Fields ¶
func (c *ProjectsLocationsTranslateTextCall) Fields(s ...googleapi.Field) *ProjectsLocationsTranslateTextCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsTranslateTextCall) Header ¶
func (c *ProjectsLocationsTranslateTextCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type ProjectsService ¶
type ProjectsService struct { Locations *ProjectsLocationsService // contains filtered or unexported fields }
func NewProjectsService ¶
func NewProjectsService(s *Service) *ProjectsService
func (*ProjectsService) DetectLanguage ¶
func (r *ProjectsService) DetectLanguage(parent string, detectlanguagerequest *DetectLanguageRequest) *ProjectsDetectLanguageCall
DetectLanguage: Detects the language of text within a request.
- parent: Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id}/locations/{location-id}` or `projects/{project-number-or-id}`. For global calls, use `projects/{project-number-or-id}/locations/global` or `projects/{project-number-or-id}`. Only models within the same region (has same location-id) can be used. Otherwise an INVALID_ARGUMENT (400) error is returned.
func (*ProjectsService) GetSupportedLanguages ¶
func (r *ProjectsService) GetSupportedLanguages(parent string) *ProjectsGetSupportedLanguagesCall
GetSupportedLanguages: Returns a list of supported languages for translation.
- parent: Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id}` or `projects/{project-number-or-id}/locations/{location-id}`. For global calls, use `projects/{project-number-or-id}/locations/global` or `projects/{project-number-or-id}`. Non-global location is required for AutoML models. Only models within the same region (have same location-id) can be used, otherwise an INVALID_ARGUMENT (400) error is returned.
func (*ProjectsService) TranslateText ¶
func (r *ProjectsService) TranslateText(parent string, translatetextrequest *TranslateTextRequest) *ProjectsTranslateTextCall
TranslateText: Translates input text and returns translated text.
- parent: Project or location to make a call. Must refer to a caller's project. Format: `projects/{project-number-or-id}` or `projects/{project-number-or-id}/locations/{location-id}`. For global calls, use `projects/{project-number-or-id}/locations/global` or `projects/{project-number-or-id}`. Non-global location is required for requests using AutoML models or custom glossaries. Models and glossaries must be within the same region (have same location-id), otherwise an INVALID_ARGUMENT (400) error is returned.
type ProjectsTranslateTextCall ¶
type ProjectsTranslateTextCall struct {
// contains filtered or unexported fields
}
func (*ProjectsTranslateTextCall) Context ¶
func (c *ProjectsTranslateTextCall) Context(ctx context.Context) *ProjectsTranslateTextCall
Context sets the context to be used in this call's Do method.
func (*ProjectsTranslateTextCall) Do ¶
func (c *ProjectsTranslateTextCall) Do(opts ...googleapi.CallOption) (*TranslateTextResponse, error)
Do executes the "translate.projects.translateText" call. Any non-2xx status code is an error. Response headers are in either *TranslateTextResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsTranslateTextCall) Fields ¶
func (c *ProjectsTranslateTextCall) Fields(s ...googleapi.Field) *ProjectsTranslateTextCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsTranslateTextCall) Header ¶
func (c *ProjectsTranslateTextCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type Service ¶
type Service struct { BasePath string // API endpoint base URL UserAgent string // optional additional User-Agent fragment Projects *ProjectsService // contains filtered or unexported fields }
func New
deprecated
New creates a new Service. It uses the provided http.Client for requests.
Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func NewService ¶
NewService creates a new Service.
type Status ¶
type Status struct { // Code: The status code, which should be an enum value of google.rpc.Code. Code int64 `json:"code,omitempty"` // Details: A list of messages that carry the error details. There is a common // set of message types for APIs to use. Details []googleapi.RawMessage `json:"details,omitempty"` // Message: A developer-facing error message, which should be in English. Any // user-facing error message should be localized and sent in the // google.rpc.Status.details field, or localized by the client. Message string `json:"message,omitempty"` // ForceSendFields is a list of field names (e.g. "Code") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Code") to include in API requests // with the JSON null value. By default, fields with empty values are omitted // from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
Status: The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide (https://cloud.google.com/apis/design/errors).
func (Status) MarshalJSON ¶
type SupportedLanguage ¶
type SupportedLanguage struct { // DisplayName: Human readable name of the language localized in the display // language specified in the request. DisplayName string `json:"displayName,omitempty"` // LanguageCode: Supported language code, generally consisting of its ISO 639-1 // identifier, for example, 'en', 'ja'. In certain cases, BCP-47 codes // including language and region identifiers are returned (for example, 'zh-TW' // and 'zh-CN') LanguageCode string `json:"languageCode,omitempty"` // SupportSource: Can be used as source language. SupportSource bool `json:"supportSource,omitempty"` // SupportTarget: Can be used as target language. SupportTarget bool `json:"supportTarget,omitempty"` // ForceSendFields is a list of field names (e.g. "DisplayName") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "DisplayName") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
SupportedLanguage: A single supported language response corresponds to information related to one supported language.
func (SupportedLanguage) MarshalJSON ¶
func (s SupportedLanguage) MarshalJSON() ([]byte, error)
type SupportedLanguages ¶
type SupportedLanguages struct { // Languages: A list of supported language responses. This list contains an // entry for each language the Translation API supports. Languages []*SupportedLanguage `json:"languages,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Languages") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Languages") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
SupportedLanguages: The response message for discovering supported languages.
func (SupportedLanguages) MarshalJSON ¶
func (s SupportedLanguages) MarshalJSON() ([]byte, error)
type TranslateDocumentRequest ¶
type TranslateDocumentRequest struct { // CustomizedAttribution: Optional. This flag is to support user customized // attribution. If not provided, the default is `Machine Translated by Google`. // Customized attribution should follow rules in // https://cloud.google.com/translate/attribution#attribution_and_logos CustomizedAttribution string `json:"customizedAttribution,omitempty"` // DocumentInputConfig: Required. Input configurations. DocumentInputConfig *DocumentInputConfig `json:"documentInputConfig,omitempty"` // DocumentOutputConfig: Optional. Output configurations. Defines if the output // file should be stored within Cloud Storage as well as the desired output // format. If not provided the translated file will only be returned through a // byte-stream and its output mime type will be the same as the input file's // mime type. DocumentOutputConfig *DocumentOutputConfig `json:"documentOutputConfig,omitempty"` // EnableRotationCorrection: Optional. If true, enable auto rotation correction // in DVS. EnableRotationCorrection bool `json:"enableRotationCorrection,omitempty"` // EnableShadowRemovalNativePdf: Optional. If true, use the text removal server // to remove the shadow text on background image for native pdf translation. // Shadow removal feature can only be enabled when // is_translate_native_pdf_only: false && pdf_native_only: false EnableShadowRemovalNativePdf bool `json:"enableShadowRemovalNativePdf,omitempty"` // GlossaryConfig: Optional. Glossary to be applied. The glossary must be // within the same region (have the same location-id) as the model, otherwise // an INVALID_ARGUMENT (400) error is returned. GlossaryConfig *TranslateTextGlossaryConfig `json:"glossaryConfig,omitempty"` // IsTranslateNativePdfOnly: Optional. is_translate_native_pdf_only field for // external customers. If true, the page limit of online native pdf translation // is 300 and only native pdf pages will be translated. IsTranslateNativePdfOnly bool `json:"isTranslateNativePdfOnly,omitempty"` // Labels: Optional. The labels with user-defined metadata for the request. // Label keys and values can be no longer than 63 characters (Unicode // codepoints), can only contain lowercase letters, numeric characters, // underscores and dashes. International characters are allowed. Label values // are optional. Label keys must start with a letter. See // https://cloud.google.com/translate/docs/advanced/labels for more // information. Labels map[string]string `json:"labels,omitempty"` // Model: Optional. The `model` type requested for this translation. The format // depends on model type: - AutoML Translation models: // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` // - General (built-in) models: // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, // If not provided, the default Google model (NMT) will be used for // translation. Model string `json:"model,omitempty"` // SourceLanguageCode: Optional. The BCP-47 language code of the input document // if known, for example, "en-US" or "sr-Latn". Supported language codes are // listed in Language Support. If the source language isn't specified, the API // attempts to identify the source language automatically and returns the // source language within the response. Source language must be specified if // the request contains a glossary or a custom model. SourceLanguageCode string `json:"sourceLanguageCode,omitempty"` // TargetLanguageCode: Required. The BCP-47 language code to use for // translation of the input document, set to one of the language codes listed // in Language Support. TargetLanguageCode string `json:"targetLanguageCode,omitempty"` // ForceSendFields is a list of field names (e.g. "CustomizedAttribution") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "CustomizedAttribution") to // include in API requests with the JSON null value. By default, fields with // empty values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
TranslateDocumentRequest: A document translation request.
func (TranslateDocumentRequest) MarshalJSON ¶
func (s TranslateDocumentRequest) MarshalJSON() ([]byte, error)
type TranslateDocumentResponse ¶
type TranslateDocumentResponse struct { // DocumentTranslation: Translated document. DocumentTranslation *DocumentTranslation `json:"documentTranslation,omitempty"` // GlossaryConfig: The `glossary_config` used for this translation. GlossaryConfig *TranslateTextGlossaryConfig `json:"glossaryConfig,omitempty"` // GlossaryDocumentTranslation: The document's translation output if a glossary // is provided in the request. This can be the same as // [TranslateDocumentResponse.document_translation] if no glossary terms apply. GlossaryDocumentTranslation *DocumentTranslation `json:"glossaryDocumentTranslation,omitempty"` // Model: Only present when 'model' is present in the request. 'model' is // normalized to have a project number. For example: If the 'model' field in // TranslateDocumentRequest is: // `projects/{project-id}/locations/{location-id}/models/general/nmt` then // `model` here would be normalized to // `projects/{project-number}/locations/{location-id}/models/general/nmt`. Model string `json:"model,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "DocumentTranslation") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "DocumentTranslation") to include // in API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
TranslateDocumentResponse: A translated document response message.
func (TranslateDocumentResponse) MarshalJSON ¶
func (s TranslateDocumentResponse) MarshalJSON() ([]byte, error)
type TranslateTextGlossaryConfig ¶
type TranslateTextGlossaryConfig struct { // Glossary: Required. Specifies the glossary used for this translation. Use // this format: projects/*/locations/*/glossaries/* Glossary string `json:"glossary,omitempty"` // IgnoreCase: Optional. Indicates match is case-insensitive. Default value is // false if missing. IgnoreCase bool `json:"ignoreCase,omitempty"` // ForceSendFields is a list of field names (e.g. "Glossary") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Glossary") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
TranslateTextGlossaryConfig: Configures which glossary should be used for a specific target language, and defines options for applying that glossary.
func (TranslateTextGlossaryConfig) MarshalJSON ¶
func (s TranslateTextGlossaryConfig) MarshalJSON() ([]byte, error)
type TranslateTextRequest ¶
type TranslateTextRequest struct { // Contents: Required. The content of the input in string format. We recommend // the total content be less than 30k codepoints. The max length of this field // is 1024. Use BatchTranslateText for larger text. Contents []string `json:"contents,omitempty"` // GlossaryConfig: Optional. Glossary to be applied. The glossary must be // within the same region (have the same location-id) as the model, otherwise // an INVALID_ARGUMENT (400) error is returned. GlossaryConfig *TranslateTextGlossaryConfig `json:"glossaryConfig,omitempty"` // Labels: Optional. The labels with user-defined metadata for the request. // Label keys and values can be no longer than 63 characters (Unicode // codepoints), can only contain lowercase letters, numeric characters, // underscores and dashes. International characters are allowed. Label values // are optional. Label keys must start with a letter. See // https://cloud.google.com/translate/docs/labels for more information. Labels map[string]string `json:"labels,omitempty"` // MimeType: Optional. The format of the source text, for example, "text/html", // "text/plain". If left blank, the MIME type defaults to "text/html". MimeType string `json:"mimeType,omitempty"` // Model: Optional. The `model` type requested for this translation. The format // depends on model type: - AutoML Translation models: // `projects/{project-number-or-id}/locations/{location-id}/models/{model-id}` // - General (built-in) models: // `projects/{project-number-or-id}/locations/{location-id}/models/general/nmt`, // For global (non-regionalized) requests, use `location-id` `global`. For // example, // `projects/{project-number-or-id}/locations/global/models/general/nmt`. If // not provided, the default Google model (NMT) will be used Model string `json:"model,omitempty"` // SourceLanguageCode: Optional. The BCP-47 language code of the input text if // known, for example, "en-US" or "sr-Latn". Supported language codes are // listed in Language Support. If the source language isn't specified, the API // attempts to identify the source language automatically and returns the // source language within the response. SourceLanguageCode string `json:"sourceLanguageCode,omitempty"` // TargetLanguageCode: Required. The BCP-47 language code to use for // translation of the input text, set to one of the language codes listed in // Language Support. TargetLanguageCode string `json:"targetLanguageCode,omitempty"` // ForceSendFields is a list of field names (e.g. "Contents") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Contents") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
TranslateTextRequest: The request message for synchronous translation.
func (TranslateTextRequest) MarshalJSON ¶
func (s TranslateTextRequest) MarshalJSON() ([]byte, error)
type TranslateTextResponse ¶
type TranslateTextResponse struct { // GlossaryTranslations: Text translation responses if a glossary is provided // in the request. This can be the same as `translations` if no terms apply. // This field has the same length as `contents`. GlossaryTranslations []*Translation `json:"glossaryTranslations,omitempty"` // Translations: Text translation responses with no glossary applied. This // field has the same length as `contents`. Translations []*Translation `json:"translations,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "GlossaryTranslations") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "GlossaryTranslations") to include // in API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
func (TranslateTextResponse) MarshalJSON ¶
func (s TranslateTextResponse) MarshalJSON() ([]byte, error)
type Translation ¶
type Translation struct { // DetectedLanguageCode: The BCP-47 language code of source text in the initial // request, detected automatically, if no source language was passed within the // initial request. If the source language was passed, auto-detection of the // language does not occur and this field is empty. DetectedLanguageCode string `json:"detectedLanguageCode,omitempty"` // GlossaryConfig: The `glossary_config` used for this translation. GlossaryConfig *TranslateTextGlossaryConfig `json:"glossaryConfig,omitempty"` // Model: Only present when `model` is present in the request. `model` here is // normalized to have project number. For example: If the `model` requested in // TranslationTextRequest is // `projects/{project-id}/locations/{location-id}/models/general/nmt` then // `model` here would be normalized to // `projects/{project-number}/locations/{location-id}/models/general/nmt`. Model string `json:"model,omitempty"` // TranslatedText: Text translated into the target language. If an error occurs // during translation, this field might be excluded from the response. TranslatedText string `json:"translatedText,omitempty"` // ForceSendFields is a list of field names (e.g. "DetectedLanguageCode") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "DetectedLanguageCode") to include // in API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
Translation: A single translation response.
func (Translation) MarshalJSON ¶
func (s Translation) MarshalJSON() ([]byte, error)
type WaitOperationRequest ¶
type WaitOperationRequest struct { // Timeout: The maximum duration to wait before timing out. If left blank, the // wait will be at most the time permitted by the underlying HTTP/RPC protocol. // If RPC context deadline is also specified, the shorter one will be used. Timeout string `json:"timeout,omitempty"` // ForceSendFields is a list of field names (e.g. "Timeout") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Timeout") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
WaitOperationRequest: The request message for Operations.WaitOperation.
func (WaitOperationRequest) MarshalJSON ¶
func (s WaitOperationRequest) MarshalJSON() ([]byte, error)