Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 66 lines 2.2 kB view raw
1<?php 2 3namespace SocialDept\AtpSchema\Generated\App\Bsky\Embed\Images; 4 5use SocialDept\AtpSchema\Data\Data; 6use SocialDept\AtpSchema\Generated\App\Bsky\Embed\Defs\AspectRatio; 7 8/** 9 * GENERATED CODE - DO NOT EDIT 10 * 11 * Lexicon: app.bsky.embed.images.viewImage 12 * Type: object 13 * 14 * @property string $thumb Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View. 15 * @property string $fullsize Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. 16 * @property string $alt Alt text description of the image, for accessibility. 17 * @property AspectRatio|null $aspectRatio 18 * 19 * Constraints: 20 * - Required: thumb, fullsize, alt 21 * - thumb: Format: uri 22 * - fullsize: Format: uri 23 */ 24class ViewImage extends Data 25{ 26 /** 27 * @param string $thumb Fully-qualified URL where a thumbnail of the image can be fetched. For example, CDN location provided by the App View. 28 * @param string $fullsize Fully-qualified URL where a large version of the image can be fetched. May or may not be the exact original blob. For example, CDN location provided by the App View. 29 * @param string $alt Alt text description of the image, for accessibility. 30 */ 31 public function __construct( 32 public readonly string $thumb, 33 public readonly string $fullsize, 34 public readonly string $alt, 35 public readonly ?AspectRatio $aspectRatio = null 36 ) { 37 } 38 39 /** 40 * Get the lexicon NSID for this data type. 41 * 42 * @return string 43 */ 44 public static function getLexicon(): string 45 { 46 return 'app.bsky.embed.images.viewImage'; 47 } 48 49 50 /** 51 * Create an instance from an array. 52 * 53 * @param array $data The data array 54 * @return static 55 */ 56 public static function fromArray(array $data): static 57 { 58 return new static( 59 thumb: $data['thumb'], 60 fullsize: $data['fullsize'], 61 alt: $data['alt'], 62 aspectRatio: isset($data['aspectRatio']) ? AspectRatio::fromArray($data['aspectRatio']) : null 63 ); 64 } 65 66}