|
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; |
|
13
|
|
|
|
|
14
|
|
|
use Psr\Http\Message\ResponseInterface; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* Get information related to an individual or team account. |
|
18
|
|
|
* NOTE: For making calls against the currently authenticated account, see the `User` resource. |
|
19
|
|
|
* |
|
20
|
|
|
* @author Alexandru G. <[email protected]> |
|
21
|
|
|
*/ |
|
22
|
|
|
class Users extends Api |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* Get the public information associated with a user |
|
26
|
|
|
* |
|
27
|
|
|
* @access public |
|
28
|
|
|
* @param string $username |
|
29
|
|
|
* @return ResponseInterface |
|
30
|
|
|
*/ |
|
31
|
1 |
|
public function get($username) |
|
32
|
|
|
{ |
|
33
|
1 |
|
return $this->getClient()->setApiVersion('2.0')->get( |
|
34
|
1 |
|
sprintf('/users/%s', $username) |
|
35
|
|
|
); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Get the list of the user's repositories |
|
40
|
|
|
* |
|
41
|
|
|
* @access public |
|
42
|
|
|
* @param string $username |
|
43
|
|
|
* @return ResponseInterface |
|
44
|
|
|
*/ |
|
45
|
1 |
|
public function repositories($username) |
|
46
|
|
|
{ |
|
47
|
1 |
|
return $this->getClient()->setApiVersion('2.0')->get( |
|
48
|
1 |
|
sprintf('/repositories/%s', $username) |
|
49
|
|
|
); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Get invitations |
|
54
|
|
|
* |
|
55
|
|
|
* @access public |
|
56
|
|
|
* @return Users\Invitations |
|
57
|
|
|
* |
|
58
|
|
|
* @throws \InvalidArgumentException |
|
59
|
1 |
|
*/ |
|
60
|
|
|
public function invitations() |
|
61
|
1 |
|
{ |
|
62
|
1 |
|
return $this->api(Users\Invitations::class); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* Get sshKeys |
|
67
|
|
|
* |
|
68
|
|
|
* @access public |
|
69
|
|
|
* @return Users\SshKeys |
|
70
|
|
|
* |
|
71
|
|
|
* @throws \InvalidArgumentException |
|
72
|
|
|
*/ |
|
73
|
1 |
|
public function sshKeys() |
|
74
|
|
|
{ |
|
75
|
1 |
|
return $this->api(Users\SshKeys::class); |
|
76
|
1 |
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|