|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +// This file is auto-generated by oagen. Do not edit. |
| 6 | + |
| 7 | +namespace WorkOS\Resource; |
| 8 | + |
| 9 | +readonly class Group implements \JsonSerializable |
| 10 | +{ |
| 11 | + use JsonSerializableTrait; |
| 12 | + |
| 13 | + public function __construct( |
| 14 | + /** The Group object. */ |
| 15 | + public string $object, |
| 16 | + /** The unique ID of the Group. */ |
| 17 | + public string $id, |
| 18 | + /** The ID of the Organization the Group belongs to. */ |
| 19 | + public string $organizationId, |
| 20 | + /** The name of the Group. */ |
| 21 | + public string $name, |
| 22 | + /** An optional description of the Group. */ |
| 23 | + public ?string $description, |
| 24 | + /** An ISO 8601 timestamp. */ |
| 25 | + public \DateTimeImmutable $createdAt, |
| 26 | + /** An ISO 8601 timestamp. */ |
| 27 | + public \DateTimeImmutable $updatedAt, |
| 28 | + ) { |
| 29 | + } |
| 30 | + |
| 31 | + public static function fromArray(array $data): self |
| 32 | + { |
| 33 | + return new self( |
| 34 | + object: $data['object'], |
| 35 | + id: $data['id'], |
| 36 | + organizationId: $data['organization_id'], |
| 37 | + name: $data['name'], |
| 38 | + description: $data['description'] ?? null, |
| 39 | + createdAt: new \DateTimeImmutable($data['created_at']), |
| 40 | + updatedAt: new \DateTimeImmutable($data['updated_at']), |
| 41 | + ); |
| 42 | + } |
| 43 | + |
| 44 | + public function toArray(): array |
| 45 | + { |
| 46 | + return [ |
| 47 | + 'object' => $this->object, |
| 48 | + 'id' => $this->id, |
| 49 | + 'organization_id' => $this->organizationId, |
| 50 | + 'name' => $this->name, |
| 51 | + 'description' => $this->description, |
| 52 | + 'created_at' => $this->createdAt->format(\DateTimeInterface::RFC3339_EXTENDED), |
| 53 | + 'updated_at' => $this->updatedAt->format(\DateTimeInterface::RFC3339_EXTENDED), |
| 54 | + ]; |
| 55 | + } |
| 56 | +} |
0 commit comments