googleapis.cloudtranslation
Module googleapis.cloudtranslation
API
Definitions
ballerinax/googleapis.cloudtranslation Ballerina library
Overview
This is a generated connector for Google Cloud Translation API v3 OpenAPI specification. Integrates text translation into your website or application.
Prerequisites
Before using this connector in your Ballerina application, complete the following:
- Create a Google account
- Obtain tokens - Follow this link
Quickstart
To use the Google Cloud Translation connector in your Ballerina application, update the .bal file as follows:
Step 1: Import connector
First, import the ballerinax/googleapis.cloudtranslation
module into the Ballerina project.
import ballerinax/googleapis.cloudtranslation;
Step 2: Create a new connector instance
Create a cloudtranslation:ClientConfig
with the OAuth2 tokens obtained, and initialize the connector with it.
cloudtranslation:ClientConfig clientConfig = { auth: { clientId: <CLIENT_ID>, clientSecret: <CLIENT_SECRET>, refreshUrl: <REFRESH_URL>, refreshToken: <REFRESH_TOKEN> } }; cloudtranslation:Client baseClient = check new Client(clientConfig);
Step 3: Invoke connector operation
-
Now you can use the operations available within the connector. Note that they are in the form of remote operations.
Following is an example on how to translate input text and return translated text using the connector.
Translates input text and returns translated text
public function main() { cloudtranslation:TranslateTextResponse|error response = baseClient->translatetextProjectsLocations("projects/<project-number-or-id>/locations/<location-id>"); if (response is cloudtranslation:TranslateTextResponse) { log:printInfo(response.toString()); } else { log:printError(response.message()); } }
-
Use
bal run
command to compile and run the Ballerina program.
Clients
googleapis.cloudtranslation: Client
This is a generated connector for Google Cloud Translation API v3 OpenAPI specification. Integrates text translation into your website or application.
Constructor
Gets invoked to initialize the connector
.
The connector initialization requires setting the API credentials.
Create a Google account and obtain tokens by following this guide.
init (ConnectionConfig config, string serviceUrl)
- config ConnectionConfig - The configurations to be used when initializing the
connector
- serviceUrl string "https://translation.googleapis.com/" - URL of the target service
getProjectsLocationsOperations
function getProjectsLocationsOperations(string name, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType) returns Operation|error
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.
Parameters
- name string - The name of the operation resource.
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
deleteProjectsLocationsOperations
function deleteProjectsLocationsOperations(string name, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType) returns Response|error
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
.
Parameters
- name string - The name of the operation resource to be deleted.
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
listProjectsLocations
function listProjectsLocations(string name, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType, string? filter, int? pageSize, string? pageToken) returns ListLocationsResponse|error
Lists information about the supported locations for this service.
Parameters
- name string - The resource that owns the locations collection, if applicable.
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
- pageSize int? (default ()) - The maximum number of results to return. If not set, the service selects a default.
- pageToken string? (default ()) - A page token received from the
next_page_token
field in the response. Send that page token to receive the subsequent page.
Return Type
- ListLocationsResponse|error - Successful response
listProjectsLocationsOperations
function listProjectsLocationsOperations(string name, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType, string? filter, int? pageSize, string? pageToken) returns ListOperationsResponse|error
Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED
. NOTE: the name
binding allows API services to override the binding to use different resource name schemes, such as users/*/operations
. To override the binding, API services can add a binding such as "/v1/{name=users/*}/operations"
to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must ensure the name binding is the parent resource, without the operations collection id.
Parameters
- name string - The name of the operation's parent resource.
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
- filter string? (default ()) - The standard list filter.
- pageSize int? (default ()) - The standard list page size.
- pageToken string? (default ()) - The standard list page token.
Return Type
- ListOperationsResponse|error - Successful response
cancelProjectsLocationsOperations
function cancelProjectsLocationsOperations(string name, CancelOperationRequest payload, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType) returns Response|error
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
.
Parameters
- name string - The name of the operation resource to be cancelled.
- payload CancelOperationRequest - CancelOperation request
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
waitProjectsLocationsOperations
function waitProjectsLocationsOperations(string name, WaitOperationRequest payload, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType) returns Operation|error
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.
Parameters
- name string - The name of the operation resource to wait on.
- payload WaitOperationRequest - WaitOperation request
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
listProjectsLocationsGlossaries
function listProjectsLocationsGlossaries(string parent, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType, string? filter, int? pageSize, string? pageToken) returns ListGlossariesResponse|error
Lists glossaries in a project. Returns NOT_FOUND, if the project doesn't exist.
Parameters
- parent string - Required. The name of the project from which to list all of the glossaries.
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
- filter string? (default ()) - Optional. 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.
- pageSize int? (default ()) - Optional. Requested page size. The server may return fewer glossaries than requested. If unspecified, the server picks an appropriate default.
- pageToken string? (default ()) - Optional. 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 ifpage_token
is empty or missing.
Return Type
- ListGlossariesResponse|error - Successful response
createProjectsLocationsGlossaries
function createProjectsLocationsGlossaries(string parent, Glossary payload, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType) returns Operation|error
Creates a glossary and returns the long-running operation. Returns NOT_FOUND, if the project doesn't exist.
Parameters
- parent string - Required. The project name.
- payload Glossary - Glossary request
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
getsupportedlanguagesProjectsLocations
function getsupportedlanguagesProjectsLocations(string parent, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType, string? displayLanguageCode, string? model) returns SupportedLanguages|error
Returns a list of supported languages for translation.
Parameters
- parent string - Required. Project or location to make a call. Must refer to a caller's project. Format:
projects/{project-number-or-id}
orprojects/{project-number-or-id}/locations/{location-id}
. For global calls, useprojects/{project-number-or-id}/locations/global
orprojects/{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.
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
- displayLanguageCode string? (default ()) - Optional. The language to use to return localized, human readable names of supported languages. If missing, then display names are not returned in a response.
- model string? (default ()) - Optional. 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.
Return Type
- SupportedLanguages|error - Successful response
batchtranslatetextProjectsLocations
function batchtranslatetextProjectsLocations(string parent, BatchTranslateTextRequest payload, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType) returns Operation|error
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.
Parameters
- parent string - Required. Location to make a call. Must refer to a caller's project. Format:
projects/{project-number-or-id}/locations/{location-id}
. Theglobal
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.
- payload BatchTranslateTextRequest - BatchTranslateText request
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
detectlanguageProjectsLocations
function detectlanguageProjectsLocations(string parent, DetectLanguageRequest payload, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType) returns DetectLanguageResponse|error
Detects the language of text within a request.
Parameters
- parent string - Required. Project or location to make a call. Must refer to a caller's project. Format:
projects/{project-number-or-id}/locations/{location-id}
orprojects/{project-number-or-id}
. For global calls, useprojects/{project-number-or-id}/locations/global
orprojects/{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.
- payload DetectLanguageRequest - DetectLanguage request
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
Return Type
- DetectLanguageResponse|error - Successful response
translatetextProjectsLocations
function translatetextProjectsLocations(string parent, TranslateTextRequest payload, string? xgafv, string? alt, string? callback, string? fields, string? quotaUser, string? uploadProtocol, string? uploadType) returns TranslateTextResponse|error
Translates input text and returns translated text.
Parameters
- parent string - Required. Project or location to make a call. Must refer to a caller's project. Format:
projects/{project-number-or-id}
orprojects/{project-number-or-id}/locations/{location-id}
. For global calls, useprojects/{project-number-or-id}/locations/global
orprojects/{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.
- payload TranslateTextRequest - TranslateText request
- xgafv string? (default ()) - V1 error format.
- alt string? (default ()) - Data format for response.
- callback string? (default ()) - JSONP
- fields string? (default ()) - Selector specifying which fields to include in a partial response.
- quotaUser string? (default ()) - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.
- uploadProtocol string? (default ()) - Upload protocol for media (e.g. "raw", "multipart").
- uploadType string? (default ()) - Legacy upload protocol for media (e.g. "media", "multipart").
Return Type
- TranslateTextResponse|error - Successful response
Records
googleapis.cloudtranslation: BatchTranslateTextRequest
The batch translation request.
Fields
- glossaries record {}? - Optional. Glossaries to be applied for translation. It's keyed by target language code.
- inputConfigs InputConfig[]? - 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.
- labels record {}? - 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.
- models record {}? - 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.
- outputConfig OutputConfig? - Output configuration for BatchTranslateText request.
- sourceLanguageCode string? - Required. Source language code.
- targetLanguageCodes string[]? - Required. Specify up to 10 language codes here.
googleapis.cloudtranslation: CancelOperationRequest
The request message for Operations.CancelOperation.
googleapis.cloudtranslation: ClientHttp1Settings
Provides settings related to HTTP/1.x protocol.
Fields
- keepAlive KeepAlive(default http:KEEPALIVE_AUTO) - Specifies whether to reuse a connection for multiple requests
- chunking Chunking(default http:CHUNKING_AUTO) - The chunking behaviour of the request
- proxy ProxyConfig? - Proxy server related options
googleapis.cloudtranslation: ConnectionConfig
Provides a set of configurations for controlling the behaviours when communicating with a remote HTTP endpoint.
Fields
- auth BearerTokenConfig|OAuth2RefreshTokenGrantConfig - Configurations related to client authentication
- httpVersion HttpVersion(default http:HTTP_2_0) - The HTTP version understood by the client
- http1Settings ClientHttp1Settings? - Configurations related to HTTP/1.x protocol
- http2Settings ClientHttp2Settings? - Configurations related to HTTP/2 protocol
- timeout decimal(default 60) - The maximum time to wait (in seconds) for a response before closing the connection
- forwarded string(default "disable") - The choice of setting
forwarded
/x-forwarded
header
- poolConfig PoolConfiguration? - Configurations associated with request pooling
- cache CacheConfig? - HTTP caching related configurations
- compression Compression(default http:COMPRESSION_AUTO) - Specifies the way of handling compression (
accept-encoding
) header
- circuitBreaker CircuitBreakerConfig? - Configurations associated with the behaviour of the Circuit Breaker
- retryConfig RetryConfig? - Configurations associated with retrying
- responseLimits ResponseLimitConfigs? - Configurations associated with inbound response size limits
- secureSocket ClientSecureSocket? - SSL/TLS-related options
- proxy ProxyConfig? - Proxy server related options
- validation boolean(default true) - Enables the inbound payload validation functionality which provided by the constraint package. Enabled by default
googleapis.cloudtranslation: DetectedLanguage
The response message for language detection.
Fields
- confidence float? - The confidence of the detection result for this language.
- languageCode string? - The BCP-47 language code of source content in the request, detected automatically.
googleapis.cloudtranslation: DetectLanguageRequest
The request message for language detection.
Fields
- content string? - The content of the input stored as a string.
- labels record {}? - 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.
- mimeType string? - Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".
- model string? - Optional. The language detection model to be used. Format:
projects/{project-number-or-id}/locations/{location-id}/models/language-detection/{model-id}
Only one language detection model is currently supported:projects/{project-number-or-id}/locations/{location-id}/models/language-detection/default
. If not specified, the default model is used.
googleapis.cloudtranslation: DetectLanguageResponse
The response message for language detection.
Fields
- languages DetectedLanguage[]? - The most probable language detected by the Translation API. For each request, the Translation API will always return only one result.
googleapis.cloudtranslation: GcsDestination
The Google Cloud Storage location for the output content.
Fields
- outputUriPrefix string? - Required. The bucket used in 'output_uri_prefix' must exist and there must be no files under 'output_uri_prefix'. 'output_uri_prefix' must end with "/" and start with "gs://". One 'output_uri_prefix' can only be used by one batch translation job at a time. Otherwise an INVALID_ARGUMENT (400) error is returned.
googleapis.cloudtranslation: GcsSource
The Google Cloud Storage location for the input content.
Fields
- inputUri string? - Required. Source data URI. For example,
gs://my_bucket/my_object
.
googleapis.cloudtranslation: Glossary
Represents a glossary built from user provided data.
Fields
- endTime string? - Output only. When the glossary creation was finished.
- entryCount int? - Output only. The number of entries defined in the glossary.
- inputConfig GlossaryInputConfig? - Input configuration for glossaries.
- languageCodesSet LanguageCodesSet? - Used with equivalent term set glossaries.
- languagePair LanguageCodePair? - Used with unidirectional glossaries.
- name string? - Required. The resource name of the glossary. Glossary names have the form
projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}
.
- submitTime string? - Output only. When CreateGlossary was called.
googleapis.cloudtranslation: GlossaryInputConfig
Input configuration for glossaries.
Fields
- gcsSource GcsSource? - The Google Cloud Storage location for the input content.
googleapis.cloudtranslation: InputConfig
Input configuration for BatchTranslateText request.
Fields
- gcsSource GcsSource? - The Google Cloud Storage location for the input content.
- mimeType string? - 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.
googleapis.cloudtranslation: LanguageCodePair
Used with unidirectional glossaries.
Fields
- sourceLanguageCode string? - Required. The BCP-47 language code of the input text, for example, "en-US". Expected to be an exact match for GlossaryTerm.language_code.
- targetLanguageCode string? - Required. The BCP-47 language code for translation output, for example, "zh-CN". Expected to be an exact match for GlossaryTerm.language_code.
googleapis.cloudtranslation: LanguageCodesSet
Used with equivalent term set glossaries.
Fields
- languageCodes string[]? - 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.
googleapis.cloudtranslation: ListGlossariesResponse
Response message for ListGlossaries.
Fields
- glossaries Glossary[]? - The list of glossaries for a project.
- nextPageToken string? - 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.
googleapis.cloudtranslation: ListLocationsResponse
The response message for Locations.ListLocations.
Fields
- locations Location[]? - A list of locations that matches the specified filter in the request.
- nextPageToken string? - The standard List next-page token.
googleapis.cloudtranslation: ListOperationsResponse
The response message for Operations.ListOperations.
Fields
- nextPageToken string? - The standard List next-page token.
- operations Operation[]? - A list of operations that matches the specified filter in the request.
googleapis.cloudtranslation: Location
A resource that represents Google Cloud Platform location.
Fields
- displayName string? - The friendly name for this location, typically a nearby city name. For example, "Tokyo".
- labels record {}? - Cross-service attributes for the location. For example {"cloud.googleapis.com/region": "us-east1"}
- locationId string? - The canonical id for this location. For example:
"us-east1"
.
- metadata record {}? - Service-specific metadata. For example the available capacity at the given location.
- name string? - Resource name for the location, which may vary between implementations. For example:
"projects/example-project/locations/us-east1"
googleapis.cloudtranslation: OAuth2RefreshTokenGrantConfig
OAuth2 Refresh Token Grant Configs
Fields
- Fields Included from *OAuth2RefreshTokenGrantConfig
- refreshUrl string(default "https://accounts.google.com/o/oauth2/token") - Refresh URL
googleapis.cloudtranslation: Operation
This resource represents a long-running operation that is the result of a network API call.
Fields
- done boolean? - If the value is
false
, it means the operation is still in progress. Iftrue
, the operation is completed, and eithererror
orresponse
is available.
- 'error 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. EachStatus
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.
- metadata record {}? - 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.
- name string? - 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 withoperations/{unique_id}
.
- response record {}? - The normal response of the operation in case of success. If the original method returns no data on success, such as
Delete
, the response isgoogle.protobuf.Empty
. If the original method is standardGet
/Create
/Update
, the response should be the resource. For other methods, the response should have the type XxxResponse, whereXxx
is the original method name. For example, if the original method name is TakeSnapshot(), the inferred response type isTakeSnapshotResponse
.
googleapis.cloudtranslation: OutputConfig
Output configuration for BatchTranslateText request.
Fields
- gcsDestination GcsDestination? - The Google Cloud Storage location for the output content.
googleapis.cloudtranslation: ProxyConfig
Proxy server configurations to be used with the HTTP client endpoint.
Fields
- host string(default "") - Host name of the proxy server
- port int(default 0) - Proxy server port
- userName string(default "") - Proxy server username
- password string(default "") - Proxy server password
googleapis.cloudtranslation: 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. 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.
Fields
- code int? - The status code, which should be an enum value of google.rpc.Code.
- details record {}[]? - A list of messages that carry the error details. There is a common set of message types for APIs to use.
- message string? - 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.
googleapis.cloudtranslation: SupportedLanguage
A single supported language response corresponds to information related to one supported language.
Fields
- displayName string? - Human readable name of the language localized in the display language specified in the request.
- languageCode string? - 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')
- supportSource boolean? - Can be used as source language.
- supportTarget boolean? - Can be used as target language.
googleapis.cloudtranslation: SupportedLanguages
The response message for discovering supported languages.
Fields
- languages SupportedLanguage[]? - A list of supported language responses. This list contains an entry for each language the Translation API supports.
googleapis.cloudtranslation: TranslateTextGlossaryConfig
Configures which glossary should be used for a specific target language, and defines options for applying that glossary.
Fields
- glossary string? - Required. The
glossary
to be applied for this translation. The format depends on glossary: - User provided custom glossary:projects/{project-number-or-id}/locations/{location-id}/glossaries/{glossary-id}
- ignoreCase boolean? - Optional. Indicates match is case-insensitive. Default value is false if missing.
googleapis.cloudtranslation: TranslateTextRequest
The request message for synchronous translation.
Fields
- contents string[]? - 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.
- glossaryConfig TranslateTextGlossaryConfig? - Configures which glossary should be used for a specific target language, and defines options for applying that glossary.
- labels record {}? - 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.
- mimeType string? - Optional. The format of the source text, for example, "text/html", "text/plain". If left blank, the MIME type defaults to "text/html".
- model string? - 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, uselocation-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
- sourceLanguageCode string? - 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.
- targetLanguageCode string? - 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.
googleapis.cloudtranslation: TranslateTextResponse
Fields
- glossaryTranslations Translation[]? - 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 ascontents
.
- translations Translation[]? - Text translation responses with no glossary applied. This field has the same length as
contents
.
googleapis.cloudtranslation: Translation
A single translation response.
Fields
- detectedLanguageCode string? - 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.
- glossaryConfig TranslateTextGlossaryConfig? - Configures which glossary should be used for a specific target language, and defines options for applying that glossary.
- model string? - Only present when
model
is present in the request.model
here is normalized to have project number. For example: If themodel
requested in TranslationTextRequest isprojects/{project-id}/locations/{location-id}/models/general/nmt
thenmodel
here would be normalized toprojects/{project-number}/locations/{location-id}/models/general/nmt
.
- translatedText string? - Text translated into the target language. If an error occurs during translation, this field might be excluded from the response.
googleapis.cloudtranslation: WaitOperationRequest
The request message for Operations.WaitOperation.
Fields
- timeout string? - 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.
Import
import ballerinax/googleapis.cloudtranslation;
Metadata
Released date: over 1 year ago
Version: 1.5.1
License: Apache-2.0
Compatibility
Platform: any
Ballerina version: 2201.4.1
GraalVM compatible: Yes
Pull count
Total: 1
Current verison: 1
Weekly downloads
Keywords
Education/Translator
Cost/Free
Vendor/Google
Contributors
Dependencies