refactor(core): enhance SDK structure and documentation
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
@@ -2,20 +2,27 @@
|
||||
|
||||
namespace Apoloz\AlfaBank\Requests\Webhooks;
|
||||
|
||||
use Apoloz\AlfaBank\Data\WebhookCollectionData;
|
||||
use Apoloz\AlfaBank\Data\Webhooks\Subscriptions\WebhookSubscriptionData;
|
||||
use Apoloz\AlfaBank\Traits\HasAlfaPagination;
|
||||
use Saloon\Enums\Method;
|
||||
use Saloon\Http\Request;
|
||||
use Saloon\Http\Response;
|
||||
use Spatie\LaravelData\DataCollection;
|
||||
|
||||
class GetWebhooksRequest extends Request
|
||||
{
|
||||
use HasAlfaPagination;
|
||||
|
||||
protected Method $method = Method::GET;
|
||||
|
||||
public function __construct(
|
||||
protected ?int $offset = 0,
|
||||
protected ?int $limit = 20,
|
||||
protected ?string $object = null
|
||||
) {}
|
||||
protected ?string $object = null,
|
||||
?int $limit = 20,
|
||||
?int $offset = 0
|
||||
) {
|
||||
$this->limit = $limit;
|
||||
$this->offset = $offset;
|
||||
}
|
||||
|
||||
public function resolveEndpoint(): string
|
||||
{
|
||||
@@ -24,15 +31,13 @@ class GetWebhooksRequest extends Request
|
||||
|
||||
protected function defaultQuery(): array
|
||||
{
|
||||
return array_filter([
|
||||
'offset' => $this->offset,
|
||||
'limit' => $this->limit,
|
||||
return array_filter(array_merge([
|
||||
'object' => $this->object,
|
||||
]);
|
||||
], $this->getPaginationQuery()));
|
||||
}
|
||||
|
||||
public function createDtoFromResponse(Response $response): WebhookCollectionData
|
||||
public function createDtoFromResponse(Response $response): DataCollection
|
||||
{
|
||||
return WebhookCollectionData::from($response->json());
|
||||
return WebhookSubscriptionData::collect($response->json(), DataCollection::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user