Skip to content

Conversation

oguzkocer
Copy link
Contributor

@oguzkocer oguzkocer commented Sep 24, 2025

Summary

Consolidates the separate /posts and /pages endpoints into a unified /posts endpoint that accepts a PostEndpointType parameter, enabling support for custom post types while maintaining backward compatibility for existing functionality.

Breaking Changes

  • API Changes: Posts methods now require PostEndpointType parameter (.posts, .pages, or .custom(String))
  • Type Consolidation: SparsePost/SparsePageSparseAnyPost, PostWithEditContext/PageWithEditContextAnyPostWithEditContext
  • Removed Types: Eliminated separate page-specific types and endpoints

Key Changes

  • Rust: Unified SparseAnyPost type with #[WpContextualOption] for page-specific fields
  • Kotlin/Swift: Updated method signatures and removed legacy page endpoints
  • Runtime Flexibility: Trade compile-time type safety for runtime post type flexibility
  • Custom Post Types: Foundation for supporting WordPress plugins that define custom post types

Migration

// Before
client.pages().list_with_edit_context(params)

// After
client.posts().list_with_edit_context(PostEndpointType::Pages, params)

@oguzkocer oguzkocer added this to the 0.2 milestone Sep 24, 2025
@oguzkocer oguzkocer added the Rust label Sep 24, 2025
@oguzkocer oguzkocer changed the title POC: Any post Unify Posts and Pages Endpoints for Custom Post Type Support Sep 25, 2025
@jkmassel jkmassel marked this pull request as ready for review September 25, 2025 17:48
Copy link
Contributor

@jkmassel jkmassel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with the Swift sample app and it works great

@oguzkocer oguzkocer enabled auto-merge (squash) September 25, 2025 17:54
@oguzkocer oguzkocer merged commit cefd079 into trunk Sep 25, 2025
22 checks passed
@oguzkocer oguzkocer deleted the any-post branch September 25, 2025 18:17
oguzkocer added a commit that referenced this pull request Sep 26, 2025
Update Swift wrapper and example app to use the new unified terms endpoint
with TermEndpointType parameter, following the same pattern as the posts
unification in PR #915. This enables custom taxonomy support while maintaining
backward compatibility for existing categories and tags functionality.

Changes:
- Update WordPressAPI.swift to use unified terms endpoint
- Update Pagination.swift with TypedPaginationAwareExecutor for terms
- Add categories and tags examples to Swift demo app
- Add AnyTermWithEditContext support in ListViewData
- Fix CancellationTests to use new posts API signature
oguzkocer added a commit that referenced this pull request Sep 26, 2025
Update Swift wrapper and example app to use the new unified terms endpoint
with TermEndpointType parameter, following the same pattern as the posts
unification in PR #915. This enables custom taxonomy support while maintaining
backward compatibility for existing categories and tags functionality.

Changes:
- Update WordPressAPI.swift to use unified terms endpoint
- Update Pagination.swift with TypedPaginationAwareExecutor for terms
- Add categories and tags examples to Swift demo app
- Add AnyTermWithEditContext support in ListViewData
- Fix CancellationTests to use new posts API signature
oguzkocer added a commit that referenced this pull request Sep 26, 2025
Update Swift wrapper and example app to use the new unified terms endpoint
with TermEndpointType parameter, following the same pattern as the posts
unification in PR #915. This enables custom taxonomy support while maintaining
backward compatibility for existing categories and tags functionality.

Changes:
- Update WordPressAPI.swift to use unified terms endpoint
- Update Pagination.swift with TypedPaginationAwareExecutor for terms
- Add categories and tags examples to Swift demo app
- Add AnyTermWithEditContext support in ListViewData
- Fix CancellationTests to use new posts API signature
oguzkocer added a commit that referenced this pull request Sep 26, 2025
Update Swift wrapper to use the new unified terms endpoint
with TermEndpointType parameter, following the same pattern as the posts
unification in PR #915. This enables custom taxonomy support while maintaining
backward compatibility for existing categories and tags functionality.

Changes:
- Update WordPressAPI.swift to use unified terms endpoint
- Update Pagination.swift with TypedPaginationAwareExecutor for terms
- Add AnyTermWithEditContext support in ListViewData
- Fix CancellationTests to use new posts API signature
oguzkocer added a commit that referenced this pull request Sep 26, 2025
* Unify categories and tags endpoints into terms endpoint

Consolidate separate categories and tags REST API endpoints into a unified
terms endpoint to reduce code duplication and improve maintainability.
The unified approach uses TermEndpointType to distinguish between different
taxonomy types while sharing common functionality.

Changes:
- Replace CategoryId and TagId with unified TermId type
- Consolidate CategoryCreateParams/TagCreateParams into TermCreateParams
- Consolidate CategoryListParams/TagListParams into TermListParams
- Consolidate CategoryUpdateParams/TagUpdateParams into TermUpdateParams
- Add TermEndpointType enum to specify taxonomy type (Categories/Tags)
- Update API client to use unified terms() endpoint methods
- Update all integration tests to use new unified terms API
- Update Swift and Kotlin bindings to export unified types
- Remove legacy categories_endpoint and tags_endpoint modules

* Complete Swift implementation for unified terms endpoint

Update Swift wrapper to use the new unified terms endpoint
with TermEndpointType parameter, following the same pattern as the posts
unification in PR #915. This enables custom taxonomy support while maintaining
backward compatibility for existing categories and tags functionality.

Changes:
- Update WordPressAPI.swift to use unified terms endpoint
- Update Pagination.swift with TypedPaginationAwareExecutor for terms
- Add AnyTermWithEditContext support in ListViewData
- Fix CancellationTests to use new posts API signature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants