Repository navigation
Expand file tree
/
Copy pathAssets.php
More file actions
90 lines (82 loc) · 2.88 KB
/
Copy pathAssets.php
File metadata and controls
90 lines (82 loc) · 2.88 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
86
87
88
89
90
<?php
namespace Github\Api\Repository;
use Github\Api\AbstractApi;
use Github\Exception\MissingArgumentException;
/**
* @link http://developer.github.com/v3/repos/releases/
* @author Evgeniy Guseletov <d46k16@gmail.com>
*/
class Assets extends AbstractApi
{
/**
* @deprecated Will be removed as soon as gh releases api gets stable
*/
public function configure()
{
$this->client->setHeaders(array(
'Accept: application/vnd.github.manifold-preview'
));
}
/**
* Get all release's assets in selected repository
* GET /repos/:owner/:repo/releases/:id/assets
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param integer $id the id of the release
*
* @return array
*/
public function all($username, $repository, $id)
{
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/'.rawurlencode($id).'/assets');
}
/**
* Get an asset in selected repository's release
* GET /repos/:owner/:repo/releases/assets/:id
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param integer $id the id of the asset
*
* @return array
*/
public function show($username, $repository, $id)
{
return $this->get('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.rawurlencode($id));
}
/**
* Edit an asset in selected repository's release
* PATCH /repos/:owner/:repo/releases/assets/:id
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param integer $id the id of the asset
* @param array $params request parameters
*
* @throws MissingArgumentException
*
* @return array
*/
public function edit($username, $repository, $id, array $params)
{
if (!isset($params['name'])) {
throw new MissingArgumentException('name');
}
return $this->patch('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.rawurlencode($id), $params);
}
/**
* Delete an asset in selected repository's release
* DELETE /repos/:owner/:repo/releases/assets/:id
*
* @param string $username the user who owns the repo
* @param string $repository the name of the repo
* @param integer $id the id of the asset
*
* @return array
*/
public function remove($username, $repository, $id)
{
return $this->delete('repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/releases/assets/'.rawurlencode($id));
}
}