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