1 | <?php |
||
30 | class DefaultApiClient extends AbstractApiClient |
||
31 | { |
||
32 | /** |
||
33 | * Default request headers. |
||
34 | * |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $headers = array( |
||
38 | 'Accept' => 'application/json' |
||
39 | ); |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | public function makeApiCall(RequestInterface $request) |
||
75 | |||
76 | /** |
||
77 | * Creates response object from response array. |
||
78 | * |
||
79 | * @param array $response |
||
80 | * |
||
81 | * @return Response API Response object |
||
82 | * |
||
83 | * @throws ClientException Thrown when response object could not be created |
||
84 | */ |
||
85 | protected function createResponseObject(array $response) |
||
93 | |||
94 | /** |
||
95 | * Adds authentication details to request with OAuth decorator. |
||
96 | * |
||
97 | * @param RequestInterface $request |
||
98 | * |
||
99 | * @return OAuthDecorator OAuth ready decorated Request |
||
100 | */ |
||
101 | protected function authenticateRequest(RequestInterface $request) |
||
109 | |||
110 | /** |
||
111 | * Sends the actual request. |
||
112 | * |
||
113 | * @param RequestInterface $request |
||
114 | * |
||
115 | * @return Response Response object created from raw response |
||
116 | * |
||
117 | * @throws ClientException Thrown when response could not be created. |
||
118 | */ |
||
119 | protected function sendRequest(RequestInterface $request) |
||
127 | |||
128 | /** |
||
129 | * Refreshes the token via then authenticator. |
||
130 | * |
||
131 | * @param RequestInterface $request |
||
132 | * |
||
133 | * @return void |
||
134 | */ |
||
135 | protected function getNewToken(RequestInterface $request) |
||
146 | |||
147 | /** |
||
148 | * Adds default headers to the headers per request, only if the key |
||
149 | * cannot not be found in the headers per request. |
||
150 | * |
||
151 | * @param array $headers |
||
152 | * |
||
153 | * @return array |
||
154 | */ |
||
155 | protected function addDefaultHeaders($headers) |
||
165 | } |
||
166 |