(wh *identity.Webhook)
| 55 | } |
| 56 | |
| 57 | func webhookView(wh *identity.Webhook) WebhookView { |
| 58 | v := WebhookView{ |
| 59 | ID: wh.ID, |
| 60 | URL: wh.URL, |
| 61 | Description: wh.Description, |
| 62 | Events: orEmptyStrings(wh.Events), |
| 63 | Filters: WebhookFiltersView{ |
| 64 | AgentIDs: wh.Filters.AgentIDs, |
| 65 | ConversationIDs: wh.Filters.ConversationIDs, |
| 66 | Labels: wh.Filters.Labels, |
| 67 | }, |
| 68 | Enabled: wh.Enabled, |
| 69 | CreatedAt: wh.CreatedAt.UTC().Format(time.RFC3339), |
| 70 | } |
| 71 | if wh.AutoDisabledAt != nil { |
| 72 | v.AutoDisabledAt = wh.AutoDisabledAt.UTC().Format(time.RFC3339) |
| 73 | } |
| 74 | if wh.LastDeliveredAt != nil { |
| 75 | v.LastDeliveredAt = wh.LastDeliveredAt.UTC().Format(time.RFC3339) |
| 76 | } |
| 77 | return v |
| 78 | } |
| 79 | |
| 80 | // validateWebhookFields replicates the legacy validation. The two |
| 81 | // security-critical checks are reused from their canonical homes (SSRF via |
no test coverage detected