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