This repository was archived by the owner on Nov 5, 2018. It is now read-only.
forked from KnpLabs/php-github-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeployKeys.php
More file actions
46 lines (37 loc) · 1.44 KB
/
Copy pathDeployKeys.php
File metadata and controls
46 lines (37 loc) · 1.44 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
<?php
namespace Github\Api\Repository;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/repos/keys/
* @author Joseph Bielawski <stloyd@gmail.com>
*/
class DeployKeys extends AbstractApi
{
public function all($username, $repository)
{
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys');
}
public function show($username, $repository, $id)
{
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id));
}
public function create($username, $repository, array $params)
{
if (!isset($params['title'], $params['key'])) {
throw new MissingArgumentException(array('title', 'key'));
}
return $this->post('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys', $params);
}
public function update($username, $repository, $id, array $params)
{
if (!isset($params['title'], $params['key'])) {
throw new MissingArgumentException(array('title', 'key'));
}
return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id), $params);
}
public function remove($username, $repository, $id)
{
return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/keys/'.rawurlencode($id));
}
}