Skip to content

Commit

Permalink
add GetOtherTeamInfoContext method
Browse files Browse the repository at this point in the history
  • Loading branch information
johanmcos committed Dec 13, 2022
1 parent f50586f commit d778e9e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions team.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,27 @@ func (api *Client) GetTeamInfo() (*TeamInfo, error) {
return api.GetTeamInfoContext(context.Background())
}

// GetOtherTeamInfo gets Team information for any team
func (api *Client) GetOtherTeamInfo(team string) (*TeamInfo, error) {
// GetOtherTeamInfoContext gets Team information for any team with a custom context
func (api *Client) GetOtherTeamInfoContext(ctx context.Context, team string) (*TeamInfo, error) {
if team == "" {
return api.GetTeamInfo()
return api.GetTeamInfoContext(ctx)
}
values := url.Values{
"token": {api.token},
}
values.Add("team", team)
response, err := api.teamRequest(context.Background(), "team.info", values)
response, err := api.teamRequest(ctx, "team.info", values)
if err != nil {
return nil, err
}
return &response.Team, nil
}

// GetOtherTeamInfo gets Team information for any team
func (api *Client) GetOtherTeamInfo(team string) (*TeamInfo, error) {
return api.GetOtherTeamInfoContext(context.Background(), team)
}

// GetTeamInfoContext gets the Team Information of the user with a custom context
func (api *Client) GetTeamInfoContext(ctx context.Context) (*TeamInfo, error) {
values := url.Values{
Expand Down

0 comments on commit d778e9e

Please sign in to comment.