Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions src/main/java/org/kohsuke/github/GHTeam.java
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,58 @@ public void setPrivacy(Privacy privacy) throws IOException {
root().createRequest().method("PATCH").with("privacy", privacy).withUrlPath(api("")).send();
}

/**
* Sets the team's name.
*
* @param name
* the new name
* @throws IOException
* the io exception
*/
public void setName(String name) throws IOException {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're moving to not have set methods on objects. I don't see any on here yet...

root().createRequest().method("PATCH").with("name", name).withUrlPath(api("")).send();
}

/**
* Sets the team's notification setting.
*
* @param notificationSetting
* the notification setting (e.g. "notifications_enabled" or "notifications_disabled")
* @throws IOException
* the io exception
*/
public void setNotificationSetting(String notificationSetting) throws IOException {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at GHTeamBuilder, this doesn't already exist in this repo as a concept under a team. However, I think this would work better as an enum so that we can only provide valid values to the request

Copy link
Copy Markdown
Member

@bitwiseman bitwiseman Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to add enum methods and have the string methods call those to validate the string input. Still need the string methods though.

root().createRequest()
.method("PATCH")
.with("notification_setting", notificationSetting)
.withUrlPath(api(""))
.send();
}

/**
* Sets the team's permission.
*
* @param permission
* the permission (e.g. "pull", "push", or "admin")
* @throws IOException
* the io exception
*/
public void setPermission(String permission) throws IOException {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GHOrganization.Permission exists for this already, so should be reused here

root().createRequest().method("PATCH").with("permission", permission).withUrlPath(api("")).send();
}

/**
* Sets the team's parent team by ID.
*
* @param parentTeamId
* the ID of the parent team, or {@code null} to remove the parent
* @throws IOException
* the io exception
*/
public void setParentTeamId(Long parentTeamId) throws IOException {
root().createRequest().method("PATCH").with("parent_team_id", parentTeamId).withUrlPath(api("")).send();
}

private String api(String tail) {
if (organization == null) {
// Teams returned from pull requests to do not have an organization. Attempt to use url.
Expand Down
Loading