Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 70 lines 1.9 kB view raw
1<?php 2 3namespace SocialDept\AtpSchema\Generated\App\Bsky\Actor\Defs; 4 5use Carbon\Carbon; 6use SocialDept\AtpSchema\Data\Data; 7 8/** 9 * GENERATED CODE - DO NOT EDIT 10 * 11 * An individual verification for an associated subject. 12 * 13 * Lexicon: app.bsky.actor.defs.verificationView 14 * Type: object 15 * 16 * @property string $issuer The user who issued this verification. 17 * @property string $uri The AT-URI of the verification record. 18 * @property bool $isValid True if the verification passes validation, otherwise false. 19 * @property Carbon $createdAt Timestamp when the verification was created. 20 * 21 * Constraints: 22 * - Required: issuer, uri, isValid, createdAt 23 * - issuer: Format: did 24 * - uri: Format: at-uri 25 * - createdAt: Format: datetime 26 */ 27class VerificationView extends Data 28{ 29 /** 30 * @param string $issuer The user who issued this verification. 31 * @param string $uri The AT-URI of the verification record. 32 * @param bool $isValid True if the verification passes validation, otherwise false. 33 * @param Carbon $createdAt Timestamp when the verification was created. 34 */ 35 public function __construct( 36 public readonly string $issuer, 37 public readonly string $uri, 38 public readonly bool $isValid, 39 public readonly Carbon $createdAt 40 ) { 41 } 42 43 /** 44 * Get the lexicon NSID for this data type. 45 * 46 * @return string 47 */ 48 public static function getLexicon(): string 49 { 50 return 'app.bsky.actor.defs.verificationView'; 51 } 52 53 54 /** 55 * Create an instance from an array. 56 * 57 * @param array $data The data array 58 * @return static 59 */ 60 public static function fromArray(array $data): static 61 { 62 return new static( 63 issuer: $data['issuer'], 64 uri: $data['uri'], 65 isValid: $data['isValid'], 66 createdAt: Carbon::parse($data['createdAt']) 67 ); 68 } 69 70}