Fix draft listing for current Substack API responses - #78
Merged
Merged
Conversation
ma2za
approved these changes
Sep 27, 2026
ma2za
left a comment
Owner
There was a problem hiding this comment.
Reviewed the response normalization and all callers. Returning the posts list preserves the CLI and internal list contract while retaining legacy list responses. Offline tests, the merge result against current main, package builds, and CI across Python 3.10–3.14 pass.
ma2za
added a commit
that referenced
this pull request
Sep 27, 2026
Fix draft listing for current Substack API responses
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.
Api.get_drafts()previously returned the entire response object, while callers expected a list of draft records. This causeddrafts listand other draft-management operations to handle the response incorrectly.This PR extracts the draft records from the
postsfield while preserving compatibility with responses that already return a list.Details
The drafts API response format includes pagination metadata alongside the draft records. Returning the complete dictionary from
Api.get_drafts()breaks consumers that expect to iterate over draft objects.For example, the CLI expects to process each draft with calls such as:
When the response envelope is returned directly, those callers receive the dictionary itself instead of the list under
posts.Implementation
Api.get_drafts()now:postsfield.Test Coverage
Added a regression test that verifies:
posts,hasMore, andnextCursoris handled correctly.Api.get_drafts()returns only the draft records.Documentation
Added an
Unreleasedchangelog entry describing the fix.The formatting hooks also normalized existing formatting in the widget-preservation implementation and test files. These changes are formatting-only and do not alter their behavior.