-
Notifications
You must be signed in to change notification settings - Fork 0
/
structs.go
48 lines (40 loc) · 1.36 KB
/
structs.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main
import (
"time"
"github.com/gofrs/uuid"
)
// Base for all messages published to end-consumers
type Message struct {
Channel string `json:"channel"`
UUID uuid.UUID `json:"uuid"`
}
type PushMessage struct {
Message
Created time.Time `json:"created"`
Payload map[string]interface{} `json:"payload"`
}
// Base for messages sent on the 'system' channel
type SystemMessage struct {
Message
Cmd string `json:"cmd"`
}
// The 'init' system message
type InitResponseMessage struct {
SystemMessage
SubscriberID uuid.UUID `json:"subscriber_id"`
ReconnectToken uuid.UUID `json:"reconnect_token"`
Subscription Subscription `json:"subscription"`
Reconnected bool `json:"reconnected"`
}
type Subscription struct {
ID uuid.UUID `json:"id"` // Read-only, can't be set by the client when creating a subscription
Description string `json:"description,omitempty"` // Optional description of the subscription
Name string `json:"name,omitempty"` // Optional when creating a subscription
Filters []SubscriptionFilter `json:"filters"`
}
type SubscriptionFilter struct {
Channel string `json:"channel,omitempty"`
GameID int `json:"game_id,omitempty"`
SeriesID int `json:"series_id,omitempty"`
MatchID int `json:"match_id,omitempty"`
}