feat(subscribers): slim listing, API warnings, and filter - #18
Merged
Conversation
…lter Three spec changes. Slim listing (issue #9): kit subscribers list --slim Request body changes (issue #8). The API now documents that custom field keys are the field key, not the label, and that unknown keys are ignored and reported in a warnings array. Create and update print those warnings, so a typo in --fields no longer passes silently. The --state help text now lists all five states the API accepts, and the CLI validates it. The list filter separately accepts all, which is not a real state. Filter (issue #13): kit subscribers filter --json '[{"type":"subscriber_state","states":["active"]}]' kit subscribers filter --file conditions.json --include tags,stats The filter body is too nested for one flag per condition, so it comes from a file or an inline string. A bare conditions array is wrapped in the all object the API wants. --counting-mode, --include, and the stats date range get their own flags. Two related fixes: - subscribers create and update now take --format, like the rest of the CLI. - printSuccess stays quiet under --format json, so piping into a JSON parser works. Call sites that pass no options behave as before.
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.
Part 5 of 8. Base: #17.
What this adds
Slim listing:
Filter:
Request body changes
The API now documents two things about
POST /v4/subscribersandPUT /v4/subscribers/{id}.key, not the label. Uselast_name, notLast Name.warningsarray.Create and update now print those warnings. A typo in
--fieldsno longer passes silently. The--statehelp text lists all five states that the API accepts, and the CLI validates the value. The list filter separately acceptsall, which is not a real state.Design notes
The filter body nests too deeply for one flag per condition. It therefore comes from a file or an inline string. The CLI wraps a bare conditions array in the
allobject that the API wants.--counting-mode,--include, and the stats date range get their own flags.Two related fixes ride along:
subscribers createandsubscribers updatenow take--format, like the rest of the CLI.printSuccessstays quiet under--format json. Piping intojqnow works. Call sites that pass no options behave as before.Open question for the reviewer
The spec declares no query parameters on
POST /v4/subscribers/filter. Its response returns pagination cursors. This branch therefore sendsper_page,after, andbeforeas query parameters. If Kit expects them in the body, the fix is one line insrc/commands/subscribers.js.Review notes
Tests: 264 before, 306 after.
Closes #8
Closes #9
Closes #13
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.