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
14 NewStar(ctx context.Context, star *models.Star)
15 DeleteStar(ctx context.Context, star *models.Star)
16
17 NewIssue(ctx context.Context, issue *models.Issue, mentions []syntax.DID)
18 NewIssueComment(ctx context.Context, comment *models.IssueComment, mentions []syntax.DID)
19 NewIssueState(ctx context.Context, actor syntax.DID, issue *models.Issue)
20 DeleteIssue(ctx context.Context, issue *models.Issue)
21
22 NewFollow(ctx context.Context, follow *models.Follow)
23 DeleteFollow(ctx context.Context, follow *models.Follow)
24
25 NewPull(ctx context.Context, pull *models.Pull)
26 NewPullComment(ctx context.Context, comment *models.PullComment, mentions []syntax.DID)
27 NewPullState(ctx context.Context, actor syntax.DID, pull *models.Pull)
28
29 NewIssueLabelOp(ctx context.Context, issue *models.Issue)
30 NewPullLabelOp(ctx context.Context, pull *models.Pull)
31
32 UpdateProfile(ctx context.Context, profile *models.Profile)
33
34 NewString(ctx context.Context, s *models.String)
35 EditString(ctx context.Context, s *models.String)
36 DeleteString(ctx context.Context, did, rkey string)
37
38 Push(ctx context.Context, repo *models.Repo, ref, oldSha, newSha, committerDid string)
39
40 Clone(ctx context.Context, repo *models.Repo)
41}
42
43// BaseNotifier is a listener that does nothing
44type BaseNotifier struct{}
45
46var _ Notifier = &BaseNotifier{}
47
48func (m *BaseNotifier) NewRepo(ctx context.Context, repo *models.Repo) {}
49func (m *BaseNotifier) DeleteRepo(ctx context.Context, repo *models.Repo) {}
50
51func (m *BaseNotifier) NewStar(ctx context.Context, star *models.Star) {}
52func (m *BaseNotifier) DeleteStar(ctx context.Context, star *models.Star) {}
53
54func (m *BaseNotifier) NewIssue(ctx context.Context, issue *models.Issue, mentions []syntax.DID) {}
55func (m *BaseNotifier) NewIssueComment(ctx context.Context, comment *models.IssueComment, mentions []syntax.DID) {
56}
57func (m *BaseNotifier) NewIssueState(ctx context.Context, actor syntax.DID, issue *models.Issue) {}
58func (m *BaseNotifier) DeleteIssue(ctx context.Context, issue *models.Issue) {}
59
60func (m *BaseNotifier) NewIssueLabelOp(ctx context.Context, issue *models.Issue) {}
61func (m *BaseNotifier) NewPullLabelOp(ctx context.Context, pull *models.Pull) {}
62
63func (m *BaseNotifier) NewFollow(ctx context.Context, follow *models.Follow) {}
64func (m *BaseNotifier) DeleteFollow(ctx context.Context, follow *models.Follow) {}
65
66func (m *BaseNotifier) NewPull(ctx context.Context, pull *models.Pull) {}
67func (m *BaseNotifier) NewPullComment(ctx context.Context, models *models.PullComment, mentions []syntax.DID) {
68}
69func (m *BaseNotifier) NewPullState(ctx context.Context, actor syntax.DID, pull *models.Pull) {}
70
71func (m *BaseNotifier) UpdateProfile(ctx context.Context, profile *models.Profile) {}
72
73func (m *BaseNotifier) NewString(ctx context.Context, s *models.String) {}
74func (m *BaseNotifier) EditString(ctx context.Context, s *models.String) {}
75func (m *BaseNotifier) DeleteString(ctx context.Context, did, rkey string) {}
76
77func (m *BaseNotifier) Push(ctx context.Context, repo *models.Repo, ref, oldSha, newSha, committerDid string) {
78}
79
80func (m *BaseNotifier) Clone(ctx context.Context, repo *models.Repo) {}