|
1 | 1 | <?php |
2 | 2 |
|
3 | | - |
4 | 3 | namespace Printful; |
5 | 4 |
|
6 | | - |
7 | 5 | use Printful\Structures\Generator\GenerationResultItem; |
8 | 6 | use Printful\Structures\Generator\MockupGenerationFile; |
9 | 7 | use Printful\Structures\Generator\MockupGenerationParameters; |
@@ -33,12 +31,19 @@ public function __construct(PrintfulApiClient $printfulClient) |
33 | 31 | * Get all available templates for specific printful product |
34 | 32 | * |
35 | 33 | * @param int $productId Printful product id |
| 34 | + * @param string|null $orientation Used for products with multiple orientations (e.g. wall art) {@see TemplateItem::ORIENTATION_HORIZONTAL} {@see TemplateItem::ORIENTATION_VERTICAL} |
36 | 35 | * @return ProductPrintfiles |
37 | 36 | * @throws Exceptions\PrintfulException |
38 | 37 | */ |
39 | | - public function getProductPrintfiles($productId) |
| 38 | + public function getProductPrintfiles($productId, $orientation = null) |
40 | 39 | { |
41 | | - $raw = $this->printfulClient->get('mockup-generator/printfiles/' . $productId); |
| 40 | + $query = []; |
| 41 | + |
| 42 | + if ($orientation) { |
| 43 | + $query['orientation'] = $orientation; |
| 44 | + } |
| 45 | + |
| 46 | + $raw = $this->printfulClient->get('mockup-generator/printfiles/' . $productId, $query); |
42 | 47 |
|
43 | 48 | $productPrintfiles = new ProductPrintfiles; |
44 | 49 |
|
@@ -185,7 +190,7 @@ private function parametersToArray(MockupGenerationParameters $parameters) |
185 | 190 | * This includes background images and area positions. |
186 | 191 | * |
187 | 192 | * @param int $productId |
188 | | - * @param string|null $orientation Used for wall art only {@see TemplateItem::ORIENTATION_HORIZONTAL} {@see TemplateItem::ORIENTATION_VERTICAL} |
| 193 | + * @param string|null $orientation Used for products with multiple orientations (e.g. wall art) {@see TemplateItem::ORIENTATION_HORIZONTAL} {@see TemplateItem::ORIENTATION_VERTICAL} |
189 | 194 | * @return ProductTemplates |
190 | 195 | * @throws Exceptions\PrintfulApiException |
191 | 196 | * @throws Exceptions\PrintfulException |
|
0 commit comments