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;
6
7/**
8 * GENERATED CODE - DO NOT EDIT
9 *
10 * Lexicon: app.bsky.actor.defs.contentLabelPref
11 * Type: object
12 *
13 * @property string|null $labelerDid Which labeler does this preference apply to? If undefined, applies globally.
14 * @property string $label
15 * @property string $visibility
16 *
17 * Constraints:
18 * - Required: label, visibility
19 * - labelerDid: Format: did
20 */
21class ContentLabelPref extends Data
22{
23 /**
24 * @param string|null $labelerDid Which labeler does this preference apply to? If undefined, applies globally.
25 */
26 public function __construct(
27 public readonly string $label,
28 public readonly string $visibility,
29 public readonly ?string $labelerDid = null
30 ) {
31 }
32
33 /**
34 * Get the lexicon NSID for this data type.
35 *
36 * @return string
37 */
38 public static function getLexicon(): string
39 {
40 return 'app.bsky.actor.defs.contentLabelPref';
41 }
42
43
44 /**
45 * Create an instance from an array.
46 *
47 * @param array $data The data array
48 * @return static
49 */
50 public static function fromArray(array $data): static
51 {
52 return new static(
53 label: $data['label'],
54 visibility: $data['visibility'],
55 labelerDid: $data['labelerDid'] ?? null
56 );
57 }
58
59}