1package notify
2
3import (
4 "context"
5
6 "tangled.org/core/appview/models"
7)
8
9type Notifier interface {
10 NewRepo(ctx context.Context, repo *models.Repo)
11
12 NewStar(ctx context.Context, star *models.Star)
13 DeleteStar(ctx context.Context, star *models.Star)
14
15 NewIssue(ctx context.Context, issue *models.Issue)
16 NewIssueComment(ctx context.Context, comment *models.IssueComment)
17 NewIssueClosed(ctx context.Context, issue *models.Issue)
18
19 NewFollow(ctx context.Context, follow *models.Follow)
20 DeleteFollow(ctx context.Context, follow *models.Follow)
21
22 NewPull(ctx context.Context, pull *models.Pull)
23 NewPullComment(ctx context.Context, comment *models.PullComment)
24 NewPullMerged(ctx context.Context, pull *models.Pull)
25 NewPullClosed(ctx context.Context, pull *models.Pull)
26
27 UpdateProfile(ctx context.Context, profile *models.Profile)
28
29 NewString(ctx context.Context, s *models.String)
30 EditString(ctx context.Context, s *models.String)
31 DeleteString(ctx context.Context, did, rkey string)
32}
33
34// BaseNotifier is a listener that does nothing
35type BaseNotifier struct{}
36
37var _ Notifier = &BaseNotifier{}
38
39func (m *BaseNotifier) NewRepo(ctx context.Context, repo *models.Repo) {}
40
41func (m *BaseNotifier) NewStar(ctx context.Context, star *models.Star) {}
42func (m *BaseNotifier) DeleteStar(ctx context.Context, star *models.Star) {}
43
44func (m *BaseNotifier) NewIssue(ctx context.Context, issue *models.Issue) {}
45func (m *BaseNotifier) NewIssueComment(ctx context.Context, comment *models.IssueComment) {}
46func (m *BaseNotifier) NewIssueClosed(ctx context.Context, issue *models.Issue) {}
47
48func (m *BaseNotifier) NewFollow(ctx context.Context, follow *models.Follow) {}
49func (m *BaseNotifier) DeleteFollow(ctx context.Context, follow *models.Follow) {}
50
51func (m *BaseNotifier) NewPull(ctx context.Context, pull *models.Pull) {}
52func (m *BaseNotifier) NewPullComment(ctx context.Context, models *models.PullComment) {}
53func (m *BaseNotifier) NewPullMerged(ctx context.Context, pull *models.Pull) {}
54func (m *BaseNotifier) NewPullClosed(ctx context.Context, pull *models.Pull) {}
55
56func (m *BaseNotifier) UpdateProfile(ctx context.Context, profile *models.Profile) {}
57
58func (m *BaseNotifier) NewString(ctx context.Context, s *models.String) {}
59func (m *BaseNotifier) EditString(ctx context.Context, s *models.String) {}
60func (m *BaseNotifier) DeleteString(ctx context.Context, did, rkey string) {}