Download src/Preset/Application/Commands/ListPresetsCommand.php from pnacorp/AIKEEDO: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Preset/Application/Commands/ListPresetsCommand.php
- Command line
-
hf download hf://pnacorp/AIKEEDO/src/Preset/Application/Commands/ListPresetsCommand.php
-
curl -L -o ListPresetsCommand.php https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Preset/Application/Commands/ListPresetsCommand.php
1.46 kB
| declare(strict_types=1); | |
| namespace Preset\Application\Commands; | |
| use Preset\Application\CommandHandlers\ListPresetsCommandHandler; | |
| use Preset\Domain\ValueObjects\SortParameter; | |
| use Shared\Domain\ValueObjects\CursorDirection; | |
| use Shared\Domain\ValueObjects\Id; | |
| use Shared\Domain\ValueObjects\MaxResults; | |
| use Shared\Domain\ValueObjects\SortDirection; | |
| use Shared\Infrastructure\CommandBus\Attributes\Handler; | |
| (ListPresetsCommandHandler::class) | |
| class ListPresetsCommand extends CountPresetsCommand | |
| { | |
| public ?SortParameter $sortParameter = null; | |
| public SortDirection $sortDirection = SortDirection::DESC; | |
| public ?Id $cursor = null; | |
| public ?MaxResults $maxResults = null; | |
| public CursorDirection $cursorDirection = CursorDirection::STARTING_AFTER; | |
| public function __construct() | |
| { | |
| $this->maxResults = new MaxResults(MaxResults::DEFAULT); | |
| } | |
| public function setOrderBy(string $orderBy, string $dir): void | |
| { | |
| $this->sortParameter = SortParameter::from($orderBy); | |
| $this->sortDirection = SortDirection::from(strtoupper($dir)); | |
| } | |
| public function setCursor(string $id, string $dir = 'starting_after'): self | |
| { | |
| $this->cursor = new Id($id); | |
| $this->cursorDirection = CursorDirection::from($dir); | |
| return $this; | |
| } | |
| public function setLimit(int $limit): self | |
| { | |
| $this->maxResults = new MaxResults($limit); | |
| return $this; | |
| } | |
| } | |