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