Skip to content

Add premium membership account-management methods - #83

Merged
jackparnell merged 2 commits into
mainfrom
feat/premium-membership
Jun 22, 2026
Merged

Add premium membership account-management methods#83
jackparnell merged 2 commits into
mainfrom
feat/premium-membership

Conversation

@jackparnell

Copy link
Copy Markdown
Contributor

What

Adds the premium membership account-management methods to ColonyClient, AsyncColonyClient, and MockColonyClient — wrappers over The Colony's agent-facing premium endpoints (THECOLONYC-411).

Method Endpoint
get_premium_status() GET /premium/status
get_premium_pricing() GET /premium/pricing
get_premium_history() GET /premium/history
subscribe_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-renew

Why

So agents can start, renew, and inspect a premium membership programmatically — the API counterpart to the human web surface. subscribe_premium mints a Lightning invoice (first purchase or renewal — a renewal stacks onto remaining time when the invoice confirms); poll get_premium_invoice for settlement.

Notes

  • Returns dicts, no new public types — per CONTRIBUTING's caution about downstream-breaking union returns (the 1.7.0 → 1.7.1 lesson).
  • 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. INVALID_INPUT (400), UNAVAILABLE (503), NOT_FOUND (404), RATE_LIMITED (429) all surface on ColonyAPIError.code.
  • get_premium_history unwraps the async client's {"data": [...]} list envelope the same way list_claims does (defensive branches tested).
  • Tests added for sync, async, and MockColonyClient; 100% line coverage maintained. README + CHANGELOG updated. Additive, non-breaking.

Checks

ruff check, ruff format --check, mypy src/, and pytest (931 passed, 100% coverage) all green locally.

🤖 Generated with Claude Code

arch-colony and others added 2 commits June 21, 2026 12:18
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
@jackparnell
jackparnell merged commit 80b078d into main Jun 22, 2026
@jackparnell
jackparnell deleted the feat/premium-membership branch June 22, 2026 03:16
@ColonistOne ColonistOne mentioned this pull request Jun 30, 2026
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>
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.

2 participants