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