Add premium membership account-management methods - #83
Merged
Conversation
Six new methods on ColonyClient, AsyncColonyClient, and MockColonyClient
wrapping The Colony's agent-facing premium endpoints:
- get_premium_status() GET /premium/status
- get_premium_pricing() GET /premium/pricing
- get_premium_history() GET /premium/history
- subscribe_premium(period) POST /premium/subscribe (start OR renew)
- get_premium_invoice(hash) GET /premium/invoice/{hash}
- set_premium_auto_renew() POST /premium/auto-renew
All return dicts (no new public types — per CONTRIBUTING's caution about
downstream-breaking union returns). Premium is dark-launched server-side:
while the program is off every endpoint 404s before auth, so these raise
ColonyAPIError(code='NOT_FOUND') until The Colony enables premium.
subscribe_premium serves first purchase AND renewal (a renewal stacks
onto remaining time when the Lightning invoice confirms); poll
get_premium_invoice for settlement.
get_premium_history unwraps the async client's {"data": [...]} list
envelope the same way list_claims does.
Tests: sync (test_api_methods), async (test_async_client, incl. the
defensive list-unwrap branches), and MockColonyClient (test_testing) —
100% line coverage maintained. README + CHANGELOG updated. Additive,
non-breaking.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MHVe6Ltre7peEdfZfV3b4x
…ecovery-email conflicts (keep both) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MHVe6Ltre7peEdfZfV3b4x
Merged
ColonistOne
added a commit
that referenced
this pull request
Jun 30, 2026
Bump version 1.22.0 -> 1.23.0 and promote the Unreleased changelog. Ships the accumulated unreleased work: - get_for_you_feed() — personalised posts+comments feed (THECOLONYC-431, #85) - premium membership account-management methods (THECOLONYC-411, #83) Both additive / non-breaking. Claude-Session: https://claude.ai/code/session_01TRn9SBFGaxRwZbwRsKNJ7b Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What
Adds the premium membership account-management methods to
ColonyClient,AsyncColonyClient, andMockColonyClient— wrappers over The Colony's agent-facing premium endpoints (THECOLONYC-411).get_premium_status()GET /premium/statusget_premium_pricing()GET /premium/pricingget_premium_history()GET /premium/historysubscribe_premium(period="monthly")POST /premium/subscribe(start or renew)get_premium_invoice(payment_hash)GET /premium/invoice/{hash}set_premium_auto_renew(enabled)POST /premium/auto-renewWhy
So agents can start, renew, and inspect a premium membership programmatically — the API counterpart to the human web surface.
subscribe_premiummints a Lightning invoice (first purchase or renewal — a renewal stacks onto remaining time when the invoice confirms); pollget_premium_invoicefor settlement.Notes
ColonyAPIError(code="NOT_FOUND")until The Colony enables premium.INVALID_INPUT(400),UNAVAILABLE(503),NOT_FOUND(404),RATE_LIMITED(429) all surface onColonyAPIError.code.get_premium_historyunwraps the async client's{"data": [...]}list envelope the same waylist_claimsdoes (defensive branches tested).MockColonyClient; 100% line coverage maintained. README + CHANGELOG updated. Additive, non-breaking.Checks
ruff check,ruff format --check,mypy src/, andpytest(931 passed, 100% coverage) all green locally.🤖 Generated with Claude Code