Webhooks returns a paginated list of webhooks. Requires super-admin auth. Logic migrated from internal/graphql/webhooks.go.
(ctx context.Context, meta RequestMetadata, params *model.PaginatedRequest)
| 238 | // Webhooks returns a paginated list of webhooks. Requires super-admin auth. |
| 239 | // Logic migrated from internal/graphql/webhooks.go. |
| 240 | func (p *provider) Webhooks(ctx context.Context, meta RequestMetadata, params *model.PaginatedRequest) (*model.Webhooks, *ResponseSideEffects, error) { |
| 241 | log := p.Log.With().Str("func", "Webhooks").Logger() |
| 242 | if err := p.requireSuperAdmin(ctx, meta); err != nil { |
| 243 | return nil, nil, err |
| 244 | } |
| 245 | |
| 246 | pagination := utils.GetPagination(params) |
| 247 | webhooks, pagination, err := p.StorageProvider.ListWebhook(ctx, pagination) |
| 248 | if err != nil { |
| 249 | log.Debug().Err(err).Msg("failed ListWebhook") |
| 250 | return nil, nil, err |
| 251 | } |
| 252 | res := make([]*model.Webhook, len(webhooks)) |
| 253 | for i, webhook := range webhooks { |
| 254 | res[i] = webhook.AsAPIWebhook() |
| 255 | } |
| 256 | return &model.Webhooks{ |
| 257 | Pagination: pagination, |
| 258 | Webhooks: res, |
| 259 | }, nil, nil |
| 260 | } |
| 261 | |
| 262 | // WebhookLogs returns a paginated list of webhook delivery logs, optionally |
| 263 | // filtered by webhook id. Requires super-admin auth. Logic migrated from |
nothing calls this directly
no test coverage detected