-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
team: allow specifying role #262
Conversation
type AddUserToTeamOptions struct { | ||
TeamID string `json:"-"` | ||
UserID string `json:"-"` | ||
Role string `json:"role,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on your comment in the PR, there are only a handful of values that are accepted. Instead of this being a string
, should we make it a named string
type so that we can have a set of constants that people can also use?
type UserRole string
const (
UserRoleManager UserRole = "manager"
// ...
)
The User
struct also has a Role
field that's a string
. I'm not sure if it makes sense for these to be different. 🤔
To be clear, this comment isn't a request to change but looking for your thoughts / feedback.
@@ -84,8 +91,8 @@ func (c *Client) RemoveUserFromTeam(teamID, userID string) error { | |||
} | |||
|
|||
// AddUserToTeam adds a user to a team. | |||
func (c *Client) AddUserToTeam(teamID, userID string) error { | |||
_, err := c.put("/teams/"+teamID+"/users/"+userID, nil, nil) | |||
func (c *Client) AddUserToTeam(options AddUserToTeamOptions) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This modification makes this a breaking change, which will add some delays in merging.
How would you feel about creating a new method, and update AddUserToTeam()
to call that one and indicate the other should be used instead? Then we can file an issue to clean this up in v2.0.0
.
I've taken inspiration from this PR, and added an option struct with Thank you for this contribution and the inspiration. |
Permit specifying the role when adding a user to a team. Tested locally. The role must be "manager", "observer", or "responder".