Skip to content

Conversation

@stanleyphu
Copy link
Contributor

Description

  • Adds list_feature_flags method to UserManagement module to support GET /user_management/users/:id/feature-flags endpoint

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.

@stanleyphu stanleyphu requested a review from a team as a code owner December 17, 2025 01:56
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 17, 2025

Greptile Overview

Greptile Summary

Added support for listing user feature flags via the GET /user_management/users/:id/feature-flags endpoint. The implementation follows the existing SDK patterns for list operations with cursor-based pagination.

Key changes:

  • Implemented list_feature_flags method in both UserManagement (sync) and AsyncUserManagement (async) classes
  • Added FeatureFlagsListResource type alias using existing FeatureFlag and FeatureFlagListFilters types
  • Included comprehensive test with proper mocking and assertions
  • Supports standard pagination parameters: limit, before, after, and order

Minor issue found:

  • The return statements use the long form WorkOSListResource[FeatureFlag, FeatureFlagListFilters, ListMetadata] instead of the defined type alias FeatureFlagsListResource, which is inconsistent with other list methods in the file

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk after addressing the minor style inconsistency
  • The implementation correctly follows established patterns in the codebase for list operations, includes both sync and async versions, has proper tests, and handles pagination consistently. The only issue is a minor style inconsistency where the long form of the type is used instead of the defined alias, which doesn't affect functionality but should be fixed for code consistency
  • workos/user_management.py needs minor style fix to use type alias instead of long form (lines 1658 and 2396)

Important Files Changed

File Analysis

Filename Score Overview
workos/user_management.py 4/5 Added list_feature_flags method to both sync and async classes with proper pagination support. Minor style issue: uses long form type instead of alias.
tests/test_user_management.py 5/5 Added test for list_feature_flags with proper fixtures and assertions, will run for both sync/async via class decorator.

Sequence Diagram

sequenceDiagram
    participant Client
    participant UserManagement
    participant HTTPClient
    participant WorkOSAPI

    Client->>UserManagement: list_feature_flags(user_id, limit, before, after, order)
    UserManagement->>UserManagement: Create FeatureFlagListFilters params
    UserManagement->>HTTPClient: request(USER_FEATURE_FLAGS_PATH, GET, params)
    HTTPClient->>WorkOSAPI: GET /user_management/users/{user_id}/feature-flags
    WorkOSAPI-->>HTTPClient: Response with feature flags data
    HTTPClient-->>UserManagement: JSON response
    UserManagement->>UserManagement: Parse response into ListPage[FeatureFlag]
    UserManagement->>UserManagement: Create FeatureFlagsListResource with pagination support
    UserManagement-->>Client: FeatureFlagsListResource
Loading

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.

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@stanleyphu stanleyphu merged commit 1d935d6 into main Dec 17, 2025
8 checks passed
@stanleyphu stanleyphu deleted the feat/add-list-user-feature-flags branch December 17, 2025 02:40
@stanleyphu stanleyphu mentioned this pull request Dec 17, 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