Parse and validate AT Protocol Lexicons with DTO generation for Laravel
1<?php
2
3namespace SocialDept\AtpSchema\Generated\App\Bsky\Embed;
4
5use SocialDept\AtpSchema\Data\BlobReference;
6use SocialDept\AtpSchema\Data\Data;
7use SocialDept\AtpSchema\Generated\App\Bsky\Embed\Defs\AspectRatio;
8
9/**
10 * GENERATED CODE - DO NOT EDIT
11 *
12 * A video embedded in a Bluesky record (eg, a post).
13 *
14 * Lexicon: app.bsky.embed.video
15 * Type: object
16 *
17 * @property BlobReference $video The mp4 video file. May be up to 100mb, formerly limited to 50mb.
18 * @property array<Caption>|null $captions
19 * @property string|null $alt Alt text description of the video, for accessibility.
20 * @property AspectRatio|null $aspectRatio
21 *
22 * Constraints:
23 * - Required: video
24 * - captions: Max length: 20
25 * - alt: Max length: 10000
26 * - alt: Max graphemes: 1000
27 */
28class Video extends Data
29{
30 /**
31 * @param BlobReference $video The mp4 video file. May be up to 100mb, formerly limited to 50mb.
32 * @param string|null $alt Alt text description of the video, for accessibility.
33 */
34 public function __construct(
35 public readonly BlobReference $video,
36 public readonly ?array $captions = null,
37 public readonly ?string $alt = null,
38 public readonly ?AspectRatio $aspectRatio = null
39 ) {
40 }
41
42 /**
43 * Get the lexicon NSID for this data type.
44 *
45 * @return string
46 */
47 public static function getLexicon(): string
48 {
49 return 'app.bsky.embed.video';
50 }
51
52
53 /**
54 * Create an instance from an array.
55 *
56 * @param array $data The data array
57 * @return static
58 */
59 public static function fromArray(array $data): static
60 {
61 return new static(
62 video: $data['video'],
63 captions: $data['captions'] ?? [],
64 alt: $data['alt'] ?? null,
65 aspectRatio: isset($data['aspectRatio']) ? AspectRatio::fromArray($data['aspectRatio']) : null
66 );
67 }
68
69}