Skip to content

feat(client): query support on put and del, plus shared helpers - #14

Merged
imjohnbo merged 1 commit into
mainfrom
catchup/01-client
Aug 20, 2026
Merged

feat(client): query support on put and del, plus shared helpers#14
imjohnbo merged 1 commit into
mainfrom
catchup/01-client

Conversation

@imjohnbo

@imjohnbo imjohnbo commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Base of an 8-part stack that closes the 10 open api-spec-change issues.

What this changes

This branch prepares the client layer. It adds three things.

  1. put() and del() accept a query object. DELETE /v4/tags/{tag_id}/subscribers identifies the subscriber with an email_address query parameter. DELETE therefore needs query support.
  2. parseIdList() and parseCsvList() parse comma-separated flags. Several later branches add commands that take ID lists and weekday lists.
  3. printWarnings() prints the warnings array that the API returns on subscriber create and update. It writes to stderr, so --format json output stays parseable.

Test harness

scripts/helpers.js adds a test harness. It drives a real commander tree with fetch mocked. 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.js is not a test file. npm test globs scripts/*.test.js only.

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.

PR Contents
1 #14 (this one) Client query support and shared helpers
2 #15 Sequence CRUD and sequence emails
3 #16 Posts and snippets
4 #17 Broadcast filters, account-wide stats, link clicks
5 #18 Subscriber slim listing, warnings, filter
6 #19 Tag rename, remove-by-email, bulk delete
7 #20 Account endpoints and purchase create
8 #21 Spec coverage map and its tests

Base branch: main for part 1, the previous part's branch for the rest.
GitHub retargets each base to main as the part below it merges.

… 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant