commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ResourceByProjectKeyProducts.php
1 <?php
2 
3 declare(strict_types=1);
10 
13 use GuzzleHttp\ClientInterface;
14 use Psr\Http\Message\UploadedFileInterface;
15 
20 {
24  public function __construct(array $args = [], ClientInterface $client = null)
25  {
26  parent::__construct('/{projectKey}/products', $args, $client);
27  }
28 
31  public function withKey(string $key = null): ResourceByProjectKeyProductsKeyByKey
32  {
33  $args = $this->getArgs();
34  if (!is_null($key)) {
35  $args['key'] = $key;
36  }
37 
38  return new ResourceByProjectKeyProductsKeyByKey($args, $this->getClient());
39  }
42  public function withId(string $ID = null): ResourceByProjectKeyProductsByID
43  {
44  $args = $this->getArgs();
45  if (!is_null($ID)) {
46  $args['ID'] = $ID;
47  }
48 
49  return new ResourceByProjectKeyProductsByID($args, $this->getClient());
50  }
54  {
55  $args = $this->getArgs();
56 
57  return new ResourceByProjectKeyProductsSearch($args, $this->getClient());
58  }
59 
64  public function get($body = null, array $headers = []): ByProjectKeyProductsGet
65  {
66  $args = $this->getArgs();
67 
68  return new ByProjectKeyProductsGet($args['projectKey'], $body, $headers, $this->getClient());
69  }
74  public function head($body = null, array $headers = []): ByProjectKeyProductsHead
75  {
76  $args = $this->getArgs();
77 
78  return new ByProjectKeyProductsHead($args['projectKey'], $body, $headers, $this->getClient());
79  }
84  public function post(?ProductDraft $body = null, array $headers = []): ByProjectKeyProductsPost
85  {
86  $args = $this->getArgs();
87 
88  return new ByProjectKeyProductsPost($args['projectKey'], $body, $headers, $this->getClient());
89  }
90 }