rclone/vendor/github.com/aws/aws-sdk-go/service/polly/examples_test.go

157 lines
3.3 KiB
Go

// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package polly_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/polly"
)
var _ time.Duration
var _ bytes.Buffer
func ExamplePolly_DeleteLexicon() {
sess := session.Must(session.NewSession())
svc := polly.New(sess)
params := &polly.DeleteLexiconInput{
Name: aws.String("LexiconName"), // Required
}
resp, err := svc.DeleteLexicon(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExamplePolly_DescribeVoices() {
sess := session.Must(session.NewSession())
svc := polly.New(sess)
params := &polly.DescribeVoicesInput{
LanguageCode: aws.String("LanguageCode"),
NextToken: aws.String("NextToken"),
}
resp, err := svc.DescribeVoices(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExamplePolly_GetLexicon() {
sess := session.Must(session.NewSession())
svc := polly.New(sess)
params := &polly.GetLexiconInput{
Name: aws.String("LexiconName"), // Required
}
resp, err := svc.GetLexicon(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExamplePolly_ListLexicons() {
sess := session.Must(session.NewSession())
svc := polly.New(sess)
params := &polly.ListLexiconsInput{
NextToken: aws.String("NextToken"),
}
resp, err := svc.ListLexicons(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExamplePolly_PutLexicon() {
sess := session.Must(session.NewSession())
svc := polly.New(sess)
params := &polly.PutLexiconInput{
Content: aws.String("LexiconContent"), // Required
Name: aws.String("LexiconName"), // Required
}
resp, err := svc.PutLexicon(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExamplePolly_SynthesizeSpeech() {
sess := session.Must(session.NewSession())
svc := polly.New(sess)
params := &polly.SynthesizeSpeechInput{
OutputFormat: aws.String("OutputFormat"), // Required
Text: aws.String("Text"), // Required
VoiceId: aws.String("VoiceId"), // Required
LexiconNames: []*string{
aws.String("LexiconName"), // Required
// More values...
},
SampleRate: aws.String("SampleRate"),
SpeechMarkTypes: []*string{
aws.String("SpeechMarkType"), // Required
// More values...
},
TextType: aws.String("TextType"),
}
resp, err := svc.SynthesizeSpeech(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}