aboutsummaryrefslogtreecommitdiff
path: root/widget/api/hello.go
blob: fd071d5f0dbd5f3870eab4cbb701e00d5ee6b110 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package api

import (
	"encoding/json"
	"io"
)

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, _ ...string) error {
	b, err := json.Marshal(h)
	if err != nil {
		return err
	}
	_, err = w.Write(b)
	return err
}