| 1 |
<?php |
| 2 |
/*! |
| 3 |
* Hybridauth |
| 4 |
* https://hybridauth.github.io | https://github.com/hybridauth/hybridauth |
| 5 |
* (c) 2017 Hybridauth authors | https://hybridauth.github.io/license.html |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace Hybridauth\Adapter; |
| 9 |
|
| 10 |
use Hybridauth\HttpClient\HttpClientInterface; |
| 11 |
use Hybridauth\Storage\StorageInterface; |
| 12 |
use Hybridauth\Logger\LoggerInterface; |
| 13 |
|
| 14 |
/** |
| 15 |
* Interface AdapterInterface |
| 16 |
*/ |
| 17 |
interface AdapterInterface |
| 18 |
{ |
| 19 |
/** |
| 20 |
* Initiate the appropriate protocol and process/automate the authentication or authorization flow. |
| 21 |
* |
| 22 |
* @return bool|null |
| 23 |
*/ |
| 24 |
public function authenticate(); |
| 25 |
|
| 26 |
/** |
| 27 |
* Returns TRUE if the user is connected |
| 28 |
* |
| 29 |
* @return bool |
| 30 |
*/ |
| 31 |
public function isConnected(); |
| 32 |
|
| 33 |
/** |
| 34 |
* Clear all access token in storage |
| 35 |
*/ |
| 36 |
public function disconnect(); |
| 37 |
|
| 38 |
/** |
| 39 |
* Retrieve the connected user profile |
| 40 |
* |
| 41 |
* @return \Hybridauth\User\Profile |
| 42 |
*/ |
| 43 |
public function getUserProfile(); |
| 44 |
|
| 45 |
/** |
| 46 |
* Retrieve the connected user contacts list |
| 47 |
* |
| 48 |
* @return \Hybridauth\User\Contact[] |
| 49 |
*/ |
| 50 |
public function getUserContacts(); |
| 51 |
|
| 52 |
/** |
| 53 |
* Retrieve the connected user pages|companies|groups list |
| 54 |
* |
| 55 |
* @return array |
| 56 |
*/ |
| 57 |
public function getUserPages(); |
| 58 |
|
| 59 |
/** |
| 60 |
* Retrieve the user activity stream |
| 61 |
* |
| 62 |
* @param string $stream |
| 63 |
* |
| 64 |
* @return \Hybridauth\User\Activity[] |
| 65 |
*/ |
| 66 |
public function getUserActivity($stream); |
| 67 |
|
| 68 |
/** |
| 69 |
* Post a status on user wall|timeline|blog|website|etc. |
| 70 |
* |
| 71 |
* @param string|array $status |
| 72 |
* |
| 73 |
* @return mixed API response |
| 74 |
*/ |
| 75 |
public function setUserStatus($status); |
| 76 |
|
| 77 |
/** |
| 78 |
* Post a status on page|company|group wall. |
| 79 |
* |
| 80 |
* @param string|array $status |
| 81 |
* @param string $pageId |
| 82 |
* |
| 83 |
* @return mixed API response |
| 84 |
*/ |
| 85 |
public function setPageStatus($status, $pageId); |
| 86 |
|
| 87 |
/** |
| 88 |
* Send a signed request to provider API |
| 89 |
* |
| 90 |
* @param string $url |
| 91 |
* @param string $method |
| 92 |
* @param array $parameters |
| 93 |
* @param array $headers |
| 94 |
* @param bool $multipart |
| 95 |
* |
| 96 |
* @return mixed |
| 97 |
*/ |
| 98 |
public function apiRequest($url, $method = 'GET', $parameters = [], $headers = [], $multipart = false); |
| 99 |
|
| 100 |
/** |
| 101 |
* Do whatever may be necessary to make sure tokens do not expire. |
| 102 |
* Intended to be be called frequently, e.g. via Cron. |
| 103 |
*/ |
| 104 |
public function maintainToken(); |
| 105 |
|
| 106 |
/** |
| 107 |
* Return oauth access tokens. |
| 108 |
* |
| 109 |
* @return array |
| 110 |
*/ |
| 111 |
public function getAccessToken(); |
| 112 |
|
| 113 |
/** |
| 114 |
* Set oauth access tokens. |
| 115 |
* |
| 116 |
* @param array $tokens |
| 117 |
*/ |
| 118 |
public function setAccessToken($tokens = []); |
| 119 |
|
| 120 |
/** |
| 121 |
* Set http client instance. |
| 122 |
* |
| 123 |
* @param HttpClientInterface $httpClient |
| 124 |
*/ |
| 125 |
public function setHttpClient(HttpClientInterface $httpClient = null); |
| 126 |
|
| 127 |
/** |
| 128 |
* Return http client instance. |
| 129 |
*/ |
| 130 |
public function getHttpClient(); |
| 131 |
|
| 132 |
/** |
| 133 |
* Set storage instance. |
| 134 |
* |
| 135 |
* @param StorageInterface $storage |
| 136 |
*/ |
| 137 |
public function setStorage(StorageInterface $storage = null); |
| 138 |
|
| 139 |
/** |
| 140 |
* Return storage instance. |
| 141 |
*/ |
| 142 |
public function getStorage(); |
| 143 |
|
| 144 |
/** |
| 145 |
* Set Logger instance. |
| 146 |
* |
| 147 |
* @param LoggerInterface $logger |
| 148 |
*/ |
| 149 |
public function setLogger(LoggerInterface $logger = null); |
| 150 |
|
| 151 |
/** |
| 152 |
* Return logger instance. |
| 153 |
*/ |
| 154 |
public function getLogger(); |
| 155 |
} |
| 156 |
|