-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathApiKeyRevokedData.php
More file actions
68 lines (61 loc) · 2.08 KB
/
Copy pathApiKeyRevokedData.php
File metadata and controls
68 lines (61 loc) · 2.08 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
declare(strict_types=1);
// This file is auto-generated by oagen. Do not edit.
namespace WorkOS\Resource;
/** The event payload. */
readonly class ApiKeyRevokedData 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 ApiKeyRevokedDataOwner $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,
/**
* 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,
) {
}
public static function fromArray(array $data): self
{
return new self(
object: $data['object'] ?? 'api_key',
id: $data['id'],
owner: ApiKeyRevokedDataOwner::fromArray($data['owner']),
name: $data['name'],
obfuscatedValue: $data['obfuscated_value'],
lastUsedAt: $data['last_used_at'] ?? null,
permissions: $data['permissions'],
createdAt: $data['created_at'],
updatedAt: $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,
'permissions' => $this->permissions,
'created_at' => $this->createdAt,
'updated_at' => $this->updatedAt,
];
}
}