Parse and validate AT Protocol Lexicons with DTO generation for Laravel
1<?php
2
3namespace SocialDept\AtpSchema\Generated\App\Bsky\Embed\External;
4
5use SocialDept\AtpSchema\Data\BlobReference;
6use SocialDept\AtpSchema\Data\Data;
7
8/**
9 * GENERATED CODE - DO NOT EDIT
10 *
11 * Lexicon: app.bsky.embed.external.external
12 * Type: object
13 *
14 * @property string $uri
15 * @property string $title
16 * @property string $description
17 * @property BlobReference|null $thumb
18 *
19 * Constraints:
20 * - Required: uri, title, description
21 * - uri: Format: uri
22 */
23class External extends Data
24{
25 public function __construct(
26 public readonly string $uri,
27 public readonly string $title,
28 public readonly string $description,
29 public readonly ?BlobReference $thumb = 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.embed.external.external';
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 uri: $data['uri'],
54 title: $data['title'],
55 description: $data['description'],
56 thumb: $data['thumb'] ?? null
57 );
58 }
59
60}