Issues returns a channel with gitlab project issues, ascending order.
(ctx context.Context, client *gitlab.Client, pid string, since time.Time)
| 10 | |
| 11 | // Issues returns a channel with gitlab project issues, ascending order. |
| 12 | func Issues(ctx context.Context, client *gitlab.Client, pid string, since time.Time) <-chan *gitlab.Issue { |
| 13 | out := make(chan *gitlab.Issue) |
| 14 | |
| 15 | go func() { |
| 16 | defer close(out) |
| 17 | |
| 18 | opts := gitlab.ListProjectIssuesOptions{ |
| 19 | UpdatedAfter: &since, |
| 20 | Scope: gitlab.String("all"), |
| 21 | Sort: gitlab.String("asc"), |
| 22 | } |
| 23 | |
| 24 | for { |
| 25 | issues, resp, err := client.Issues.ListProjectIssues(pid, &opts, gitlab.WithContext(ctx)) |
| 26 | if err != nil { |
| 27 | return |
| 28 | } |
| 29 | |
| 30 | for _, issue := range issues { |
| 31 | out <- issue |
| 32 | } |
| 33 | |
| 34 | if resp.CurrentPage >= resp.TotalPages { |
| 35 | break |
| 36 | } |
| 37 | |
| 38 | opts.Page = resp.NextPage |
| 39 | } |
| 40 | }() |
| 41 | |
| 42 | return out |
| 43 | } |
| 44 | |
| 45 | // Notes returns a channel with note events |
| 46 | func Notes(ctx context.Context, client *gitlab.Client, issue *gitlab.Issue) <-chan Event { |