|
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 Buzz\Message\MessageInterface; |
|
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 MessageInterface |
|
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 followers. |
|
40
|
|
|
* |
|
41
|
|
|
* @access public |
|
42
|
|
|
* @param string $username |
|
43
|
|
|
* @return MessageInterface |
|
44
|
|
|
*/ |
|
45
|
1 |
|
public function followers($username) |
|
46
|
|
|
{ |
|
47
|
1 |
|
return $this->getClient()->setApiVersion('2.0')->get( |
|
48
|
1 |
|
sprintf('users/%s/followers', $username) |
|
49
|
|
|
); |
|
50
|
|
|
} |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Get a list of accounts the user is following |
|
54
|
|
|
* |
|
55
|
|
|
* @access public |
|
56
|
|
|
* @param string $username |
|
57
|
|
|
* @return MessageInterface |
|
58
|
|
|
*/ |
|
59
|
1 |
|
public function following($username) |
|
60
|
|
|
{ |
|
61
|
1 |
|
return $this->getClient()->setApiVersion('2.0')->get( |
|
62
|
1 |
|
sprintf('users/%s/following', $username) |
|
63
|
|
|
); |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* Get the list of the user's repositories |
|
68
|
|
|
* |
|
69
|
|
|
* @access public |
|
70
|
|
|
* @param string $username |
|
71
|
|
|
* @return MessageInterface |
|
72
|
|
|
*/ |
|
73
|
1 |
|
public function repositories($username) |
|
74
|
|
|
{ |
|
75
|
1 |
|
return $this->getClient()->setApiVersion('2.0')->get( |
|
76
|
1 |
|
sprintf('repositories/%s', $username) |
|
77
|
|
|
); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Get account |
|
82
|
|
|
* |
|
83
|
|
|
* @access public |
|
84
|
|
|
* @return Users\Account |
|
85
|
|
|
* |
|
86
|
|
|
* @throws \InvalidArgumentException |
|
87
|
|
|
*/ |
|
88
|
1 |
|
public function account() |
|
89
|
|
|
{ |
|
90
|
1 |
|
return $this->api('Users\\Account'); |
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Get emails |
|
95
|
|
|
* |
|
96
|
|
|
* @access public |
|
97
|
|
|
* @return Users\Emails |
|
98
|
|
|
* |
|
99
|
|
|
* @throws \InvalidArgumentException |
|
100
|
|
|
*/ |
|
101
|
1 |
|
public function emails() |
|
102
|
|
|
{ |
|
103
|
1 |
|
return $this->api('Users\\Emails'); |
|
104
|
|
|
} |
|
105
|
|
|
|
|
106
|
|
|
/** |
|
107
|
|
|
* Get invitations |
|
108
|
|
|
* |
|
109
|
|
|
* @access public |
|
110
|
|
|
* @return Users\Invitations |
|
111
|
|
|
* |
|
112
|
|
|
* @throws \InvalidArgumentException |
|
113
|
|
|
*/ |
|
114
|
1 |
|
public function invitations() |
|
115
|
|
|
{ |
|
116
|
1 |
|
return $this->api('Users\\Invitations'); |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* Get oauth |
|
121
|
|
|
* |
|
122
|
|
|
* @access public |
|
123
|
|
|
* @return Users\OAuth |
|
124
|
|
|
* |
|
125
|
|
|
* @throws \InvalidArgumentException |
|
126
|
|
|
*/ |
|
127
|
1 |
|
public function oauth() |
|
128
|
|
|
{ |
|
129
|
1 |
|
return $this->api('Users\\OAuth'); |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* Get sshKeys |
|
134
|
|
|
* |
|
135
|
|
|
* @access public |
|
136
|
|
|
* @return Users\SshKeys |
|
137
|
|
|
* |
|
138
|
|
|
* @throws \InvalidArgumentException |
|
139
|
|
|
*/ |
|
140
|
1 |
|
public function sshKeys() |
|
141
|
|
|
{ |
|
142
|
1 |
|
return $this->api('Users\\SshKeys'); |
|
143
|
|
|
} |
|
144
|
|
|
} |
|
145
|
|
|
|