@@ 24-63 (lines=40) @@ | ||
21 | * @method Customer mapResponse(ApiResponseInterface $response) |
|
22 | * @method Customer mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) |
|
23 | */ |
|
24 | class MeGetRequest extends AbstractApiRequest |
|
25 | { |
|
26 | protected $resultClass = Customer::class; |
|
27 | ||
28 | /** |
|
29 | * @param Context $context |
|
30 | */ |
|
31 | public function __construct(Context $context = null) |
|
32 | { |
|
33 | parent::__construct(MeEndpoint::endpoint(), $context); |
|
34 | } |
|
35 | ||
36 | /** |
|
37 | * @param Context $context |
|
38 | * @return static |
|
39 | */ |
|
40 | public static function of(Context $context = null) |
|
41 | { |
|
42 | return new static($context); |
|
43 | } |
|
44 | ||
45 | /** |
|
46 | * @return HttpRequest |
|
47 | * @internal |
|
48 | */ |
|
49 | public function httpRequest() |
|
50 | { |
|
51 | return new HttpRequest(HttpMethod::GET, $this->getPath()); |
|
52 | } |
|
53 | ||
54 | /** |
|
55 | * @param ResponseInterface $response |
|
56 | * @return ResourceResponse |
|
57 | * @internal |
|
58 | */ |
|
59 | public function buildResponse(ResponseInterface $response) |
|
60 | { |
|
61 | return new ResourceResponse($response, $this, $this->getContext()); |
|
62 | } |
|
63 | } |
|
64 |
@@ 25-60 (lines=36) @@ | ||
22 | * @method Project mapResponse(ApiResponseInterface $response) |
|
23 | * @method Project mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null) |
|
24 | */ |
|
25 | class ProjectGetRequest extends AbstractApiRequest |
|
26 | { |
|
27 | protected $resultClass = Project::class; |
|
28 | ||
29 | public function __construct(Context $context = null) |
|
30 | { |
|
31 | parent::__construct(new JsonEndpoint(''), $context); |
|
32 | } |
|
33 | /** |
|
34 | * @param ResponseInterface $response |
|
35 | * @return ResourceResponse |
|
36 | * @internal |
|
37 | */ |
|
38 | public function buildResponse(ResponseInterface $response) |
|
39 | { |
|
40 | return new ResourceResponse($response, $this, $this->getContext()); |
|
41 | } |
|
42 | ||
43 | /** |
|
44 | * @return HttpRequest |
|
45 | * @internal |
|
46 | */ |
|
47 | public function httpRequest() |
|
48 | { |
|
49 | return new HttpRequest(HttpMethod::GET, $this->getPath()); |
|
50 | } |
|
51 | ||
52 | /** |
|
53 | * @param Context $context |
|
54 | * @return static |
|
55 | */ |
|
56 | public static function of(Context $context = null) |
|
57 | { |
|
58 | return new static($context); |
|
59 | } |
|
60 | } |
|
61 |