Repository navigation
Expand file tree
/
Copy pathGitHubIssuesLabels.php
More file actions
93 lines (74 loc) · 1.99 KB
/
Copy pathGitHubIssuesLabels.php
File metadata and controls
93 lines (74 loc) · 1.99 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
91
92
<?php
require_once(__DIR__ . '/../GitHubClient.php');
require_once(__DIR__ . '/../GitHubService.php');
require_once(__DIR__ . '/../objects/GitHubLabel.php');
class GitHubIssuesLabels extends GitHubService
{
/**
* List all labels for this repository
*
* @return array<GitHubLabel>
*/
public function listAllLabelsForThisRepository($owner, $repo)
{
$data = array();
return $this->client->request("/repos/$owner/$repo/labels", 'GET', $data, 200, 'GitHubLabel', true);
}
/**
* Get a single label
*
* @return GitHubLabel
*/
public function getSingleLabel($owner, $repo, $name)
{
$data = array();
return $this->client->request("/repos/$owner/$repo/labels/$name", 'GET', $data, 200, 'GitHubLabel');
}
/**
* Create a label
*
*/
public function createLabel($owner, $repo, $name)
{
$data = array();
return $this->client->request("/repos/$owner/$repo/labels/$name", 'DELETE', $data, 204, '');
}
/**
* List labels on an issue
*
* @return array<GitHubLabel>
*/
public function listLabelsOnAnIssue($owner, $repo, $number)
{
$data = array();
return $this->client->request("/repos/$owner/$repo/issues/$number/labels", 'GET', $data, 200, 'GitHubLabel', true);
}
/**
* Add labels to an issue
*
*/
public function addLabelsToAnIssue($owner, $repo, $number, $name)
{
$data = array();
return $this->client->request("/repos/$owner/$repo/issues/$number/labels/$name", 'DELETE', $data, 204, '');
}
/**
* Replace all labels for an issue
*
* @return array<GitHubLabel>
*/
public function replaceAllLabelsForAnIssue($owner, $repo, $number)
{
$data = array();
return $this->client->request("/repos/$owner/$repo/issues/$number/labels", 'PUT', $data, 200, 'GitHubLabel', true);
}
/**
* Remove all labels from an issue
*
*/
public function removeAllLabelsFromAnIssue($owner, $repo, $number)
{
$data = array();
return $this->client->request("/repos/$owner/$repo/issues/$number/labels", 'DELETE', $data, 204, '');
}
}