Parse and validate AT Protocol Lexicons with DTO generation for Laravel
1<?php
2
3namespace SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs;
4
5use SocialDept\AtpSchema\Data\Data;
6use SocialDept\AtpSchema\Generated\App\Bsky\Graph\Defs\ListViewBasic;
7use SocialDept\AtpSchema\Generated\App\Bsky\Notification\Defs\ActivitySubscription;
8
9/**
10 * GENERATED CODE - DO NOT EDIT
11 *
12 * Metadata about the requesting account's relationship with the subject
13 * account. Only has meaningful content for authed requests.
14 *
15 * Lexicon: app.bsky.actor.defs.viewerState
16 * Type: object
17 *
18 * @property bool|null $muted
19 * @property ListViewBasic|null $mutedByList
20 * @property bool|null $blockedBy
21 * @property string|null $blocking
22 * @property ListViewBasic|null $blockingByList
23 * @property string|null $following
24 * @property string|null $followedBy
25 * @property mixed $knownFollowers This property is present only in selected cases, as an optimization.
26 * @property ActivitySubscription|null $activitySubscription This property is present only in selected cases, as an optimization.
27 *
28 * Constraints:
29 * - blocking: Format: at-uri
30 * - following: Format: at-uri
31 * - followedBy: Format: at-uri
32 */
33class ViewerState extends Data
34{
35 /**
36 * @param mixed $knownFollowers This property is present only in selected cases, as an optimization.
37 * @param ActivitySubscription|null $activitySubscription This property is present only in selected cases, as an optimization.
38 */
39 public function __construct(
40 public readonly ?bool $muted = null,
41 public readonly ?ListViewBasic $mutedByList = null,
42 public readonly ?bool $blockedBy = null,
43 public readonly ?string $blocking = null,
44 public readonly ?ListViewBasic $blockingByList = null,
45 public readonly ?string $following = null,
46 public readonly ?string $followedBy = null,
47 public readonly mixed $knownFollowers = null,
48 public readonly ?ActivitySubscription $activitySubscription = null
49 ) {
50 }
51
52 /**
53 * Get the lexicon NSID for this data type.
54 *
55 * @return string
56 */
57 public static function getLexicon(): string
58 {
59 return 'app.bsky.actor.defs.viewerState';
60 }
61
62
63 /**
64 * Create an instance from an array.
65 *
66 * @param array $data The data array
67 * @return static
68 */
69 public static function fromArray(array $data): static
70 {
71 return new static(
72 muted: $data['muted'] ?? null,
73 mutedByList: isset($data['mutedByList']) ? ListViewBasic::fromArray($data['mutedByList']) : null,
74 blockedBy: $data['blockedBy'] ?? null,
75 blocking: $data['blocking'] ?? null,
76 blockingByList: isset($data['blockingByList']) ? ListViewBasic::fromArray($data['blockingByList']) : null,
77 following: $data['following'] ?? null,
78 followedBy: $data['followedBy'] ?? null,
79 knownFollowers: $data['knownFollowers'] ?? null,
80 activitySubscription: isset($data['activitySubscription']) ? ActivitySubscription::fromArray($data['activitySubscription']) : null
81 );
82 }
83
84}