( ctx context.Context)
| 43 | } |
| 44 | |
| 45 | func (repo *Repository) GetWebhooks( |
| 46 | ctx context.Context) (map[types.WebhookID]types.Webhook, error) { |
| 47 | if len(repo.Webhooks) > 0 { |
| 48 | return repo.Webhooks, nil |
| 49 | } |
| 50 | |
| 51 | opt := &github.ListOptions{PerPage: repo.paginationSize} |
| 52 | hooks, err := utils.GetPaginatedResult( |
| 53 | ctx, |
| 54 | repo.backoff, |
| 55 | opt, |
| 56 | func(opts *github.ListOptions) ([]*github.Hook, *github.Response, error) { |
| 57 | return repo.client.Repositories.ListHooks(ctx, |
| 58 | *repo.info.Organization.Login, |
| 59 | *repo.info.Name, |
| 60 | opt, |
| 61 | ) |
| 62 | }, |
| 63 | utils.WebhooksAggregator, |
| 64 | ) |
| 65 | |
| 66 | hookMap := make(map[types.WebhookID]types.Webhook, len(hooks)) |
| 67 | for _, h := range hooks { |
| 68 | hookMap[types.WebhookID(*h.ID)] = h |
| 69 | } |
| 70 | repo.Webhooks = hookMap |
| 71 | return hookMap, err |
| 72 | } |
| 73 | |
| 74 | func (repo *Repository) GetWorkflows( |
| 75 | ctx context.Context) (map[types.WorkflowID]types.Workflow, error) { |
nothing calls this directly
no test coverage detected