Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .last-synced-sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
92db0495807c86fbbc4d45bd266a6c1f5bcbb59c
f908f520f9fcd63dfd42ed35b7f141a65b61609b
17 changes: 16 additions & 1 deletion .oagen-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 2,
"language": "php",
"generatedAt": "2026-04-28T15:07:27.545Z",
"generatedAt": "2026-04-30T20:02:41.747Z",
"files": [
"lib/Resource/ActionAuthenticationDenied.php",
"lib/Resource/ActionAuthenticationDeniedData.php",
Expand All @@ -17,6 +17,8 @@
"lib/Resource/ApiKeyRevokedData.php",
"lib/Resource/ApiKeyRevokedDataOwner.php",
"lib/Resource/ApiKeyValidationResponse.php",
"lib/Resource/ApiKeyValidationResponseApiKey.php",
"lib/Resource/ApiKeyValidationResponseApiKeyOwner.php",
"lib/Resource/ApiKeyWithValue.php",
"lib/Resource/ApiKeyWithValueOwner.php",
"lib/Resource/ApplicationCredentialsListItem.php",
Expand Down Expand Up @@ -210,6 +212,10 @@
"lib/Resource/DsyncGroupUserAddedData.php",
"lib/Resource/DsyncGroupUserRemoved.php",
"lib/Resource/DsyncGroupUserRemovedData.php",
"lib/Resource/DsyncTokenCreated.php",
"lib/Resource/DsyncTokenCreatedData.php",
"lib/Resource/DsyncTokenDeleted.php",
"lib/Resource/DsyncTokenDeletedData.php",
"lib/Resource/DsyncUserCreated.php",
"lib/Resource/DsyncUserDeleted.php",
"lib/Resource/DsyncUserUpdated.php",
Expand Down Expand Up @@ -433,6 +439,7 @@
"lib/Resource/UserObject.php",
"lib/Resource/UserOrganizationMembership.php",
"lib/Resource/UserOrganizationMembershipBaseListData.php",
"lib/Resource/UserOrganizationMembershipBaseWithUser.php",
"lib/Resource/UserSessionsAuthMethod.php",
"lib/Resource/UserSessionsImpersonator.php",
"lib/Resource/UserSessionsListItem.php",
Expand Down Expand Up @@ -518,6 +525,8 @@
"tests/Fixtures/api_key_revoked_data.json",
"tests/Fixtures/api_key_revoked_data_owner.json",
"tests/Fixtures/api_key_validation_response.json",
"tests/Fixtures/api_key_validation_response_api_key.json",
"tests/Fixtures/api_key_validation_response_api_key_owner.json",
"tests/Fixtures/api_key_with_value.json",
"tests/Fixtures/api_key_with_value_owner.json",
"tests/Fixtures/application_credentials_list_item.json",
Expand Down Expand Up @@ -684,6 +693,10 @@
"tests/Fixtures/dsync_group_user_added_data.json",
"tests/Fixtures/dsync_group_user_removed.json",
"tests/Fixtures/dsync_group_user_removed_data.json",
"tests/Fixtures/dsync_token_created.json",
"tests/Fixtures/dsync_token_created_data.json",
"tests/Fixtures/dsync_token_deleted.json",
"tests/Fixtures/dsync_token_deleted_data.json",
"tests/Fixtures/dsync_user_created.json",
"tests/Fixtures/dsync_user_deleted.json",
"tests/Fixtures/dsync_user_updated.json",
Expand Down Expand Up @@ -781,6 +794,7 @@
"tests/Fixtures/list_user_invite.json",
"tests/Fixtures/list_user_organization_membership.json",
"tests/Fixtures/list_user_organization_membership_base_list_data.json",
"tests/Fixtures/list_user_organization_membership_base_with_user.json",
"tests/Fixtures/list_user_sessions_list_item.json",
"tests/Fixtures/list_webhook_endpoint_json.json",
"tests/Fixtures/magic_auth.json",
Expand Down Expand Up @@ -908,6 +922,7 @@
"tests/Fixtures/user_object.json",
"tests/Fixtures/user_organization_membership.json",
"tests/Fixtures/user_organization_membership_base_list_data.json",
"tests/Fixtures/user_organization_membership_base_with_user.json",
"tests/Fixtures/user_sessions_impersonator.json",
"tests/Fixtures/user_sessions_list_item.json",
"tests/Fixtures/user_updated.json",
Expand Down
1 change: 0 additions & 1 deletion lib/Resource/ApiKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

namespace WorkOS\Resource;

/** The API Key object if the value is valid, or `null` if invalid. */
readonly class ApiKey implements \JsonSerializable
{
use JsonSerializableTrait;
Expand Down
4 changes: 2 additions & 2 deletions lib/Resource/ApiKeyCreatedData.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function fromArray(array $data): self
return new self(
object: $data['object'] ?? 'api_key',
id: $data['id'],
owner: ApiKeyCreatedDataOwner::fromArray($data['owner']),
owner: $data['owner'],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P0 TypeError: raw array passed to typed ApiKeyCreatedDataOwner property

$data['owner'] is a plain array, but the constructor declares owner as ApiKeyCreatedDataOwner. PHP will throw a TypeError at runtime on any call to ApiKeyCreatedData::fromArray(). The diff removed the ApiKeyCreatedDataOwner::fromArray($data['owner']) call that was there before.

Suggested change
owner: $data['owner'],
owner: ApiKeyCreatedDataOwner::fromArray($data['owner']),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 ApiKeyCreatedData::fromArray passes raw array to typed ApiKeyCreatedDataOwner parameter

The fromArray method at line 44 passes $data['owner'] (a raw associative array from JSON decode) directly to the constructor, but the owner parameter is typed as ApiKeyCreatedDataOwner (line 20). With declare(strict_types=1) at the top of the file, this will throw a TypeError at runtime: "Cannot pass value of type array to parameter $owner of type ApiKeyCreatedDataOwner". The previous code correctly called ApiKeyCreatedDataOwner::fromArray($data['owner']). The same issue exists in toArray() at line 59, where $this->owner is output directly instead of calling $this->owner->toArray().

Suggested change
owner: $data['owner'],
owner: ApiKeyCreatedDataOwner::fromArray($data['owner']),
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

name: $data['name'],
obfuscatedValue: $data['obfuscated_value'],
lastUsedAt: $data['last_used_at'] ?? null,
Expand All @@ -56,7 +56,7 @@ public function toArray(): array
return [
'object' => $this->object,
'id' => $this->id,
'owner' => $this->owner->toArray(),
'owner' => $this->owner,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 ApiKeyCreatedData::toArray outputs owner object directly instead of calling toArray()

At line 59, toArray() outputs 'owner' => $this->owner directly. Since $this->owner is typed as ApiKeyCreatedDataOwner, this should be $this->owner->toArray() to properly serialize the object to an array, consistent with the pattern used in all other resource classes. If BUG-0001 is fixed (so $this->owner is a proper ApiKeyCreatedDataOwner object), this line will put an object into the array instead of a serialized array representation.

Suggested change
'owner' => $this->owner,
'owner' => $this->owner->toArray(),
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

'name' => $this->name,
'obfuscated_value' => $this->obfuscatedValue,
'last_used_at' => $this->lastUsedAt,
Expand Down
1 change: 0 additions & 1 deletion lib/Resource/ApiKeyCreatedDataOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

namespace WorkOS\Resource;

/** The owner of the API key. */
readonly class ApiKeyCreatedDataOwner implements \JsonSerializable
{
use JsonSerializableTrait;
Expand Down
4 changes: 2 additions & 2 deletions lib/Resource/ApiKeyRevokedData.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function fromArray(array $data): self
return new self(
object: $data['object'] ?? 'api_key',
id: $data['id'],
owner: ApiKeyRevokedDataOwner::fromArray($data['owner']),
owner: $data['owner'],
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P0 TypeError: raw array passed to typed ApiKeyRevokedDataOwner property

Same issue as ApiKeyCreatedData: $data['owner'] is an array but the constructor expects ApiKeyRevokedDataOwner. Every call to ApiKeyRevokedData::fromArray() will throw a TypeError.

Suggested change
owner: $data['owner'],
owner: ApiKeyRevokedDataOwner::fromArray($data['owner']),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 ApiKeyRevokedData::fromArray passes raw array to typed ApiKeyRevokedDataOwner parameter

Identical issue to ApiKeyCreatedData: line 44 passes $data['owner'] (a raw array) to the constructor, but the owner parameter is typed as ApiKeyRevokedDataOwner (lib/Resource/ApiKeyRevokedData.php:20). With declare(strict_types=1), this throws a TypeError at runtime. The previous code correctly called ApiKeyRevokedDataOwner::fromArray($data['owner']).

Suggested change
owner: $data['owner'],
owner: ApiKeyRevokedDataOwner::fromArray($data['owner']),
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

name: $data['name'],
obfuscatedValue: $data['obfuscated_value'],
lastUsedAt: $data['last_used_at'] ?? null,
Expand All @@ -56,7 +56,7 @@ public function toArray(): array
return [
'object' => $this->object,
'id' => $this->id,
'owner' => $this->owner->toArray(),
'owner' => $this->owner,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 ApiKeyRevokedData::toArray outputs owner object directly instead of calling toArray()

At line 59, toArray() outputs 'owner' => $this->owner directly instead of $this->owner->toArray(), identical to the issue in ApiKeyCreatedData. This will produce incorrect serialization output.

Suggested change
'owner' => $this->owner,
'owner' => $this->owner->toArray(),
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

'name' => $this->name,
'obfuscated_value' => $this->obfuscatedValue,
'last_used_at' => $this->lastUsedAt,
Expand Down
1 change: 0 additions & 1 deletion lib/Resource/ApiKeyRevokedDataOwner.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

namespace WorkOS\Resource;

/** The owner of the API key. */
readonly class ApiKeyRevokedDataOwner implements \JsonSerializable
{
use JsonSerializableTrait;
Expand Down
4 changes: 2 additions & 2 deletions lib/Resource/ApiKeyValidationResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
use JsonSerializableTrait;

public function __construct(
public ?ApiKey $apiKey,
public ?ApiKeyValidationResponseApiKey $apiKey,
) {
}

public static function fromArray(array $data): self
{
return new self(
apiKey: isset($data['api_key']) ? ApiKey::fromArray($data['api_key']) : null,
apiKey: isset($data['api_key']) ? ApiKeyValidationResponseApiKey::fromArray($data['api_key']) : null,
);
}

Expand Down
67 changes: 67 additions & 0 deletions lib/Resource/ApiKeyValidationResponseApiKey.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

declare(strict_types=1);

// This file is auto-generated by oagen. Do not edit.

namespace WorkOS\Resource;

readonly class ApiKeyValidationResponseApiKey implements \JsonSerializable
{
use JsonSerializableTrait;

public function __construct(
/** Distinguishes the API Key object. */
public string $object,
/** Unique identifier of the API Key. */
public string $id,
/** The entity that owns the API Key. */
public ApiKeyValidationResponseApiKeyOwner $owner,
/** A descriptive name for the API Key. */
public string $name,
/** An obfuscated representation of the API Key value. */
public string $obfuscatedValue,
/** Timestamp of when the API Key was last used. */
public ?\DateTimeImmutable $lastUsedAt,
/**
* The permission slugs assigned to the API Key.
* @var array<string>
*/
public array $permissions,
/** An ISO 8601 timestamp. */
public \DateTimeImmutable $createdAt,
/** An ISO 8601 timestamp. */
public \DateTimeImmutable $updatedAt,
) {
}

public static function fromArray(array $data): self
{
return new self(
object: $data['object'] ?? 'api_key',
id: $data['id'],
owner: ApiKeyValidationResponseApiKeyOwner::fromArray($data['owner']),
name: $data['name'],
obfuscatedValue: $data['obfuscated_value'],
lastUsedAt: isset($data['last_used_at']) ? new \DateTimeImmutable($data['last_used_at']) : null,
permissions: $data['permissions'],
createdAt: new \DateTimeImmutable($data['created_at']),
updatedAt: new \DateTimeImmutable($data['updated_at']),
);
}

public function toArray(): array
{
return [
'object' => $this->object,
'id' => $this->id,
'owner' => $this->owner->toArray(),
'name' => $this->name,
'obfuscated_value' => $this->obfuscatedValue,
'last_used_at' => $this->lastUsedAt?->format(\DateTimeInterface::RFC3339_EXTENDED),
'permissions' => $this->permissions,
'created_at' => $this->createdAt->format(\DateTimeInterface::RFC3339_EXTENDED),
'updated_at' => $this->updatedAt->format(\DateTimeInterface::RFC3339_EXTENDED),
];
}
}
37 changes: 37 additions & 0 deletions lib/Resource/ApiKeyValidationResponseApiKeyOwner.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);

// This file is auto-generated by oagen. Do not edit.

namespace WorkOS\Resource;

/** The entity that owns the API Key. */
readonly class ApiKeyValidationResponseApiKeyOwner implements \JsonSerializable
{
use JsonSerializableTrait;

public function __construct(
/** The type of the API Key owner. */
public string $type,
/** Unique identifier of the API Key owner. */
public string $id,
) {
}

public static function fromArray(array $data): self
{
return new self(
type: $data['type'] ?? 'organization',
id: $data['id'],
);
}

public function toArray(): array
{
return [
'type' => $this->type,
'id' => $this->id,
];
}
}
4 changes: 4 additions & 0 deletions lib/Resource/DirectoryUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public function __construct(
public ?string $firstName = null,
/** The last name of the user. */
public ?string $lastName = null,
/** The full name of the user. */
public ?string $name = null,
/**
* A list of email addresses for the user.
* @var array<\WorkOS\Resource\DirectoryUserEmail>|null
Expand Down Expand Up @@ -85,6 +87,7 @@ public static function fromArray(array $data): self
updatedAt: new \DateTimeImmutable($data['updated_at']),
firstName: $data['first_name'] ?? null,
lastName: $data['last_name'] ?? null,
name: $data['name'] ?? null,
emails: isset($data['emails']) ? array_map(fn ($item) => DirectoryUserEmail::fromArray($item), $data['emails']) : null,
jobTitle: $data['job_title'] ?? null,
username: $data['username'] ?? null,
Expand All @@ -109,6 +112,7 @@ public function toArray(): array
'updated_at' => $this->updatedAt->format(\DateTimeInterface::RFC3339_EXTENDED),
'first_name' => $this->firstName,
'last_name' => $this->lastName,
'name' => $this->name,
'emails' => $this->emails !== null ? array_map(fn ($item) => $item->toArray(), $this->emails) : null,
'job_title' => $this->jobTitle,
'username' => $this->username,
Expand Down
6 changes: 5 additions & 1 deletion lib/Resource/DirectoryUserWithGroups.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(
/** An ISO 8601 timestamp. */
public \DateTimeImmutable $updatedAt,
/**
* The directory groups the user belongs to. Use the List Directory Groups endpoint with a user filter instead.
* The directory groups the user belongs to. Deprecated: starting May 1, 2026, this field returns an empty array by default for newly created teams. Existing teams currently depending on this field should migrate to the new access pattern for better throughput performance — the field is unbounded by user, so users with many group memberships produce large, slow response payloads. Use the List Directory Groups endpoint with a `user` filter to fetch a user's group memberships.
* @var array<\WorkOS\Resource\DirectoryGroup>
* @deprecated
*/
Expand All @@ -50,6 +50,8 @@ public function __construct(
public ?string $firstName = null,
/** The last name of the user. */
public ?string $lastName = null,
/** The full name of the user. */
public ?string $name = null,
/**
* A list of email addresses for the user.
* @var array<\WorkOS\Resource\DirectoryUserWithGroupsEmail>|null
Expand Down Expand Up @@ -92,6 +94,7 @@ public static function fromArray(array $data): self
groups: array_map(fn ($item) => DirectoryGroup::fromArray($item), $data['groups']),
firstName: $data['first_name'] ?? null,
lastName: $data['last_name'] ?? null,
name: $data['name'] ?? null,
emails: isset($data['emails']) ? array_map(fn ($item) => DirectoryUserWithGroupsEmail::fromArray($item), $data['emails']) : null,
jobTitle: $data['job_title'] ?? null,
username: $data['username'] ?? null,
Expand All @@ -117,6 +120,7 @@ public function toArray(): array
'groups' => array_map(fn ($item) => $item->toArray(), $this->groups),
'first_name' => $this->firstName,
'last_name' => $this->lastName,
'name' => $this->name,
'emails' => $this->emails !== null ? array_map(fn ($item) => $item->toArray(), $this->emails) : null,
'job_title' => $this->jobTitle,
'username' => $this->username,
Expand Down
50 changes: 50 additions & 0 deletions lib/Resource/DsyncTokenCreated.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

declare(strict_types=1);

// This file is auto-generated by oagen. Do not edit.

namespace WorkOS\Resource;

readonly class DsyncTokenCreated implements \JsonSerializable
{
use JsonSerializableTrait;

public function __construct(
/** Unique identifier for the event. */
public string $id,
public string $event,
/** The event payload. */
public DsyncTokenCreatedData $data,
/** An ISO 8601 timestamp. */
public \DateTimeImmutable $createdAt,
/** Distinguishes the Event object. */
public string $object,
public ?EventContext $context = null,
) {
}

public static function fromArray(array $data): self
{
return new self(
id: $data['id'],
event: $data['event'] ?? 'dsync.token.created',
data: DsyncTokenCreatedData::fromArray($data['data']),
createdAt: new \DateTimeImmutable($data['created_at']),
object: $data['object'] ?? 'event',
context: isset($data['context']) ? EventContext::fromArray($data['context']) : null,
);
}

public function toArray(): array
{
return [
'id' => $this->id,
'event' => $this->event,
'data' => $this->data->toArray(),
'created_at' => $this->createdAt->format(\DateTimeInterface::RFC3339_EXTENDED),
'object' => $this->object,
'context' => $this->context?->toArray(),
];
}
}
Loading
Loading