mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-27 15:49:23 +00:00
Update vendor (nlopes/slack)
This commit is contained in:
23
vendor/github.com/nlopes/slack/search.go
generated
vendored
23
vendor/github.com/nlopes/slack/search.go
generated
vendored
@ -1,6 +1,7 @@
|
||||
package slack
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"net/url"
|
||||
"strconv"
|
||||
@ -80,7 +81,7 @@ func NewSearchParameters() SearchParameters {
|
||||
}
|
||||
}
|
||||
|
||||
func (api *Client) _search(path, query string, params SearchParameters, files, messages bool) (response *searchResponseFull, error error) {
|
||||
func (api *Client) _search(ctx context.Context, path, query string, params SearchParameters, files, messages bool) (response *searchResponseFull, error error) {
|
||||
values := url.Values{
|
||||
"token": {api.config.token},
|
||||
"query": {query},
|
||||
@ -101,7 +102,7 @@ func (api *Client) _search(path, query string, params SearchParameters, files, m
|
||||
values.Add("page", strconv.Itoa(params.Page))
|
||||
}
|
||||
response = &searchResponseFull{}
|
||||
err := post(path, values, response, api.debug)
|
||||
err := post(ctx, path, values, response, api.debug)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -113,7 +114,11 @@ func (api *Client) _search(path, query string, params SearchParameters, files, m
|
||||
}
|
||||
|
||||
func (api *Client) Search(query string, params SearchParameters) (*SearchMessages, *SearchFiles, error) {
|
||||
response, err := api._search("search.all", query, params, true, true)
|
||||
return api.SearchContext(context.Background(), query, params)
|
||||
}
|
||||
|
||||
func (api *Client) SearchContext(ctx context.Context, query string, params SearchParameters) (*SearchMessages, *SearchFiles, error) {
|
||||
response, err := api._search(ctx, "search.all", query, params, true, true)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@ -121,7 +126,11 @@ func (api *Client) Search(query string, params SearchParameters) (*SearchMessage
|
||||
}
|
||||
|
||||
func (api *Client) SearchFiles(query string, params SearchParameters) (*SearchFiles, error) {
|
||||
response, err := api._search("search.files", query, params, true, false)
|
||||
return api.SearchFilesContext(context.Background(), query, params)
|
||||
}
|
||||
|
||||
func (api *Client) SearchFilesContext(ctx context.Context, query string, params SearchParameters) (*SearchFiles, error) {
|
||||
response, err := api._search(ctx, "search.files", query, params, true, false)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -129,7 +138,11 @@ func (api *Client) SearchFiles(query string, params SearchParameters) (*SearchFi
|
||||
}
|
||||
|
||||
func (api *Client) SearchMessages(query string, params SearchParameters) (*SearchMessages, error) {
|
||||
response, err := api._search("search.messages", query, params, false, true)
|
||||
return api.SearchMessagesContext(context.Background(), query, params)
|
||||
}
|
||||
|
||||
func (api *Client) SearchMessagesContext(ctx context.Context, query string, params SearchParameters) (*SearchMessages, error) {
|
||||
response, err := api._search(ctx, "search.messages", query, params, false, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user