feat(client): query support on put and del, plus shared helpers - #14
Merged
Conversation
… warning helpers
Groundwork for the API spec catch-up. Three additions:
- put() and del() now accept a query object. DELETE /v4/tags/{tag_id}/subscribers
identifies the subscriber with an email_address query parameter, so DELETE
needs it.
- parseIdList() and parseCsvList() parse comma-separated CLI flags. Several new
commands take ID lists and day lists.
- printWarnings() prints the warnings array the API returns on subscriber create
and update. It writes to stderr so --format json output stays parseable.
Also adds scripts/helpers.js, a test harness that drives a real commander tree
with fetch mocked. Tests can now assert on the request the CLI would send.
This was referenced Aug 20, 2026
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.
Base of an 8-part stack that closes the 10 open
api-spec-changeissues.What this changes
This branch prepares the client layer. It adds three things.
put()anddel()accept a query object.DELETE /v4/tags/{tag_id}/subscribersidentifies the subscriber with anemail_addressquery parameter.DELETEtherefore needs query support.parseIdList()andparseCsvList()parse comma-separated flags. Several later branches add commands that take ID lists and weekday lists.printWarnings()prints thewarningsarray that the API returns on subscriber create and update. It writes to stderr, so--format jsonoutput stays parseable.Test harness
scripts/helpers.jsadds a test harness. It drives a real commander tree withfetchmocked. A test can now assert on the request that the CLI sends, including the method, the path, the query, and the body. Every later branch in this stack uses it.scripts/helpers.jsis not a test file.npm testglobsscripts/*.test.jsonly.Review notes
No user-facing command changes here. The 22 new tests cover the parse helpers, the query support, and the warning output.
Tests: 125 before, 147 after.
The stack
Merge from the top down. Each part builds on the one above it.
Base branch:
mainfor part 1, the previous part's branch for the rest.GitHub retargets each base to
mainas the part below it merges.