Commit c81b480
feat(webhooks): type get_webhook_sample_payload return as TypedDict union
Parity with `tango-node`'s `WebhookSamplePayloadResponse` discriminated union.
The endpoint can return one of two response shapes depending on whether
`event_type` is supplied:
- Single-event: `{event_type, sample_delivery, signature_header, note}`
- All-events: `{samples, usage, signature_header, note}`
Added `WebhookSampleDelivery`, `WebhookSamplePayloadSingleResponse`,
`WebhookSamplePayloadAllResponse`, and the union alias
`WebhookSamplePayloadResponse` as TypedDict classes (structural, no runtime
conversion). Exported from the top-level `tango` package and used as the
return annotation on `client.get_webhook_sample_payload()`. No behavior
change — just better static typing.
Verified against the live API:
- single (`alerts.contract.match`): returns 4 keys matching the Single shape
- all: returns 4 keys matching the All shape
All 285 unit tests still pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 6cb9b91 commit c81b480
3 files changed
Lines changed: 41 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
65 | 73 | | |
66 | 74 | | |
67 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
2592 | 2593 | | |
2593 | 2594 | | |
2594 | 2595 | | |
2595 | | - | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
2596 | 2599 | | |
2597 | 2600 | | |
2598 | 2601 | | |
2599 | | - | |
2600 | | - | |
| 2602 | + | |
| 2603 | + | |
| 2604 | + | |
2601 | 2605 | | |
2602 | 2606 | | |
2603 | 2607 | | |
2604 | 2608 | | |
2605 | | - | |
| 2609 | + | |
2606 | 2610 | | |
2607 | 2611 | | |
2608 | 2612 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
580 | 580 | | |
581 | 581 | | |
582 | 582 | | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
583 | 607 | | |
584 | 608 | | |
585 | 609 | | |
| |||
0 commit comments