1 | <?php |
||
30 | class Client |
||
31 | { |
||
32 | /** |
||
33 | * @var string |
||
34 | */ |
||
35 | private $baseUri; |
||
36 | |||
37 | /** |
||
38 | * @var array |
||
39 | */ |
||
40 | private $headers = []; |
||
41 | |||
42 | /** |
||
43 | * @var GuzzleClient |
||
44 | */ |
||
45 | private $client; |
||
46 | |||
47 | /** |
||
48 | * Client constructor. |
||
49 | * |
||
50 | * @param Container $container |
||
51 | */ |
||
52 | public function __construct(Container $container) |
||
63 | |||
64 | /** |
||
65 | * @param $token |
||
66 | */ |
||
67 | public function setToken($token) |
||
71 | |||
72 | /** |
||
73 | * @param $uri |
||
74 | * @return string |
||
75 | */ |
||
76 | private function makeUri($uri) |
||
80 | |||
81 | /** |
||
82 | * @param $options |
||
83 | * @param $type |
||
84 | * @return array |
||
85 | */ |
||
86 | private function buildOptions($options, $type) |
||
93 | |||
94 | /** |
||
95 | * @param $method |
||
96 | * @param $uri |
||
97 | * @param $type |
||
98 | * @param array $options |
||
99 | * @return ResponseInterface |
||
100 | */ |
||
101 | private function dispatch($method, $uri, $type, array $options = []) |
||
115 | |||
116 | /** |
||
117 | * @param $uri |
||
118 | * @param array $options |
||
119 | * @param string $type |
||
120 | * @return ResponseInterface |
||
121 | */ |
||
122 | public function get($uri, array $options = [], $type = RequestOptions::QUERY) |
||
126 | |||
127 | /** |
||
128 | * @param $uri |
||
129 | * @param array $options |
||
130 | * @param string $type |
||
131 | * @return ResponseInterface |
||
132 | */ |
||
133 | public function post($uri, $options = [], $type = RequestOptions::JSON) |
||
137 | |||
138 | /** |
||
139 | * @param $uri |
||
140 | * @param array $options |
||
141 | * @param string $type |
||
142 | * @return ResponseInterface |
||
143 | */ |
||
144 | public function put($uri, $options = [], $type = RequestOptions::JSON) |
||
148 | |||
149 | /** |
||
150 | * @param $uri |
||
151 | * @param array $options |
||
152 | * @param string $type |
||
153 | * @return ResponseInterface |
||
154 | */ |
||
155 | public function delete($uri, $options = [], $type = RequestOptions::JSON) |
||
159 | } |
||
160 |