-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathDataIntegrationAccessTokenResponseAccessToken.php
More file actions
55 lines (48 loc) · 1.66 KB
/
DataIntegrationAccessTokenResponseAccessToken.php
File metadata and controls
55 lines (48 loc) · 1.66 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
<?php
declare(strict_types=1);
// This file is auto-generated by oagen. Do not edit.
namespace WorkOS\Resource;
/** The [access token](https://workos.com/docs/reference/pipes/access-token) object, present when `active` is `true`. */
readonly class DataIntegrationAccessTokenResponseAccessToken implements \JsonSerializable
{
use JsonSerializableTrait;
public function __construct(
/** Distinguishes the access token object. */
public string $object,
/** The OAuth access token for the connected integration. */
public string $accessToken,
/** The ISO-8601 formatted timestamp indicating when the access token expires. */
public ?string $expiresAt,
/**
* The scopes granted to the access token.
* @var array<string>
*/
public array $scopes,
/**
* If the integration has requested scopes that aren't present on the access token, they're listed here.
* @var array<string>
*/
public array $missingScopes,
) {
}
public static function fromArray(array $data): self
{
return new self(
object: $data['object'],
accessToken: $data['access_token'],
expiresAt: $data['expires_at'] ?? null,
scopes: $data['scopes'],
missingScopes: $data['missing_scopes'],
);
}
public function toArray(): array
{
return [
'object' => $this->object,
'access_token' => $this->accessToken,
'expires_at' => $this->expiresAt,
'scopes' => $this->scopes,
'missing_scopes' => $this->missingScopes,
];
}
}