-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathclient.go
39 lines (34 loc) · 857 Bytes
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"context"
"fmt"
"os"
speech "github.com/viam-labs/speech-service-api/src/speech_service_api_go"
"go.viam.com/rdk/logging"
"go.viam.com/rdk/robot/client"
"go.viam.com/utils/rpc"
)
func main() {
logger := logging.NewDevelopmentLogger("client")
robot, err := client.New(
context.Background(),
os.Getenv("ROBOT_ADDRESS"),
logger,
client.WithDialOptions(
rpc.WithEntityCredentials(
os.Getenv("API_KEY_ID"),
rpc.Credentials{
Type: rpc.CredentialsTypeAPIKey,
Payload: os.Getenv("API_KEY"),
})),
)
if err != nil {
logger.Fatal(err)
}
defer robot.Close(context.Background())
logger.Info("Resources:")
logger.Info(robot.ResourceNames())
sp, err := speech.FromRobot(robot, "speechio")
fmt.Println("err", err)
sp.Say(context.Background(), "Hello there, how is your day going?", true)
}