Package list golang-github-nlopes-slack / 8263daf
Implement DeleteFile Norberto Lopes 6 years ago
2 changed file(s) with 22 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
1818 fmt.Printf("%s\n", err)
1919 return
2020 }
21 fmt.Printf("Name: %s, Url: %s\n", file.Name, file.Url)
21 fmt.Printf("Name: %s, Url: %s\n", file.Name, file.URL)
22
23 err = api.DeleteFile(file.Id)
24 if err != nil {
25 fmt.Printf("%s\n", err)
26 return
27 }
28 fmt.Printf("File %s deleted successfully.\n", file.Name)
2229 }
213213 }
214214 return &response.File, nil
215215 }
216
217 // DeleteFile deletes a file
218 func (api *Slack) DeleteFile(fileId string) error {
219 values := url.Values{
220 "token": {api.config.token},
221 "file": {fileId},
222 }
223 _, err := fileRequest("files.delete", values, api.debug)
224 if err != nil {
225 return err
226 }
227 return nil
228
229 }