Skip to content
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
- [#397](https://github.com/workos/workos-php/pull/397) feat(generated)!: regenerate from spec (5 changes)

**⚠️ Breaking**
- **[api_keys](https://workos.com/docs/reference/authkit/api-keys)**:
- Made `expires_at` required in API key models
- **[directory_sync](https://workos.com/docs/reference/directory-sync)**:
- Removed model `DsyncDeactivated`
- Removed model `DsyncDeactivatedData`
- Removed model `DsyncDeactivatedDataDomain`
- Removed enum `DsyncDeactivatedDataType`
- Removed enum `DsyncDeactivatedDataState`
- **[radar](https://workos.com/docs/reference/radar)**:
- Removed `domain_sign_up_rate_limit` from `RadarStandaloneResponseControl`
- **[user_management](https://workos.com/docs/reference/authkit/user)**:
- Removed `return_to` from `RevokeSession`

**Features**
- **[api_keys](https://workos.com/docs/reference/authkit/api-keys)**:
- Added model `ExpireApiKey`
- Added model `ApiKeyUpdated`
- Added model `ApiKeyUpdatedData`
- Added model `ApiKeyUpdatedDataOwner`
- Added model `UserApiKeyUpdatedDataOwner`
- Added model `ApiKeyUpdatedDataPreviousAttribute`
- Added endpoint `POST /api_keys/{id}/expire`
- **[audit_logs](https://workos.com/docs/reference/audit-logs)**:
- Added `Snowflake` to `AuditLogConfigurationLogStreamType`
- **[connect](https://workos.com/docs/reference/workos-connect/standalone)**:
- Added `name` to `UserObject`
- **[directory_sync](https://workos.com/docs/reference/directory-sync)**:
- Added model `DsyncTokenCreated`
- Added model `DsyncTokenCreatedData`
- Added model `DsyncTokenRevoked`
- Added model `DsyncTokenRevokedData`
- **[user_management](https://workos.com/docs/reference/authkit/user)**:
- Added `name` to user management models
- **[webhooks](https://workos.com/docs/reference/webhooks)**:
- Added `api_key.updated` to `CreateWebhookEndpointEvents`
- Added `api_key.updated` to `UpdateWebhookEndpointEvents`
2 changes: 1 addition & 1 deletion .last-synced-sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cb6857d51b453e3cbdb5bf3647d3ca229dd8af65
d8c5a7de598792b1cee18d4a9842825110e5c74a
32 changes: 25 additions & 7 deletions .oagen-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": 2,
"language": "php",
"generatedAt": "2026-05-28T14:19:36.431Z",
"generatedAt": "2026-06-03T19:19:56.689Z",
"files": [
"lib/Resource/ActionAuthenticationDenied.php",
"lib/Resource/ActionAuthenticationDeniedData.php",
Expand All @@ -17,6 +17,10 @@
"lib/Resource/ApiKeyRevoked.php",
"lib/Resource/ApiKeyRevokedData.php",
"lib/Resource/ApiKeyRevokedDataOwner.php",
"lib/Resource/ApiKeyUpdated.php",
"lib/Resource/ApiKeyUpdatedData.php",
"lib/Resource/ApiKeyUpdatedDataOwner.php",
"lib/Resource/ApiKeyUpdatedDataPreviousAttribute.php",
"lib/Resource/ApiKeyValidationResponse.php",
"lib/Resource/ApplicationCredentialsListItem.php",
"lib/Resource/AssignRole.php",
Expand Down Expand Up @@ -205,9 +209,6 @@
"lib/Resource/DsyncActivated.php",
"lib/Resource/DsyncActivatedData.php",
"lib/Resource/DsyncActivatedDataDomain.php",
"lib/Resource/DsyncDeactivated.php",
"lib/Resource/DsyncDeactivatedData.php",
"lib/Resource/DsyncDeactivatedDataDomain.php",
"lib/Resource/DsyncDeleted.php",
"lib/Resource/DsyncDeletedData.php",
"lib/Resource/DsyncDeletedDataState.php",
Expand All @@ -220,6 +221,10 @@
"lib/Resource/DsyncGroupUserAddedData.php",
"lib/Resource/DsyncGroupUserRemoved.php",
"lib/Resource/DsyncGroupUserRemovedData.php",
"lib/Resource/DsyncTokenCreated.php",
"lib/Resource/DsyncTokenCreatedData.php",
"lib/Resource/DsyncTokenRevoked.php",
"lib/Resource/DsyncTokenRevokedData.php",
"lib/Resource/DsyncUserCreated.php",
"lib/Resource/DsyncUserDeleted.php",
"lib/Resource/DsyncUserUpdated.php",
Expand All @@ -240,6 +245,7 @@
"lib/Resource/EventContextGoogleAnalyticsSession.php",
"lib/Resource/EventListListMetadata.php",
"lib/Resource/EventSchema.php",
"lib/Resource/ExpireApiKey.php",
"lib/Resource/ExternalAuthCompleteResponse.php",
"lib/Resource/FeatureFlag.php",
"lib/Resource/FeatureFlagOwner.php",
Expand Down Expand Up @@ -447,6 +453,7 @@
"lib/Resource/UserApiKeyCreatedDataOwner.php",
"lib/Resource/UserApiKeyOwner.php",
"lib/Resource/UserApiKeyRevokedDataOwner.php",
"lib/Resource/UserApiKeyUpdatedDataOwner.php",
"lib/Resource/UserApiKeyWithValue.php",
"lib/Resource/UserApiKeyWithValueOwner.php",
"lib/Resource/UserAuthenticationFactorEnrollResponse.php",
Expand Down Expand Up @@ -556,6 +563,10 @@
"tests/Fixtures/api_key_revoked.json",
"tests/Fixtures/api_key_revoked_data.json",
"tests/Fixtures/api_key_revoked_data_owner.json",
"tests/Fixtures/api_key_updated.json",
"tests/Fixtures/api_key_updated_data.json",
"tests/Fixtures/api_key_updated_data_owner.json",
"tests/Fixtures/api_key_updated_data_previous_attribute.json",
"tests/Fixtures/api_key_validation_response.json",
"tests/Fixtures/application_credentials_list_item.json",
"tests/Fixtures/assign_role.json",
Expand Down Expand Up @@ -718,9 +729,6 @@
"tests/Fixtures/dsync_activated.json",
"tests/Fixtures/dsync_activated_data.json",
"tests/Fixtures/dsync_activated_data_domain.json",
"tests/Fixtures/dsync_deactivated.json",
"tests/Fixtures/dsync_deactivated_data.json",
"tests/Fixtures/dsync_deactivated_data_domain.json",
"tests/Fixtures/dsync_deleted.json",
"tests/Fixtures/dsync_deleted_data.json",
"tests/Fixtures/dsync_group_created.json",
Expand All @@ -731,6 +739,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_revoked.json",
"tests/Fixtures/dsync_token_revoked_data.json",
"tests/Fixtures/dsync_user_created.json",
"tests/Fixtures/dsync_user_deleted.json",
"tests/Fixtures/dsync_user_updated.json",
Expand All @@ -750,6 +762,7 @@
"tests/Fixtures/event_context_google_analytics_session.json",
"tests/Fixtures/event_list_list_metadata.json",
"tests/Fixtures/event_schema.json",
"tests/Fixtures/expire_api_key.json",
"tests/Fixtures/external_auth_complete_response.json",
"tests/Fixtures/feature_flag.json",
"tests/Fixtures/feature_flag_owner.json",
Expand Down Expand Up @@ -964,6 +977,7 @@
"tests/Fixtures/user_api_key_created_data_owner.json",
"tests/Fixtures/user_api_key_owner.json",
"tests/Fixtures/user_api_key_revoked_data_owner.json",
"tests/Fixtures/user_api_key_updated_data_owner.json",
"tests/Fixtures/user_api_key_with_value.json",
"tests/Fixtures/user_api_key_with_value_owner.json",
"tests/Fixtures/user_authentication_factor_enroll_response.json",
Expand Down Expand Up @@ -1737,6 +1751,10 @@
"sdkMethod": "deleteApiKey",
"service": "apiKeys"
},
"POST /api_keys/{id}/expire": {
"sdkMethod": "createApiKeyExpire",
"service": "apiKeys"
},
"GET /user_management/users/{userId}/api_keys": {
"sdkMethod": "listUserApiKeys",
"service": "userManagement"
Expand Down
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}
8 changes: 4 additions & 4 deletions lib/Resource/ApiKeyCreatedData.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public function __construct(
public string $obfuscatedValue,
/** The timestamp when the API key was last used. */
public ?string $lastUsedAt,
/** Timestamp when the API Key expires. Null means the key does not expire. */
public ?\DateTimeImmutable $expiresAt,
/**
* The permissions granted to the API key.
* @var array<string>
Expand All @@ -33,8 +35,6 @@ public function __construct(
public string $createdAt,
/** The timestamp when the API key was last updated. */
public string $updatedAt,
/** Timestamp when the API Key expires. Null means the key does not expire. */
public ?\DateTimeImmutable $expiresAt = null,
) {
}

Expand All @@ -49,10 +49,10 @@ public static function fromArray(array $data): self
name: $data['name'],
obfuscatedValue: $data['obfuscated_value'],
lastUsedAt: $data['last_used_at'] ?? null,
expiresAt: isset($data['expires_at']) ? new \DateTimeImmutable($data['expires_at']) : null,
permissions: $data['permissions'],
createdAt: $data['created_at'],
updatedAt: $data['updated_at'],
expiresAt: isset($data['expires_at']) ? new \DateTimeImmutable($data['expires_at']) : null,
);
}

Expand All @@ -65,10 +65,10 @@ public function toArray(): array
'name' => $this->name,
'obfuscated_value' => $this->obfuscatedValue,
'last_used_at' => $this->lastUsedAt,
'expires_at' => $this->expiresAt?->format(\DateTimeInterface::RFC3339_EXTENDED),
'permissions' => $this->permissions,
'created_at' => $this->createdAt,
'updated_at' => $this->updatedAt,
'expires_at' => $this->expiresAt?->format(\DateTimeInterface::RFC3339_EXTENDED),
];
}
}
8 changes: 4 additions & 4 deletions lib/Resource/ApiKeyRevokedData.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public function __construct(
public string $obfuscatedValue,
/** The timestamp when the API key was last used. */
public ?string $lastUsedAt,
/** Timestamp when the API Key expires. Null means the key does not expire. */
public ?\DateTimeImmutable $expiresAt,
/**
* The permissions granted to the API key.
* @var array<string>
Expand All @@ -33,8 +35,6 @@ public function __construct(
public string $createdAt,
/** The timestamp when the API key was last updated. */
public string $updatedAt,
/** Timestamp when the API Key expires. Null means the key does not expire. */
public ?\DateTimeImmutable $expiresAt = null,
) {
}

Expand All @@ -49,10 +49,10 @@ public static function fromArray(array $data): self
name: $data['name'],
obfuscatedValue: $data['obfuscated_value'],
lastUsedAt: $data['last_used_at'] ?? null,
expiresAt: isset($data['expires_at']) ? new \DateTimeImmutable($data['expires_at']) : null,
permissions: $data['permissions'],
createdAt: $data['created_at'],
updatedAt: $data['updated_at'],
expiresAt: isset($data['expires_at']) ? new \DateTimeImmutable($data['expires_at']) : null,
);
}

Expand All @@ -65,10 +65,10 @@ public function toArray(): array
'name' => $this->name,
'obfuscated_value' => $this->obfuscatedValue,
'last_used_at' => $this->lastUsedAt,
'expires_at' => $this->expiresAt?->format(\DateTimeInterface::RFC3339_EXTENDED),
'permissions' => $this->permissions,
'created_at' => $this->createdAt,
'updated_at' => $this->updatedAt,
'expires_at' => $this->expiresAt?->format(\DateTimeInterface::RFC3339_EXTENDED),
];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace WorkOS\Resource;

readonly class DsyncDeactivated implements \JsonSerializable
readonly class ApiKeyUpdated implements \JsonSerializable
{
use JsonSerializableTrait;

Expand All @@ -17,7 +17,7 @@ public function __construct(
public string $id,
public string $event,
/** The event payload. */
public DsyncDeactivatedData $data,
public ApiKeyUpdatedData $data,
/** An ISO 8601 timestamp. */
public \DateTimeImmutable $createdAt,
public ?EventContext $context = null,
Expand All @@ -29,8 +29,8 @@ public static function fromArray(array $data): self
return new self(
object: $data['object'] ?? 'event',
id: $data['id'],
event: $data['event'] ?? 'dsync.deactivated',
data: DsyncDeactivatedData::fromArray($data['data']),
event: $data['event'] ?? 'api_key.updated',
data: ApiKeyUpdatedData::fromArray($data['data']),
createdAt: new \DateTimeImmutable($data['created_at']),
context: isset($data['context']) ? EventContext::fromArray($data['context']) : null,
);
Expand Down
78 changes: 78 additions & 0 deletions lib/Resource/ApiKeyUpdatedData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

declare(strict_types=1);

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

namespace WorkOS\Resource;

/** The event payload. */
readonly class ApiKeyUpdatedData 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 owner of the API key. */
public ApiKeyUpdatedDataOwner|UserApiKeyUpdatedDataOwner $owner,
/** The name of the API key. */
public string $name,
/** The obfuscated value of the API key. */
public string $obfuscatedValue,
/** The timestamp when the API key was last used. */
public ?string $lastUsedAt,
/** Timestamp when the API Key expires. Null means the key does not expire. */
public ?\DateTimeImmutable $expiresAt,
/**
* The permissions granted to the API key.
* @var array<string>
*/
public array $permissions,
/** The timestamp when the API key was created. */
public string $createdAt,
/** The timestamp when the API key was last updated. */
public string $updatedAt,
/** Previous API key attributes before the update. */
public ApiKeyUpdatedDataPreviousAttribute $previousAttributes,
) {
}

public static function fromArray(array $data): self
{
return new self(
object: $data['object'] ?? 'api_key',
id: $data['id'],
owner: match ($data['owner']['type'] ?? null) {
'organization' => ApiKeyUpdatedDataOwner::fromArray($data['owner']), 'user' => UserApiKeyUpdatedDataOwner::fromArray($data['owner']), default => throw new \UnexpectedValueException(sprintf('Unknown type: %s', json_encode($data['owner']['type'] ?? null)))
},
name: $data['name'],
obfuscatedValue: $data['obfuscated_value'],
lastUsedAt: $data['last_used_at'] ?? null,
expiresAt: isset($data['expires_at']) ? new \DateTimeImmutable($data['expires_at']) : null,
permissions: $data['permissions'],
createdAt: $data['created_at'],
updatedAt: $data['updated_at'],
previousAttributes: ApiKeyUpdatedDataPreviousAttribute::fromArray($data['previous_attributes']),
);
}

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,
'expires_at' => $this->expiresAt?->format(\DateTimeInterface::RFC3339_EXTENDED),
'permissions' => $this->permissions,
'created_at' => $this->createdAt,
'updated_at' => $this->updatedAt,
'previous_attributes' => $this->previousAttributes->toArray(),
];
}
}
Loading