Skip to content

feat: add get_user_plan_limits - #275

Open
claytonjn wants to merge 1 commit into
todoist:mainfrom
claytonjn:user-plan-limits
Open

claytonjn wants to merge 1 commit into
todoist:mainfrom
claytonjn:user-plan-limits

Conversation

@claytonjn

Copy link
Copy Markdown

Context

  • Todoist only exposes the user's plan limits through the Sync API (user_plan_limits), so there's no way to check through the SDK what a plan includes. For example, location and absolute reminders return 403 PREMIUM_ONLY on the free plan, and callers can't check for that before creating the task.
  • The TypeScript SDK already reads the same resource with a narrow sync request in getPersonalProjectCapacity().
  • I'm using this in the Home Assistant Todoist integration, to fail a "new task with reminder" action up front on plans without reminders, instead of creating the task and then failing on the reminder.

What was changed

  • get_user_plan_limits() in TodoistAPI and TodoistAPIAsync. It posts {"sync_token": "*", "resource_types": ["user_plan_limits"]} to /sync and returns a UserPlanLimits with current and next (None when no upgrade is available).
  • PlanLimits model with the documented user plan info fields. Everything except plan_name is optional, because the API leaves out some documented limits (for example, workspace_filters was missing for both a free and a Pro account).
  • API test using a real free plan response, model tests for unknown fields and for a plan with no upgrade, and a changelog entry under Unreleased.

Release

Same request as #274: Home Assistant is on 4.0.1, and main holds the unreleased httpx2 migration. Would you consider cherry-picking this onto release/4.0.x? It applies cleanly there and the tests pass. The only adjustment is the docstring's httpx2.HTTPStatusError, which is httpx on 4.0.x.

Todoist only exposes plan limits through the Sync API, so callers that need
to know what the user's plan includes, such as whether it allows reminders,
had to build that request themselves. Add get_user_plan_limits to both
clients, returning the current plan's limits and those of the available
upgrade.

Every limit except plan_name is optional, because the API leaves out some
documented limits, such as workspace_filters.
@claytonjn
claytonjn requested a review from a team as a code owner November 15, 2026 23:06
@claytonjn
claytonjn requested review from PotHix and removed request for a team November 15, 2026 23:06

This branch has not been deployed

No deployments
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