hwt/hwt.go

26 lines
429 B
Go
Raw Normal View History

2018-01-16 20:57:04 -08:00
package hwt
import (
"context"
fmt "fmt"
"github.com/twitchtv/twirp"
pb "mcquay.me/hwt/rpc/hwt"
2018-01-16 20:57:04 -08:00
)
2018-01-20 09:07:57 -08:00
type Server struct {
Hostname string
}
2018-01-16 20:57:04 -08:00
func (s *Server) Hello(ctx context.Context, req *pb.HelloReq) (*pb.HelloResp, error) {
if req.Subject == "" {
return nil, twirp.RequiredArgumentError("subject")
}
2018-01-20 09:07:57 -08:00
r := &pb.HelloResp{
Text: fmt.Sprintf("echo: %v", req.Subject),
Hostname: s.Hostname,
}
return r, nil
2018-01-16 20:57:04 -08:00
}