Skip to content

Commit 8676620

Browse files
committed
add endpoint for fetching a single allocation
1 parent 8c2545e commit 8676620

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/Requests/GetAllocation.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
3+
namespace Spatie\FloatSdk\Requests;
4+
5+
use Saloon\Enums\Method;
6+
use Saloon\Http\Request;
7+
use Saloon\Http\Response;
8+
use Spatie\FloatSdk\Resources\AllocationResource;
9+
10+
class GetAllocation extends Request
11+
{
12+
protected Method $method = Method::GET;
13+
14+
public function __construct(protected int $id) {}
15+
16+
public function resolveEndpoint(): string
17+
{
18+
return "/tasks/{$this->id}";
19+
}
20+
21+
public function createDtoFromResponse(Response $response): AllocationResource
22+
{
23+
return AllocationResource::createFromResponse($response->json());
24+
}
25+
}

0 commit comments

Comments
 (0)