Add webhook update method with isEnabled/statusChangeReason#1806
Open
jacalata wants to merge 3 commits into
Open
Add webhook update method with isEnabled/statusChangeReason#1806jacalata wants to merge 3 commits into
jacalata 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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