Add support for list organization feature flags endpoint#476
Merged
stanleyphu merged 1 commit intomainfrom Oct 2, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
FeatureFlagto theListableResourceTypeVar inlist_resource.py, enabling proper generic typing for theWorkOSListResourceclass - 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
MockFeatureFlagfixture 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"
5 files reviewed, no comments
mthadley
approved these changes
Oct 2, 2025
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.
Description
Adds
list_feature_flagsmethod to supportGET /organizations/:id/feature-flags.Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
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