-
Notifications
You must be signed in to change notification settings - Fork 775
Expand file tree
/
Copy pathGHTeamUpdateBuilder.java
More file actions
123 lines (111 loc) · 3.53 KB
/
GHTeamUpdateBuilder.java
File metadata and controls
123 lines (111 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package org.kohsuke.github;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
/**
* Updates a team.
*
* @see <a href=https://developer.github.com/v3/teams/#update-team>Update team docs</a>
* @author Rory Kelly
*/
public class GHTeamUpdateBuilder extends GitHubInteractiveObject {
private final String orgName;
private final String existingName;
/** The builder. */
protected final Requester builder;
/**
* Instantiates a new GH team update builder.
*
* @param root
* the root
* @param orgName
* the org name
* @param existingName
* the current name of the existing team
*/
@SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected")
public GHTeamUpdateBuilder(GitHub root, String orgName, String existingName) {
super(root);
this.orgName = orgName;
this.existingName = existingName;
this.builder = root.createRequest();
}
/**
* Updates a team with all the provided parameters.
*
* @return the gh team
* @throws IOException
* if team cannot be updated
*/
public GHTeam update() throws IOException {
return builder.method("PATCH").withUrlPath("/orgs/" + orgName + "/teams/" + existingName).fetch(GHTeam.class).wrapUp(root());
}
/**
* Name for this team.
*
* @param name
* name of team
* @return a builder to continue with building
*/
public GHTeamUpdateBuilder name(String name) {
this.builder.with("name", name);
return this;
}
/**
* Description for this team.
*
* @param description
* description of team
* @return a builder to continue with building
*/
public GHTeamUpdateBuilder description(String description) {
this.builder.with("description", description);
return this;
}
/**
* Privacy for this team.
*
* @param privacy
* privacy of team
* @return a builder to continue with building
*/
public GHTeamUpdateBuilder privacy(GHTeam.Privacy privacy) {
this.builder.with("privacy", privacy);
return this;
}
/**
* The notification setting explicitly set for this team.
*
* @param notificationSetting
* notification setting to be applied
* @return a builder to continue with building
*/
public GHTeamUpdateBuilder notifications(GHTeam.NotificationSetting notificationSetting) {
this.builder.with("notification_setting", notificationSetting);
return this;
}
/**
* The permission that new repositories will be added to the team with when none is specified.
*
* @param permission
* permission to be applied
* @return a builder to continue with building
* @deprecated see
* <a href=https://developer.github.com/v3/teams/#update-team>Update team docs</a>
*/
@Deprecated
public GHTeamUpdateBuilder permission(GHOrganization.Permission permission) {
this.builder.with("permission", permission);
return this;
}
/**
* Parent team id for this team.
*
* @param parentTeamId
* parentTeamId of team, or null if you are removing the parent
* @return a builder to continue with building
*/
public GHTeamUpdateBuilder parentTeamId(Long parentTeamId) {
this.builder.with("parent_team_id", parentTeamId);
return this;
}
}