Skip to content

Commit 76c5506

Browse files
committed
feat: add missing setter methods to GHTeam
Add setName, setNotificationSetting, setPermission, and setParentTeamId methods following the existing setDescription and setPrivacy pattern. Each uses PATCH to the team API endpoint. Fixes #2218
1 parent eb12f66 commit 76c5506

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

src/main/java/org/kohsuke/github/GHTeam.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,58 @@ public void setPrivacy(Privacy privacy) throws IOException {
511511
root().createRequest().method("PATCH").with("privacy", privacy).withUrlPath(api("")).send();
512512
}
513513

514+
/**
515+
* Sets the team's name.
516+
*
517+
* @param name
518+
* the new name
519+
* @throws IOException
520+
* the io exception
521+
*/
522+
public void setName(String name) throws IOException {
523+
root().createRequest().method("PATCH").with("name", name).withUrlPath(api("")).send();
524+
}
525+
526+
/**
527+
* Sets the team's notification setting.
528+
*
529+
* @param notificationSetting
530+
* the notification setting (e.g. "notifications_enabled" or "notifications_disabled")
531+
* @throws IOException
532+
* the io exception
533+
*/
534+
public void setNotificationSetting(String notificationSetting) throws IOException {
535+
root().createRequest()
536+
.method("PATCH")
537+
.with("notification_setting", notificationSetting)
538+
.withUrlPath(api(""))
539+
.send();
540+
}
541+
542+
/**
543+
* Sets the team's permission.
544+
*
545+
* @param permission
546+
* the permission (e.g. "pull", "push", or "admin")
547+
* @throws IOException
548+
* the io exception
549+
*/
550+
public void setPermission(String permission) throws IOException {
551+
root().createRequest().method("PATCH").with("permission", permission).withUrlPath(api("")).send();
552+
}
553+
554+
/**
555+
* Sets the team's parent team by ID.
556+
*
557+
* @param parentTeamId
558+
* the ID of the parent team, or {@code null} to remove the parent
559+
* @throws IOException
560+
* the io exception
561+
*/
562+
public void setParentTeamId(Long parentTeamId) throws IOException {
563+
root().createRequest().method("PATCH").with("parent_team_id", parentTeamId).withUrlPath(api("")).send();
564+
}
565+
514566
private String api(String tail) {
515567
if (organization == null) {
516568
// Teams returned from pull requests to do not have an organization. Attempt to use url.

0 commit comments

Comments
 (0)