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
|
|
|
namespace Bitbucket\API; |
12
|
|
|
|
13
|
|
|
use Psr\Http\Message\ResponseInterface; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* @author Matt S. <[email protected]> |
17
|
|
|
*/ |
18
|
|
|
class Workspaces extends Api |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* Get a list of workspaces to which the caller has access. |
22
|
|
|
* |
23
|
|
|
* @access public |
24
|
|
|
* @return ResponseInterface |
25
|
|
|
* |
26
|
|
|
* @throws \InvalidArgumentException |
27
|
|
|
*/ |
28
|
|
|
public function all() |
29
|
|
|
{ |
30
|
|
|
return $this->getClient()->setApiVersion('2.0')->get('/workspaces'); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Get the public information associated with a workspace. |
35
|
|
|
* |
36
|
|
|
* @access public |
37
|
|
|
* @param string $workspace The workspace ID (slug) or workspace UUID in curly brackets. |
38
|
|
|
* @return ResponseInterface |
39
|
|
|
*/ |
40
|
|
|
public function profile($workspace) |
41
|
|
|
{ |
42
|
|
|
return $this->getClient()->setApiVersion('2.0')->get( |
43
|
|
|
sprintf('/workspaces/%s', $workspace) |
44
|
|
|
); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* Get the workspace members. |
49
|
|
|
* |
50
|
|
|
* @access public |
51
|
|
|
* @param string $workspace The workspace ID (slug) or workspace UUID in curly brackets. |
52
|
|
|
* @return ResponseInterface |
53
|
|
|
*/ |
54
|
|
|
public function members($workspace) |
55
|
|
|
{ |
56
|
|
|
return $this->getClient()->setApiVersion('2.0')->get( |
57
|
|
|
sprintf('/workspaces/%s/members', $workspace) |
58
|
|
|
); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Get the list of projects in the workspace |
63
|
|
|
* |
64
|
|
|
* @access public |
65
|
|
|
* @param string $workspace The workspace ID (slug) or workspace UUID in curly brackets. |
66
|
|
|
* @return ResponseInterface |
67
|
|
|
*/ |
68
|
|
|
public function projects($workspace) |
69
|
|
|
{ |
70
|
|
|
return $this->getClient()->setApiVersion('2.0')->get( |
71
|
|
|
sprintf('/workspaces/%s/projects', $workspace) |
72
|
|
|
); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @return Workspaces\Hooks |
77
|
|
|
* @throws \InvalidArgumentException |
78
|
|
|
*/ |
79
|
|
|
public function hooks() |
80
|
|
|
{ |
81
|
|
|
return $this->api(Workspaces\Hooks::class); |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|