1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AcquiaCloudApi\Endpoints; |
4
|
|
|
|
5
|
|
|
use AcquiaCloudApi\Connector\ClientInterface; |
6
|
|
|
use AcquiaCloudApi\Response\ApplicationsResponse; |
7
|
|
|
use AcquiaCloudApi\Response\InvitationsResponse; |
8
|
|
|
use AcquiaCloudApi\Response\MembersResponse; |
9
|
|
|
use AcquiaCloudApi\Response\OrganizationsResponse; |
10
|
|
|
use AcquiaCloudApi\Response\TeamsResponse; |
11
|
|
|
use AcquiaCloudApi\Response\OperationResponse; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class Client |
15
|
|
|
* @package AcquiaCloudApi\CloudApi |
16
|
|
|
*/ |
17
|
|
|
class Organizations implements CloudApi |
18
|
|
|
{ |
19
|
|
|
|
20
|
|
|
/** @var ClientInterface The API client. */ |
21
|
|
|
protected $client; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Client constructor. |
25
|
|
|
* |
26
|
|
|
* @param ClientInterface $client |
27
|
|
|
*/ |
28
|
|
|
public function __construct(ClientInterface $client) |
29
|
|
|
{ |
30
|
|
|
$this->client = $client; |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Show all organizations. |
35
|
|
|
* |
36
|
|
|
* @return OrganizationsResponse |
37
|
|
|
*/ |
38
|
|
|
public function getAll() |
39
|
|
|
{ |
40
|
|
|
return new OrganizationsResponse($this->client->request('get', '/organizations')); |
|
|
|
|
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Show all applications in an organisation. |
45
|
|
|
* |
46
|
|
|
* @param string $organizationUuid |
47
|
|
|
* |
48
|
|
|
* @return ApplicationsResponse |
49
|
|
|
*/ |
50
|
|
|
public function getApplications($organizationUuid) |
51
|
|
|
{ |
52
|
|
|
return new ApplicationsResponse( |
53
|
|
|
$this->client->request('get', "/organizations/${organizationUuid}/applications") |
|
|
|
|
54
|
|
|
); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Show all members of an organisation. |
59
|
|
|
* |
60
|
|
|
* @param string $organizationUuid |
61
|
|
|
* @return MembersResponse |
62
|
|
|
*/ |
63
|
|
|
public function getMembers($organizationUuid) |
64
|
|
|
{ |
65
|
|
|
return new MembersResponse( |
66
|
|
|
$this->client->request('get', "/organizations/${organizationUuid}/members") |
|
|
|
|
67
|
|
|
); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Show all members invited to an organisation. |
72
|
|
|
* |
73
|
|
|
* @param string $organizationUuid |
74
|
|
|
* @return InvitationsResponse |
75
|
|
|
*/ |
76
|
|
|
public function getInvitees($organizationUuid) |
77
|
|
|
{ |
78
|
|
|
return new InvitationsResponse( |
79
|
|
|
$this->client->request('get', "/organizations/${organizationUuid}/team-invites") |
|
|
|
|
80
|
|
|
); |
81
|
|
|
} |
82
|
|
|
|
83
|
|
|
/** |
84
|
|
|
* Delete a member from an organisation. |
85
|
|
|
* |
86
|
|
|
* @param string $organizationUuid |
87
|
|
|
* @param string $memberUuid |
88
|
|
|
* @return OperationResponse |
89
|
|
|
*/ |
90
|
|
|
public function deleteMember($organizationUuid, $memberUuid) |
91
|
|
|
{ |
92
|
|
|
return new OperationResponse( |
93
|
|
|
$this->client->request( |
|
|
|
|
94
|
|
|
'delete', |
95
|
|
|
"/organizations/${organizationUuid}/members/${memberUuid}" |
96
|
|
|
) |
97
|
|
|
); |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Show all teams in an organization. |
102
|
|
|
* |
103
|
|
|
* @param string $organizationUuid |
104
|
|
|
* @return TeamsResponse |
105
|
|
|
*/ |
106
|
|
|
public function getTeams($organizationUuid) |
107
|
|
|
{ |
108
|
|
|
return new TeamsResponse( |
109
|
|
|
$this->client->request('get', "/organizations/${organizationUuid}/teams") |
|
|
|
|
110
|
|
|
); |
111
|
|
|
} |
112
|
|
|
} |
113
|
|
|
|