-
Notifications
You must be signed in to change notification settings - Fork 18
feat(generated): Add new classes and fields for API key validation and dsync tokens #378
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?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 92db0495807c86fbbc4d45bd266a6c1f5bcbb59c | ||
| f908f520f9fcd63dfd42ed35b7f141a65b61609b |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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'], | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 ApiKeyCreatedData::fromArray passes raw array to typed ApiKeyCreatedDataOwner parameter The
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||
| name: $data['name'], | ||||||
| obfuscatedValue: $data['obfuscated_value'], | ||||||
| lastUsedAt: $data['last_used_at'] ?? null, | ||||||
|
|
@@ -56,7 +56,7 @@ public function toArray(): array | |||||
| return [ | ||||||
| 'object' => $this->object, | ||||||
| 'id' => $this->id, | ||||||
| 'owner' => $this->owner->toArray(), | ||||||
| 'owner' => $this->owner, | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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,
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||
| 'name' => $this->name, | ||||||
| 'obfuscated_value' => $this->obfuscatedValue, | ||||||
| 'last_used_at' => $this->lastUsedAt, | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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'], | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Same issue as
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 ApiKeyRevokedData::fromArray passes raw array to typed ApiKeyRevokedDataOwner parameter Identical issue to
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||||||
| name: $data['name'], | ||||||||||
| obfuscatedValue: $data['obfuscated_value'], | ||||||||||
| lastUsedAt: $data['last_used_at'] ?? null, | ||||||||||
|
|
@@ -56,7 +56,7 @@ public function toArray(): array | |||||||||
| return [ | ||||||||||
| 'object' => $this->object, | ||||||||||
| 'id' => $this->id, | ||||||||||
| 'owner' => $this->owner->toArray(), | ||||||||||
| 'owner' => $this->owner, | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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,
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. |
||||||||||
| 'name' => $this->name, | ||||||||||
| 'obfuscated_value' => $this->obfuscatedValue, | ||||||||||
| 'last_used_at' => $this->lastUsedAt, | ||||||||||
|
|
||||||||||
| 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), | ||
| ]; | ||
| } | ||
| } |
| 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, | ||
| ]; | ||
| } | ||
| } |
| 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(), | ||
| ]; | ||
| } | ||
| } |
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.
ApiKeyCreatedDataOwnerproperty$data['owner']is a plain array, but the constructor declaresownerasApiKeyCreatedDataOwner. PHP will throw aTypeErrorat runtime on any call toApiKeyCreatedData::fromArray(). The diff removed theApiKeyCreatedDataOwner::fromArray($data['owner'])call that was there before.