v20180321

package
v3.0.959+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// 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"

	// The service is suspended due to overdue payments. Top up your account first.
	FAILEDOPERATION_SERVICEISOLATE = "FailedOperation.ServiceIsolate"

	// 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"

	// Unknown error.
	INTERNALERROR_ERRORUNKNOWN = "InternalError.ErrorUnknown"

	// Request failed.
	INTERNALERROR_REQUESTFAILED = "InternalError.RequestFailed"

	// Invalid parameter.
	INVALIDPARAMETER = "InvalidParameter"

	// Invalid parameter.
	INVALIDPARAMETER_MISSINGPARAMETER = "InvalidParameter.MissingParameter"

	// The quota limit is reached.
	LIMITEXCEEDED = "LimitExceeded"

	// The request frequency limit is reached.
	LIMITEXCEEDED_LIMITEDACCESSFREQUENCY = "LimitExceeded.LimitedAccessFrequency"

	// Missing parameter.
	MISSINGPARAMETER = "MissingParameter"

	// 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"
)
View Source
const APIVersion = "2018-03-21"

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	common.Client
}

func NewClient

func NewClient(credential common.CredentialIface, region string, clientProfile *profile.ClientProfile) (client *Client, err error)

func NewClientWithSecretId

func NewClientWithSecretId(secretId, secretKey, region string) (client *Client, err error)

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_NOFREEAMOUNT = "FailedOperation.NoFreeAmount"
FAILEDOPERATION_SERVICEISOLATE = "FailedOperation.ServiceIsolate"
FAILEDOPERATION_USERNOTREGISTERED = "FailedOperation.UserNotRegistered"
INTERNALERROR = "InternalError"
INTERNALERROR_BACKENDTIMEOUT = "InternalError.BackendTimeout"
INTERNALERROR_ERRORUNKNOWN = "InternalError.ErrorUnknown"
INTERNALERROR_REQUESTFAILED = "InternalError.RequestFailed"
INVALIDPARAMETER = "InvalidParameter"
INVALIDPARAMETER_MISSINGPARAMETER = "InvalidParameter.MissingParameter"
LIMITEXCEEDED = "LimitExceeded"
LIMITEXCEEDED_LIMITEDACCESSFREQUENCY = "LimitExceeded.LimitedAccessFrequency"
MISSINGPARAMETER = "MissingParameter"
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_NOFREEAMOUNT = "FailedOperation.NoFreeAmount"
FAILEDOPERATION_SERVICEISOLATE = "FailedOperation.ServiceIsolate"
FAILEDOPERATION_USERNOTREGISTERED = "FailedOperation.UserNotRegistered"
INTERNALERROR = "InternalError"
INTERNALERROR_BACKENDTIMEOUT = "InternalError.BackendTimeout"
INTERNALERROR_ERRORUNKNOWN = "InternalError.ErrorUnknown"
INTERNALERROR_REQUESTFAILED = "InternalError.RequestFailed"
INVALIDPARAMETER = "InvalidParameter"
INVALIDPARAMETER_MISSINGPARAMETER = "InvalidParameter.MissingParameter"
LIMITEXCEEDED = "LimitExceeded"
LIMITEXCEEDED_LIMITEDACCESSFREQUENCY = "LimitExceeded.LimitedAccessFrequency"
MISSINGPARAMETER = "MissingParameter"
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
	// ko: Korean
	// 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), ko (Korean), 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), ko (Korean), 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> en (English): zh (Simplified Chinese), ja (Japanese), ko (Korean), 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), and hi (Hindi)</li>
	// <li>ja (Japanese): zh (Simplified Chinese), en (English), and ko (Korean)</li>
	// <li>ko (Korean): zh (Simplified Chinese), en (English), and ja (Japanese)</li>
	// <li>fr (French): zh (Simplified Chinese), en (English), es (Spanish), it (Italian), de (German), tr (Turkish), ru (Russian), and pt (Portuguese)</li>
	// <li>es (Spanish): zh (Simplified Chinese), en (English), fr (French), it (Italian), de (German), tr (Turkish), ru (Russian), and pt (Portuguese)</li>
	// <li>it (Italian): zh (Simplified Chinese), en (English), fr (French), es (Spanish), de (German), tr (Turkish), ru (Russian), and pt (Portuguese)</li>
	// <li>de (German): zh (Simplified Chinese), en (English), fr (French), es (Spanish), it (Italian), tr (Turkish), ru (Russian), and pt (Portuguese)</li>
	// <li>tr (Turkish): zh (Simplified Chinese), en (English), fr (French), es (Spanish), it (Italian), de (German), ru (Russian), and pt (Portuguese)</li>
	// <li>ru (Russian): zh (Simplified Chinese), en (English), fr (French), es (Spanish), it (Italian), de (German), tr (Turkish), and pt (Portuguese)</li>
	// <li>pt (Portuguese): zh (Simplified Chinese), en (English), fr (French), es (Spanish), it (Italian), de (German), tr (Turkish), and ru (Russian)</li>
	// <li>vi (Vietnamese): zh (Simplified Chinese) and en (English)</li
	// <li>id (Bahasa Indonesian): zh (Simplified Chinese) and en (English)</li
	// <li>th (Thai): zh (Simplified Chinese) and en (English)</li
	// <li>ms (Malay): zh (Simplified Chinese) and en (English)</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"`
}

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
	// ko: Korean
	// 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), ko (Korean), 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), ko (Korean), 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> en (English): zh (Simplified Chinese), ja (Japanese), ko (Korean), 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), and hi (Hindi)</li>
	// <li>ja (Japanese): zh (Simplified Chinese), en (English), and ko (Korean)</li>
	// <li>ko (Korean): zh (Simplified Chinese), en (English), and ja (Japanese)</li>
	// <li>fr (French): zh (Simplified Chinese), en (English), es (Spanish), it (Italian), de (German), tr (Turkish), ru (Russian), and pt (Portuguese)</li>
	// <li>es (Spanish): zh (Simplified Chinese), en (English), fr (French), it (Italian), de (German), tr (Turkish), ru (Russian), and pt (Portuguese)</li>
	// <li>it (Italian): zh (Simplified Chinese), en (English), fr (French), es (Spanish), de (German), tr (Turkish), ru (Russian), and pt (Portuguese)</li>
	// <li>de (German): zh (Simplified Chinese), en (English), fr (French), es (Spanish), it (Italian), tr (Turkish), ru (Russian), and pt (Portuguese)</li>
	// <li>tr (Turkish): zh (Simplified Chinese), en (English), fr (French), es (Spanish), it (Italian), de (German), ru (Russian), and pt (Portuguese)</li>
	// <li>ru (Russian): zh (Simplified Chinese), en (English), fr (French), es (Spanish), it (Italian), de (German), tr (Turkish), and pt (Portuguese)</li>
	// <li>pt (Portuguese): zh (Simplified Chinese), en (English), fr (French), es (Spanish), it (Italian), de (German), tr (Turkish), and ru (Russian)</li>
	// <li>vi (Vietnamese): zh (Simplified Chinese) and en (English)</li
	// <li>id (Bahasa Indonesian): zh (Simplified Chinese) and en (English)</li
	// <li>th (Thai): zh (Simplified Chinese) and en (English)</li
	// <li>ms (Malay): zh (Simplified Chinese) and en (English)</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"`
}

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, which is returned for each request. RequestId is required for locating a problem.
	RequestId *string `json:"RequestId,omitnil,omitempty" name:"RequestId"`
}

Predefined struct for user

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL