summaryrefslogtreecommitdiff
path: root/yggdrasil/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'yggdrasil/server.go')
-rw-r--r--yggdrasil/server.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/yggdrasil/server.go b/yggdrasil/server.go
new file mode 100644
index 0000000..818f3ed
--- /dev/null
+++ b/yggdrasil/server.go
@@ -0,0 +1,26 @@
+package yggdrasil
+
+type Server interface {
+ // HasJoined returns nil if and only if err != nil
+ HasJoined(username string, serverID string) (*HasJoinedResponse, error)
+ // Name returns a human-readable, unique name of this server
+ Name() string
+}
+
+type HasJoinedResponse struct {
+ StatusCode int `json:"-"`
+ RawBody []byte `json:"-"`
+ ServerName string `json:"-"`
+
+ ID string `json:"id"`
+ Name string `json:"name"`
+ Properties []struct {
+ Name string `json:"name"`
+ Value string `json:"value"`
+ Signature string `json:"signature,omitempty"`
+ } `json:"properties"`
+}
+
+func (r HasJoinedResponse) HasJoined() bool {
+ return r.StatusCode == 200 && r.ID != "" && r.Name != ""
+}