Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 71 lines 1.7 kB view raw
1<?php 2 3namespace SocialDept\AtpSchema\Generated\Tools\Ozone\Moderation\Defs; 4 5use Carbon\Carbon; 6use SocialDept\AtpSchema\Data\Data; 7 8/** 9 * GENERATED CODE - DO NOT EDIT 10 * 11 * Lexicon: tools.ozone.moderation.defs.recordView 12 * Type: object 13 * 14 * @property string $uri 15 * @property string $cid 16 * @property mixed $value 17 * @property array<string> $blobCids 18 * @property Carbon $indexedAt 19 * @property mixed $moderation 20 * @property mixed $repo 21 * 22 * Constraints: 23 * - Required: uri, cid, value, blobCids, indexedAt, moderation, repo 24 * - uri: Format: at-uri 25 * - cid: Format: cid 26 * - indexedAt: Format: datetime 27 */ 28class RecordView extends Data 29{ 30 public function __construct( 31 public readonly string $uri, 32 public readonly string $cid, 33 public readonly mixed $value, 34 public readonly array $blobCids, 35 public readonly Carbon $indexedAt, 36 public readonly mixed $moderation, 37 public readonly mixed $repo 38 ) { 39 } 40 41 /** 42 * Get the lexicon NSID for this data type. 43 * 44 * @return string 45 */ 46 public static function getLexicon(): string 47 { 48 return 'tools.ozone.moderation.defs.recordView'; 49 } 50 51 52 /** 53 * Create an instance from an array. 54 * 55 * @param array $data The data array 56 * @return static 57 */ 58 public static function fromArray(array $data): static 59 { 60 return new static( 61 uri: $data['uri'], 62 cid: $data['cid'], 63 value: $data['value'], 64 blobCids: $data['blobCids'], 65 indexedAt: Carbon::parse($data['indexedAt']), 66 moderation: $data['moderation'], 67 repo: $data['repo'] 68 ); 69 } 70 71}