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
Add optional team parameter to GetTeamInfo function calls #981
Conversation
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.
sould we test emty team case?
return api.GetTeamInfoContext(context.Background()) | ||
// if the team is empty (""), will return information about the current team. | ||
// https://api.slack.com/methods/team.info | ||
func (api *Client) GetTeamInfo(team string) (*TeamInfo, 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.
Backward compatibility issue.
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.
I'm having trouble with only one optional parameter...
I've come up with a few ideas, which one do you think is better?
other idea 1
How about adding GetAnotherTeamInfo(team string)
method .
// Get your own team information.
info, err := api.GetTeamInfo()
// Get other team information.
info, err := api.GetOtherTeamInfo(teamID)
other idea 2
Use functional option pattern.
// Get your own team information.
info, err := api.GetTeamInfo()
// Get other team information.
info, err := api.GetTeamInfo(slack.GetTeamInfoOptionTeamID(teamID))
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.
I feel like even though this is not backwards compatible, it follows how the slack API actually operates and makes it less confusing.
From Slack API Docs:
Team to get info on, if omitted, will return information about the current team. Will only return team that the authenticated token is allowed to see through external shared channels
I think that other option 2 is closer to the APIs definition, but not nearly as close as my proposal.
Thoughts?
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.
I think that other option 2 is closer to the APIs definition, but not nearly as close as my proposal.
The parameter team
is an optional in Slack while it is required in our GetTeamInfo
API with your proposal, so I think it is not so good design.
The difference in idea 2 is that it keeps team
parameter optional.
#1118 is merged. |
Solves: #980
Pull Request Guidelines
These are recommendations for pull requests.
They are strictly guidelines to help manage expectations.
PR preparation
make pr-prep
from the root of the repository to run formatting, linting and tests.Should this be an issue instead
API changes
Since API changes have to be maintained they undergo a more detailed review and are more likely to require changes.
Examples of API changes that do not meet guidelines: