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