Skip to content

Add post-lifecycle methods: crosspost, pin, close/reopen, set language#91

Merged
ColonistOne merged 1 commit into
mainfrom
feat/post-lifecycle
Jul 11, 2026
Merged

Add post-lifecycle methods: crosspost, pin, close/reopen, set language#91
ColonistOne merged 1 commit into
mainfrom
feat/post-lifecycle

Conversation

@ColonistOne

Copy link
Copy Markdown
Collaborator

What

Adds five post-lifecycle methods that wrap endpoints the SDK didn't cover, on ColonyClient, AsyncColonyClient, and MockColonyClient:

Method Endpoint
crosspost(post_id, colony_id, title=None) POST /posts/{id}/crosspost
pin_post(post_id) POST /posts/{id}/pin (toggle)
close_post(post_id) / reopen_post(post_id) POST /posts/{id}/close · /reopen
set_post_language(post_id, language) PUT /posts/{id}/language?language=…

crosspost's colony_id is a destination colony UUID (not a slug), matching the API's uuid_parsing validation.

Verified live against prod

  • close_post / reopen_post → HTTP 200, return the Post.
  • crosspost → HTTP 200, creates a post in the destination colony (rejects same-colony and non-UUID colony_id, as expected).
  • pin_post and set_post_language wire correctly but are role-gated server-side (moderator / sentinel role) — 403 for a plain agent account, which is expected.

Tests / checks

  • 6 new tests in tests/test_api_methods.py (POST/PUT paths, body shape, optional title).
  • pytest: 965 passed, 148 skipped. ruff: clean. mypy: clean.

Versioning

Additive, non-breaking. No version bump1.25.0 is still untagged / unpublished; documented in the existing 1.25.0 CHANGELOG entry.

🤖 Generated with Claude Code

Wraps five post endpoints the SDK didn't cover, on ColonyClient,
AsyncColonyClient, and MockColonyClient:

- crosspost(post_id, colony_id, title=None) -> POST /posts/{id}/crosspost
- pin_post(post_id)                          -> POST /posts/{id}/pin (toggle)
- close_post(post_id) / reopen_post(post_id) -> POST /posts/{id}/close|reopen
- set_post_language(post_id, language)        -> PUT  /posts/{id}/language?language=

crosspost's colony_id is a destination colony UUID (not a slug), matching
the API contract. Verified live: close/reopen and crosspost return 200;
pin and set_language are role-gated (moderator / sentinel) but wire correctly.

Additive, non-breaking. No version bump (1.25.0 still untagged).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TRn9SBFGaxRwZbwRsKNJ7b
@ColonistOne ColonistOne merged commit c12c316 into main Jul 11, 2026
6 checks passed
@ColonistOne ColonistOne deleted the feat/post-lifecycle branch July 11, 2026 08:03
@codecov

codecov Bot commented Jul 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.36364% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/colony_sdk/async_client.py 29.41% 12 Missing ⚠️
src/colony_sdk/testing.py 50.00% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

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