|
35 | 35 | interface OAuthInterface extends ApiClientInterface, ClientInterface, LoggerAwareInterface{ |
36 | 36 |
|
37 | 37 | /** |
| 38 | + * Prepares the URL with optional $params which redirects to the provider's authorization prompt |
| 39 | + * and returns a PSR-7 UriInterface with all necessary parameters set |
| 40 | + * |
38 | 41 | * @param array $params |
39 | 42 | * |
40 | 43 | * @return \Psr\Http\Message\UriInterface |
41 | 44 | */ |
42 | 45 | public function getAuthURL(array $params = null):UriInterface; |
43 | 46 |
|
44 | 47 | /** |
| 48 | + * Authorizes the $request with the credentials from the given $token |
| 49 | + * and returns a PSR-7 RequestInterface with all necessary headers and/or parameters set |
| 50 | + * |
45 | 51 | * @param \Psr\Http\Message\RequestInterface $request |
46 | 52 | * @param \chillerlan\OAuth\Core\AccessToken $token |
47 | 53 | * |
48 | 54 | * @return \Psr\Http\Message\RequestInterface |
| 55 | + * @throws \chillerlan\OAuth\Core\ProviderException |
49 | 56 | * @internal |
50 | 57 | */ |
51 | 58 | public function getRequestAuthorization(RequestInterface $request, AccessToken $token):RequestInterface; |
52 | 59 |
|
53 | 60 | /** |
| 61 | + * Prepares an API request to $path with the given parameters, gets authorization, fires the request |
| 62 | + * and returns a PSR-7 ResponseInterface with the corresponding API response |
| 63 | + * |
54 | 64 | * @param string $path |
55 | 65 | * @param array $params |
56 | 66 | * @param string $method |
57 | 67 | * @param null $body |
58 | 68 | * @param array $headers |
59 | 69 | * |
60 | 70 | * @return \Psr\Http\Message\ResponseInterface |
| 71 | + * @throws \chillerlan\OAuth\Core\ProviderException |
61 | 72 | */ |
62 | 73 | public function request(string $path, array $params = null, string $method = null, $body = null, array $headers = null):ResponseInterface; |
63 | 74 |
|
64 | 75 | /** |
| 76 | + * Sets an optional OAuthStorageInterface |
| 77 | + * |
65 | 78 | * @param \chillerlan\OAuth\Storage\OAuthStorageInterface $storage |
66 | 79 | * |
67 | 80 | * @return \chillerlan\OAuth\Core\OAuthInterface |
68 | 81 | */ |
69 | 82 | public function setStorage(OAuthStorageInterface $storage):OAuthInterface; |
70 | 83 |
|
71 | 84 | /** |
| 85 | + * Sets an optional PSR-17 RequestFactoryInterface |
| 86 | + * |
72 | 87 | * @param \Psr\Http\Message\RequestFactoryInterface $requestFactory |
73 | 88 | * |
74 | 89 | * @return \chillerlan\OAuth\Core\OAuthInterface |
75 | 90 | */ |
76 | 91 | public function setRequestFactory(RequestFactoryInterface $requestFactory):OAuthInterface; |
77 | 92 |
|
78 | 93 | /** |
| 94 | + * Sets an optional PSR-17 StreamFactoryInterface |
| 95 | + * |
79 | 96 | * @param \Psr\Http\Message\StreamFactoryInterface $streamFactory |
80 | 97 | * |
81 | 98 | * @return \chillerlan\OAuth\Core\OAuthInterface |
82 | 99 | */ |
83 | 100 | public function setStreamFactory(StreamFactoryInterface $streamFactory):OAuthInterface; |
84 | 101 |
|
85 | 102 | /** |
| 103 | + * Sets an optional PSR-17 UriFactoryInterface |
| 104 | + * |
86 | 105 | * @param \Psr\Http\Message\UriFactoryInterface $uriFactory |
87 | 106 | * |
88 | 107 | * @return \chillerlan\OAuth\Core\OAuthInterface |
|
0 commit comments