Migrate webhook commands to SDK
Merged
RO
6mo ago+184+184+012345678901234567890123456789-156-156-012345678901234567890123456789
Summary
- Migrates
webhook show|create|update|delete|reactivatefrom the legacy HTTP client (getClient()) to the typedWebhooksServiceon the SDK account client. webhook listuses the typed service for the no-flag case and falls back toac.Get/ac.GetAllfor--pageand--all, since the SDK'sWebhooks().Listdoesn't accept a path. (webhook deliverieswas already on the SDK and is untouched.)- Behavior, flags, and CLI surface are unchanged —
SURFACE.txtdoesn't change. The e2e CRUD test inwebhook_test.gocontinues to drive the same UX.
Notes
- Unit tests switched to the
SetTestModeWithSDKhttptest-backed pattern. - Body assertions updated: SDK posts the typed request directly, so no more
{"webhook": {...}}wrapper. URL assertions forget/update/deletedrop the.jsonsuffix to match the SDK paths (Rails accepts both forms). Createno longer needs a Location follow-up —WebhooksService.Createreturns the fullWebhookdirectly.
Summary by cubic
Migrates webhook CLI commands from the legacy HTTP client to the typed SDK for better type safety with the same CLI behavior. Also fixes list paging when using --all with --page.
-
Refactors
- Switched to SDK
WebhooksServiceforshow,create,update,delete, andreactivate. list: usesWebhooks().Listby default; falls back toac.Get/ac.GetAllfor--page/--all.- Request/response: removed
"webhook"body wrapper; dropped.jsonpaths;Createreturns fullWebhook(no Location follow-up); removed unusedprintSuccessWithLocation. - Tests now use
SetTestModeWithSDK; assertions match new paths/payloads; errors viaconvertSDKError.
- Switched to SDK
-
Bug Fixes
webhook list --all --page Nnow starts from page N when fetching all results; added a unit test to lock this in.