service

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeeplRequestResponse

type DeeplRequestResponse struct {
	Translations []DeeplRequestResponseTranslation
}

type DeeplRequestResponseTranslation

type DeeplRequestResponseTranslation struct {
	DetectedSourceLanguage string `json:"detected_source_language"`
	Text                   string `json:"text"`
}

type DeeplRequestUsage

type DeeplRequestUsage struct {
	CharacterCount int64 `json:"character_count"`
	CharacterLimit int64 `json:"character_limit"`
}

type T2Config

type T2Config struct {
	SourceLang string
	PivotLang  string
}

type T2Service

type T2Service struct {
	// contains filtered or unexported fields
}

func NewT2

func NewT2(config T2Config, tr Translation) T2Service

func (T2Service) TraductionTranslation

func (t2 T2Service) TraductionTranslation(t string) error

type Translation

type Translation interface {
	Translate(text string, source string, target string) (TranslationResponse, error)
	Usage() (UsageResponse, error)
}

type TranslationDeepl

type TranslationDeepl struct {
	Endpoint string
	ApiKey   string
}

func (TranslationDeepl) Translate

func (d TranslationDeepl) Translate(text string, source string, target string) (TranslationResponse, error)

func (TranslationDeepl) Usage

func (d TranslationDeepl) Usage() (UsageResponse, error)

type TranslationResponse

type TranslationResponse struct {
	Text string
}

type UsageResponse

type UsageResponse struct {
	Used  int64
	Limit int64
}

Jump to

Keyboard shortcuts

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