1 | <?php |
||
22 | final class ProductClient |
||
23 | { |
||
24 | const BASE_URL = 'https://products.izettle.com/organizations/%s'; |
||
25 | |||
26 | const POST_CATEGORY = self::BASE_URL . '/categories'; |
||
27 | const GET_CATEGORY = self::BASE_URL . '/categories/%s'; |
||
28 | const GET_CATEGORIES = self::BASE_URL . '/categories'; |
||
29 | |||
30 | const POST_DISCOUNT = self::BASE_URL . '/discounts'; |
||
31 | const GET_DISCOUNT = self::BASE_URL . '/discounts/%s'; |
||
32 | const PUT_DISCOUNT = self::BASE_URL . '/discounts/%s'; |
||
33 | const DELETE_DISCOUNT = self::BASE_URL . '/discounts/%s'; |
||
34 | const GET_DISCOUNTS = self::BASE_URL . '/discounts'; |
||
35 | |||
36 | const GET_EXPORT = self::BASE_URL . '/products/%s'; |
||
37 | const GET_EXPORT_TEMPLATE = self::BASE_URL . '/products/%s/template'; |
||
38 | |||
39 | const GET_LIBRARY = self::BASE_URL . '/library'; |
||
40 | |||
41 | const POST_PRODUCT = self::BASE_URL . '/products'; |
||
42 | const GET_PRODUCT = self::BASE_URL . '/products/%s'; |
||
43 | const PUT_PRODUCT = self::BASE_URL . '/products/v2/%s'; |
||
44 | const DELETE_PRODUCT = self::BASE_URL . '/products/%s'; |
||
45 | const POST_PRODUCT_VARIANT = self::BASE_URL . '/products/%s/variants'; |
||
46 | const PUT_PRODUCT_VARIANT = self::BASE_URL . '/products/%s/variants/%s'; |
||
47 | const DELETE_PRODUCT_VARIANT = self::BASE_URL . '/products/%s/variants/%s'; |
||
48 | const GET_PRODUCTS = self::BASE_URL . '/products'; |
||
49 | const DELETE_PRODUCTS = self::BASE_URL . '/products'; |
||
50 | |||
51 | private $client; |
||
52 | private $organizationUuid; |
||
53 | private $categoryBuilder; |
||
54 | private $discountBuilder; |
||
55 | private $libraryBuilder; |
||
56 | private $productBuilder; |
||
57 | |||
58 | 13 | public function __construct( |
|
73 | |||
74 | /** |
||
75 | * @return Category[] |
||
76 | */ |
||
77 | 2 | public function getCategories(): array |
|
84 | |||
85 | 1 | public function createCategory(Category $category): void |
|
90 | |||
91 | /** |
||
92 | * @return Discount[] |
||
93 | */ |
||
94 | 2 | public function getDiscounts(): array |
|
101 | |||
102 | 1 | public function createDiscount(Discount $discount): void |
|
108 | |||
109 | 1 | public function deleteDiscount(Discount $discount): void |
|
115 | |||
116 | 2 | public function getLibrary(): Library |
|
123 | |||
124 | /** |
||
125 | * @return Product[] |
||
126 | */ |
||
127 | 2 | public function getProducts(): array |
|
134 | |||
135 | 1 | public function createProduct(Product $product): void |
|
141 | |||
142 | 1 | public function deleteProduct(Product $product): void |
|
148 | } |
||
149 |