Skip to content

Commit c926806

Browse files
committed
Voeg verhuurcontracten log call toe
1 parent c8e1e5e commit c926806

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<?php
2+
3+
namespace Koba\ToolboxClient\Directories\Verhuurcontracten\AddLog;
4+
5+
use Koba\ToolboxClient\Call\AbstractCall;
6+
use Koba\ToolboxClient\Directories\Verhuurcontracten\VerhuurcontractenDirectory;
7+
use Koba\ToolboxClient\Request\HttpMethod;
8+
use Psr\Http\Message\ResponseInterface;
9+
10+
class AddLogCall extends AbstractCall
11+
{
12+
protected int $contractId;
13+
protected int $status;
14+
protected ?string $statusOmschrijving = null;
15+
16+
public function setContractId(int $contractId): self
17+
{
18+
$this->contractId = $contractId;
19+
return $this;
20+
}
21+
22+
public function setStatus(int $status): self
23+
{
24+
$this->status = $status;
25+
return $this;
26+
}
27+
28+
public function setStatusOmschrijving(?string $omschrijving): self
29+
{
30+
$this->statusOmschrijving = $omschrijving;
31+
return $this;
32+
}
33+
34+
public static function make(
35+
VerhuurcontractenDirectory $directory,
36+
int $contractId,
37+
int $status,
38+
): self {
39+
return (new self($directory))
40+
->setContractId($contractId)
41+
->setStatus($status);
42+
}
43+
44+
protected function getMethod(): HttpMethod
45+
{
46+
return HttpMethod::PUT;
47+
}
48+
49+
protected function getEndpoint(): string
50+
{
51+
return "v1/verhuurcontrantacten/contract/{$this->contractId}/log";
52+
}
53+
54+
/**
55+
* @return array<string,mixed>
56+
*/
57+
protected function getBody(): array
58+
{
59+
return [
60+
'status' => $this->status,
61+
'status_omschrijving' => $this->statusOmschrijving,
62+
];
63+
}
64+
65+
public function send(): ResponseInterface
66+
{
67+
return $this->performRequest();
68+
}
69+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace Koba\ToolboxClient\Directories\Verhuurcontracten;
4+
5+
use Koba\ToolboxClient\Directories\Verhuurcontracten\AddLog\AddLogCall;
6+
use Koba\ToolboxClient\Directory\Directory;
7+
8+
class VerhuurcontractenDirectory extends Directory
9+
{
10+
public function addLog(int $contractId, int $status): AddLogCall
11+
{
12+
return AddLogCall::make($this, $contractId, $status);
13+
}
14+
}

src/ToolboxClient/Scopes/Scope.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ enum Scope: string
88
case CONTACTPERSONEN = 'contactpersonen';
99
case INSTELLINGSNUMMERS = 'instellingsnummers';
1010
case INVENTARIS = 'inventaris';
11+
case VERHUURCONTRACTEN_GOEDKEUREN = 'verhuurcontracten.goedkeuren';
1112
}

src/ToolboxClient/ToolboxClient.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Koba\ToolboxClient\Directories\Instellingsnummers\InstellingsnummersDirectory;
88
use Koba\ToolboxClient\Directories\Inventaris\InventarisDirectory;
99
use Koba\ToolboxClient\Directories\Statistieken\StatistiekenDirectory;
10+
use Koba\ToolboxClient\Directories\Verhuurcontracten\VerhuurcontractenDirectory;
1011
use Koba\ToolboxClient\Request\EncapsulatedRequestFactory;
1112
use Psr\Http\Client\ClientInterface;
1213
use Psr\Http\Message\RequestFactoryInterface;
@@ -51,4 +52,9 @@ public function inventaris(): InventarisDirectory
5152
{
5253
return new InventarisDirectory($this->requestFactory);
5354
}
55+
56+
public function verhuurcontracten(): VerhuurcontractenDirectory
57+
{
58+
return new VerhuurcontractenDirectory($this->requestFactory);
59+
}
5460
}

0 commit comments

Comments
 (0)