1 | <?php |
||
23 | final class ProductClient |
||
24 | { |
||
25 | const BASE_URL = 'https://products.izettle.com/organizations/%s'; |
||
26 | |||
27 | const POST_CATEGORY = self::BASE_URL . '/categories'; |
||
28 | const GET_CATEGORY = self::BASE_URL . '/categories/%s'; |
||
29 | const GET_CATEGORIES = self::BASE_URL . '/categories'; |
||
30 | |||
31 | const POST_DISCOUNT = self::BASE_URL . '/discounts'; |
||
32 | const GET_DISCOUNT = self::BASE_URL . '/discounts/%s'; |
||
33 | const PUT_DISCOUNT = self::BASE_URL . '/discounts/%s'; |
||
34 | const DELETE_DISCOUNT = self::BASE_URL . '/discounts/%s'; |
||
35 | const GET_DISCOUNTS = self::BASE_URL . '/discounts'; |
||
36 | |||
37 | const GET_EXPORT = self::BASE_URL . '/products/%s'; |
||
38 | const GET_EXPORT_TEMPLATE = self::BASE_URL . '/products/%s/template'; |
||
39 | |||
40 | const GET_LIBRARY = self::BASE_URL . '/library'; |
||
41 | |||
42 | const POST_PRODUCT = self::BASE_URL . '/products'; |
||
43 | const GET_PRODUCT = self::BASE_URL . '/products/%s'; |
||
44 | const PUT_PRODUCT = self::BASE_URL . '/products/v2/%s'; |
||
45 | const DELETE_PRODUCT = self::BASE_URL . '/products/%s'; |
||
46 | const POST_PRODUCT_VARIANT = self::BASE_URL . '/products/%s/variants'; |
||
47 | const PUT_PRODUCT_VARIANT = self::BASE_URL . '/products/%s/variants/%s'; |
||
48 | const DELETE_PRODUCT_VARIANT = self::BASE_URL . '/products/%s/variants/%s'; |
||
49 | const GET_PRODUCTS = self::BASE_URL . '/products'; |
||
50 | const DELETE_PRODUCTS = self::BASE_URL . '/products'; |
||
51 | |||
52 | private $client; |
||
53 | private $organizationUuid; |
||
54 | private $categoryBuilder; |
||
55 | private $discountBuilder; |
||
56 | private $libraryBuilder; |
||
57 | private $productBuilder; |
||
58 | |||
59 | 13 | public function __construct( |
|
74 | |||
75 | /** |
||
76 | * @return Category[] |
||
77 | */ |
||
78 | 2 | public function getCategories(): array |
|
85 | |||
86 | /** |
||
87 | * @throws UnprocessableEntityException |
||
88 | */ |
||
89 | 1 | public function createCategory(Category $category): void |
|
94 | |||
95 | /** |
||
96 | * @return Discount[] |
||
97 | */ |
||
98 | 2 | public function getDiscounts(): array |
|
105 | |||
106 | /** |
||
107 | * @throws UnprocessableEntityException |
||
108 | */ |
||
109 | 1 | public function createDiscount(Discount $discount): void |
|
115 | |||
116 | /** |
||
117 | * @throws UnprocessableEntityException |
||
118 | */ |
||
119 | 1 | public function deleteDiscount(Discount $discount): void |
|
125 | |||
126 | 2 | public function getLibrary(): Library |
|
133 | |||
134 | /** |
||
135 | * @return Product[] |
||
136 | */ |
||
137 | 2 | public function getProducts(): array |
|
144 | |||
145 | /** |
||
146 | * @throws UnprocessableEntityException |
||
147 | */ |
||
148 | 1 | public function createProduct(Product $product): void |
|
154 | |||
155 | /** |
||
156 | * @throws UnprocessableEntityException |
||
157 | */ |
||
158 | public function updateProduct($uuid, array $array): void |
||
164 | |||
165 | /** |
||
166 | * @throws UnprocessableEntityException |
||
167 | */ |
||
168 | 1 | public function deleteProduct(Product $product): void |
|
174 | } |
||
175 |