1 | <?php |
||
32 | class HttplugClient implements HttpClientInterface |
||
33 | { |
||
34 | /** |
||
35 | * @var \Http\Client\HttpClient |
||
36 | */ |
||
37 | private $httpClient; |
||
38 | |||
39 | /** |
||
40 | * @var RequestFactory |
||
41 | */ |
||
42 | private $requestFactory; |
||
43 | |||
44 | /** |
||
45 | * @var StreamFactory |
||
46 | */ |
||
47 | private $streamFactory; |
||
48 | |||
49 | /** |
||
50 | * Panda cloud id |
||
51 | * |
||
52 | * @var string |
||
53 | */ |
||
54 | private $cloudId; |
||
55 | |||
56 | /** |
||
57 | * Panda Account |
||
58 | * |
||
59 | * @var Account |
||
60 | */ |
||
61 | private $account; |
||
62 | |||
63 | /** |
||
64 | * HttplugClient constructor. |
||
65 | * |
||
66 | * @param \Http\Client\HttpClient|null $httpClient |
||
67 | * @param RequestFactory|null $requestFactory |
||
68 | * @param StreamFactory|null $streamFactory |
||
69 | */ |
||
70 | 10 | public function __construct(\Http\Client\HttpClient $httpClient = null, RequestFactory $requestFactory = null, StreamFactory $streamFactory = null) |
|
76 | |||
77 | /** |
||
78 | * {@inheritDoc} |
||
79 | */ |
||
80 | 10 | public function setCloudId($cloudId) |
|
84 | |||
85 | /** |
||
86 | * {@inheritDoc} |
||
87 | */ |
||
88 | 1 | public function getCloudId() |
|
92 | |||
93 | /** |
||
94 | * {@inheritDoc} |
||
95 | */ |
||
96 | 10 | public function setAccount(Account $account) |
|
100 | |||
101 | /** |
||
102 | * {@inheritDoc} |
||
103 | */ |
||
104 | 1 | public function getAccount() |
|
108 | |||
109 | /** |
||
110 | * {@inheritDoc} |
||
111 | */ |
||
112 | 2 | public function get($path, array $params = array()) |
|
116 | |||
117 | /** |
||
118 | * {@inheritDoc} |
||
119 | */ |
||
120 | 1 | public function post($path, array $params = array()) |
|
124 | |||
125 | /** |
||
126 | * {@inheritDoc} |
||
127 | */ |
||
128 | 1 | public function put($path, array $params = array()) |
|
132 | |||
133 | /** |
||
134 | * {@inheritDoc} |
||
135 | */ |
||
136 | 1 | public function delete($path, array $params = array()) |
|
140 | |||
141 | /** |
||
142 | * Send signed HTTP requests to the API server. |
||
143 | * |
||
144 | * @param string $method HTTP method (GET, POST, PUT or DELETE) |
||
145 | * @param string $path Request path |
||
146 | * @param array $params Additional request parameters |
||
147 | * |
||
148 | * @return string The API server's response |
||
149 | * |
||
150 | * @throws ApiException if an API error occurs |
||
151 | * @throws HttpException if the request fails |
||
152 | */ |
||
153 | 5 | private function request($method, $path, array $params) |
|
201 | } |
||
202 |