-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathConnectorInterface.php
More file actions
70 lines (58 loc) · 1.69 KB
/
ConnectorInterface.php
File metadata and controls
70 lines (58 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
declare(strict_types=1);
namespace Platformsh\Client\Connection;
use GuzzleHttp\ClientInterface;
use Platformsh\Client\Session\SessionInterface;
interface ConnectorInterface
{
/**
* Get the session instance for this connection.
*/
public function getSession(): SessionInterface;
/**
* Log in to Platform.sh.
*
* @param bool $force
* Whether to re-authenticate even if the session appears to be logged
* in already.
* @param int|string|null $totp
* Time-based one-time password (two-factor authentication).
*/
public function logIn(string $username, string $password, bool $force = false, int|string $totp = null);
/**
* Log out.
*/
public function logOut();
/**
* Check whether the user is logged in.
*/
public function isLoggedIn(): bool;
/**
* Get an authenticated Guzzle client.
*
* This will fail if the user is not logged in.
*/
public function getClient(): ClientInterface;
/**
* Set the API token to use for Platform.sh requests.
*
* @param string $token
* The token value.
* @param string $type
* The token type: 'exchange' for an API token (recommended), or 'access'
* for an OAuth 2.0 access token.
*/
public function setApiToken(string $token, string $type);
/**
* Get the connector configuration.
*/
public function getConfig(): array;
/**
* Returns the access token saved in the session, if any.
*/
public function getAccessToken(): ?string;
/**
* Get the configured API gateway URL (without trailing slash).
*/
public function getApiUrl(): string;
}