forked from hub4j/github-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGHInvitation.java
More file actions
56 lines (48 loc) · 1.48 KB
/
GHInvitation.java
File metadata and controls
56 lines (48 loc) · 1.48 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
package org.kohsuke.github;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.net.URL;
/**
* The type GHInvitation.
*
* @see GitHub#getMyInvitations() GitHub#getMyInvitations()
* @see GHRepository#listInvitations() GHRepository#listInvitations()
*/
@SuppressFBWarnings(
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
"UUF_UNUSED_FIELD" },
justification = "JSON API")
public class GHInvitation extends GHObject {
/* package almost final */ GitHub root;
private int id;
private GHRepository repository;
private GHUser invitee, inviter;
private String permissions;
private String html_url;
GHInvitation wrapUp(GitHub root) {
this.root = root;
return this;
}
/**
* Accept a repository invitation.
*
* @throws IOException
* the io exception
*/
public void accept() throws IOException {
root.createRequest().method("PATCH").withUrlPath("/user/repository_invitations/" + id).send();
}
/**
* Decline a repository invitation.
*
* @throws IOException
* the io exception
*/
public void decline() throws IOException {
root.createRequest().method("DELETE").withUrlPath("/user/repository_invitations/" + id).send();
}
@Override
public URL getHtmlUrl() {
return GitHubClient.parseURL(html_url);
}
}