Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 64 lines 1.5 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 * Logs lifecycle event on a record subject. Normally captured by automod from 12 * the firehose and emitted to ozone for historical tracking. 13 * 14 * Lexicon: tools.ozone.moderation.defs.recordEvent 15 * Type: object 16 * 17 * @property string|null $comment 18 * @property string $op 19 * @property string|null $cid 20 * @property Carbon $timestamp 21 * 22 * Constraints: 23 * - Required: timestamp, op 24 * - cid: Format: cid 25 * - timestamp: Format: datetime 26 */ 27class RecordEvent extends Data 28{ 29 public function __construct( 30 public readonly string $op, 31 public readonly Carbon $timestamp, 32 public readonly ?string $comment = null, 33 public readonly ?string $cid = null 34 ) { 35 } 36 37 /** 38 * Get the lexicon NSID for this data type. 39 * 40 * @return string 41 */ 42 public static function getLexicon(): string 43 { 44 return 'tools.ozone.moderation.defs.recordEvent'; 45 } 46 47 48 /** 49 * Create an instance from an array. 50 * 51 * @param array $data The data array 52 * @return static 53 */ 54 public static function fromArray(array $data): static 55 { 56 return new static( 57 op: $data['op'], 58 timestamp: Carbon::parse($data['timestamp']), 59 comment: $data['comment'] ?? null, 60 cid: $data['cid'] ?? null 61 ); 62 } 63 64}