wsstranslator

package
v0.0.0-...-4020383 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//TranslatorSubscriptionKey Azure Translator Subscription env key
	TranslatorSubscriptionKey = "WSS_TRANSLATOR_SUBSCRIPTION_KEY"
	//TranslatorEndpointKey Azure Translator Endpoint env key
	TranslatorEndpointKey = "WSS_TRANSLATOR_ENDPOINT"
	//TranslatorRegionKey Azure Translator Region env key
	TranslatorRegionKey = "WSS_TRANSLATOR_REGION"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	TranslatorRegion       string
	TranslatorSubscription string
	ServiceEnpoint         string
}

Configuration structure for the Translator service configuration

func BuildConfigurationFromEnvs

func BuildConfigurationFromEnvs() (*Configuration, error)

BuildConfigurationFromEnvs builds the configuration from env variables

func (*Configuration) IsValid

func (c *Configuration) IsValid() bool

IsValid Checks if the configuration is valid

type Language

type Language struct {
	Code string
	Name string
}

Language describes a single language

type LanguagesResult

type LanguagesResult struct {
	Languages []Language
}

LanguagesResult result of the LanguagesAPI

type TranslatorResult

type TranslatorResult struct {
	Translation    *string
	IdentifiedLang *string
}

TranslatorResult result of the TranslatorAPI

type TranslatorServiceClient

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

TranslatorServiceClient client for the Azure Translator Service

func NewTranslatorServiceClient

func NewTranslatorServiceClient(conf *Configuration) *TranslatorServiceClient

NewTranslatorServiceClient TranslatorServiceClient constructor

func (*TranslatorServiceClient) InvokeLanguages

func (s *TranslatorServiceClient) InvokeLanguages(LanguagesContext context.Context) (*LanguagesResult, error)

InvokeLanguages invokes the Languages APIs to obtain the list of supported languages

func (*TranslatorServiceClient) InvokeTranslator

func (s *TranslatorServiceClient) InvokeTranslator(translatorContext context.Context, message string, lang *string) (*TranslatorResult, error)

InvokeTranslator invokes the Translator APIs with the provided photo

Jump to

Keyboard shortcuts

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