1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author @jayS-de <[email protected]> |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Request\Project; |
7
|
|
|
|
8
|
|
|
use Psr\Http\Message\ResponseInterface; |
9
|
|
|
use Commercetools\Core\Client\HttpMethod; |
10
|
|
|
use Commercetools\Core\Client\HttpRequest; |
11
|
|
|
use Commercetools\Core\Client\JsonEndpoint; |
12
|
|
|
use Commercetools\Core\Model\Common\Context; |
13
|
|
|
use Commercetools\Core\Request\AbstractApiRequest; |
14
|
|
|
use Commercetools\Core\Response\ResourceResponse; |
15
|
|
|
use Commercetools\Core\Model\Project\Project; |
16
|
|
|
use Commercetools\Core\Response\ApiResponseInterface; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* @package Commercetools\Core\Request\Project |
20
|
|
|
* @link https://dev.commercetools.com/http-api-projects-project.html#get-project |
21
|
|
|
* @method Project mapResponse(ApiResponseInterface $response) |
22
|
|
|
*/ |
23
|
|
|
class ProjectGetRequest extends AbstractApiRequest |
24
|
|
|
{ |
25
|
|
|
protected $resultClass = '\Commercetools\Core\Model\Project\Project'; |
26
|
|
|
|
27
|
1 |
|
public function __construct(Context $context = null) |
28
|
|
|
{ |
29
|
1 |
|
parent::__construct(new JsonEndpoint(''), $context); |
30
|
1 |
|
} |
31
|
|
|
/** |
32
|
|
|
* @param ResponseInterface $response |
33
|
|
|
* @return ResourceResponse |
34
|
|
|
* @internal |
35
|
|
|
*/ |
36
|
|
|
public function buildResponse(ResponseInterface $response) |
37
|
|
|
{ |
38
|
|
|
return new ResourceResponse($response, $this, $this->getContext()); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @return HttpRequest |
43
|
|
|
* @internal |
44
|
|
|
*/ |
45
|
|
|
public function httpRequest() |
46
|
|
|
{ |
47
|
|
|
return new HttpRequest(HttpMethod::GET, $this->getPath()); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param Context $context |
52
|
|
|
* @return static |
53
|
|
|
*/ |
54
|
1 |
|
public static function of(Context $context = null) |
55
|
|
|
{ |
56
|
1 |
|
return new static($context); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|