55
66/**
77 * Creates a team.
8+ *
9+ * https://developer.github.com/v3/teams/#parameters
810 */
9- public class GHCreateTeamBuilder {
11+ public class GHTeamBuilder {
1012
1113 private final GitHub root ;
1214 protected final Requester builder ;
13- private final String apiUrlTail ;
15+ private final String orgName ;
1416
15- public GHCreateTeamBuilder (GitHub root , String apiUrlTail , String name ) {
17+ public GHTeamBuilder (GitHub root , String orgName , String name ) {
1618 this .root = root ;
17- this .apiUrlTail = apiUrlTail ;
19+ this .orgName = orgName ;
1820 this .builder = root .createRequest ();
1921 this .builder .with ("name" , name );
2022 }
@@ -26,7 +28,7 @@ public GHCreateTeamBuilder(GitHub root, String apiUrlTail, String name) {
2628 * description of team
2729 * @return a builder to continue with building
2830 */
29- public GHCreateTeamBuilder description (String description ) {
31+ public GHTeamBuilder description (String description ) {
3032 this .builder .with ("description" , description );
3133 return this ;
3234 }
@@ -38,7 +40,7 @@ public GHCreateTeamBuilder description(String description) {
3840 * maintainers of team
3941 * @return a builder to continue with building
4042 */
41- public GHCreateTeamBuilder maintainers (List <String > maintainers ) {
43+ public GHTeamBuilder maintainers (List <String > maintainers ) {
4244 this .builder .with ("maintainers" , maintainers );
4345 return this ;
4446 }
@@ -50,7 +52,7 @@ public GHCreateTeamBuilder maintainers(List<String> maintainers) {
5052 * repoNames to add team to
5153 * @return a builder to continue with building
5254 */
53- public GHCreateTeamBuilder repoNames (List <String > repoNames ) {
55+ public GHTeamBuilder repoNames (List <String > repoNames ) {
5456 this .builder .with ("repo_names" , repoNames );
5557 return this ;
5658 }
@@ -62,7 +64,7 @@ public GHCreateTeamBuilder repoNames(List<String> repoNames) {
6264 * privacy of team
6365 * @return a builder to continue with building
6466 */
65- public GHCreateTeamBuilder privacy (GHTeam .Privacy privacy ) {
67+ public GHTeamBuilder privacy (GHTeam .Privacy privacy ) {
6668 this .builder .with ("privacy" , privacy );
6769 return this ;
6870 }
@@ -74,7 +76,7 @@ public GHCreateTeamBuilder privacy(GHTeam.Privacy privacy) {
7476 * parentTeamId of team
7577 * @return a builder to continue with building
7678 */
77- public GHCreateTeamBuilder parentTeamId (int parentTeamId ) {
79+ public GHTeamBuilder parentTeamId (int parentTeamId ) {
7880 this .builder .with ("parent_team_id" , parentTeamId );
7981 return this ;
8082 }
@@ -87,6 +89,6 @@ public GHCreateTeamBuilder parentTeamId(int parentTeamId) {
8789 * if team cannot be created
8890 */
8991 public GHTeam create () throws IOException {
90- return builder .method ("POST" ).withUrlPath (apiUrlTail ).fetch (GHTeam .class ).wrapUp (root );
92+ return builder .method ("POST" ).withUrlPath ("/orgs/" + orgName + "/teams" ).fetch (GHTeam .class ).wrapUp (root );
9193 }
9294}
0 commit comments