diff --git a/team.go b/team.go index 029e2b5bc..c2cecbe0d 100644 --- a/team.go +++ b/team.go @@ -96,15 +96,22 @@ func (api *Client) accessLogsRequest(ctx context.Context, path string, values ur } // GetTeamInfo gets the Team Information of the user -func (api *Client) GetTeamInfo() (*TeamInfo, error) { - 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) { + return api.GetTeamInfoContext(context.Background(), team) } // GetTeamInfoContext gets the Team Information of the user with a custom context -func (api *Client) GetTeamInfoContext(ctx context.Context) (*TeamInfo, error) { +// if the team is empty (""), will return information about the current team. +// https://api.slack.com/methods/team.info +func (api *Client) GetTeamInfoContext(ctx context.Context, team string) (*TeamInfo, error) { values := url.Values{ "token": {api.token}, } + if team != "" { + values.Add("team", team) + } response, err := api.teamRequest(ctx, "team.info", values) if err != nil { diff --git a/team_test.go b/team_test.go index ecc3769e2..10bb5ca74 100644 --- a/team_test.go +++ b/team_test.go @@ -33,7 +33,7 @@ func TestGetTeamInfo(t *testing.T) { once.Do(startServer) api := New("testing-token", OptionAPIURL("http://"+serverAddr+"/")) - teamInfo, err := api.GetTeamInfo() + teamInfo, err := api.GetTeamInfo("F0UWHUX") if err != nil { t.Errorf("Unexpected error: %s", err) return