Skip to content

Commit

Permalink
Merge pull request #1143 from johanmcos/add-GetOtherTeamInfoContext
Browse files Browse the repository at this point in the history
add GetOtherTeamInfoContext method
  • Loading branch information
kanata2 committed Dec 14, 2022
2 parents f50586f + d778e9e commit acafae8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions team.go
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 acafae8

Please sign in to comment.