-
Notifications
You must be signed in to change notification settings - Fork 17
Add Organization Feature Flags & Vault Support #299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…troducing the getFeatureFlags($organizationId) method. Added tests to validate organization feature flags. Resolved a deprecated notice in the OrganizationsTest to ensure compatibility with newer PHP versions. Implemented support for reading Vault items. Expanded the test suite to encompass Vault-related functionalities.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR introduces two major features to the WorkOS PHP SDK: Organization Feature Flags support and Vault functionality for key-value storage operations.
Organization Feature Flags: A new getFeatureFlags($organizationId)
method has been added to the Organizations
class that allows retrieval of feature flags for a specific organization. The method follows established SDK patterns by making a GET request to the organizations/{organizationId}/feature-flags
endpoint and returning the raw API response. This integrates seamlessly with the existing organization management functionality in the SDK.
Vault Support: Complete Vault functionality has been implemented with a new Vault
class containing two core methods: getVaultObject($vaultObjectId)
for retrieving individual vault objects, and listVaultObjects()
for paginated listing of vault objects. The implementation includes proper pagination support with before/after cursors and follows the same patterns used by other service classes like Organizations. A corresponding VaultObject
resource class extends BaseWorkOSResource
with appropriate attribute mappings from snake_case API responses to camelCase PHP properties.
Both features maintain consistency with existing SDK architecture - using the same Client::request
pattern, exception handling through WorkOS exceptions, and resource construction approaches. The Vault implementation specifically mirrors the pagination and resource construction patterns used in other services, ensuring developers have a familiar interface. Comprehensive test coverage has been added for both features, including proper mocking of HTTP requests and validation of response handling.
Confidence score: 4/5
- This PR is generally safe to merge with some minor code quality improvements needed
- Score reflects solid implementation following established patterns, but lowered due to formatting inconsistencies and test structure issues
- Pay close attention to the VaultTest.php file which has inconsistent assertion logic and unnecessary empty lines
5 files reviewed, 3 comments
list($before, $after, $response) = $this->vault->listVaultObjects(); | ||
$this->assertSame($vaultObjects, $response[0]->toArray()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: Inconsistent test logic - comparing single fixture object against first item in array. Should either compare arrays or single objects consistently.
public const RESPONSE_TO_RESOURCE_KEY = [ | ||
"id" => "id", | ||
"name" => "name", | ||
"updated_at" => "updatedAt", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Extra whitespace after updatedAt",
- consider removing trailing spaces for consistency
"updated_at" => "updatedAt", | |
"updated_at" => "updatedAt", |
true | ||
); | ||
|
||
return $response; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Returns raw response array instead of structured objects like other methods. Consider whether feature flags should have their own Resource class for consistency.
Description
Added Organization Feature Flags functionality in Organizations by introducing the getFeatureFlags($organizationId) method.
Added tests to validate organization feature flags.
Resolved a deprecated notice in the OrganizationsTest to ensure compatibility with newer PHP versions.
Implemented support for reading Vault items.
Expanded the test suite to encompass Vault-related functionalities.
Documentation
This may allow a change to docs, however I do not believe I have access to that repository.
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.