[MM-20684] Slash Command Autocomplete (#14557)
* [MM-20684] Initial implementation of the Command Autocomplete (#13602) * Implement Autocomplete Data * Change CommandName to Trigger * Fix Autocomplete test * Make stylistic changes * Rename a bunch of fields and methods * Fix variable names, safer type assertions * [MM-20684] plugin autocomplete implementation (#14259) * Add an endpoint for command autocomplete suggestions * Add full Suggestion to the AutocompleteSugestion struct * Add Dynamic Argument support * Tidy up things * Fix missed test case * Add support of the named arguments * Update autocomplete API Fix review issues Implement dynamic args as a local request * Fix ineffassign * Add support of the uppercase letters in arguments * Add support of the optional arguments * Remove ineffectual assignment * Add support for icons (#14489) * Address couple of nits * Add comment to IconData * Add types to all consts Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
e8daab6b84
Коммит
43e606173b
@@ -4157,6 +4157,17 @@ func (c *Client4) ListCommands(teamId string, customOnly bool) ([]*Command, *Res
|
||||
return CommandListFromJson(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
// ListCommandAutocompleteSuggestions will retrieve a list of suggestions for a userInput.
|
||||
func (c *Client4) ListCommandAutocompleteSuggestions(userInput, teamId string) ([]AutocompleteSuggestion, *Response) {
|
||||
query := fmt.Sprintf("/commands/autocomplete_suggestions?user_input=%v", userInput)
|
||||
r, err := c.DoApiGet(c.GetTeamRoute(teamId)+query, "")
|
||||
if err != nil {
|
||||
return nil, BuildErrorResponse(r, err)
|
||||
}
|
||||
defer closeBody(r)
|
||||
return AutocompleteSuggestionsFromJSON(r.Body), BuildResponse(r)
|
||||
}
|
||||
|
||||
// GetCommandById will retrieve a command by id.
|
||||
func (c *Client4) GetCommandById(cmdId string) (*Command, *Response) {
|
||||
url := fmt.Sprintf("%s/%s", c.GetCommandsRoute(), cmdId)
|
||||
|
||||
Ссылка в новой задаче
Block a user