Add webhook update method with isEnabled/statusChangeReason#1806
Add webhook update method with isEnabled/statusChangeReason#1806jacalata wants to merge 3 commits into
Conversation
Fixes #1135 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Tighten test_update_missing_id to assert MissingRequiredFieldError specifically. Add tests for update_req serializing url and event, omitting isEnabled when None, partial (name-only) updates, and correct parsing of isEnabled="false" from XML. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The return-type annotation added in the branch accidentally dropped the docstring that was on test_event_setter_none. Restore it. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Code ReviewClean, well-structured PR. Here are the issues worth addressing before merge: IssuesConvention deviation —
updated = copy.copy(item)
return updated._parse_common_tags(server_response.content, ns)This preserves locally-set fields that the server's partial response omits. Using
Inconsistent
Missing CHANGELOG entry Per repo conventions, user-visible additions get a changelog bullet with the PR number. Minor
|
Summary
Webhooks.update(webhook_item)(REST API v3.6) for modifying an existing webhook's name, event, destination URL, and enabled stateis_enabled(bool) andstatus_change_reason(str) fields toWebhookItem, parsed from theisEnabledandstatusChangeReasonXML attributes returned by the serverRequestFactory.Webhook.update_req()serializes all updatable fields;is_enabledis omitted whenNoneto support partial updates;statusChangeReasonis intentionally not serialized (server-set, read-only)MissingRequiredFieldErrorif the webhook item has no IDwebhook-source-event-*(legacy) andwebhook-event-*(newer) event name prefixes in the event setterCloses #1135
Schema compliance
isEnabledandstatusChangeReasonare both defined onwebhookTypein ts-api_3_29.xsd. Theupdate_req()child element structure (webhook-source,webhook-destination) matches the schema.webhook-event-*style event names are a live API extension not yet reflected in the published XSD; handling them is consistent with the pre-existing behavior increate_req().Test plan
python -m pytest test/test_webhook.py -v-- 22 tests, all passserver.webhooks.update(item)returns updatedWebhookItemwith correct fieldsis_enabled=Falseleaves name/url/event unchanged on serverMissingRequiredFieldErrorraised when item has no IDisEnabledattribute absent from request XML whenis_enabledisNone🤖 Generated with Claude Code