Monorepo for Tangled
tangled.org
1package notify
2
3import (
4 "context"
5
6 "github.com/bluesky-social/indigo/atproto/syntax"
7 "tangled.org/core/appview/models"
8)
9
10type Notifier interface {
11 NewRepo(ctx context.Context, repo *models.Repo)
12 DeleteRepo(ctx context.Context, repo *models.Repo)
13 RenameRepo(ctx context.Context, actor syntax.DID, oldRepo, newRepo *models.Repo)
14
15 NewStar(ctx context.Context, star *models.Star)
16 DeleteStar(ctx context.Context, star *models.Star)
17
18 NewComment(ctx context.Context, comment *models.Comment, mentions []syntax.DID)
19 DeleteComment(ctx context.Context, comment *models.Comment)
20
21 NewIssue(ctx context.Context, issue *models.Issue, mentions []syntax.DID)
22 NewIssueState(ctx context.Context, actor syntax.DID, issue *models.Issue)
23 DeleteIssue(ctx context.Context, issue *models.Issue)
24
25 NewFollow(ctx context.Context, follow *models.Follow)
26 DeleteFollow(ctx context.Context, follow *models.Follow)
27
28 NewPull(ctx context.Context, pull *models.Pull)
29 NewPullState(ctx context.Context, actor syntax.DID, pull *models.Pull)
30
31 NewIssueLabelOp(ctx context.Context, actor syntax.DID, issue *models.Issue, ops []models.LabelOp)
32 NewPullLabelOp(ctx context.Context, actor syntax.DID, pull *models.Pull, ops []models.LabelOp)
33
34 UpdateProfile(ctx context.Context, profile *models.Profile)
35
36 NewString(ctx context.Context, s *models.String)
37 EditString(ctx context.Context, s *models.String)
38 DeleteString(ctx context.Context, did, rkey string)
39
40 Push(ctx context.Context, repo *models.Repo, ref, oldSha, newSha, committerDid string)
41
42 Clone(ctx context.Context, repo *models.Repo)
43}
44
45// BaseNotifier is a listener that does nothing
46type BaseNotifier struct{}
47
48var _ Notifier = &BaseNotifier{}
49
50func (m *BaseNotifier) NewRepo(ctx context.Context, repo *models.Repo) {}
51func (m *BaseNotifier) DeleteRepo(ctx context.Context, repo *models.Repo) {}
52func (m *BaseNotifier) RenameRepo(ctx context.Context, actor syntax.DID, oldRepo, newRepo *models.Repo) {
53}
54
55func (m *BaseNotifier) NewStar(ctx context.Context, star *models.Star) {}
56func (m *BaseNotifier) DeleteStar(ctx context.Context, star *models.Star) {}
57
58func (m *BaseNotifier) NewComment(ctx context.Context, comment *models.Comment, mentions []syntax.DID) {
59}
60func (m *BaseNotifier) DeleteComment(ctx context.Context, comment *models.Comment) {}
61
62func (m *BaseNotifier) NewIssue(ctx context.Context, issue *models.Issue, mentions []syntax.DID) {}
63func (m *BaseNotifier) NewIssueState(ctx context.Context, actor syntax.DID, issue *models.Issue) {}
64func (m *BaseNotifier) DeleteIssue(ctx context.Context, issue *models.Issue) {}
65
66func (m *BaseNotifier) NewIssueLabelOp(ctx context.Context, actor syntax.DID, issue *models.Issue, ops []models.LabelOp) {
67}
68func (m *BaseNotifier) NewPullLabelOp(ctx context.Context, actor syntax.DID, pull *models.Pull, ops []models.LabelOp) {
69}
70
71func (m *BaseNotifier) NewFollow(ctx context.Context, follow *models.Follow) {}
72func (m *BaseNotifier) DeleteFollow(ctx context.Context, follow *models.Follow) {}
73
74func (m *BaseNotifier) NewPull(ctx context.Context, pull *models.Pull) {}
75func (m *BaseNotifier) NewPullState(ctx context.Context, actor syntax.DID, pull *models.Pull) {}
76
77func (m *BaseNotifier) UpdateProfile(ctx context.Context, profile *models.Profile) {}
78
79func (m *BaseNotifier) NewString(ctx context.Context, s *models.String) {}
80func (m *BaseNotifier) EditString(ctx context.Context, s *models.String) {}
81func (m *BaseNotifier) DeleteString(ctx context.Context, did, rkey string) {}
82
83func (m *BaseNotifier) Push(ctx context.Context, repo *models.Repo, ref, oldSha, newSha, committerDid string) {
84}
85
86func (m *BaseNotifier) Clone(ctx context.Context, repo *models.Repo) {}