refactor(core): enhance SDK structure and documentation
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
46
src/Requests/Escrow/GetEscrowOrdersRequest.php
Normal file
46
src/Requests/Escrow/GetEscrowOrdersRequest.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Apoloz\AlfaBank\Requests\Escrow;
|
||||
|
||||
use Apoloz\AlfaBank\Data\Escrow\EscrowOrderData;
|
||||
use Apoloz\AlfaBank\Traits\HasAlfaPagination;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Http\Response;
|
||||
use Saloon\PaginationPlugin\Contracts\Paginatable;
|
||||
use Spatie\LaravelData\DataCollection;
|
||||
|
||||
class GetEscrowOrdersRequest extends Request implements Paginatable
|
||||
{
|
||||
use HasAlfaPagination;
|
||||
|
||||
protected Method $method = Method::GET;
|
||||
|
||||
public function __construct(
|
||||
protected string $filterFromDate,
|
||||
protected string $filterToDate,
|
||||
?int $limit = 10,
|
||||
?int $offset = 0
|
||||
) {
|
||||
$this->limit = $limit;
|
||||
$this->offset = $offset;
|
||||
}
|
||||
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
return '/api/escrow-orders';
|
||||
}
|
||||
|
||||
protected function defaultQuery(): array
|
||||
{
|
||||
return array_merge([
|
||||
'filterFromDate' => $this->filterFromDate,
|
||||
'filterToDate' => $this->filterToDate,
|
||||
], $this->getPaginationQuery());
|
||||
}
|
||||
|
||||
public function createDtoFromResponse(Response $response): DataCollection
|
||||
{
|
||||
return EscrowOrderData::collect($response->json('orders') ?? [], DataCollection::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user