|
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
|
|
|
* Manages the currently authenticated account profile. |
|
18
|
|
|
* |
|
19
|
|
|
* @author Alexandru G. <[email protected]> |
|
20
|
|
|
*/ |
|
21
|
|
|
class User extends Api |
|
22
|
|
|
{ |
|
23
|
|
|
/** |
|
24
|
|
|
* Get user profile |
|
25
|
|
|
* |
|
26
|
|
|
* @access public |
|
27
|
|
|
* @return MessageInterface |
|
28
|
|
|
*/ |
|
29
|
1 |
|
public function get() |
|
30
|
|
|
{ |
|
31
|
1 |
|
return $this->requestGet('user/'); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Update user |
|
36
|
|
|
* |
|
37
|
|
|
* @access public |
|
38
|
|
|
* @param array $options Filed->value pair of account settings |
|
39
|
|
|
* @return MessageInterface |
|
40
|
|
|
* |
|
41
|
|
|
* @see https://confluence.atlassian.com/display/BITBUCKET/user+Endpoint#userEndpoint-Updateauser |
|
42
|
|
|
*/ |
|
43
|
1 |
|
public function update(array $options) |
|
44
|
|
|
{ |
|
45
|
1 |
|
return $this->requestPut('user/', $options); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Get a list of user privileges |
|
50
|
|
|
* |
|
51
|
|
|
* @access public |
|
52
|
|
|
* @return MessageInterface |
|
53
|
|
|
*/ |
|
54
|
1 |
|
public function privileges() |
|
55
|
|
|
{ |
|
56
|
1 |
|
return $this->requestGet('user/privileges'); |
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
/** |
|
60
|
|
|
* Get a list of repositories an account follows |
|
61
|
|
|
* |
|
62
|
|
|
* @access public |
|
63
|
|
|
* @return MessageInterface |
|
64
|
|
|
*/ |
|
65
|
1 |
|
public function follows() |
|
66
|
|
|
{ |
|
67
|
1 |
|
return $this->requestGet('user/follows'); |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* Get repositories |
|
72
|
|
|
* |
|
73
|
|
|
* @access public |
|
74
|
|
|
* @return User\Repositories |
|
75
|
|
|
* @codeCoverageIgnore |
|
76
|
|
|
*/ |
|
77
|
|
|
public function repositories() |
|
78
|
|
|
{ |
|
79
|
|
|
return $this->childFactory('User\\Repositories'); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* Retrieves the email for an authenticated user. |
|
84
|
|
|
* |
|
85
|
|
|
* @access public |
|
86
|
|
|
* @return MessageInterface |
|
87
|
|
|
* |
|
88
|
|
|
* @throws \InvalidArgumentException |
|
89
|
|
|
*/ |
|
90
|
1 |
|
public function emails() |
|
91
|
|
|
{ |
|
92
|
1 |
|
return $this->getClient()->setApiVersion('2.0')->get('user/emails'); |
|
93
|
|
|
} |
|
94
|
|
|
} |
|
95
|
|
|
|