@@ -30,14 +30,19 @@ discard block |
||
| 30 | 30 | * e.g. [CURLOPT_USERAGENT => 'abc'], |
| 31 | 31 | * ['CURLOPT_USERAGENT' => 'abc'] |
| 32 | 32 | * |
| 33 | - * @param bool $assoc |
|
| 34 | - * Use Assoc-style or not. |
|
| 35 | 33 | * |
| 36 | - * @param bool $stringify |
|
| 37 | - * Stringify CURLOPT_* constant names or not. |
|
| 34 | + * @return void |
|
| 38 | 35 | */ |
| 39 | 36 | public function __construct(array $credentials, array $options = []); |
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * @return Traits\BaseClientTrait |
|
| 40 | + */ |
|
| 40 | 41 | public function withCredentials(array $credentails); // : ClientInterface |
| 42 | + |
|
| 43 | + /** |
|
| 44 | + * @return Traits\BaseClientTrait |
|
| 45 | + */ |
|
| 41 | 46 | public function withOptions(array $options); // : ClientInterface |
| 42 | 47 | public function getCredentials($assoc = false); // : array |
| 43 | 48 | public function getOptions($stringify = false); // : array |
@@ -46,15 +51,12 @@ discard block |
||
| 46 | 51 | * Retrive part of credentials using magic methods or ArrayAccess interface. |
| 47 | 52 | * |
| 48 | 53 | * @param string $key |
| 49 | - * @param string $offset |
|
| 50 | - * |
|
| 51 | - * e.g. |
|
| 52 | - * $a = $client->consumer_key; |
|
| 53 | - * $b = $client['consumer_secret']; |
|
| 54 | - * $c = $client[2]; |
|
| 55 | - * $d = $client->tokenSecret; |
|
| 56 | 54 | */ |
| 57 | 55 | public function __get($key); // : string |
| 56 | + |
|
| 57 | + /** |
|
| 58 | + * @return boolean |
|
| 59 | + */ |
|
| 58 | 60 | public function __isset($key); // : boolean |
| 59 | 61 | public function offsetGet($offset); // : string |
| 60 | 62 | public function offsetExists($offset); // : boolean |
@@ -72,18 +74,31 @@ discard block |
||
| 72 | 74 | * login() uses scraping. |
| 73 | 75 | * |
| 74 | 76 | * @param string|null $oauth_callback Callback URL or "oob". |
| 75 | - * @param string $oauth_verifier |
|
| 76 | - * @param string $username Username or email. |
|
| 77 | - * @param string $password |
|
| 78 | 77 | * @throws HttpExceptionInterface |
| 79 | 78 | */ |
| 80 | 79 | public function oauthForRequestToken($oauth_callback = null); // : ClientInterface |
| 81 | 80 | public function oauthForAccessToken($oauth_verifier); // : ClientInterface |
| 82 | 81 | public function xauthForAccessToken($username, $password); // : ClientInterface |
| 83 | 82 | public function login($username, $password); // : ClientInterface |
| 83 | + |
|
| 84 | + /** |
|
| 85 | + * @return \Generator |
|
| 86 | + */ |
|
| 84 | 87 | public function oauthForRequestTokenAsync($oauth_callback = null); // : \Generator<ClientInterface> |
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @return \Generator |
|
| 91 | + */ |
|
| 85 | 92 | public function oauthForAccessTokenAsync($oauth_verifier); // : \Generator<ClientInterface> |
| 93 | + |
|
| 94 | + /** |
|
| 95 | + * @return \Generator |
|
| 96 | + */ |
|
| 86 | 97 | public function xauthForAccessTokenAsync($username, $password); // : \Generator<ClientInterface> |
| 98 | + |
|
| 99 | + /** |
|
| 100 | + * @return \Generator |
|
| 101 | + */ |
|
| 87 | 102 | public function loginAsync($username, $password); // : \Generator<ClientInterface> |
| 88 | 103 | |
| 89 | 104 | /** |
@@ -110,10 +125,30 @@ discard block |
||
| 110 | 125 | public function delete($endpoint, array $params = [], $return_response_object = false); // : \stdClass|ResponseInterface |
| 111 | 126 | public function put($endpoint, array $params = [], $return_response_object = false); // : \stdClass|ResponseInterface |
| 112 | 127 | public function postMultipart($endpoint, array $params = [], $return_response_object = false); // : \stdClass|ResponseInterface |
| 128 | + |
|
| 129 | + /** |
|
| 130 | + * @return \Generator |
|
| 131 | + */ |
|
| 113 | 132 | public function getAsync($endpoint, array $params = [], $return_response_object = false); // : \Generator<\stdClass|array|MediaInterface|ResponseInterface |
| 133 | + |
|
| 134 | + /** |
|
| 135 | + * @return \Generator |
|
| 136 | + */ |
|
| 114 | 137 | public function postAsync($endpoint, array $params = [], $return_response_object = false); // : \Generator<\stdClass|ResponseInterface> |
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * @return \Generator |
|
| 141 | + */ |
|
| 115 | 142 | public function deleteAsync($endpoint, array $params = [], $return_response_object = false); // : \Generator<\stdClass|ResponseInterface> |
| 143 | + |
|
| 144 | + /** |
|
| 145 | + * @return \Generator |
|
| 146 | + */ |
|
| 116 | 147 | public function putAsync($endpoint, array $params = [], $return_response_object = false); // : \Generator<\stdClass|ResponseInterface> |
| 148 | + |
|
| 149 | + /** |
|
| 150 | + * @return \Generator |
|
| 151 | + */ |
|
| 117 | 152 | public function postMultipartAsync($endpoint, array $params = [], $return_response_object = false); // : \Generator<\stdClass|ResponseInterface> |
| 118 | 153 | |
| 119 | 154 | /** |
@@ -137,8 +172,20 @@ discard block |
||
| 137 | 172 | public function getOut($url, array $params = [], $return_response_object = false); // : \stdClass|array|ResponseInterface |
| 138 | 173 | public function postOut($url, array $params = [], $return_response_object = false); // : \stdClass|ResponseInterface |
| 139 | 174 | public function postMultipartOut($url, array $params = [], $return_response_object = false); // : \stdClass|ResponseInterface |
| 175 | + |
|
| 176 | + /** |
|
| 177 | + * @return \Generator |
|
| 178 | + */ |
|
| 140 | 179 | public function getOutAsync($url, array $params = [], $return_response_object = false); // : \Generator<\stdClass|array|ResponseInterface |
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * @return \Generator |
|
| 183 | + */ |
|
| 141 | 184 | public function postOutAsync($url, array $params = [], $return_response_object = false); // : \Generator<\stdClass|ResponseInterface> |
| 185 | + |
|
| 186 | + /** |
|
| 187 | + * @return \Generator |
|
| 188 | + */ |
|
| 142 | 189 | public function postMultipartOutAsync($url, array $params = [], $return_response_object = false); // : \Generator<\stdClass|ResponseInterface> |
| 143 | 190 | |
| 144 | 191 | /** |
@@ -167,8 +214,13 @@ discard block |
||
| 167 | 214 | * Signature: function (ResponseInterface $response); |
| 168 | 215 | * |
| 169 | 216 | * @throws HttpExceptionInterface |
| 217 | + * @return void |
|
| 170 | 218 | */ |
| 171 | 219 | public function streaming($endpoint, callable $event_handler, array $params = [], callable $header_response_handler = null); // : null |
| 220 | + |
|
| 221 | + /** |
|
| 222 | + * @return \Generator |
|
| 223 | + */ |
|
| 172 | 224 | public function streamingAsync($endpoint, callable $event_handler, array $params = [], callable $header_response_handler = null); // : \Generator<null> |
| 173 | 225 | |
| 174 | 226 | /** |
@@ -192,10 +244,23 @@ discard block |
||
| 192 | 244 | * File data is split into chunks with specified size. |
| 193 | 245 | * |
| 194 | 246 | * @throws HttpExceptionInterface |
| 247 | + * @return \Generator |
|
| 195 | 248 | */ |
| 196 | 249 | public function uploadAsync(\SplFileObject $file, $media_category = null, callable $on_uploading = null, callable $on_processing = null, $chunk_size = 300000); // : \Generator<\stdClass> |
| 250 | + |
|
| 251 | + /** |
|
| 252 | + * @return \Generator |
|
| 253 | + */ |
|
| 197 | 254 | public function uploadImageAsync(\SplFileObject $file, callable $on_uploading = null, callable $on_processing = null, $chunk_size = 300000); // : \Generator<\stdClass> |
| 255 | + |
|
| 256 | + /** |
|
| 257 | + * @return \Generator |
|
| 258 | + */ |
|
| 198 | 259 | public function uploadAnimeGifAsync(\SplFileObject $file, callable $on_uploading = null, callable $on_processing = null, $chunk_size = 300000); // : \Generator<\stdClass> |
| 260 | + |
|
| 261 | + /** |
|
| 262 | + * @return \Generator |
|
| 263 | + */ |
|
| 199 | 264 | public function uploadVideoAsync(\SplFileObject $file, callable $on_uploading = null, callable $on_processing = null, $chunk_size = 300000); // : \Generator<\stdClass> |
| 200 | 265 | |
| 201 | 266 | /** |
@@ -204,14 +269,23 @@ discard block |
||
| 204 | 269 | * @throws HttpExceptionInterface |
| 205 | 270 | */ |
| 206 | 271 | public function oauthForBearerToken(); // : ClientInterface |
| 272 | + |
|
| 273 | + /** |
|
| 274 | + * @return \Generator |
|
| 275 | + */ |
|
| 207 | 276 | public function oauthForBearerTokenAsync(); // : \Generator<ClientInterface> |
| 208 | 277 | |
| 209 | 278 | /** |
| 210 | 279 | * Invalidate OAuth 2.0 token. |
| 211 | 280 | * |
| 212 | 281 | * @throws HttpExceptionInterface |
| 282 | + * @return void |
|
| 213 | 283 | */ |
| 214 | 284 | public function invalidateBearerToken(); // : null |
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * @return \Generator |
|
| 288 | + */ |
|
| 215 | 289 | public function invalidateBearerTokenAsync(); // : \Generator<null> |
| 216 | 290 | |
| 217 | 291 | /** |
@@ -232,11 +306,27 @@ discard block |
||
| 232 | 306 | * @throws HttpExceptionInterface |
| 233 | 307 | */ |
| 234 | 308 | public function get2($endpoint, array $params = [], $return_response_object = false); // : \stdClass|array|ResponseInterface |
| 309 | + |
|
| 310 | + /** |
|
| 311 | + * @return \Generator |
|
| 312 | + */ |
|
| 235 | 313 | public function get2Async($endpoint, array $params = [], $return_response_object = false); // : \Generator<\stdClass|array|ResponseInterface> |
| 236 | 314 | public function post2($endpoint, array $params = [], $return_response_object = false); // : \stdClass|array|ResponseInterface |
| 315 | + |
|
| 316 | + /** |
|
| 317 | + * @return \Generator |
|
| 318 | + */ |
|
| 237 | 319 | public function post2Async($endpoint, array $params = [], $return_response_object = false); // : \Generator<\stdClass|array|ResponseInterface> |
| 238 | 320 | public function delete2($endpoint, array $params = [], $return_response_object = false); // : \stdClass|array|ResponseInterface |
| 321 | + |
|
| 322 | + /** |
|
| 323 | + * @return \Generator |
|
| 324 | + */ |
|
| 239 | 325 | public function delete2Async($endpoint, array $params = [], $return_response_object = false); // : \Generator<\stdClass|array|ResponseInterface> |
| 240 | 326 | public function put2($endpoint, array $params = [], $return_response_object = false); // : \stdClass|array|ResponseInterface |
| 327 | + |
|
| 328 | + /** |
|
| 329 | + * @return \Generator |
|
| 330 | + */ |
|
| 241 | 331 | public function put2Async($endpoint, array $params = [], $return_response_object = false); // : \Generator<\stdClass|array|ResponseInterface> |
| 242 | 332 | } |
@@ -32,6 +32,9 @@ discard block |
||
| 32 | 32 | return $ch; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | + /** |
|
| 36 | + * @param string $method |
|
| 37 | + */ |
|
| 35 | 38 | protected function custom($method, $endpoint, array $params) |
| 36 | 39 | { |
| 37 | 40 | $ch = curl_init(); |
@@ -232,6 +235,9 @@ discard block |
||
| 232 | 235 | return $ch; |
| 233 | 236 | } |
| 234 | 237 | |
| 238 | + /** |
|
| 239 | + * @param string $endpoint |
|
| 240 | + */ |
|
| 235 | 241 | protected function custom2($endpoint, $params = []) |
| 236 | 242 | { |
| 237 | 243 | $ch = curl_init(); |