implement GET /teams/{team_id}/commands/autocomplete (#5951)

Этот коммит содержится в:
Carlos Tadeu Panato Junior
2017-04-04 06:20:04 +02:00
коммит произвёл Corey Hulen
родитель 348374fba5
Коммит 0a81dd9fff
3 изменённых файлов: 96 добавлений и 0 удалений

Просмотреть файл

@@ -78,6 +78,10 @@ func (c *Client4) GetTeamRoute(teamId string) string {
return fmt.Sprintf(c.GetTeamsRoute()+"/%v", teamId)
}
func (c *Client4) GetTeamAutoCompleteCommandsRoute(teamId string) string {
return fmt.Sprintf(c.GetTeamsRoute()+"/%v/commands/autocomplete", teamId)
}
func (c *Client4) GetTeamByNameRoute(teamName string) string {
return fmt.Sprintf(c.GetTeamsRoute()+"/name/%v", teamName)
}
@@ -2131,6 +2135,16 @@ func (c *Client4) ListCommands(teamId string, customOnly bool) ([]*Command, *Res
}
}
// ListCommands will retrieve a list of commands available in the team.
func (c *Client4) ListAutocompleteCommands(teamId string) ([]*Command, *Response) {
if r, err := c.DoApiGet(c.GetTeamAutoCompleteCommandsRoute(teamId), ""); err != nil {
return nil, &Response{StatusCode: r.StatusCode, Error: err}
} else {
defer closeBody(r)
return CommandListFromJson(r.Body), BuildResponse(r)
}
}
// Status Section
// GetUserStatus returns a user based on the provided user id string.