-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.go
57 lines (44 loc) · 932 Bytes
/
main.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
49
50
51
52
53
54
55
56
57
package main
import (
"log"
"os"
"os/signal"
"time"
ss "github.com/carpenterscode/superscribe"
"github.com/carpenterscode/superscribe/listener"
"github.com/carpenterscode/superscribe/receipt"
)
func fetch(receipt string) (ss.Subscription, error) {
log.Println("receipt", receipt)
return nil, nil
}
func match(now time.Time) []string {
results := []string{"1234567890", "2345678901"}
log.Println("Match()", now, results)
return results
}
type updater struct{}
func (u updater) UpdateWithNotification(note ss.Note) error {
return nil
}
func (u updater) UpdateWithReceipt(r receipt.Info) error {
return nil
}
func main() {
srv := ss.NewServer(
":8080",
"password",
match,
fetch,
updater{},
time.Second,
)
srv.AddListener(listener.AppsFlyer{})
srv.AddListener(listener.Stub{})
quit := make(chan os.Signal, 1)
signal.Notify(quit, os.Interrupt)
srv.Start()
<-quit
srv.Stop()
close(quit)
}