|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AcquiaCloudApi\Endpoints; |
|
4
|
|
|
|
|
5
|
|
|
use AcquiaCloudApi\Response\ApplicationResponse; |
|
6
|
|
|
use AcquiaCloudApi\Response\ApplicationsResponse; |
|
7
|
|
|
use AcquiaCloudApi\Response\OperationResponse; |
|
8
|
|
|
use AcquiaCloudApi\Response\TeamResponse; |
|
9
|
|
|
use AcquiaCloudApi\Response\TeamsResponse; |
|
10
|
|
|
|
|
11
|
|
|
/** |
|
12
|
|
|
* Class Teams |
|
13
|
|
|
* |
|
14
|
|
|
* @package AcquiaCloudApi\CloudApi |
|
15
|
|
|
*/ |
|
16
|
|
|
class Teams extends CloudApiBase |
|
17
|
|
|
{ |
|
18
|
|
|
/** |
|
19
|
|
|
* Create a new team. |
|
20
|
|
|
*/ |
|
21
|
|
|
public function create(string $organizationUuid, string $name): OperationResponse |
|
22
|
|
|
{ |
|
23
|
|
|
$options = [ |
|
24
|
|
|
'json' => [ |
|
25
|
|
|
'name' => $name, |
|
26
|
|
|
], |
|
27
|
|
|
]; |
|
28
|
|
|
|
|
29
|
|
|
return new OperationResponse( |
|
30
|
|
|
$this->client->request('post', "/organizations/$organizationUuid/teams", $options) |
|
31
|
|
|
); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Show all teams. |
|
36
|
|
|
* |
|
37
|
|
|
* @return TeamsResponse<TeamResponse> |
|
38
|
|
|
*/ |
|
39
|
|
|
public function getAll(): TeamsResponse |
|
40
|
|
|
{ |
|
41
|
|
|
return new TeamsResponse( |
|
42
|
|
|
$this->client->request('get', '/teams') |
|
43
|
|
|
); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* Rename an existing team. |
|
48
|
|
|
*/ |
|
49
|
|
|
public function rename(string $teamUuid, string $name): OperationResponse |
|
50
|
|
|
{ |
|
51
|
|
|
$options = [ |
|
52
|
|
|
'json' => [ |
|
53
|
|
|
'name' => $name, |
|
54
|
|
|
], |
|
55
|
|
|
]; |
|
56
|
|
|
|
|
57
|
|
|
return new OperationResponse( |
|
58
|
|
|
$this->client->request('put', "/teams/$teamUuid", $options) |
|
59
|
|
|
); |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
|
|
63
|
|
|
/** |
|
64
|
|
|
* Delete a team. |
|
65
|
|
|
*/ |
|
66
|
|
|
public function delete(string $teamUuid): OperationResponse |
|
67
|
|
|
{ |
|
68
|
|
|
return new OperationResponse( |
|
69
|
|
|
$this->client->request('delete', "/teams/$teamUuid") |
|
70
|
|
|
); |
|
71
|
|
|
} |
|
72
|
|
|
|
|
73
|
|
|
/** |
|
74
|
|
|
* Add an application to a team. |
|
75
|
|
|
*/ |
|
76
|
|
|
public function addApplication(string $teamUuid, string $applicationUuid): OperationResponse |
|
77
|
|
|
{ |
|
78
|
|
|
$options = [ |
|
79
|
|
|
'json' => [ |
|
80
|
|
|
'uuid' => $applicationUuid, |
|
81
|
|
|
], |
|
82
|
|
|
]; |
|
83
|
|
|
|
|
84
|
|
|
return new OperationResponse( |
|
85
|
|
|
$this->client->request('post', "/teams/$teamUuid/applications", $options) |
|
86
|
|
|
); |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* Invites a user to join a team. |
|
91
|
|
|
* |
|
92
|
|
|
* @param string[] $roles |
|
93
|
|
|
*/ |
|
94
|
|
|
public function invite(string $teamUuid, string $email, array $roles): OperationResponse |
|
95
|
|
|
{ |
|
96
|
|
|
$options = [ |
|
97
|
|
|
'json' => [ |
|
98
|
|
|
'email' => $email, |
|
99
|
|
|
'roles' => $roles, |
|
100
|
|
|
], |
|
101
|
|
|
]; |
|
102
|
|
|
|
|
103
|
|
|
return new OperationResponse( |
|
104
|
|
|
$this->client->request('post', "/teams/$teamUuid/invites", $options) |
|
105
|
|
|
); |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* Show all applications associated with a team. |
|
110
|
|
|
* |
|
111
|
|
|
* @return ApplicationsResponse<ApplicationResponse> |
|
112
|
|
|
*/ |
|
113
|
|
|
public function getApplications(string $teamUuid): ApplicationsResponse |
|
114
|
|
|
{ |
|
115
|
|
|
return new ApplicationsResponse( |
|
116
|
|
|
$this->client->request('get', "/teams/$teamUuid/applications") |
|
117
|
|
|
); |
|
118
|
|
|
} |
|
119
|
|
|
} |
|
120
|
|
|
|