blob: 818f3edfb5e1f81d686848ca7118644fc27bb06b (
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
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 != ""
}
|