Skip to content

Conversation

@stanleyphu
Copy link
Contributor

@stanleyphu stanleyphu commented Oct 2, 2025

Description

Adds list_feature_flags method to support GET /organizations/:id/feature-flags.

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[x] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

Docs to be updated in AUTH-5314

@stanleyphu stanleyphu marked this pull request as ready for review October 2, 2025 20:36
@stanleyphu stanleyphu requested a review from a team as a code owner October 2, 2025 20:36
@stanleyphu stanleyphu requested a review from dandorman October 2, 2025 20:36
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Summary

This PR adds support for the new WorkOS API endpoint `GET /organizations/:id/feature-flags` by implementing a `list_feature_flags` method in the Organizations module. The implementation follows the established SDK patterns by adding the method to both synchronous and asynchronous client interfaces with proper pagination support.

The change integrates seamlessly with the existing codebase architecture:

  • Type System Integration: Adds FeatureFlag to the ListableResource TypeVar in list_resource.py, enabling proper generic typing for the WorkOSListResource class
  • Consistent API Patterns: The new method follows the same signature and behavior as other list methods (list_organizations, list_organization_roles) with standard pagination parameters (limit, before, after, order)
  • Module Organization: Places the feature flags listing functionality in the organizations module rather than creating a separate feature flags module, which makes sense since feature flags are scoped to organizations
  • Testing Infrastructure: Includes comprehensive test coverage with a new MockFeatureFlag fixture that follows the established mock pattern used throughout the test suite

The implementation creates a FeatureFlagsListResource type alias using the generic WorkOSListResource pattern, ensuring type safety and automatic pagination support. A new FeatureFlagListFilters class extends ListArgs to provide the foundation for future feature-specific filtering capabilities.

Important Files Changed

Changed Files
Filename Score Overview
workos/organizations.py 5/5 Adds list_feature_flags method with proper sync/async implementations and pagination support
workos/types/list_resource.py 5/5 Adds FeatureFlag to ListableResource TypeVar for proper generic typing support
workos/types/feature_flags/list_filters.py 5/5 Creates new FeatureFlagListFilters class extending ListArgs for type-safe pagination
tests/test_organizations.py 5/5 Adds comprehensive test coverage for the new list_feature_flags method
tests/utils/fixtures/mock_feature_flag.py 5/5 Creates MockFeatureFlag fixture following established testing patterns

Confidence score: 5/5

  • This PR is safe to merge with minimal risk as it follows established patterns and includes proper testing
  • Score reflects consistent implementation following SDK conventions, comprehensive test coverage, and minimal surface area for potential issues
  • No files require special attention as all changes are well-structured and follow existing codebase patterns

Sequence Diagram

sequenceDiagram
    participant User
    participant Organizations
    participant HTTPClient
    participant WorkOSAPI
    
    User->>Organizations: "list_feature_flags(organization_id, limit, before, after, order)"
    Organizations->>Organizations: "Create FeatureFlagListFilters params"
    Organizations->>HTTPClient: "request(organizations/{org_id}/feature-flags, GET, params)"
    HTTPClient->>WorkOSAPI: "GET /organizations/{org_id}/feature-flags"
    WorkOSAPI-->>HTTPClient: "HTTP 200 + feature flags data"
    HTTPClient-->>Organizations: "Response data"
    Organizations->>Organizations: "Create WorkOSListResource with FeatureFlag items"
    Organizations-->>User: "FeatureFlagsListResource"
Loading

5 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@stanleyphu stanleyphu merged commit 130eed1 into main Oct 2, 2025
6 checks passed
@stanleyphu stanleyphu deleted the feat/add-list-org-feature-flags branch October 2, 2025 22:03
@stanleyphu stanleyphu mentioned this pull request Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants