Parse and validate AT Protocol Lexicons with DTO generation for Laravel
at main 75 lines 3.0 kB view raw
1<?php 2 3namespace SocialDept\AtpSchema\Generated\Com\Atproto\Label\Defs; 4 5use SocialDept\AtpSchema\Data\Data; 6 7/** 8 * GENERATED CODE - DO NOT EDIT 9 * 10 * Declares a label value and its expected interpretations and behaviors. 11 * 12 * Lexicon: com.atproto.label.defs.labelValueDefinition 13 * Type: object 14 * 15 * @property string $identifier The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+). 16 * @property string $severity How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing. 17 * @property string $blurs What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. 18 * @property string|null $defaultSetting The default setting for this label. 19 * @property bool|null $adultOnly Does the user need to have adult content enabled in order to configure this label? 20 * @property array $locales 21 * 22 * Constraints: 23 * - Required: identifier, severity, blurs, locales 24 * - identifier: Max length: 100 25 * - identifier: Max graphemes: 100 26 */ 27class LabelValueDefinition extends Data 28{ 29 /** 30 * @param string $identifier The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+). 31 * @param string $severity How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing. 32 * @param string $blurs What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. 33 * @param string|null $defaultSetting The default setting for this label. 34 * @param bool|null $adultOnly Does the user need to have adult content enabled in order to configure this label? 35 */ 36 public function __construct( 37 public readonly string $identifier, 38 public readonly string $severity, 39 public readonly string $blurs, 40 public readonly array $locales, 41 public readonly ?string $defaultSetting = null, 42 public readonly ?bool $adultOnly = null 43 ) { 44 } 45 46 /** 47 * Get the lexicon NSID for this data type. 48 * 49 * @return string 50 */ 51 public static function getLexicon(): string 52 { 53 return 'com.atproto.label.defs.labelValueDefinition'; 54 } 55 56 57 /** 58 * Create an instance from an array. 59 * 60 * @param array $data The data array 61 * @return static 62 */ 63 public static function fromArray(array $data): static 64 { 65 return new static( 66 identifier: $data['identifier'], 67 severity: $data['severity'], 68 blurs: $data['blurs'], 69 locales: $data['locales'] ?? [], 70 defaultSetting: $data['defaultSetting'] ?? null, 71 adultOnly: $data['adultOnly'] ?? null 72 ); 73 } 74 75}