Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidArgs = errors.New("invalid argument(s)") ErrRequest = errors.New("an error occurred on creating request") ErrHTTP = errors.New("an error occurred on executing HTTP method") ErrResponse = errors.New("an error occurred on processing response") ErrParse = errors.New("an error occurred on parsing result") )
Functions ¶
func ListSourceLangs ¶
func ListTargetLangs ¶
Types ¶
type Result ¶
type Result struct {
Text string `json:"translation"`
}
func Translate ¶
func Translate(param *TranslateParam) (*Result, error)
type TranslateParam ¶
func NewTranslateParam ¶
func NewTranslateParam(source, target, text, instance string) (*TranslateParam, error)
func (*TranslateParam) ToHTTPRequest ¶
func (param *TranslateParam) ToHTTPRequest() (*http.Request, error)
func (*TranslateParam) ToURL ¶
func (param *TranslateParam) ToURL() *url.URL
type VoiceData ¶
type VoiceData struct {
Audio []byte
}
func FetchVoice ¶
func FetchVoice(param *VoiceParam) (*VoiceData, error)
type VoiceParam ¶
func NewVoiceParam ¶
func NewVoiceParam(lang, text, instance string) (*VoiceParam, error)
func (*VoiceParam) ToHTTPRequest ¶
func (param *VoiceParam) ToHTTPRequest() (*http.Request, error)
func (*VoiceParam) ToURL ¶
func (param *VoiceParam) ToURL() *url.URL
Click to show internal directories.
Click to hide internal directories.