Documentation ¶
Index ¶
Constants ¶
const ( // FAILEDOPERATION_ERRORUSERAREA = "FailedOperation.ErrorUserArea" // FAILEDOPERATION_LANGUAGERECOGNITIONERR = "FailedOperation.LanguageRecognitionErr" // The free quota for this month is used up. To continue to use the service, you need to upgrade to a paid account in the TMT console. FAILEDOPERATION_NOFREEAMOUNT = "FailedOperation.NoFreeAmount" // FAILEDOPERATION_REQUESTAILABERR = "FailedOperation.RequestAiLabErr" // The service is suspended due to overdue payments. Top up your account first. FAILEDOPERATION_SERVICEISOLATE = "FailedOperation.ServiceIsolate" // FAILEDOPERATION_STOPUSING = "FailedOperation.StopUsing" // The service is not activated. Activate it in the TMT console first. FAILEDOPERATION_USERNOTREGISTERED = "FailedOperation.UserNotRegistered" // Internal error. INTERNALERROR = "InternalError" // Backend service timeout. Please try again later. INTERNALERROR_BACKENDTIMEOUT = "InternalError.BackendTimeout" // INTERNALERROR_ERRORGETROUTE = "InternalError.ErrorGetRoute" // Unknown error. INTERNALERROR_ERRORUNKNOWN = "InternalError.ErrorUnknown" // Request failed. INTERNALERROR_REQUESTFAILED = "InternalError.RequestFailed" // Invalid parameter. INVALIDPARAMETER = "InvalidParameter" // Invalid parameter. INVALIDPARAMETER_MISSINGPARAMETER = "InvalidParameter.MissingParameter" // INVALIDPARAMETERVALUE = "InvalidParameterValue" // The quota limit is reached. LIMITEXCEEDED = "LimitExceeded" // The request frequency limit is reached. LIMITEXCEEDED_LIMITEDACCESSFREQUENCY = "LimitExceeded.LimitedAccessFrequency" // Missing parameter. MISSINGPARAMETER = "MissingParameter" // REQUESTLIMITEXCEEDED_UINLIMITEXCEEDED = "RequestLimitExceeded.UinLimitExceeded" // Incorrect name entered in the `Action` field. UNAUTHORIZEDOPERATION_ACTIONNOTFOUND = "UnauthorizedOperation.ActionNotFound" // Unsupported operation. UNSUPPORTEDOPERATION = "UnsupportedOperation" // The text length limit (2,000 characters) for a request is reached. UNSUPPORTEDOPERATION_TEXTTOOLONG = "UnsupportedOperation.TextTooLong" // Unsupported target language. Please refer to the supported language list. UNSUPPORTEDOPERATION_UNSUPPORTEDTARGETLANGUAGE = "UnsupportedOperation.UnSupportedTargetLanguage" // Unsupported language. Please refer to the supported language list. UNSUPPORTEDOPERATION_UNSUPPORTEDLANGUAGE = "UnsupportedOperation.UnsupportedLanguage" // Unsupported source language. Please refer to the supported language list. UNSUPPORTEDOPERATION_UNSUPPORTEDSOURCELANGUAGE = "UnsupportedOperation.UnsupportedSourceLanguage" )
const APIVersion = "2018-03-21"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func NewClient ¶
func NewClient(credential common.CredentialIface, region string, clientProfile *profile.ClientProfile) (client *Client, err error)
func NewClientWithSecretId ¶
Deprecated
func (*Client) TextTranslate ¶
func (c *Client) TextTranslate(request *TextTranslateRequest) (response *TextTranslateResponse, err error)
TextTranslate This API is used to translate text in multiple language pairs, such as Chinese-English.<br />
Note: We recommend that you simplify your development with the SDK integration mode. For how to use the SDK, see Section 5 "Developer Resources".
error code that may be returned:
FAILEDOPERATION_ERRORUSERAREA = "FailedOperation.ErrorUserArea" FAILEDOPERATION_LANGUAGERECOGNITIONERR = "FailedOperation.LanguageRecognitionErr" FAILEDOPERATION_NOFREEAMOUNT = "FailedOperation.NoFreeAmount" FAILEDOPERATION_REQUESTAILABERR = "FailedOperation.RequestAiLabErr" FAILEDOPERATION_SERVICEISOLATE = "FailedOperation.ServiceIsolate" FAILEDOPERATION_STOPUSING = "FailedOperation.StopUsing" FAILEDOPERATION_USERNOTREGISTERED = "FailedOperation.UserNotRegistered" INTERNALERROR = "InternalError" INTERNALERROR_BACKENDTIMEOUT = "InternalError.BackendTimeout" INTERNALERROR_ERRORGETROUTE = "InternalError.ErrorGetRoute" INTERNALERROR_ERRORUNKNOWN = "InternalError.ErrorUnknown" INTERNALERROR_REQUESTFAILED = "InternalError.RequestFailed" INVALIDPARAMETER = "InvalidParameter" INVALIDPARAMETER_MISSINGPARAMETER = "InvalidParameter.MissingParameter" INVALIDPARAMETERVALUE = "InvalidParameterValue" LIMITEXCEEDED = "LimitExceeded" LIMITEXCEEDED_LIMITEDACCESSFREQUENCY = "LimitExceeded.LimitedAccessFrequency" MISSINGPARAMETER = "MissingParameter" REQUESTLIMITEXCEEDED_UINLIMITEXCEEDED = "RequestLimitExceeded.UinLimitExceeded" UNAUTHORIZEDOPERATION_ACTIONNOTFOUND = "UnauthorizedOperation.ActionNotFound" UNSUPPORTEDOPERATION = "UnsupportedOperation" UNSUPPORTEDOPERATION_TEXTTOOLONG = "UnsupportedOperation.TextTooLong" UNSUPPORTEDOPERATION_UNSUPPORTEDTARGETLANGUAGE = "UnsupportedOperation.UnSupportedTargetLanguage" UNSUPPORTEDOPERATION_UNSUPPORTEDLANGUAGE = "UnsupportedOperation.UnsupportedLanguage" UNSUPPORTEDOPERATION_UNSUPPORTEDSOURCELANGUAGE = "UnsupportedOperation.UnsupportedSourceLanguage"
func (*Client) TextTranslateWithContext ¶
func (c *Client) TextTranslateWithContext(ctx context.Context, request *TextTranslateRequest) (response *TextTranslateResponse, err error)
TextTranslate This API is used to translate text in multiple language pairs, such as Chinese-English.<br />
Note: We recommend that you simplify your development with the SDK integration mode. For how to use the SDK, see Section 5 "Developer Resources".
error code that may be returned:
FAILEDOPERATION_ERRORUSERAREA = "FailedOperation.ErrorUserArea" FAILEDOPERATION_LANGUAGERECOGNITIONERR = "FailedOperation.LanguageRecognitionErr" FAILEDOPERATION_NOFREEAMOUNT = "FailedOperation.NoFreeAmount" FAILEDOPERATION_REQUESTAILABERR = "FailedOperation.RequestAiLabErr" FAILEDOPERATION_SERVICEISOLATE = "FailedOperation.ServiceIsolate" FAILEDOPERATION_STOPUSING = "FailedOperation.StopUsing" FAILEDOPERATION_USERNOTREGISTERED = "FailedOperation.UserNotRegistered" INTERNALERROR = "InternalError" INTERNALERROR_BACKENDTIMEOUT = "InternalError.BackendTimeout" INTERNALERROR_ERRORGETROUTE = "InternalError.ErrorGetRoute" INTERNALERROR_ERRORUNKNOWN = "InternalError.ErrorUnknown" INTERNALERROR_REQUESTFAILED = "InternalError.RequestFailed" INVALIDPARAMETER = "InvalidParameter" INVALIDPARAMETER_MISSINGPARAMETER = "InvalidParameter.MissingParameter" INVALIDPARAMETERVALUE = "InvalidParameterValue" LIMITEXCEEDED = "LimitExceeded" LIMITEXCEEDED_LIMITEDACCESSFREQUENCY = "LimitExceeded.LimitedAccessFrequency" MISSINGPARAMETER = "MissingParameter" REQUESTLIMITEXCEEDED_UINLIMITEXCEEDED = "RequestLimitExceeded.UinLimitExceeded" UNAUTHORIZEDOPERATION_ACTIONNOTFOUND = "UnauthorizedOperation.ActionNotFound" UNSUPPORTEDOPERATION = "UnsupportedOperation" UNSUPPORTEDOPERATION_TEXTTOOLONG = "UnsupportedOperation.TextTooLong" UNSUPPORTEDOPERATION_UNSUPPORTEDTARGETLANGUAGE = "UnsupportedOperation.UnSupportedTargetLanguage" UNSUPPORTEDOPERATION_UNSUPPORTEDLANGUAGE = "UnsupportedOperation.UnsupportedLanguage" UNSUPPORTEDOPERATION_UNSUPPORTEDSOURCELANGUAGE = "UnsupportedOperation.UnsupportedSourceLanguage"
type TextTranslateRequest ¶
type TextTranslateRequest struct { *tchttp.BaseRequest // The texts to be translated, which must be encoded in UTF-8 and can contain up to 2,000 characters in a request. For non-pure texts such as those with HTML tags, the translation may fail. SourceText *string `json:"SourceText,omitnil,omitempty" name:"SourceText"` // Supported source languages: // auto: Automatic language detection // zh: Simplified Chinese // zh_TW: Traditional Chinese // en: English // ja: Japanese // fr: French // es: Spanish // it: Italian // de: German // tr: Turkish // ru: Russian // pt: Portuguese // vi: Vietnamese // id: Bahasa Indonesian // th: Thai // ms: Malay // ar: Arabic // hi: Hindi Source *string `json:"Source,omitnil,omitempty" name:"Source"` // Supported target languages for the above source languages: // // <li>zh (Simplified Chinese): en (English), ja (Japanese), fr (French), es (Spanish), it (Italian), de (German), tr (Turkish), ru (Russian), pt (Portuguese), vi (Vietnamese), id (Bahasa Indonesian), th (Thai), and ms (Malay)</li> // <li>zh-TW (Traditional Chinese): en (English), ja (Japanese), fr (French), es (Spanish), it (Italian), tr (Turkish), ru (Russian), pt (Portuguese), vi (Vietnamese), id (Bahasa Indonesian), th (Thai), and ms (Malay)</li> // <li>en (English): zh (Simplified Chinese), zh-TW (Traditional Chinese), ja (Japanese), fr (French), es (Spanish), it (Italian), de (German), tr (Turkish), vi (Vietnamese), id (Bahasa Indonesian), th (Thai), ms (Malay), and hi (Hindi)</li> // <li>fr (French): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>it (Italian): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>de (German): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>ru (Russian): zh (Simplified Chinese) and zh-TW (Traditional Chinese)</li> // <li>tr (Turkish): zh (Simplified Chinese) and zh-TW (Traditional Chinese)</li> // <li>pt (Portuguese): zh (Simplified Chinese) and tr (Turkish)</li> // <li>es (Spanish): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>ja (Japanese): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>vi (Vietnamese): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>th (Thai): zh (Simplified Chinese) and en (English)</li> // <li>id (Bahasa Indonesian): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>ms (Malay): zh (Simplified Chinese) and zh-TW (Traditional Chinese)</li> // <li>ar (Arabic): en (English)</li> // <li>hi (Hindi): en (English)</li> Target *string `json:"Target,omitnil,omitempty" name:"Target"` // The project ID, which can be obtained from **Console -> Account Center -> Project Management**. If no one is set, enter the default project ID `0`. ProjectId *int64 `json:"ProjectId,omitnil,omitempty" name:"ProjectId"` // The parameter used to mark the text content that needs to remain untranslated, such as special symbols and names of people and places. You can set only one word for this parameter in each request. Only nouns (like names of people and places) are supported, and verbs or phrases may cause poor translation outcomes. UntranslatedText *string `json:"UntranslatedText,omitnil,omitempty" name:"UntranslatedText"` TermRepoIDList []*string `json:"TermRepoIDList,omitnil,omitempty" name:"TermRepoIDList"` SentRepoIDList []*string `json:"SentRepoIDList,omitnil,omitempty" name:"SentRepoIDList"` }
func NewTextTranslateRequest ¶
func NewTextTranslateRequest() (request *TextTranslateRequest)
func (*TextTranslateRequest) FromJsonString ¶
func (r *TextTranslateRequest) FromJsonString(s string) error
FromJsonString It is highly **NOT** recommended to use this function because it has no param check, nor strict type check
func (*TextTranslateRequest) ToJsonString ¶
func (r *TextTranslateRequest) ToJsonString() string
type TextTranslateRequestParams ¶
type TextTranslateRequestParams struct { // The texts to be translated, which must be encoded in UTF-8 and can contain up to 2,000 characters in a request. For non-pure texts such as those with HTML tags, the translation may fail. SourceText *string `json:"SourceText,omitnil,omitempty" name:"SourceText"` // Supported source languages: // auto: Automatic language detection // zh: Simplified Chinese // zh_TW: Traditional Chinese // en: English // ja: Japanese // fr: French // es: Spanish // it: Italian // de: German // tr: Turkish // ru: Russian // pt: Portuguese // vi: Vietnamese // id: Bahasa Indonesian // th: Thai // ms: Malay // ar: Arabic // hi: Hindi Source *string `json:"Source,omitnil,omitempty" name:"Source"` // Supported target languages for the above source languages: // // <li>zh (Simplified Chinese): en (English), ja (Japanese), fr (French), es (Spanish), it (Italian), de (German), tr (Turkish), ru (Russian), pt (Portuguese), vi (Vietnamese), id (Bahasa Indonesian), th (Thai), and ms (Malay)</li> // <li>zh-TW (Traditional Chinese): en (English), ja (Japanese), fr (French), es (Spanish), it (Italian), tr (Turkish), ru (Russian), pt (Portuguese), vi (Vietnamese), id (Bahasa Indonesian), th (Thai), and ms (Malay)</li> // <li>en (English): zh (Simplified Chinese), zh-TW (Traditional Chinese), ja (Japanese), fr (French), es (Spanish), it (Italian), de (German), tr (Turkish), vi (Vietnamese), id (Bahasa Indonesian), th (Thai), ms (Malay), and hi (Hindi)</li> // <li>fr (French): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>it (Italian): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>de (German): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>ru (Russian): zh (Simplified Chinese) and zh-TW (Traditional Chinese)</li> // <li>tr (Turkish): zh (Simplified Chinese) and zh-TW (Traditional Chinese)</li> // <li>pt (Portuguese): zh (Simplified Chinese) and tr (Turkish)</li> // <li>es (Spanish): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>ja (Japanese): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>vi (Vietnamese): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>th (Thai): zh (Simplified Chinese) and en (English)</li> // <li>id (Bahasa Indonesian): zh (Simplified Chinese), zh-TW (Traditional Chinese) and en (English)</li> // <li>ms (Malay): zh (Simplified Chinese) and zh-TW (Traditional Chinese)</li> // <li>ar (Arabic): en (English)</li> // <li>hi (Hindi): en (English)</li> Target *string `json:"Target,omitnil,omitempty" name:"Target"` // The project ID, which can be obtained from **Console -> Account Center -> Project Management**. If no one is set, enter the default project ID `0`. ProjectId *int64 `json:"ProjectId,omitnil,omitempty" name:"ProjectId"` // The parameter used to mark the text content that needs to remain untranslated, such as special symbols and names of people and places. You can set only one word for this parameter in each request. Only nouns (like names of people and places) are supported, and verbs or phrases may cause poor translation outcomes. UntranslatedText *string `json:"UntranslatedText,omitnil,omitempty" name:"UntranslatedText"` TermRepoIDList []*string `json:"TermRepoIDList,omitnil,omitempty" name:"TermRepoIDList"` SentRepoIDList []*string `json:"SentRepoIDList,omitnil,omitempty" name:"SentRepoIDList"` }
Predefined struct for user
type TextTranslateResponse ¶
type TextTranslateResponse struct { *tchttp.BaseResponse Response *TextTranslateResponseParams `json:"Response"` }
func NewTextTranslateResponse ¶
func NewTextTranslateResponse() (response *TextTranslateResponse)
func (*TextTranslateResponse) FromJsonString ¶
func (r *TextTranslateResponse) FromJsonString(s string) error
FromJsonString It is highly **NOT** recommended to use this function because it has no param check, nor strict type check
func (*TextTranslateResponse) ToJsonString ¶
func (r *TextTranslateResponse) ToJsonString() string
type TextTranslateResponseParams ¶
type TextTranslateResponseParams struct { // The translation outcome. TargetText *string `json:"TargetText,omitnil,omitempty" name:"TargetText"` // The source language. See the request parameter `Source` for details. Source *string `json:"Source,omitnil,omitempty" name:"Source"` // The target language. See the request parameter `Target` for details. Target *string `json:"Target,omitnil,omitempty" name:"Target"` // The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"` }
Predefined struct for user