diff options
| author | Anhgelus Morhtuuzh <william@herges.fr> | 2025-09-22 22:43:44 +0200 |
|---|---|---|
| committer | Anhgelus Morhtuuzh <william@herges.fr> | 2025-09-22 22:43:44 +0200 |
| commit | b19108ed8d4ad56e7bbf1ec59d0470e118275a49 (patch) | |
| tree | 630995aadb2a02bfc3e7a4af3c67c7ac5d786aa2 /widget/api/hello.go | |
| parent | 433bd54a8b319377166ae3247d705684572cc2a4 (diff) | |
feat(widget): api to handle easily hello
Diffstat (limited to 'widget/api/hello.go')
| -rw-r--r-- | widget/api/hello.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/widget/api/hello.go b/widget/api/hello.go new file mode 100644 index 0000000..7995a36 --- /dev/null +++ b/widget/api/hello.go @@ -0,0 +1,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 +} |
