Add webhook and v2 device API methods#15
Open
jcoetsie wants to merge 1 commit into
Open
Conversation
Add create_webhook, get_webhooks, delete_webhook, and get_devices_v2 methods to BoldSmartLock class to support webhook-based event notifications for lock/unlock events. Adds WEBHOOK_SERVICE and DEVICE_SERVICE_V2 constants for the v2 API endpoints. Relates to lwestenberg/homeassistant_bold#9 Co-Authored-By: Claude Opus 4.6 (1M context) <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
create_webhook(),get_webhooks(), anddelete_webhook()methods toBoldSmartLockclass for managing Bold API webhooks (v2 endpoints)get_devices_v2()method to retrieve device data from the v2 API, which includesowner.organizationIdneeded for webhook creationWEBHOOK_SERVICEandDEVICE_SERVICE_V2constantsContext
This is the library-side change needed to support webhook-based event notifications (lock/unlock events with user info) in the Home Assistant integration. The companion PR for the HA integration is in lwestenberg/homeassistant_bold.
Relates to lwestenberg/homeassistant_bold#9
API endpoints used
POST /v2/webhooks- create webhook (organizationId, deviceIds, topics, webhookUrl, secretHttp)GET /v2/webhooks?organizationId={id}- list webhooksDELETE /v2/webhooks/{webhook-id}- delete webhookGET /v2/devices- list devices (v2, includes organizationId)Test plan
get_devices_v2()returns device data withowner.organizationIdcreate_webhook()successfully creates a webhook via the Bold APIget_webhooks()lists existing webhooks for an organizationdelete_webhook()removes a webhook by ID🤖 Generated with Claude Code