MCPcopy Index your code
hub / github.com/git-bug/git-bug / LabelEvents

Function LabelEvents

bridge/gitlab/gitlab_api.go:80–110  ·  view source on GitHub ↗

LabelEvents returns a channel with label events.

(ctx context.Context, client *gitlab.Client, issue *gitlab.Issue)

Source from the content-addressed store, hash-verified

78
79// LabelEvents returns a channel with label events.
80func LabelEvents(ctx context.Context, client *gitlab.Client, issue *gitlab.Issue) <-chan Event {
81 out := make(chan Event)
82
83 go func() {
84 defer close(out)
85
86 opts := gitlab.ListLabelEventsOptions{}
87
88 for {
89 events, resp, err := client.ResourceLabelEvents.ListIssueLabelEvents(issue.ProjectID, issue.IID, &opts, gitlab.WithContext(ctx))
90
91 if err != nil {
92 out <- ErrorEvent{Err: err, Time: time.Now()}
93 }
94
95 for _, e := range events {
96 le := LabelEvent{*e}
97 le.Label.Name = text.CleanupOneLine(le.Label.Name)
98 out <- le
99 }
100
101 if resp.CurrentPage >= resp.TotalPages {
102 break
103 }
104
105 opts.Page = resp.NextPage
106 }
107 }()
108
109 return out
110}
111
112// StateEvents returns a channel with state change events.
113func StateEvents(ctx context.Context, client *gitlab.Client, issue *gitlab.Issue) <-chan Event {

Callers 1

ImportAllMethod · 0.85

Calls 2

CleanupOneLineFunction · 0.92
closeFunction · 0.85

Tested by

no test coverage detected