-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathAccessCode.php
More file actions
65 lines (55 loc) · 1.8 KB
/
AccessCode.php
File metadata and controls
65 lines (55 loc) · 1.8 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
<?php
namespace Seam\Objects;
class AccessCode
{
public static function from_json(mixed $json): AccessCode|null
{
if (!$json) {
return null;
}
return new self(
access_code_id: $json->access_code_id ?? null,
name: $json->name ?? null,
created_at: $json->created_at ?? null,
type: $json->type ?? null,
code: $json->code ?? null,
status: $json->status ?? null,
starts_at: $json->starts_at ?? null,
ends_at: $json->ends_at ?? null,
errors: array_map(
fn($e) => SeamError::from_json($e),
$json->errors ?? []
),
warnings: array_map(
fn($e) => SeamWarning::from_json($e),
$json->warnings ?? []
)
);
}
public function __construct(
public string $access_code_id,
public string | null $name,
/* "time_bound" or "ongoing" */
public string $type,
/*
* The status of an access code on the device.
* unset -> setting -> set -> unset OR "unknown" if the account is disconnected
*/
public string $status,
/* In ISO8601 timestamp format, only for time_bound codes */
public string|null $starts_at,
/* In ISO8601 timestamp format, only for time_bound codes */
public string|null $ends_at,
/*
* The 4-8 digit code assigned to the device, note that this isn't always
* immediately available after creating the access code.
*/
public string|null $code,
public string $created_at,
/* @var SeamError[] */
public array $errors,
/* @var SeamWarning[] */
public array $warnings
) {
}
}