-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathAuditLogExportJson.php
More file actions
52 lines (45 loc) · 1.65 KB
/
Copy pathAuditLogExportJson.php
File metadata and controls
52 lines (45 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
declare(strict_types=1);
// This file is auto-generated by oagen. Do not edit.
namespace WorkOS\Resource;
readonly class AuditLogExportJson implements \JsonSerializable
{
use JsonSerializableTrait;
public function __construct(
/** Distinguishes the Audit Log Export object. */
public string $object,
/** The unique ID of the Audit Log Export. */
public string $id,
/** The state of the export. Possible values: pending, ready, error. */
public AuditLogExportJsonState $state,
/** An ISO 8601 timestamp. */
public \DateTimeImmutable $createdAt,
/** An ISO 8601 timestamp. */
public \DateTimeImmutable $updatedAt,
/** A URL to the CSV file. Only defined when the Audit Log Export is ready. */
public ?string $url = null,
) {
}
public static function fromArray(array $data): self
{
return new self(
object: $data['object'] ?? 'audit_log_export',
id: $data['id'],
state: AuditLogExportJsonState::from($data['state']),
createdAt: new \DateTimeImmutable($data['created_at']),
updatedAt: new \DateTimeImmutable($data['updated_at']),
url: $data['url'] ?? null,
);
}
public function toArray(): array
{
return [
'object' => $this->object,
'id' => $this->id,
'state' => $this->state->value,
'created_at' => $this->createdAt->format(\DateTimeInterface::RFC3339_EXTENDED),
'updated_at' => $this->updatedAt->format(\DateTimeInterface::RFC3339_EXTENDED),
'url' => $this->url,
];
}
}