forked from ligadous/wtf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wtf.go
30 lines (25 loc) · 740 Bytes
/
wtf.go
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
27
28
29
30
package wtf
import (
"time"
)
// DialID represents a dial identifier.
type DialID string
// Dial represents an adjustable WTF level associated with a user.
// A user-defined token is used to loosely authenticate update requests.
type Dial struct {
ID DialID `json:"dialID"`
Token string `json:"-"`
Name string `json:"name,omitempty"`
Level float64 `json:"level"`
ModTime time.Time `json:"modTime"`
}
// Client creates a connection to the services.
type Client interface {
DialService() DialService
}
// DialService represents a service for managing dials.
type DialService interface {
Dial(id DialID) (*Dial, error)
CreateDial(dial *Dial) error
SetLevel(id DialID, token string, level float64) error
}