-
Notifications
You must be signed in to change notification settings - Fork 735
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #683 from timja/add-full-create-team-parameters
Add support for all create team parameters
- Loading branch information
Showing
31 changed files
with
1,470 additions
and
6 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package org.kohsuke.github; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Creates a team. | ||
* | ||
* https://developer.github.com/v3/teams/#create-team | ||
*/ | ||
public class GHTeamBuilder { | ||
|
||
private final GitHub root; | ||
protected final Requester builder; | ||
private final String orgName; | ||
|
||
public GHTeamBuilder(GitHub root, String orgName, String name) { | ||
this.root = root; | ||
this.orgName = orgName; | ||
this.builder = root.createRequest(); | ||
this.builder.with("name", name); | ||
} | ||
|
||
/** | ||
* Description for this team. | ||
* | ||
* @param description | ||
* description of team | ||
* @return a builder to continue with building | ||
*/ | ||
public GHTeamBuilder description(String description) { | ||
this.builder.with("description", description); | ||
return this; | ||
} | ||
|
||
/** | ||
* Maintainers for this team. | ||
* | ||
* @param maintainers | ||
* maintainers of team | ||
* @return a builder to continue with building | ||
*/ | ||
public GHTeamBuilder maintainers(String... maintainers) { | ||
this.builder.with("maintainers", maintainers); | ||
return this; | ||
} | ||
|
||
/** | ||
* Repository names to add this team to. | ||
* | ||
* @param repoNames | ||
* repoNames to add team to | ||
* @return a builder to continue with building | ||
*/ | ||
public GHTeamBuilder repositories(String... repoNames) { | ||
this.builder.with("repo_names", repoNames); | ||
return this; | ||
} | ||
|
||
/** | ||
* Description for this team | ||
* | ||
* @param privacy | ||
* privacy of team | ||
* @return a builder to continue with building | ||
*/ | ||
public GHTeamBuilder privacy(GHTeam.Privacy privacy) { | ||
this.builder.with("privacy", privacy); | ||
return this; | ||
} | ||
|
||
/** | ||
* Parent team id for this team | ||
* | ||
* @param parentTeamId | ||
* parentTeamId of team | ||
* @return a builder to continue with building | ||
*/ | ||
public GHTeamBuilder parentTeamId(int parentTeamId) { | ||
this.builder.with("parent_team_id", parentTeamId); | ||
return this; | ||
} | ||
|
||
/** | ||
* Creates a team with all the parameters. | ||
* | ||
* @return the gh team | ||
* @throws IOException | ||
* if team cannot be created | ||
*/ | ||
public GHTeam create() throws IOException { | ||
return builder.method("POST").withUrlPath("/orgs/" + orgName + "/teams").fetch(GHTeam.class).wrapUp(root); | ||
} | ||
} |
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
41 changes: 41 additions & 0 deletions
41
...ateAllArgsTeam/__files/orgs_github-api-test-org-b4a28742-c15b-4b7d-a6ce-45b33efa8289.json
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,41 @@ | ||
{ | ||
"login": "github-api-test-org", | ||
"id": 7544739, | ||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=", | ||
"url": "https://api.github.com/orgs/github-api-test-org", | ||
"repos_url": "https://api.github.com/orgs/github-api-test-org/repos", | ||
"events_url": "https://api.github.com/orgs/github-api-test-org/events", | ||
"hooks_url": "https://api.github.com/orgs/github-api-test-org/hooks", | ||
"issues_url": "https://api.github.com/orgs/github-api-test-org/issues", | ||
"members_url": "https://api.github.com/orgs/github-api-test-org/members{/member}", | ||
"public_members_url": "https://api.github.com/orgs/github-api-test-org/public_members{/member}", | ||
"avatar_url": "https://avatars3.githubusercontent.com/u/7544739?v=4", | ||
"description": null, | ||
"is_verified": false, | ||
"has_organization_projects": true, | ||
"has_repository_projects": true, | ||
"public_repos": 10, | ||
"public_gists": 0, | ||
"followers": 0, | ||
"following": 0, | ||
"html_url": "https://github.com/github-api-test-org", | ||
"created_at": "2014-05-10T19:39:11Z", | ||
"updated_at": "2015-04-20T00:42:30Z", | ||
"type": "Organization", | ||
"total_private_repos": 0, | ||
"owned_private_repos": 0, | ||
"private_gists": 0, | ||
"disk_usage": 132, | ||
"collaborators": 0, | ||
"billing_email": "[email protected]", | ||
"default_repository_permission": "none", | ||
"members_can_create_repositories": false, | ||
"two_factor_requirement_enabled": false, | ||
"plan": { | ||
"name": "free", | ||
"space": 976562499, | ||
"private_repos": 0, | ||
"filled_seats": 7, | ||
"seats": 0 | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
...ArgsTeam/__files/orgs_github-api-test-org_teams-6d91c5d6-a8a1-4693-9b2a-dc136570b11b.json
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,55 @@ | ||
{ | ||
"name": "create-team-test", | ||
"id": 3618001, | ||
"node_id": "MDQ6VGVhbTM2MTgwMDE=", | ||
"slug": "create-team-test", | ||
"description": "Team description", | ||
"privacy": "closed", | ||
"url": "https://api.github.com/organizations/49127317/team/3618001", | ||
"html_url": "https://github.com/orgs/github-api-test-org/teams/create-team-test", | ||
"members_url": "https://api.github.com/organizations/49127317/team/3618001/members{/member}", | ||
"repositories_url": "https://api.github.com/organizations/49127317/team/3618001/repos", | ||
"permission": "pull", | ||
"parent": { | ||
"name": "Core Developers", | ||
"id": 3617900, | ||
"node_id": "MDQ6VGVhbTM2MTc5MDA=", | ||
"slug": "core-developers", | ||
"description": "", | ||
"privacy": "closed", | ||
"url": "https://api.github.com/organizations/49127317/team/3617900", | ||
"html_url": "https://github.com/orgs/github-api-test-org/teams/core-developers", | ||
"members_url": "https://api.github.com/organizations/49127317/team/3617900/members{/member}", | ||
"repositories_url": "https://api.github.com/organizations/49127317/team/3617900/repos", | ||
"permission": "pull" | ||
}, | ||
"created_at": "2020-01-25T19:41:44Z", | ||
"updated_at": "2020-01-25T19:41:44Z", | ||
"members_count": 1, | ||
"repos_count": 1, | ||
"organization": { | ||
"login": "github-api-test-org", | ||
"id": 49127317, | ||
"node_id": "MDEyOk9yZ2FuaXphdGlvbjQ5MTI3MzE3", | ||
"url": "https://api.github.com/orgs/github-api-test-org", | ||
"repos_url": "https://api.github.com/orgs/github-api-test-org/repos", | ||
"events_url": "https://api.github.com/orgs/github-api-test-org/events", | ||
"hooks_url": "https://api.github.com/orgs/github-api-test-org/hooks", | ||
"issues_url": "https://api.github.com/orgs/github-api-test-org/issues", | ||
"members_url": "https://api.github.com/orgs/github-api-test-org/members{/member}", | ||
"public_members_url": "https://api.github.com/orgs/github-api-test-org/public_members{/member}", | ||
"avatar_url": "https://avatars3.githubusercontent.com/u/49127317?v=4", | ||
"description": null, | ||
"is_verified": false, | ||
"has_organization_projects": true, | ||
"has_repository_projects": true, | ||
"public_repos": 4, | ||
"public_gists": 0, | ||
"followers": 0, | ||
"following": 0, | ||
"html_url": "https://github.com/github-api-test-org", | ||
"created_at": "2019-03-31T17:42:10Z", | ||
"updated_at": "2019-10-07T20:06:18Z", | ||
"type": "Organization" | ||
} | ||
} |
Oops, something went wrong.