Update dependencies (#1813)
This commit is contained in:
79
vendor/github.com/slack-go/slack/files.go
generated
vendored
79
vendor/github.com/slack-go/slack/files.go
generated
vendored
@@ -202,7 +202,14 @@ func (api *Client) GetFileInfoContext(ctx context.Context, fileID string, count,
|
||||
|
||||
// GetFile retreives a given file from its private download URL
|
||||
func (api *Client) GetFile(downloadURL string, writer io.Writer) error {
|
||||
return downloadFile(api.httpclient, api.token, downloadURL, writer, api)
|
||||
return api.GetFileContext(context.Background(), downloadURL, writer)
|
||||
}
|
||||
|
||||
// GetFileContext retreives a given file from its private download URL with a custom context
|
||||
//
|
||||
// For more details, see GetFile documentation.
|
||||
func (api *Client) GetFileContext(ctx context.Context, downloadURL string, writer io.Writer) error {
|
||||
return downloadFile(ctx, api.httpclient, api.token, downloadURL, writer, api)
|
||||
}
|
||||
|
||||
// GetFiles retrieves all files according to the parameters given
|
||||
@@ -210,40 +217,6 @@ func (api *Client) GetFiles(params GetFilesParameters) ([]File, *Paging, error)
|
||||
return api.GetFilesContext(context.Background(), params)
|
||||
}
|
||||
|
||||
// ListFiles retrieves all files according to the parameters given. Uses cursor based pagination.
|
||||
func (api *Client) ListFiles(params ListFilesParameters) ([]File, *ListFilesParameters, error) {
|
||||
return api.ListFilesContext(context.Background(), params)
|
||||
}
|
||||
|
||||
// ListFilesContext retrieves all files according to the parameters given with a custom context. Uses cursor based pagination.
|
||||
func (api *Client) ListFilesContext(ctx context.Context, params ListFilesParameters) ([]File, *ListFilesParameters, error) {
|
||||
values := url.Values{
|
||||
"token": {api.token},
|
||||
}
|
||||
|
||||
if params.User != DEFAULT_FILES_USER {
|
||||
values.Add("user", params.User)
|
||||
}
|
||||
if params.Channel != DEFAULT_FILES_CHANNEL {
|
||||
values.Add("channel", params.Channel)
|
||||
}
|
||||
if params.Limit != DEFAULT_FILES_COUNT {
|
||||
values.Add("limit", strconv.Itoa(params.Limit))
|
||||
}
|
||||
if params.Cursor != "" {
|
||||
values.Add("cursor", params.Cursor)
|
||||
}
|
||||
|
||||
response, err := api.fileRequest(ctx, "files.list", values)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
params.Cursor = response.Metadata.Cursor
|
||||
|
||||
return response.Files, ¶ms, nil
|
||||
}
|
||||
|
||||
// GetFilesContext retrieves all files according to the parameters given with a custom context
|
||||
func (api *Client) GetFilesContext(ctx context.Context, params GetFilesParameters) ([]File, *Paging, error) {
|
||||
values := url.Values{
|
||||
@@ -281,6 +254,42 @@ func (api *Client) GetFilesContext(ctx context.Context, params GetFilesParameter
|
||||
return response.Files, &response.Paging, nil
|
||||
}
|
||||
|
||||
// ListFiles retrieves all files according to the parameters given. Uses cursor based pagination.
|
||||
func (api *Client) ListFiles(params ListFilesParameters) ([]File, *ListFilesParameters, error) {
|
||||
return api.ListFilesContext(context.Background(), params)
|
||||
}
|
||||
|
||||
// ListFilesContext retrieves all files according to the parameters given with a custom context.
|
||||
//
|
||||
// For more details, see ListFiles documentation.
|
||||
func (api *Client) ListFilesContext(ctx context.Context, params ListFilesParameters) ([]File, *ListFilesParameters, error) {
|
||||
values := url.Values{
|
||||
"token": {api.token},
|
||||
}
|
||||
|
||||
if params.User != DEFAULT_FILES_USER {
|
||||
values.Add("user", params.User)
|
||||
}
|
||||
if params.Channel != DEFAULT_FILES_CHANNEL {
|
||||
values.Add("channel", params.Channel)
|
||||
}
|
||||
if params.Limit != DEFAULT_FILES_COUNT {
|
||||
values.Add("limit", strconv.Itoa(params.Limit))
|
||||
}
|
||||
if params.Cursor != "" {
|
||||
values.Add("cursor", params.Cursor)
|
||||
}
|
||||
|
||||
response, err := api.fileRequest(ctx, "files.list", values)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
params.Cursor = response.Metadata.Cursor
|
||||
|
||||
return response.Files, ¶ms, nil
|
||||
}
|
||||
|
||||
// UploadFile uploads a file
|
||||
func (api *Client) UploadFile(params FileUploadParameters) (file *File, err error) {
|
||||
return api.UploadFileContext(context.Background(), params)
|
||||
|
||||
Reference in New Issue
Block a user