aboutsummaryrefslogtreecommitdiff
path: root/widget/api/hello.go
diff options
context:
space:
mode:
Diffstat (limited to 'widget/api/hello.go')
-rw-r--r--widget/api/hello.go25
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
+}