go-github
go-github copied to clipboard
HookDelivery is missing the throttled_at field returned by the API
The hook-delivery and hook-delivery-item schemas in GitHub's OpenAPI description include throttled_at (string, date-time, nullable — "Time when the webhook delivery was throttled."). The live API returns it: listing deliveries for a webhook on my fork after a real push event gives a body containing "throttled_at": null alongside the other fields.
HookDelivery in github/repos_hooks_deliveries.go does not declare the field, so it is dropped on decode. Verified on master (v91) through the public API path:
client, _ := NewClient(WithAuthToken(token))
// raw body via the same client: throttled_at is present
req, _ := client.NewRequest(ctx, "GET", "repos/OWNER/REPO/hooks/HOOK_ID/deliveries?per_page=1", nil)
var raw []map[string]any
client.Do(req, &raw)
_, ok := raw[0]["throttled_at"] // true
// typed path: throttled_at is gone
ds, _, _ := client.Repositories.ListHookDeliveries(ctx, "OWNER", "REPO", HOOK_ID, &ListCursorOptions{PerPage: 1})
b, _ := json.Marshal(ds[0])
// {"id":...,"guid":...,"delivered_at":...,"redelivery":false,"duration":0,"status":...,"status_code":502,"event":"push","repository_id":...}
Same pattern as #4503. I'd like to add ThrottledAt *Timestamp to HookDelivery and cover it in the existing tests. PR to follow.