Something went wrong. Try again.
Parse and validate AT Protocol Lexicons with DTO generation for Laravel
Something went wrong. Try again.
2.0 kB · 75 lines
PHP
at dev
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576<?php
namespace SocialDept\AtpSchema\Generated\Tools\Ozone\Moderation\Defs;
use Carbon\Carbon;use SocialDept\AtpSchema\Data\Data;use SocialDept\AtpSchema\Generated\Com\Atproto\Label\Defs\Label;
/** * GENERATED CODE - DO NOT EDIT * * Lexicon: tools.ozone.moderation.defs.recordViewDetail * Type: object * * @property string $uri * @property string $cid * @property mixed $value * @property array $blobs * @property array<Label>|null $labels * @property Carbon $indexedAt * @property mixed $moderation * @property mixed $repo * * Constraints: * - Required: uri, cid, value, blobs, indexedAt, moderation, repo * - uri: Format: at-uri * - cid: Format: cid * - indexedAt: Format: datetime */class RecordViewDetail extends Data{ public function __construct( public readonly string $uri, public readonly string $cid, public readonly mixed $value, public readonly array $blobs, public readonly Carbon $indexedAt, public readonly mixed $moderation, public readonly mixed $repo, public readonly ?array $labels = null ) { }
/** * Get the lexicon NSID for this data type. * * @return string */ public static function getLexicon(): string { return 'tools.ozone.moderation.defs.recordViewDetail'; }
/** * Create an instance from an array. * * @param array $data The data array * @return static */ public static function fromArray(array $data): static { return new static( uri: $data['uri'], cid: $data['cid'], value: $data['value'], blobs: $data['blobs'] ?? [], indexedAt: Carbon::parse($data['indexedAt']), moderation: $data['moderation'], repo: $data['repo'], labels: isset($data['labels']) ? array_map(fn ($item) => Label::fromArray($item), $data['labels']) : [] ); }
}