|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the bitbucket-api package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Alexandru G. <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Bitbucket\API\Groups; |
|
13
|
|
|
|
|
14
|
|
|
use Bitbucket\API; |
|
15
|
|
|
use Psr\Http\Message\ResponseInterface; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Manage group members. |
|
19
|
|
|
* |
|
20
|
|
|
* @author Alexandru G. <[email protected]> |
|
21
|
|
|
* @see https://confluence.atlassian.com/bitbucket/groups-endpoint-296093143.html |
|
22
|
|
|
*/ |
|
23
|
|
|
class Members extends API\Api |
|
24
|
|
|
{ |
|
25
|
|
|
/** |
|
26
|
|
|
* Get the group members |
|
27
|
|
|
* |
|
28
|
|
|
* @access public |
|
29
|
|
|
* @param string $account The team or individual account owning the repository. |
|
30
|
|
|
* @param string $repo The repository identifier. |
|
31
|
|
|
* @return ResponseInterface |
|
32
|
1 |
|
*/ |
|
33
|
|
|
public function all($account, $repo) |
|
34
|
1 |
|
{ |
|
35
|
1 |
|
return $this->getClient()->setApiVersion('1.0')->get( |
|
36
|
|
|
sprintf('/groups/%s/%s/members', $account, $repo) |
|
37
|
|
|
); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* Add new member into a group. |
|
42
|
|
|
* |
|
43
|
|
|
* @access public |
|
44
|
|
|
* @param string $account The team or individual account owning the repository. |
|
45
|
|
|
* @param string $groupSlug The slug of the group. |
|
46
|
|
|
* @param string $memberUuid An individual account. |
|
47
|
|
|
* @return ResponseInterface |
|
48
|
1 |
|
*/ |
|
49
|
|
|
public function add($account, $groupSlug, $memberUuid) |
|
50
|
1 |
|
{ |
|
51
|
1 |
|
return $this->getClient()->setApiVersion('1.0')->put( |
|
52
|
|
|
sprintf('/groups/%s/%s/members/%s', $account, $groupSlug, $memberUuid) |
|
53
|
|
|
); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* Delete a member from group. |
|
58
|
|
|
* |
|
59
|
|
|
* @access public |
|
60
|
|
|
* @param string $account The team or individual account owning the repository. |
|
61
|
|
|
* @param string $groupSlug The slug of the group. |
|
62
|
|
|
* @param string $memberUuid An individual account. |
|
63
|
|
|
* @return ResponseInterface |
|
64
|
1 |
|
*/ |
|
65
|
|
|
public function delete($account, $groupSlug, $memberUuid) |
|
66
|
1 |
|
{ |
|
67
|
1 |
|
return $this->getClient()->setApiVersion('1.0')->delete( |
|
68
|
|
|
sprintf('/groups/%s/%s/members/%s', $account, $groupSlug, $memberUuid) |
|
69
|
|
|
); |
|
70
|
|
|
} |
|
71
|
|
|
} |
|
72
|
|
|
|