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