-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] implement Repository Invitations API
fixes #374
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.kohsuke.github; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.TreeMap; | ||
|
||
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; | ||
|
||
/*package*/ GHInvitation wrapUp(GitHub root) { | ||
this.root = root; | ||
return this; | ||
} | ||
|
||
/** | ||
* Accept a repository invitation. | ||
*/ | ||
public void accept() throws IOException { | ||
root.retrieve().method("PATCH").to("/user/repository_invitations/" + id); | ||
} | ||
|
||
/** | ||
* Decline a repository invitation. | ||
*/ | ||
public void decline() throws IOException { | ||
root.retrieve().method("DELETE").to("/user/repository_invitations/" + id); | ||
} | ||
|
||
@Override | ||
public URL getHtmlUrl() { | ||
return GitHub.parseURL(html_url); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters