Laravel AT Protocol Client (alpha & unstable)
1<?php
2
3namespace SocialDept\AtpClient\Data\Responses\Ozone\Server;
4
5use Illuminate\Contracts\Support\Arrayable;
6use SocialDept\AtpSchema\Generated\Tools\Ozone\Server\GetConfig\ServiceConfig;
7use SocialDept\AtpSchema\Generated\Tools\Ozone\Server\GetConfig\ViewerConfig;
8
9/**
10 * @implements Arrayable<string, mixed>
11 */
12class GetConfigResponse implements Arrayable
13{
14 public function __construct(
15 public readonly ?ServiceConfig $appview = null,
16 public readonly ?ServiceConfig $pds = null,
17 public readonly ?ServiceConfig $blobDivert = null,
18 public readonly ?ServiceConfig $chat = null,
19 public readonly ?ViewerConfig $viewer = null,
20 public readonly ?string $verifierDid = null,
21 ) {}
22
23 public static function fromArray(array $data): self
24 {
25 return new self(
26 appview: isset($data['appview']) ? ServiceConfig::fromArray($data['appview']) : null,
27 pds: isset($data['pds']) ? ServiceConfig::fromArray($data['pds']) : null,
28 blobDivert: isset($data['blobDivert']) ? ServiceConfig::fromArray($data['blobDivert']) : null,
29 chat: isset($data['chat']) ? ServiceConfig::fromArray($data['chat']) : null,
30 viewer: isset($data['viewer']) ? ViewerConfig::fromArray($data['viewer']) : null,
31 verifierDid: $data['verifierDid'] ?? null,
32 );
33 }
34
35 public function toArray(): array
36 {
37 return [
38 'appview' => $this->appview?->toArray(),
39 'pds' => $this->pds?->toArray(),
40 'blobDivert' => $this->blobDivert?->toArray(),
41 'chat' => $this->chat?->toArray(),
42 'viewer' => $this->viewer?->toArray(),
43 'verifierDid' => $this->verifierDid,
44 ];
45 }
46}