-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtypes.go
More file actions
81 lines (66 loc) · 1.67 KB
/
types.go
File metadata and controls
81 lines (66 loc) · 1.67 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package main
import (
"sync"
"time"
)
// global structure defintions
// Holding more contextual information
// associated with a timer, specifically
// for extentions in timer
type TimerMapValue struct {
timer *time.Timer
duration time.Duration
initTime time.Time
}
type TimerMap struct {
sync.Mutex
// This is the actual map that contains the list of timer objects
TimerMap map[string]TimerMapValue
// cancelList []string
}
// Input event type
type RegisterEvent struct {
EventID string `json:"event_id"`
TimeoutSecs int `json:"timeout_seconds"`
Emit string `json:"emit"`
}
type RegisterResponse struct {
Message string `json:"message"`
}
// Input event type
type TimeoutResponse struct {
EventID string `json:"event_id"`
Message string `json:"message"`
}
// This is the response that's sent to the webhook
type TimeoutMessage struct {
EventID string `json:"event_id"`
Message string `json:"message"`
TimeInitiated string `json:"time_initiated"`
}
// Input cancel event struct
type CancelEvent struct {
EventID string `json:"event_id"`
}
type CancelResponse struct {
EventID string `json:"event_id"`
Message string `json:"message"`
}
type RemainingEvent struct {
EventID string `json:"event_id"`
}
type RemainingResponse struct {
EventID string `json:"event_id"`
TimeRemaining string `json:"time_remaining"`
Message string `json:"message"`
}
type ExtendEvent struct {
EventID string `json:"event_id"`
TimeoutSecs int `json:"timeout_seconds"`
}
type ExtendResponse struct {
EventID string `json:"event_id"`
Message string `json:"message"`
}
// global constants
const MaxTimeout = time.Duration(60*120) * time.Second