-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathConnectedAccount.php
More file actions
54 lines (51 loc) · 1.91 KB
/
Copy pathConnectedAccount.php
File metadata and controls
54 lines (51 loc) · 1.91 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
<?php
namespace Seam\Objects;
class ConnectedAccount
{
public static function from_json(mixed $json): ConnectedAccount|null
{
if (!$json) {
return null;
}
return new self(
accepted_capabilities: $json->accepted_capabilities,
account_type_display_name: $json->account_type_display_name,
automatically_manage_new_devices: $json->automatically_manage_new_devices,
connected_account_id: $json->connected_account_id,
custom_metadata: $json->custom_metadata,
display_name: $json->display_name,
errors: array_map(
fn($e) => ConnectedAccountErrors::from_json($e),
$json->errors ?? [],
),
warnings: array_map(
fn($w) => ConnectedAccountWarnings::from_json($w),
$json->warnings ?? [],
),
account_type: $json->account_type ?? null,
created_at: $json->created_at ?? null,
customer_key: $json->customer_key ?? null,
image_url: $json->image_url ?? null,
user_identifier: isset($json->user_identifier)
? ConnectedAccountUserIdentifier::from_json(
$json->user_identifier,
)
: null,
);
}
public function __construct(
public array $accepted_capabilities,
public string $account_type_display_name,
public bool $automatically_manage_new_devices,
public string $connected_account_id,
public mixed $custom_metadata,
public string $display_name,
public array $errors,
public array $warnings,
public string|null $account_type,
public string|null $created_at,
public string|null $customer_key,
public string|null $image_url,
public ConnectedAccountUserIdentifier|null $user_identifier,
) {}
}