Skip to content

Commit d6b2e0b

Browse files
committed
Boekenverkoop: uploaden artikelbestand
1 parent c783761 commit d6b2e0b

File tree

2 files changed

+103
-0
lines changed

2 files changed

+103
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
namespace Koba\ToolboxClient\Directories\Boekenverkoop;
4+
5+
use Koba\ToolboxClien\Directories\Boekenverkoop\StoreStandaardBoekhandalArtikelbestandBatch\StoreStandaardBoekhandalArtikelbestandBatchCall;
6+
use Koba\ToolboxClient\Directory\Directory;
7+
8+
/**
9+
* @phpstan-import-type Artikel from StoreStandaardBoekhandalArtikelbestandBatchCall
10+
*/
11+
class BoekenverkoopDirectory extends Directory
12+
{
13+
/**
14+
* @param Artikel[] $artikels
15+
*/
16+
public function storeStandaardBoekhandelArtikelbestandBatch(
17+
array $artikels
18+
): StoreStandaardBoekhandalArtikelbestandBatchCall {
19+
return StoreStandaardBoekhandalArtikelbestandBatchCall::make(
20+
$this,
21+
$artikels
22+
);
23+
}
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
3+
namespace Koba\ToolboxClien\Directories\Boekenverkoop\StoreStandaardBoekhandalArtikelbestandBatch;
4+
5+
use DateTimeInterface;
6+
use Koba\ToolboxClient\Call\AbstractCall;
7+
use Koba\ToolboxClient\Directories\Boekenverkoop\BoekenverkoopDirectory;
8+
use Koba\ToolboxClient\Request\HttpMethod;
9+
use Psr\Http\Message\ResponseInterface;
10+
11+
/**
12+
* @phpstan-type Artikel array{
13+
* isbn: string,
14+
* prijs_incl_btw: string,
15+
* uitgevercode: string,
16+
* uitgevernaam: string,
17+
* isbn_oud: string,
18+
* titel: string,
19+
* auteur: string,
20+
* btwpercentage: string,
21+
* meldingscode: string,
22+
* melding: string,
23+
* vermoedelijkeverschijningsdatum: ?DateTimeInterface,
24+
* genrecode: string,
25+
* genre: string,
26+
* laatsteUpdate: DateTimeInterface
27+
* }
28+
*/
29+
class StoreStandaardBoekhandalArtikelbestandBatchCall extends AbstractCall
30+
{
31+
/**
32+
* @var Artikel[] $artikels
33+
*/
34+
protected array $artikels = [];
35+
36+
/**
37+
* @param Artikel[] $artikels
38+
*/
39+
public static function make(
40+
BoekenverkoopDirectory $directory,
41+
array $artikels
42+
): self {
43+
return (new self($directory))->setArtikels($artikels);
44+
}
45+
46+
/**
47+
* Stel de artikels in die in toolbox geplaatst dienen te worden.
48+
*
49+
* @param Artikel[] $artikels
50+
*/
51+
public function setArtikels(array $artikels = []): self
52+
{
53+
$this->artikels = $artikels;
54+
return $this;
55+
}
56+
57+
protected function getMethod(): HttpMethod
58+
{
59+
return HttpMethod::POST;
60+
}
61+
62+
protected function getEndpoint(): string
63+
{
64+
return 'boekenverkoop/standaard_boekhandel/artikelbestand/batch';
65+
}
66+
67+
/**
68+
* @return array<array-key,mixed>
69+
*/
70+
protected function getBody(): array
71+
{
72+
return $this->artikels;
73+
}
74+
75+
public function send(): ResponseInterface
76+
{
77+
return $this->performRequest();
78+
}
79+
}

0 commit comments

Comments
 (0)