|
@@ 187-199 (lines=13) @@
|
| 184 |
|
* Normally promising an array, though can be mixed (json_decode result) |
| 185 |
|
* Can throw UsageExceptions or RejectionExceptions |
| 186 |
|
*/ |
| 187 |
|
public function getRequestAsync( Request $request ) { |
| 188 |
|
$promise = $this->getClient()->requestAsync( |
| 189 |
|
'GET', |
| 190 |
|
$this->apiUrl, |
| 191 |
|
$this->getClientRequestOptions( $request, 'query' ) |
| 192 |
|
); |
| 193 |
|
|
| 194 |
|
return $promise->then( function ( ResponseInterface $response ) { |
| 195 |
|
return call_user_func( function ( ResponseInterface $response ) { |
| 196 |
|
return $this->decodeResponse( $response ); |
| 197 |
|
}, $response ); |
| 198 |
|
} ); |
| 199 |
|
} |
| 200 |
|
|
| 201 |
|
/** |
| 202 |
|
* @since 2.0 |
|
@@ 210-222 (lines=13) @@
|
| 207 |
|
* Normally promising an array, though can be mixed (json_decode result) |
| 208 |
|
* Can throw UsageExceptions or RejectionExceptions |
| 209 |
|
*/ |
| 210 |
|
public function postRequestAsync( Request $request ) { |
| 211 |
|
$promise = $this->getClient()->requestAsync( |
| 212 |
|
'POST', |
| 213 |
|
$this->apiUrl, |
| 214 |
|
$this->getClientRequestOptions( $request, $this->getPostRequestEncoding( $request ) ) |
| 215 |
|
); |
| 216 |
|
|
| 217 |
|
return $promise->then( function ( ResponseInterface $response ) { |
| 218 |
|
return call_user_func( function ( ResponseInterface $response ) { |
| 219 |
|
return $this->decodeResponse( $response ); |
| 220 |
|
}, $response ); |
| 221 |
|
} ); |
| 222 |
|
} |
| 223 |
|
|
| 224 |
|
/** |
| 225 |
|
* @since 0.2 |