Repository navigation
Expand file tree
/
Copy pathDeployKeys.php
More file actions
85 lines (76 loc) · 2.01 KB
/
Copy pathDeployKeys.php
File metadata and controls
85 lines (76 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
namespace Github\Api\CurrentUser;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/users/keys/
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class DeployKeys extends AbstractApi
{
/**
* List deploy keys for the authenticated user
* @link http://developer.github.com/v3/repos/keys/
*
* @return array
*/
public function all()
{
return $this->get('user/keys');
}
/**
* Shows deploy key for the authenticated user
* @link http://developer.github.com/v3/repos/keys/
*
* @param string $id
* @return array
*/
public function show($id)
{
return $this->get('user/keys/'.rawurlencode($id));
}
/**
* Adds deploy key for the authenticated user
* @link http://developer.github.com/v3/repos/keys/
*
* @param array $params
* @return array
*
* @throws MissingArgumentException
*/
public function create(array $params)
{
if (!isset($params['title'], $params['key'])) {
throw new MissingArgumentException(array('title', 'key'));
}
return $this->post('user/keys', $params);
}
/**
* Updates deploy key for the authenticated user
* @link http://developer.github.com/v3/repos/keys/
*
* @param string $id
* @param array $params
* @return array
*
* @throws MissingArgumentException
*/
public function update($id, array $params)
{
if (!isset($params['title'], $params['key'])) {
throw new MissingArgumentException(array('title', 'key'));
}
return $this->patch('user/keys/'.rawurlencode($id), $params);
}
/**
* Removes deploy key for the authenticated user
* @link http://developer.github.com/v3/repos/keys/
*
* @param string $id
* @return array
*/
public function remove($id)
{
return $this->delete('user/keys/'.rawurlencode($id));
}
}