Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 52 lines 957 B view raw
1<?php 2 3namespace SocialDept\AtpSchema\Generated\App\Bsky\Embed; 4 5use SocialDept\AtpSchema\Data\Data; 6 7/** 8 * GENERATED CODE - DO NOT EDIT 9 * 10 * A set of images embedded in a Bluesky record (eg, a post). 11 * 12 * Lexicon: app.bsky.embed.images 13 * Type: object 14 * 15 * @property array<Image> $images 16 * 17 * Constraints: 18 * - Required: images 19 * - images: Max length: 4 20 */ 21class Images extends Data 22{ 23 public function __construct( 24 public readonly array $images 25 ) { 26 } 27 28 /** 29 * Get the lexicon NSID for this data type. 30 * 31 * @return string 32 */ 33 public static function getLexicon(): string 34 { 35 return 'app.bsky.embed.images'; 36 } 37 38 39 /** 40 * Create an instance from an array. 41 * 42 * @param array $data The data array 43 * @return static 44 */ 45 public static function fromArray(array $data): static 46 { 47 return new static( 48 images: $data['images'] ?? [] 49 ); 50 } 51 52}