Skip to content

Commit e409566

Browse files
authored
Merge pull request #114 from SimonLab/remove-label-issue
add support for removing a label from an issue
2 parents 6883e50 + 026e1bb commit e409566

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed

lib/tentacat/issues/labels.ex

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,18 @@ defmodule Tentacat.Issues.Labels do
2929
def add(owner, repo, issue_id, labels, client \\ %Client{}) do
3030
post "repos/#{owner}/#{repo}/issues/#{issue_id}/labels", client, labels
3131
end
32+
33+
@doc """
34+
Remove a label from an issue
35+
36+
## Example
37+
38+
Tentacat.Issues.Labels.remove "elixir-lang", "elixir", 3970, "Important"
39+
40+
More info at: https://developer.github.com/v3/issues/labels/#remove-a-label-from-an-issue
41+
"""
42+
@spec remove(binary, binary, binary | integer, binary, Client.t) :: Tentacat.response
43+
def remove(owner, repo, issue_id, label, client \\ %Client{}) do
44+
delete "repos/#{owner}/#{repo}/issues/#{issue_id}/labels/#{label}", client
45+
end
3246
end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[
2+
{
3+
"request": {
4+
"body": "\"\"",
5+
"headers": {
6+
"User-agent": "tentacat"
7+
},
8+
"method": "delete",
9+
"options": [],
10+
"request_body": "",
11+
"url": "https://api.github.com/repos/dwyl/learn-elixir/issues/1/labels/WIP"
12+
},
13+
"response": {
14+
"body": "",
15+
"headers": {
16+
"Server": "GitHub.com",
17+
"Date": "Wed, 19 Apr 2017 15:38:42 GMT",
18+
"Content-Type": "application/json; charset=utf-8",
19+
"Content-Length": "2260",
20+
"Status": "200 OK",
21+
"X-RateLimit-Limit": "60",
22+
"X-RateLimit-Remaining": "42",
23+
"X-RateLimit-Reset": "1465314971",
24+
"Cache-Control": "public, max-age=60, s-maxage=60",
25+
"Vary": "Accept",
26+
"ETag": "\"1598b9c2c9191001f30226e51a54afb2\"",
27+
"X-GitHub-Media-Type": "github.v3; format=json",
28+
"Access-Control-Expose-Headers": "ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval",
29+
"Access-Control-Allow-Origin": "*",
30+
"Content-Security-Policy": "default-src 'none'",
31+
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
32+
"X-Content-Type-Options": "nosniff",
33+
"X-Frame-Options": "deny",
34+
"X-XSS-Protection": "1; mode=block",
35+
"X-Served-By": "318e55760cf7cdb40e61175a4d36cd32",
36+
"X-GitHub-Request-Id": "32E9B27E:B216:239A2390:5756E46C"
37+
},
38+
"status_code": 204,
39+
"type": "ok"
40+
}
41+
}
42+
]

test/issues/labels_test.exs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,11 @@ defmodule Tentacat.Issues.LabelsTest do
2323
assert name == "WIP"
2424
end
2525
end
26+
27+
test "remove/5" do
28+
use_cassette "issues/labels#remove" do
29+
{status_code, _} = remove("dwyl", "learn-elixir", "1", "WIP", @client)
30+
assert status_code == 204
31+
end
32+
end
2633
end

0 commit comments

Comments
 (0)