MCPcopy Create free account
hub / github.com/authorizerdev/authorizer / WebhookLogs

Method WebhookLogs

internal/service/admin_webhooks.go:265–296  ·  view source on GitHub ↗

WebhookLogs returns a paginated list of webhook delivery logs, optionally filtered by webhook id. Requires super-admin auth. Logic migrated from internal/graphql/webhook_logs.go.

(ctx context.Context, meta RequestMetadata, params *model.ListWebhookLogRequest)

Source from the content-addressed store, hash-verified

263// filtered by webhook id. Requires super-admin auth. Logic migrated from
264// internal/graphql/webhook_logs.go.
265func (p *provider) WebhookLogs(ctx context.Context, meta RequestMetadata, params *model.ListWebhookLogRequest) (*model.WebhookLogs, *ResponseSideEffects, error) {
266 log := p.Log.With().Str("func", "WebhookLogs").Logger()
267 if err := p.requireSuperAdmin(ctx, meta); err != nil {
268 return nil, nil, err
269 }
270
271 var pagination *model.Pagination
272 var webhookID string
273 if params != nil {
274 pagination = utils.GetPagination(&model.PaginatedRequest{
275 Pagination: params.Pagination,
276 })
277 webhookID = refs.StringValue(params.WebhookID)
278 } else {
279 pagination = utils.GetPagination(nil)
280 webhookID = ""
281 }
282
283 webhookLogs, pagination, err := p.StorageProvider.ListWebhookLogs(ctx, pagination, webhookID)
284 if err != nil {
285 log.Debug().Err(err).Msg("failed ListWebhookLogs")
286 return nil, nil, err
287 }
288 resItems := make([]*model.WebhookLog, len(webhookLogs))
289 for i, webhookLog := range webhookLogs {
290 resItems[i] = webhookLog.AsAPIWebhookLog()
291 }
292 return &model.WebhookLogs{
293 Pagination: pagination,
294 WebhookLogs: resItems,
295 }, nil, nil
296}
297
298// TestEndpoint sends a synthetic event payload to a webhook endpoint and returns
299// the resulting HTTP status and response body. Requires super-admin auth. Logic

Callers

nothing calls this directly

Calls 5

requireSuperAdminMethod · 0.95
GetPaginationFunction · 0.92
StringValueFunction · 0.92
AsAPIWebhookLogMethod · 0.80
ListWebhookLogsMethod · 0.65

Tested by

no test coverage detected