-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathMpApiClient.php
107 lines (90 loc) · 3.55 KB
/
MpApiClient.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php declare(strict_types=1);
namespace MpApiClient;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\ClientInterface as GuzzleClientInterface;
use MpApiClient\Article\ArticleClient;
use MpApiClient\Brand\BrandClient;
use MpApiClient\Category\CategoryClient;
use MpApiClient\Checks\ChecksClient;
use MpApiClient\Common\Interfaces\ArticleClientInterface;
use MpApiClient\Common\Interfaces\BrandClientInterface;
use MpApiClient\Common\Interfaces\CategoryClientInterface;
use MpApiClient\Common\Interfaces\ChecksClientInterface;
use MpApiClient\Common\Interfaces\ClientInterface;
use MpApiClient\Common\Interfaces\FinancialClientInterface;
use MpApiClient\Common\Interfaces\LabelClientInterface;
use MpApiClient\Common\Interfaces\MpApiClientInterface;
use MpApiClient\Common\Interfaces\OrderClientInterface;
use MpApiClient\Common\Interfaces\ShopClientInterface;
use MpApiClient\Common\Interfaces\SupplyDelayClientInterface;
use MpApiClient\Financial\FinancialClient;
use MpApiClient\Label\LabelClient;
use MpApiClient\Order\OrderClient;
use MpApiClient\Shop\ShopClient;
use MpApiClient\SupplyDelay\SupplyDelayClient;
final class MpApiClient implements ClientInterface, MpApiClientInterface
{
const APP_NAME = 'mp-api-client';
const APP_VERSION = '5.0.0';
private BrandClientInterface $brandClient;
private CategoryClientInterface $categoryClient;
private ChecksClientInterface $checksClient;
private FinancialClientInterface $financialClient;
private LabelClientInterface $labelClient;
private OrderClientInterface $ordersClient;
private ArticleClientInterface $articleClient;
private ShopClientInterface $shopClient;
private SupplyDelayClientInterface $supplyDelayClient;
public function __construct(GuzzleClientInterface $client, string $appTag)
{
$this->brandClient = new BrandClient($client, $appTag);
$this->categoryClient = new CategoryClient($client, $appTag);
$this->checksClient = new ChecksClient($client, $appTag);
$this->financialClient = new FinancialClient($client, $appTag);
$this->labelClient = new LabelClient($client, $appTag);
$this->ordersClient = new OrderClient($client, $appTag);
$this->articleClient = new ArticleClient($client, $appTag);
$this->shopClient = new ShopClient($client, $appTag);
$this->supplyDelayClient = new SupplyDelayClient($client, $appTag);
}
public static function createFromOptions(string $appTag, MpApiClientOptions $options): self
{
return new self(new GuzzleClient($options->getGuzzleOptionsArray()), $appTag);
}
public function orders(): OrderClientInterface
{
return $this->ordersClient;
}
public function article(): ArticleClientInterface
{
return $this->articleClient;
}
public function financial(): FinancialClientInterface
{
return $this->financialClient;
}
public function brand(): BrandClientInterface
{
return $this->brandClient;
}
public function category(): CategoryClientInterface
{
return $this->categoryClient;
}
public function checks(): ChecksClientInterface
{
return $this->checksClient;
}
public function shop(): ShopClientInterface
{
return $this->shopClient;
}
public function label(): LabelClientInterface
{
return $this->labelClient;
}
public function supplyDelay(): SupplyDelayClientInterface
{
return $this->supplyDelayClient;
}
}