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