Repository navigation
Expand file tree
/
Copy pathPublicKeys.php
More file actions
74 lines (67 loc) · 1.56 KB
/
Copy pathPublicKeys.php
File metadata and controls
74 lines (67 loc) · 1.56 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
<?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 PublicKeys extends AbstractApi
{
/**
* List deploy keys for the authenticated user.
*
* @link https://developer.github.com/v3/users/keys/
*
* @return array
*/
public function all()
{
return $this->get('/user/keys');
}
/**
* Shows deploy key for the authenticated user.
*
* @link https://developer.github.com/v3/users/keys/
*
* @param int $id
*
* @return array
*/
public function show($id)
{
return $this->get('/user/keys/'.rawurlencode($id));
}
/**
* Adds deploy key for the authenticated user.
*
* @link https://developer.github.com/v3/users/keys/
*
* @param array $params
*
* @throws \Github\Exception\MissingArgumentException
*
* @return array
*/
public function create(array $params)
{
if (!isset($params['title'], $params['key'])) {
throw new MissingArgumentException(['title', 'key']);
}
return $this->post('/user/keys', $params);
}
/**
* Removes deploy key for the authenticated user.
*
* @link https://developer.github.com/v3/users/keys/
*
* @param int $id
*
* @return array
*/
public function remove($id)
{
return $this->delete('/user/keys/'.rawurlencode($id));
}
}