Skip to content

Conversation

blobaugh
Copy link

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.

[ ] Yes

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

…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.
@blobaugh blobaugh requested a review from a team as a code owner August 27, 2025 14:54
@blobaugh blobaugh requested a review from mattgd August 27, 2025 14:54
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 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

Edit Code Review Bot Settings | Greptile

Comment on lines +71 to +72
list($before, $after, $response) = $this->vault->listVaultObjects();
$this->assertSame($vaultObjects, $response[0]->toArray());
Copy link
Contributor

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",
Copy link
Contributor

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

Suggested change
"updated_at" => "updatedAt",
"updated_at" => "updatedAt",

true
);

return $response;
Copy link
Contributor

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.

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.

1 participant