aboutsummaryrefslogtreecommitdiff
path: root/widget/api/hello.go
blob: 7995a36f1f7f8b1f0f7efcd201469e3b50a83e27 (plain)
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
package api

import (
	"encoding/json"
	"io"
)

type Method string

const MethodHello Method = "hello"

type Hello struct {
	Name    string `json:"name"`
	ID      string `json:"id"`
	Version uint   `json:"version"`
}

func (h *Hello) Respond(w io.Writer) error {
	b, err := json.Marshal(h)
	if err != nil {
		return err
	}
	_, err = w.Write(b)
	return err
}